|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 /** 00029 * Representation Tree Node 00030 * 00031 * @author Stefan Galinski <stefan.galinski@gmail.com> 00032 * @author Steffen Ritter <info@steffen-ritter.net> 00033 * @package TYPO3 00034 * @subpackage t3lib 00035 */ 00036 class t3lib_tree_RepresentationNode extends t3lib_tree_Node { 00037 /** 00038 * Node Label 00039 * 00040 * @var string 00041 */ 00042 protected $label = ''; 00043 00044 /** 00045 * Node Type 00046 * 00047 * @var string 00048 */ 00049 protected $type = ''; 00050 00051 /** 00052 * Node CSS Class 00053 * 00054 * @var string 00055 */ 00056 protected $class = ''; 00057 00058 /** 00059 * Node Icon 00060 * 00061 * @var string 00062 */ 00063 protected $icon = ''; 00064 00065 /** 00066 * Callback function that is called e.g after a click on the label 00067 * 00068 * @var string 00069 */ 00070 protected $callbackAction = ''; 00071 00072 /** 00073 * @param string $class 00074 * @return void 00075 */ 00076 public function setClass($class) { 00077 $this->class = $class; 00078 } 00079 00080 /** 00081 * @return string 00082 */ 00083 public function getClass() { 00084 return $this->class; 00085 } 00086 00087 /** 00088 * @param string $icon 00089 * @return void 00090 */ 00091 public function setIcon($icon) { 00092 $this->icon = $icon; 00093 } 00094 00095 /** 00096 * @return string 00097 */ 00098 public function getIcon() { 00099 return $this->icon; 00100 } 00101 00102 /** 00103 * @param string $label 00104 */ 00105 public function setLabel($label) { 00106 $this->label = $label; 00107 } 00108 00109 /** 00110 * @return string 00111 */ 00112 public function getLabel() { 00113 return $this->label; 00114 } 00115 00116 /** 00117 * @param string $type 00118 * @return void 00119 */ 00120 public function setType($type) { 00121 $this->type = $type; 00122 } 00123 00124 /** 00125 * @return string 00126 */ 00127 public function getType() { 00128 return $this->type; 00129 } 00130 00131 /** 00132 * Sets the callback action 00133 * 00134 * @param string $callbackAction 00135 * @return void 00136 */ 00137 public function setCallbackAction($callbackAction) { 00138 $this->callbackAction = $callbackAction; 00139 } 00140 00141 /** 00142 * Returns the callback action 00143 * 00144 * @return string 00145 */ 00146 public function getCallbackAction() { 00147 return $this->callbackAction; 00148 } 00149 00150 /** 00151 * Returns the node in an array representation that can be used for serialization 00152 * 00153 * @return array 00154 */ 00155 public function toArray() { 00156 $arrayRepresentation = parent::toArray(); 00157 $arrayRepresentation = array_merge($arrayRepresentation, array( 00158 'label' => $this->label, 00159 'type' => $this->type, 00160 'class' => $this->class, 00161 'icon' => $this->icon, 00162 'callbackAction' => $this->callbackAction 00163 )); 00164 return $arrayRepresentation; 00165 } 00166 00167 /** 00168 * Sets data of the node by a given data array 00169 * 00170 * @param array $data 00171 * @return void 00172 */ 00173 public function dataFromArray($data) { 00174 parent::dataFromArray($data); 00175 00176 $this->setLabel($data['label']); 00177 $this->setType($data['type']); 00178 $this->setClass($data['class']); 00179 $this->setIcon($data['icon']); 00180 $this->setCallbackAction($data['callbackAction']); 00181 } 00182 } 00183 00184 ?>
1.8.0