TYPO3 API  SVNRelease
class.t3lib_tree_tca_abstracttcatreedataprovider.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2010-2011 Steffen Ritter <info@steffen-ritter.net>
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  * An abstract TCA tree data provider
00030  *
00031  * @author Steffen Ritter <info@steffen-ritter.net>
00032  * @package TYPO3
00033  * @subpackage t3lib_tree
00034  */
00035 abstract class t3lib_tree_Tca_AbstractTcaTreeDataProvider extends t3lib_tree_AbstractDataProvider {
00036     /**
00037      * @var boolean
00038      */
00039     protected $expandAll = FALSE;
00040 
00041     /**
00042      * @var int
00043      */
00044     protected $levelMaximum = 2;
00045 
00046     /**
00047      * @var t3lib_tree_AbstractNode
00048      */
00049     protected $treeData = NULL;
00050 
00051     /**
00052      * @var string
00053      */
00054     protected $nonSelectableLevelList = '0';
00055 
00056     /**
00057      * @var string
00058      */
00059     protected $expandedList = '';
00060 
00061     /**
00062      * @var string
00063      */
00064     protected $selectedList = '';
00065 
00066     /**
00067      * Contains all ids which may be allowed to display according to
00068      * beUser Rights and foreign_table_where (if type db)
00069      *
00070      * @var array $itemWhiteList
00071      */
00072     protected $itemWhiteList = array();
00073 
00074     /**
00075      * Sets the id of the tree
00076      *
00077      * @param string $treeId
00078      * @return void
00079      */
00080     public function setTreeId($treeId) {
00081         $this->treeId = $treeId;
00082     }
00083 
00084     /**
00085      * Gets the id of the tree
00086      * @return string
00087      */
00088     public function getTreeId() {
00089         return $this->treeId;
00090     }
00091 
00092 
00093     /**
00094      * Sets the expandAll
00095      *
00096      * @param bool $expandAll
00097      * @return void
00098      */
00099     public function setExpandAll($expandAll) {
00100         $this->expandAll = $expandAll;
00101     }
00102 
00103     /**
00104      * Gets the expamdAll
00105      *
00106      * @return bool
00107      */
00108     public function getExpandAll() {
00109         return $this->expandAll;
00110     }
00111 
00112     /**
00113      * Sets the levelMaximum
00114      *
00115      * @param int $levelMaximum
00116      * @return void
00117      */
00118     public function setLevelMaximum($levelMaximum) {
00119         $this->levelMaximum = $levelMaximum;
00120     }
00121 
00122     /**
00123      * Gets the levelMaximum
00124      *
00125      * @return int
00126      */
00127     public function getLevelMaximum() {
00128         return $this->levelMaximum;
00129     }
00130 
00131     /**
00132      * Gets the expanded state of a given node
00133      *
00134      * @param t3lib_tree_AbstractNode $node
00135      * @return bool
00136      */
00137     protected function isExpanded(t3lib_tree_Node $node) {
00138         return $this->getExpandAll() || t3lib_div::inList($this->expandedList, $node->getId());
00139     }
00140 
00141 
00142     /**
00143      * Sets the list for expanded nodes
00144      *
00145      * @param string $expandedList
00146      * @return void
00147      */
00148     public function setExpandedList($expandedList) {
00149         $this->expandedList = $expandedList;
00150     }
00151 
00152     /**
00153      * Gets the list for expanded nodes
00154      *
00155      * @return string
00156      */
00157     public function getExpandedList() {
00158         return $this->expandedList;
00159     }
00160 
00161     /**
00162      * Read the list for expanded nodes from user settings
00163      *
00164      * @return void
00165      */
00166     public function initializeTreeData() {
00167         $this->expandedList = $GLOBALS['BE_USER']->uc['tcaTrees'][$this->treeId];
00168     }
00169 
00170     /**
00171      * Sets the list for selected nodes
00172      *
00173      * @param  $selectedList
00174      * @return void
00175      */
00176     public function setSelectedList($selectedList) {
00177         $this->selectedList = $selectedList;
00178     }
00179 
00180     /**
00181      * Gets the list for selected nodes
00182      *
00183      * @return string
00184      */
00185     public function getSelectedList() {
00186         return $this->selectedList;
00187     }
00188 
00189     /**
00190      * Sets the list for non selectabal tree levels
00191      *
00192      * @param  $nonSelectableLevelList
00193      * @return void
00194      */
00195     public function setNonSelectableLevelList($nonSelectableLevelList) {
00196         $this->nonSelectableLevelList = $nonSelectableLevelList;
00197     }
00198 
00199     /**
00200      * Gets the list for non selectabal tree levels
00201      *
00202      * @return string
00203      */
00204     public function getNonSelectableLevelList() {
00205         return $this->nonSelectableLevelList;
00206     }
00207 
00208     /**
00209      * Setter for the itemWhiteList
00210      *
00211      * @param array $itemWhiteList
00212      * @return void
00213      */
00214     public function setItemWhiteList(array $itemWhiteList) {
00215         $this->itemWhiteList = $itemWhiteList;
00216     }
00217 
00218     /**
00219      * Getter for the itemWhiteList
00220      *
00221      * @return array
00222      */
00223     public function getItemWhiteList() {
00224         return $this->itemWhiteList;
00225     }
00226 }
00227 
00228 ?>