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\Controller;
14:
15: use DcGeneral\Data\PropertyValueBagInterface;
16: use DcGeneral\Data\ModelInterface;
17: use DcGeneral\EnvironmentInterface;
18:
19: /**
20: * This interface describes a controller.
21: *
22: * @package DcGeneral\Controller
23: */
24: interface ControllerInterface
25: {
26: /**
27: * Set the environment.
28: *
29: * @param EnvironmentInterface $environment The environment.
30: *
31: * @return ControllerInterface
32: */
33: public function setEnvironment(EnvironmentInterface $environment);
34:
35: /**
36: * Retrieve the attached environment.
37: *
38: * @return EnvironmentInterface
39: */
40: public function getEnvironment();
41:
42: /**
43: * Retrieve the base config for retrieving data.
44: *
45: * This includes all auxiliary filters from DCA etc. but excludes the filters from panels.
46: *
47: * @return \DcGeneral\Data\ConfigInterface
48: */
49: public function getBaseConfig();
50:
51: /**
52: * Scan for children of a given model.
53: *
54: * This method is ready for mixed hierarchy and will return all children and grandchildren for the given table
55: * (or originating table of the model, if no provider name has been given) for all levels and parent child conditions.
56: *
57: * @param ModelInterface $objModel The model to assemble children from.
58: *
59: * @param string $strDataProvider The name of the data provider to fetch children from.
60: *
61: * @return array
62: */
63: public function assembleAllChildrenFrom($objModel, $strDataProvider = '');
64:
65: /**
66: * Update the current model from a post request. Additionally, trigger meta palettes, if installed.
67: *
68: * @param ModelInterface $model The model to update.
69: *
70: * @param PropertyValueBagInterface $propertyValues The value bag to retrieve the values from.
71: *
72: * @return ControllerInterface
73: */
74: public function updateModelFromPropertyBag($model, $propertyValues);
75:
76: /**
77: * Return all supported languages from the default data data provider.
78: *
79: * @param mixed $mixID The id of a model for which the languages shall be retrieved.
80: *
81: * @return array
82: */
83: public function getSupportedLanguages($mixID);
84:
85: /**
86: * Check if the given model is a root model for the current data definition.
87: *
88: * @param ModelInterface $model The model to check.
89: *
90: * @return bool
91: */
92: public function isRootModel(ModelInterface $model);
93:
94: /**
95: * Apply the root condition of the current data definition to the given model.
96: *
97: * @param ModelInterface $model The model to be used as root.
98: *
99: * @return ControllerInterface
100: */
101: public function setRootModel(ModelInterface $model);
102:
103: /**
104: * Set a model as the parent of another model.
105: *
106: * @param ModelInterface $childModel The model to become the child.
107: *
108: * @param ModelInterface $parentModel The model to use as parent.
109: *
110: * @return ControllerInterface
111: */
112: public function setParent(ModelInterface $childModel, ModelInterface $parentModel);
113:
114: /**
115: * Sets all parent condition fields in the destination to the values from the source model.
116: *
117: * Useful when moving an element after another in a different parent.
118: *
119: * @param ModelInterface $receivingModel The model that shall get updated.
120: *
121: * @param ModelInterface $sourceModel The model that the values shall get retrieved from.
122: *
123: * @param string $parentTable The name of the parent table for the models.
124: *
125: * @return ControllerInterface
126: */
127: public function setSameParent(ModelInterface $receivingModel, ModelInterface $sourceModel, $parentTable);
128: }
129: