1: <?php
2: /**
3: * PHP version 5
4: * @package generalDriver
5: * @author Christian Schiffler <c.schiffler@cyberspectrum.de>
6: * @author Stefan Heimes <stefan_heimes@hotmail.com>
7: * @author Tristan Lins <tristan.lins@bit3.de>
8: * @copyright The MetaModels team.
9: * @license LGPL.
10: * @filesource
11: */
12:
13: namespace DcGeneral;
14:
15: use ContaoCommunityAlliance\Translator\TranslatorInterface;
16:
17: /**
18: * Interface EnvironmentInterface.
19: *
20: * This interface describes the environment of a DcGeneral instance. It holds reference to the data providers, the view,
21: * the data definition etc.
22: * One could say the Environment is the glue of DcGeneral, holding everything together.
23: *
24: * @package DcGeneral
25: */
26: interface EnvironmentInterface
27: {
28: /**
29: * Set the Controller for the current setup.
30: *
31: * @param \DcGeneral\Controller\ControllerInterface $objController The controller to use.
32: *
33: * @return EnvironmentInterface
34: */
35: public function setController($objController);
36:
37: /**
38: * Retrieve the Controller from the current setup.
39: *
40: * @return \DcGeneral\Controller\ControllerInterface
41: */
42: public function getController();
43:
44: /**
45: * Set the View for the current setup.
46: *
47: * @param \DcGeneral\View\ViewInterface $objView The view to use.
48: *
49: * @return EnvironmentInterface
50: */
51: public function setView($objView);
52:
53: /**
54: * Retrieve the View from the current setup.
55: *
56: * @return \DcGeneral\View\ViewInterface
57: */
58: public function getView();
59:
60: /**
61: * Set the data definition for this instance.
62: *
63: * @param \DcGeneral\DataDefinition\ContainerInterface $objContainer The data definition container to store.
64: *
65: * @return EnvironmentInterface
66: */
67: public function setDataDefinition($objContainer);
68:
69: /**
70: * Retrieve the data definition for this instance.
71: *
72: * @return \DcGeneral\DataDefinition\ContainerInterface
73: */
74: public function getDataDefinition();
75:
76: /**
77: * Set the data definition of the parent container.
78: *
79: * @param \DcGeneral\DataDefinition\ContainerInterface $objContainer The data definition container to store.
80: *
81: * @return EnvironmentInterface
82: */
83: public function setParentDataDefinition($objContainer);
84:
85: /**
86: * Retrieve the data definition for the parent container. This applies only when in parented mode.
87: *
88: * @return \DcGeneral\DataDefinition\ContainerInterface
89: */
90: public function getParentDataDefinition();
91:
92: /**
93: * Set the data definition of the root container.
94: *
95: * @param \DcGeneral\DataDefinition\ContainerInterface $objContainer The data definition container to store.
96: *
97: * @return EnvironmentInterface
98: */
99: public function setRootDataDefinition($objContainer);
100:
101: /**
102: * Retrieve the data definition for the root container. This applies only when in hierarchical mode.
103: *
104: * @return \DcGeneral\DataDefinition\ContainerInterface
105: */
106: public function getRootDataDefinition();
107:
108: /**
109: * Set the input provider to use.
110: *
111: * @param \DcGeneral\InputProviderInterface $objInputProvider The input provider to use.
112: *
113: * @return EnvironmentInterface
114: */
115: public function setInputProvider($objInputProvider);
116:
117: /**
118: * Retrieve the input provider.
119: *
120: * @return \DcGeneral\InputProviderInterface
121: */
122: public function getInputProvider();
123:
124: /**
125: * Determine if the data provider with the given name exists.
126: *
127: * @param string|null $strSource The source name to check the providers for.
128: *
129: * @return mixed
130: */
131: public function hasDataProvider($strSource = null);
132:
133: /**
134: * Retrieve the data provider for the named source.
135: *
136: * If a source name is given, the named data provider will get returned, if not given, the default data provider
137: * will get returned, the default is to be determined via: getEnvironment()->getDataDefinition()->getDataProvider()
138: *
139: * @param string|null $strSource The name of the source.
140: *
141: * @return \DcGeneral\Data\DataProviderInterface
142: */
143: public function getDataProvider($strSource = null);
144:
145: /**
146: * Register a data provider to the environment.
147: *
148: * @param string $strSource The name of the source.
149: *
150: * @param \DcGeneral\Data\DataProviderInterface $dataProvider The data provider instance to register under the given
151: * name.
152: *
153: * @return EnvironmentInterface
154: */
155: public function addDataProvider($strSource, $dataProvider);
156:
157: /**
158: * Remove a data provider from the environment.
159: *
160: * @param string $strSource The name of the source.
161: *
162: * @return EnvironmentInterface
163: */
164: public function removeDataProvider($strSource);
165:
166: /**
167: * Return the clipboard.
168: *
169: * @return \DcGeneral\Clipboard\ClipboardInterface
170: */
171: public function getClipboard();
172:
173: /**
174: * Set the the clipboard.
175: *
176: * @param \DcGeneral\Clipboard\ClipboardInterface $objClipboard Clipboard instance.
177: *
178: * @return EnvironmentInterface
179: */
180: public function setClipboard($objClipboard);
181:
182: /**
183: * Set the translation manager to use.
184: *
185: * @param TranslatorInterface $manager The translation manager.
186: *
187: * @return \DcGeneral\EnvironmentInterface
188: */
189: public function setTranslator(TranslatorInterface $manager);
190:
191: /**
192: * Retrieve the translation manager to use.
193: *
194: * @return TranslatorInterface
195: */
196: public function getTranslator();
197:
198: /**
199: * Set the event propagator to use.
200: *
201: * @param \DcGeneral\Event\EventPropagatorInterface $propagator The event propagator to use.
202: *
203: * @return \DcGeneral\EnvironmentInterface
204: */
205:
206: public function setEventPropagator($propagator);
207:
208: /**
209: * Retrieve the event propagator to use.
210: *
211: * @return \DcGeneral\Event\EventPropagatorInterface
212: */
213: public function getEventPropagator();
214: }
215: