[TASK] Clean up the phpDoc of t3lib/tree/
[Packages/TYPO3.CMS.git] / t3lib / tree / tca / class.t3lib_tree_tca_abstracttcatreedataprovider.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Steffen Ritter <info@steffen-ritter.net>
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 * An abstract TCA tree data provider
30 *
31 * @author Steffen Ritter <info@steffen-ritter.net>
32 * @package TYPO3
33 * @subpackage t3lib_tree
34 */
35 abstract class t3lib_tree_Tca_AbstractTcaTreeDataProvider extends t3lib_tree_AbstractDataProvider {
36 /**
37 * @var boolean
38 */
39 protected $expandAll = FALSE;
40
41 /**
42 * @var integer
43 */
44 protected $levelMaximum = 2;
45
46 /**
47 * @var t3lib_tree_AbstractNode
48 */
49 protected $treeData = NULL;
50
51 /**
52 * @var string
53 */
54 protected $nonSelectableLevelList = '0';
55
56 /**
57 * @var string
58 */
59 protected $expandedList = '';
60
61 /**
62 * @var string
63 */
64 protected $selectedList = '';
65
66 /**
67 * Contains all ids which may be allowed to display according to
68 * beUser Rights and foreign_table_where (if type db)
69 *
70 * @var array $itemWhiteList
71 */
72 protected $itemWhiteList = array();
73
74 /**
75 * Contains all ids which are not allowed to be selected
76 */
77 protected $itemUnselectableList = array();
78
79 /**
80 * Sets the id of the tree
81 *
82 * @param string $treeId
83 * @return void
84 */
85 public function setTreeId($treeId) {
86 $this->treeId = $treeId;
87 }
88
89 /**
90 * Gets the id of the tree
91 * @return string
92 */
93 public function getTreeId() {
94 return $this->treeId;
95 }
96
97
98 /**
99 * Sets the expandAll
100 *
101 * @param boolean $expandAll
102 * @return void
103 */
104 public function setExpandAll($expandAll) {
105 $this->expandAll = $expandAll;
106 }
107
108 /**
109 * Gets the expamdAll
110 *
111 * @return boolean
112 */
113 public function getExpandAll() {
114 return $this->expandAll;
115 }
116
117 /**
118 * Sets the levelMaximum
119 *
120 * @param integer $levelMaximum
121 * @return void
122 */
123 public function setLevelMaximum($levelMaximum) {
124 $this->levelMaximum = $levelMaximum;
125 }
126
127 /**
128 * Gets the levelMaximum
129 *
130 * @return integer
131 */
132 public function getLevelMaximum() {
133 return $this->levelMaximum;
134 }
135
136 /**
137 * Gets the expanded state of a given node
138 *
139 * @param t3lib_tree_AbstractNode $node
140 * @return boolean
141 */
142 protected function isExpanded(t3lib_tree_Node $node) {
143 return $this->getExpandAll() || t3lib_div::inList($this->expandedList, $node->getId());
144 }
145
146 /**
147 * Sets the list for expanded nodes
148 *
149 * @param string $expandedList
150 * @return void
151 */
152 public function setExpandedList($expandedList) {
153 $this->expandedList = $expandedList;
154 }
155
156 /**
157 * Gets the list for expanded nodes
158 *
159 * @return string
160 */
161 public function getExpandedList() {
162 return $this->expandedList;
163 }
164
165 /**
166 * Read the list for expanded nodes from user settings
167 *
168 * @return void
169 */
170 public function initializeTreeData() {
171 $this->expandedList = $GLOBALS['BE_USER']->uc['tcaTrees'][$this->treeId];
172 }
173
174 /**
175 * Sets the list for selected nodes
176 *
177 * @param string $selectedList
178 * @return void
179 */
180 public function setSelectedList($selectedList) {
181 $this->selectedList = $selectedList;
182 }
183
184 /**
185 * Gets the list for selected nodes
186 *
187 * @return string
188 */
189 public function getSelectedList() {
190 return $this->selectedList;
191 }
192
193 /**
194 * Sets the list for non selectabal tree levels
195 *
196 * @param string $nonSelectableLevelList
197 * @return void
198 */
199 public function setNonSelectableLevelList($nonSelectableLevelList) {
200 $this->nonSelectableLevelList = $nonSelectableLevelList;
201 }
202
203 /**
204 * Gets the list for non selectabal tree levels
205 *
206 * @return string
207 */
208 public function getNonSelectableLevelList() {
209 return $this->nonSelectableLevelList;
210 }
211
212 /**
213 * Setter for the itemWhiteList
214 *
215 * @param array $itemWhiteList
216 * @return void
217 */
218 public function setItemWhiteList(array $itemWhiteList) {
219 $this->itemWhiteList = $itemWhiteList;
220 }
221
222 /**
223 * Getter for the itemWhiteList
224 *
225 * @return array
226 */
227 public function getItemWhiteList() {
228 return $this->itemWhiteList;
229 }
230
231 /**
232 * Setter for $itemUnselectableList
233 *
234 * @param array $itemUnselectableList
235 * @return void
236 */
237 public function setItemUnselectableList(array $itemUnselectableList) {
238 $this->itemUnselectableList = $itemUnselectableList;
239 }
240
241 /**
242 * Getter for $itemUnselectableList
243 *
244 * @return array
245 */
246 public function getItemUnselectableList() {
247 return $this->itemUnselectableList;
248 }
249 }
250
251 ?>