[BUGFIX] Missing column in t3lib_TCEmain::getPreviousLocalizedRecordUid
[Packages/TYPO3.CMS.git] / t3lib / tree / class.t3lib_tree_representationnode.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 * Representation Tree Node
30 *
31 * @author Stefan Galinski <stefan.galinski@gmail.com>
32 * @author Steffen Ritter <info@steffen-ritter.net>
33 * @package TYPO3
34 * @subpackage t3lib
35 */
36 class t3lib_tree_RepresentationNode extends t3lib_tree_Node {
37 /**
38 * Node Label
39 *
40 * @var string
41 */
42 protected $label = '';
43
44 /**
45 * Node Type
46 *
47 * @var string
48 */
49 protected $type = '';
50
51 /**
52 * Node CSS Class
53 *
54 * @var string
55 */
56 protected $class = '';
57
58 /**
59 * Node Icon
60 *
61 * @var string
62 */
63 protected $icon = '';
64
65 /**
66 * Callback function that is called e.g after a click on the label
67 *
68 * @var string
69 */
70 protected $callbackAction = '';
71
72 /**
73 * @param string $class
74 * @return void
75 */
76 public function setClass($class) {
77 $this->class = $class;
78 }
79
80 /**
81 * @return string
82 */
83 public function getClass() {
84 return $this->class;
85 }
86
87 /**
88 * @param string $icon
89 * @return void
90 */
91 public function setIcon($icon) {
92 $this->icon = $icon;
93 }
94
95 /**
96 * @return string
97 */
98 public function getIcon() {
99 return $this->icon;
100 }
101
102 /**
103 * @param string $label
104 */
105 public function setLabel($label) {
106 $this->label = $label;
107 }
108
109 /**
110 * @return string
111 */
112 public function getLabel() {
113 return $this->label;
114 }
115
116 /**
117 * @param string $type
118 * @return void
119 */
120 public function setType($type) {
121 $this->type = $type;
122 }
123
124 /**
125 * @return string
126 */
127 public function getType() {
128 return $this->type;
129 }
130
131 /**
132 * Sets the callback action
133 *
134 * @param string $callbackAction
135 * @return void
136 */
137 public function setCallbackAction($callbackAction) {
138 $this->callbackAction = $callbackAction;
139 }
140
141 /**
142 * Returns the callback action
143 *
144 * @return string
145 */
146 public function getCallbackAction() {
147 return $this->callbackAction;
148 }
149
150 /**
151 * Returns the node in an array representation that can be used for serialization
152 *
153 * @param bool $addChildNodes
154 * @return array
155 */
156 public function toArray($addChildNodes = TRUE) {
157 $arrayRepresentation = parent::toArray();
158 $arrayRepresentation = array_merge($arrayRepresentation, array(
159 'label' => $this->label,
160 'type' => $this->type,
161 'class' => $this->class,
162 'icon' => $this->icon,
163 'callbackAction' => $this->callbackAction
164 ));
165 return $arrayRepresentation;
166 }
167
168 /**
169 * Sets data of the node by a given data array
170 *
171 * @param array $data
172 * @return void
173 */
174 public function dataFromArray($data) {
175 parent::dataFromArray($data);
176
177 $this->setLabel($data['label']);
178 $this->setType($data['type']);
179 $this->setClass($data['class']);
180 $this->setIcon($data['icon']);
181 $this->setCallbackAction($data['callbackAction']);
182 }
183 }
184
185 ?>