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\Contao\View\Contao2BackendView\Event;
14:
15: /**
16: * Class GetOperationButtonEvent.
17: *
18: * This event gets emitted when an operation button is rendered.
19: *
20: * @package DcGeneral\Contao\View\Contao2BackendView\Event
21: */
22: class GetOperationButtonEvent
23: extends BaseButtonEvent
24: {
25: const NAME = 'dc-general.view.contao2backend.get-operation-button';
26:
27: /**
28: * The command for which the button is being rendered.
29: *
30: * @var \DcGeneral\DataDefinition\Definition\View\CommandInterface
31: */
32: protected $command;
33:
34: /**
35: * The model to which the command shall be applied to.
36: *
37: * @var \DcGeneral\Data\ModelInterface
38: */
39: protected $model;
40:
41: /**
42: * The ids of any child records of the model.
43: *
44: * @var array
45: */
46: protected $childRecordIds;
47:
48: /**
49: * Determinator if there is a circular reference from an item in the clipboard to the current model.
50: *
51: * @var bool
52: */
53: protected $circularReference;
54:
55: /**
56: * The next model succeeding the current model.
57: *
58: * @var ModelInterface
59: */
60: protected $next;
61:
62: /**
63: * The model preceeding the current model.
64: *
65: * @var ModelInterface
66: */
67: protected $previous;
68:
69: /**
70: * The href for the command.
71: *
72: * @var string
73: */
74: protected $href;
75:
76: /**
77: * Set the attached command.
78: *
79: * @param \DcGeneral\DataDefinition\Definition\View\CommandInterface $objCommand The command.
80: *
81: * @return $this
82: */
83: public function setCommand($objCommand)
84: {
85: $this->command = $objCommand;
86:
87: return $this;
88: }
89:
90: /**
91: * Retrieve the attached command.
92: *
93: * @return \DcGeneral\DataDefinition\Definition\View\CommandInterface
94: */
95: public function getCommand()
96: {
97: return $this->command;
98: }
99:
100: /**
101: * Set the ids of the child records of the current model.
102: *
103: * @param array $childRecordIds The list of ids.
104: *
105: * @return $this
106: */
107: public function setChildRecordIds($childRecordIds)
108: {
109: $this->childRecordIds = $childRecordIds;
110:
111: return $this;
112: }
113:
114: /**
115: * Retrieve the ids of the child records of the current model.
116: *
117: * @return array
118: */
119: public function getChildRecordIds()
120: {
121: return $this->childRecordIds;
122: }
123:
124: /**
125: * Set determinator if there exists a circular reference.
126: *
127: * This flag determines if there exists a circular reference between the item currently in the clipboard and the
128: * current model. A circular reference is of relevance when performing a cut and paste operation for example.
129: *
130: * @param boolean $circularReference The flag.
131: *
132: * @return $this
133: */
134: public function setCircularReference($circularReference)
135: {
136: $this->circularReference = $circularReference;
137:
138: return $this;
139: }
140:
141: /**
142: * Get determinator if there exists a circular reference.
143: *
144: * This flag determines if there exists a circular reference between the item currently in the clipboard and the
145: * current model. A circular reference is of relevance when performing a cut and paste operation for example.
146: *
147: * @return boolean
148: */
149: public function getCircularReference()
150: {
151: return $this->circularReference;
152: }
153:
154: /**
155: * Set the next model in the list, succeeding the current model.
156: *
157: * @param \DcGeneral\Data\ModelInterface $next The successor.
158: *
159: * @return $this
160: */
161: public function setNext($next)
162: {
163: $this->next = $next;
164:
165: return $this;
166: }
167:
168: /**
169: * Get the next model in the list, succeeding the current model.
170: *
171: * @return \DcGeneral\Data\ModelInterface
172: */
173: public function getNext()
174: {
175: return $this->next;
176: }
177:
178: /**
179: * Set the previous model in the list, preceding the current model.
180: *
181: * @param \DcGeneral\Data\ModelInterface $previous The id of the predecessor.
182: *
183: * @return $this
184: */
185: public function setPrevious($previous)
186: {
187: $this->previous = $previous;
188:
189: return $this;
190: }
191:
192: /**
193: * Get the previous model in the list, preceding the current model.
194: *
195: * @return \DcGeneral\Data\ModelInterface
196: */
197: public function getPrevious()
198: {
199: return $this->previous;
200: }
201:
202: /**
203: * Set the href for the button.
204: *
205: * @param string $href The href.
206: *
207: * @return $this
208: */
209: public function setHref($href)
210: {
211: $this->href = $href;
212:
213: return $this;
214: }
215:
216: /**
217: * Retrieve the href for the button.
218: *
219: * @return string
220: */
221: public function getHref()
222: {
223: return $this->href;
224: }
225:
226: /**
227: * Set the model currently in scope.
228: *
229: * @param \DcGeneral\Data\ModelInterface $model The model.
230: *
231: * @return $this
232: */
233: public function setObjModel($model)
234: {
235: $this->model = $model;
236:
237: return $this;
238: }
239:
240: /**
241: * Get the model currently in scope.
242: *
243: * @return \DcGeneral\Data\ModelInterface
244: */
245: public function getModel()
246: {
247: return $this->model;
248: }
249: }
250: