[BUGFIX] Autoloader Cache is not updated
[Packages/TYPO3.CMS.git] / t3lib / contextmenu / class.t3lib_contextmenu_action.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * Context Menu Action
30 *
31 * @author Stefan Galinski <stefan.galinski@gmail.com>
32 * @package TYPO3
33 * @subpackage t3lib
34 */
35 class t3lib_contextmenu_Action {
36 /**
37 * Label
38 *
39 * @var string
40 */
41 protected $label = '';
42
43 /**
44 * Identifier
45 *
46 * @var string
47 */
48 protected $id = '';
49
50 /**
51 * Icon
52 *
53 * @var string
54 */
55 protected $icon = '';
56
57 /**
58 * Class
59 *
60 * @var string
61 */
62 protected $class = '';
63
64 /**
65 * Callback Action
66 *
67 * @var string
68 */
69 protected $callbackAction = '';
70
71 /**
72 * Type
73 *
74 * @var string
75 */
76 protected $type = '';
77
78 /**
79 * Child Action Collection
80 *
81 * @var t3lib_contextmenu_ActionCollection
82 */
83 protected $childActions = NULL;
84
85 /**
86 * Custom Action Attributes
87 *
88 * @var array
89 */
90 protected $customAttributes = array();
91
92 /**
93 * Returns the label
94 *
95 * @return string
96 */
97 public function getLabel() {
98 return $this->label;
99 }
100
101 /**
102 * Sets the label
103 *
104 * @param string $label
105 */
106 public function setLabel($label) {
107 $this->label = $label;
108 }
109
110 /**
111 * Returns the identifier
112 *
113 * @return string
114 */
115 public function getId() {
116 return $this->id;
117 }
118
119 /**
120 * Sets the identifier
121 *
122 * @param string $id
123 */
124 public function setId($id) {
125 $this->id = $id;
126 }
127
128 /**
129 * Returns the icon
130 *
131 * @return string
132 */
133 public function getIcon() {
134 return $this->icon;
135 }
136
137 /**
138 * Sets the icon
139 *
140 * @param string $icon
141 * @return void
142 */
143 public function setIcon($icon) {
144 $this->icon = $icon;
145 }
146
147 /**
148 * Returns the class
149 *
150 * @return string
151 */
152 public function getClass() {
153 return $this->class;
154 }
155
156 /**
157 * Sets the class
158 *
159 * @param string $class
160 */
161 public function setClass($class) {
162 $this->class = $class;
163 }
164
165 /**
166 * Returns the callback action
167 *
168 * @return string
169 */
170 public function getCallbackAction() {
171 return $this->callbackAction;
172 }
173
174 /**
175 * Sets the callback action
176 *
177 * @param string $callbackAction
178 */
179 public function setCallbackAction($callbackAction) {
180 $this->callbackAction = $callbackAction;
181 }
182
183 /**
184 * Returns the type
185 *
186 * @return string
187 */
188 public function getType() {
189 return $this->type;
190 }
191
192 /**
193 * Sets the type
194 *
195 * @param string $type
196 * @return void
197 */
198 public function setType($type) {
199 $this->type = $type;
200 }
201
202 /**
203 * Returns the child actions
204 *
205 * @return t3lib_contextmenu_ActionCollection
206 */
207 public function getChildActions() {
208 return $this->childActions;
209 }
210
211 /**
212 * Sets the child actions
213 *
214 * @param t3lib_contextmenu_ActionCollection $actions
215 * @return void
216 */
217 public function setChildActions(t3lib_contextmenu_ActionCollection $actions) {
218 $this->childActions = $actions;
219 }
220
221 /**
222 * Returns TRUE if the action has child actions
223 *
224 * @return boolean
225 */
226 public function hasChildActions() {
227 if ($this->childActions !== NULL) {
228 return TRUE;
229 }
230
231 return FALSE;
232 }
233
234 /**
235 * Sets the custom attributes
236 *
237 * @param array $customAttributes
238 * @return void
239 */
240 public function setCustomAttributes(array $customAttributes) {
241 $this->customAttributes = $customAttributes;
242 }
243
244 /**
245 * Returns the custom attributes
246 *
247 * @return array
248 */
249 public function getCustomAttributes() {
250 return $this->customAttributes;
251 }
252
253 /**
254 * Returns the action as an array
255 *
256 * @return array
257 */
258 public function toArray() {
259 $arrayRepresentation = array(
260 'label' => $this->getLabel(),
261 'id' => $this->getId(),
262 'icon' => $this->getIcon(),
263 'class' => $this->getClass(),
264 'callbackAction' => $this->getCallbackAction(),
265 'type' => $this->getType(),
266 'customAttributes' => $this->getCustomAttributes()
267 );
268
269 $arrayRepresentation['childActions'] = '';
270 if ($this->hasChildActions()) {
271 $arrayRepresentation['childActions'] = $this->childActions->toArray();
272 }
273
274 return $arrayRepresentation;
275 }
276 }
277
278 ?>