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\DataDefinition\Definition;
14:
15: /**
16: * This interface describes the basic information about the data definition.
17: *
18: * @package DcGeneral\DataDefinition\Definition
19: */
20: interface BasicDefinitionInterface extends DefinitionInterface
21: {
22: /**
23: * The name of the definition.
24: */
25: const NAME = 'basic';
26:
27: /**
28: * Flat mode. All models are on the same hierarchical level. No root conditions are defined.
29: */
30: const MODE_FLAT = 0;
31:
32: /**
33: * Hierarchical mode. The models span over various levels.
34: */
35: const MODE_PARENTEDLIST = 1;
36:
37: /**
38: * Hierarchical mode. The models span over various levels.
39: */
40: const MODE_HIERARCHICAL = 2;
41:
42: /**
43: * Set the mode the data definition is in.
44: *
45: * @param int $mode
46: *
47: * See the constants in this interface. The mode should either be {@link BasicDefinitionInterface::MODE_FLAT}
48: * or {@link BasicDefinitionInterface::MODE_HIERARCHICAL}.
49: *
50: * @return BasicDefinitionInterface
51: */
52: public function setMode($mode);
53:
54: /**
55: * Get the mode the data definition is in.
56: *
57: * @return int
58: */
59: public function getMode();
60:
61: /**
62: * Set the name of the data provider that holds the models for the root level.
63: *
64: * Be aware that there may be any number of in-between data sources, depending on the defined
65: * {@link ParentChildCondition}s
66: *
67: * Note: This does only apply when in tree mode or parenting mode. For flat mode this does not make sense.
68: *
69: * @param string $providerName The name of the data provider of the root elements.
70: *
71: * @return BasicDefinitionInterface
72: */
73: public function setRootDataProvider($providerName);
74:
75: /**
76: * Retrieve the name of data provider that holds the models for the root level.
77: *
78: * Be aware that there may be any number of in-between data sources, depending on the defined
79: * {@link ParentChildCondition}s
80: *
81: * Note: This does only apply when in tree mode or parenting mode. For flat mode this does not make sense.
82: *
83: * @return string
84: */
85: public function getRootDataProvider();
86:
87: /**
88: * Set the name of the data provider that holds the parent model.
89: *
90: * Note: This does only apply when in tree mode or parenting mode. For flat mode this does not make sense.
91: *
92: * @param string $providerName The name of the data provider of the parent element.
93: *
94: * @return BasicDefinitionInterface
95: */
96: public function setParentDataProvider($providerName);
97:
98: /**
99: * Retrieve the name of data provider that holds the parent model.
100: *
101: * Note: This does only apply when in tree mode or parenting mode. For flat mode this does not make sense.
102: *
103: * @return string
104: */
105: public function getParentDataProvider();
106:
107: /**
108: * Set the name of the data provider which holds the models that we work on.
109: *
110: * @param string $providerName The name of the data provider of the elements being processed.
111: *
112: * @return BasicDefinitionInterface
113: */
114: public function setDataProvider($providerName);
115:
116: /**
117: * Retrieve the name of data provider which holds the models that we work on.
118: *
119: * @return string
120: */
121: public function getDataProvider();
122:
123: /**
124: * Set the additional filters to be used for retrieving elements for the view.
125: *
126: * @param string $dataProvider The name of the data provider for which additional filters shall be passed.
127: *
128: * @param array $filter Array of filter rules.
129: *
130: * @return BasicDefinitionInterface
131: */
132: public function setAdditionalFilter($dataProvider, $filter);
133:
134: /**
135: * Determine if additional filters are set for the given data provider.
136: *
137: * @param string $dataProvider The name of the data provider for which additional filters shall be checked.
138: *
139: * @return bool
140: */
141: public function hasAdditionalFilter($dataProvider = null);
142:
143: /**
144: * Get the additional filters to be used for retrieving elements for the view.
145: *
146: * @param string $dataProvider The name of the data provider for which additional filters shall be retrieved.
147: *
148: * @return array
149: */
150: public function getAdditionalFilter($dataProvider = null);
151:
152: /**
153: * If true, adding of further records is prohibited.
154: *
155: * @param bool $value The flag - true means prohibit element creation, false means allow creation of new elements.
156: *
157: * @return BasicDefinitionInterface
158: *
159: * @todo isn't this a candidate for deprecation? See BasicDefinitionInterface::setCreatable().
160: */
161: public function setClosed($value);
162:
163: /**
164: * Boolean flag determining if this data container is closed.
165: *
166: * True means, there may not be any records added or deleted, false means there may be any record appended or
167: * deleted..
168: *
169: * @return bool
170: *
171: * @todo isn't this a candidate for deprecation? See BasicDefinitionInterface::isCreatable().
172: */
173: public function isClosed();
174:
175: /**
176: * Boolean flag determining if this data container is editable.
177: *
178: * @param bool $value True means, the data records may be edited.
179: *
180: * @return BasicDefinitionInterface
181: */
182: public function setEditable($value);
183:
184: /**
185: * Boolean flag determining if this data container is editable.
186: *
187: * True means, the data records may be edited.
188: *
189: * @return bool
190: */
191: public function isEditable();
192:
193: /**
194: * Set boolean flag determining if this data container is deletable.
195: *
196: * @param bool $value True means, the data records may be deleted.
197: *
198: * @return BasicDefinitionInterface
199: */
200: public function setDeletable($value);
201:
202: /**
203: * Boolean flag determining if this data container is deletable.
204: *
205: * True means, the data records may be deleted.
206: *
207: * @return bool
208: */
209: public function isDeletable();
210:
211: /**
212: * Determines if new entries may be created within this data container.
213: *
214: * @param bool $value True means new entries may be created, false prohibits creation of new entries.
215: *
216: * @return BasicDefinitionInterface
217: */
218: public function setCreatable($value);
219:
220: /**
221: * Determines if new entries may be created within this data container.
222: *
223: * True means new entries may be created, false prohibits creation of new entries.
224: *
225: * @return bool
226: */
227: public function isCreatable();
228:
229: /**
230: * Determines if the view shall switch automatically into edit mode.
231: *
232: * This most likely only affects parenting modes like trees etc.
233: *
234: * @param bool $switchToEditEnabled The flag - true means switch automatically to editing mode, false allows
235: * listing.
236: *
237: * @return BasicDefinitionInterface
238: */
239: public function setSwitchToEditEnabled($switchToEditEnabled);
240:
241: /**
242: * Determines if the view shall switch automatically into edit mode.
243: *
244: * This most likely only affects parenting modes like trees etc.
245: *
246: * @return bool
247: */
248: public function isSwitchToEditEnabled();
249: }
250: