Documentation TYPO3 par Ameos

class.t3lib_treeview.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
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 ***************************************************************/
00101 require_once (PATH_t3lib.'class.t3lib_iconworks.php');
00102 require_once (PATH_t3lib.'class.t3lib_befunc.php');
00103 require_once (PATH_t3lib.'class.t3lib_div.php');
00104 
00105 
00115 class t3lib_treeView {
00116 
00117                 // EXTERNAL, static:
00118         var $expandFirst=0;             // If set, the first element in the tree is always expanded.
00119         var $expandAll=0;               // If set, then ALL items will be expanded, regardless of stored settings.
00120         var $thisScript='';             // Holds the current script to reload to.
00121         var $titleAttrib = 'title';             // Which HTML attribute to use: alt/title. See init().
00122         var $ext_IconMode = false;              // If true, no context menu is rendered on icons. If set to "titlelink" the icon is linked as the title is.
00123         var $addSelfId = 0;                             // If set, the id of the mounts will be added to the internal ids array
00124         var $title='no title';                  // Used if the tree is made of records (not folders for ex.)
00125         var $showDefaultTitleAttribute = FALSE;         // If true, a default title attribute showing the UID of the record is shown. This cannot be enabled by default because it will destroy many applications where another title attribute is in fact applied later.
00126         var $highlightPagesWithVersions = TRUE;         // If true, pages containing child records which has versions will be highlighted in yellow. This might be too expensive in terms of processing power.
00127 
00132         var $BE_USER='';
00133 
00139         var $MOUNTS='';
00140 
00141 
00142 
00147         var $table='';
00148 
00152         var $parentField='pid';
00153 
00159         var $clause='';
00160 
00166         var $orderByFields='';
00167 
00173         var $fieldArray = Array('uid','title');
00174 
00179         var $defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate,cruser_id';
00180 
00181 
00189         var $treeName = '';
00190 
00197         var $domIdPrefix = 'row';
00198 
00202         var $backPath;
00203 
00207         var $iconPath = '';
00208 
00209 
00213         var $iconName = 'default.gif';
00214 
00219         var $makeHTML=1;
00220 
00224         var $setRecs = 0;
00225 
00230         var $subLevelID = '_SUB_LEVEL';
00231 
00232 
00233 
00234 
00235                 // *********
00236                 // Internal
00237                 // *********
00238                 // For record trees:
00239         var $ids = Array();                             // one-dim array of the uid's selected.
00240         var $ids_hierarchy = array();   // The hierarchy of element uids
00241         var $buffer_idH = array();              // Temporary, internal array
00242 
00243                 // For FOLDER trees:
00244         var $specUIDmap=array();                // Special UIDs for folders (integer-hashes of paths)
00245 
00246                 // For arrays:
00247         var $data = false;                              // Holds the input data array
00248         var $dataLookup = false;                // Holds an index with references to the data array.
00249 
00250                 // For both types
00251         var $tree = Array();                    // Tree is accumulated in this variable
00252         var $stored = array();                  // Holds (session stored) information about which items in the tree are unfolded and which are not.
00253         var $bank=0;                                    // Points to the current mountpoint key
00254         var $recs = array();                    // Accumulates the displayed records.
00255 
00256 
00257 
00258 
00259 
00260 
00261 
00270         function init($clause='', $orderByFields='')    {
00271                 $this->BE_USER = $GLOBALS['BE_USER'];   // Setting BE_USER by default
00272                 $this->titleAttrib = 'title';   // Setting title attribute to use.
00273                 $this->backPath = $GLOBALS['BACK_PATH'];        // Setting backpath.
00274 
00275                 if ($clause)    $this->clause = $clause;        // Setting clause
00276                 if ($orderByFields)     $this->orderByFields = $orderByFields;
00277 
00278                 if (!is_array($this->MOUNTS))   {
00279                         $this->MOUNTS = array(0 => 0); // dummy
00280                 }
00281 
00282                 $this->setTreeName();
00283 
00284                 if($this->table) {
00285                         t3lib_div::loadTCA($this->table);
00286                 }
00287 
00288                         // setting this to false disables the use of array-trees by default
00289                 $this->data = false;
00290                 $this->dataLookup = false;
00291         }
00292 
00293 
00301         function setTreeName($treeName='') {
00302                 $this->treeName = $treeName ? $treeName : $this->treeName;
00303                 $this->treeName = $this->treeName ? $this->treeName : $this->table;
00304                 $this->treeName = str_replace('_','',$this->treeName);
00305         }
00306 
00307 
00315         function addField($field,$noCheck=0)    {
00316                 global $TCA;
00317                 if ($noCheck || is_array($TCA[$this->table]['columns'][$field]) || t3lib_div::inList($this->defaultList,$field))        {
00318                         $this->fieldArray[]=$field;
00319                 }
00320         }
00321 
00322 
00323 
00329         function reset()        {
00330                 $this->tree = array();
00331                 $this->recs = array();
00332                 $this->ids = array();
00333                 $this->ids_hierarchy = array();
00334         }
00335 
00336 
00337         /*******************************************
00338          *
00339          * output
00340          *
00341          *******************************************/
00342 
00349         function getBrowsableTree()     {
00350 
00351                         // Get stored tree structure AND updating it if needed according to incoming PM GET var.
00352                 $this->initializePositionSaving();
00353 
00354                         // Init done:
00355                 $titleLen=intval($this->BE_USER->uc['titleLen']);
00356                 $treeArr=array();
00357 
00358                         // Traverse mounts:
00359                 foreach($this->MOUNTS as $idx => $uid)  {
00360 
00361                                 // Set first:
00362                         $this->bank=$idx;
00363                         $isOpen = $this->stored[$idx][$uid] || $this->expandFirst;
00364 
00365                                 // Save ids while resetting everything else.
00366                         $curIds = $this->ids;
00367                         $this->reset();
00368                         $this->ids = $curIds;
00369 
00370                                 // Set PM icon for root of mount:
00371                         $cmd=$this->bank.'_'.($isOpen?"0_":"1_").$uid.'_'.$this->treeName;
00372                         $icon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($isOpen?'minus':'plus').'only.gif','width="18" height="16"').' alt="" />';
00373                         $firstHtml= $this->PM_ATagWrap($icon,$cmd);
00374 
00375                                 // Preparing rootRec for the mount
00376                         if ($uid)       {
00377                                 $rootRec = $this->getRecord($uid);
00378                                 $firstHtml.=$this->getIcon($rootRec);
00379                         } else {
00380                                         // Artificial record for the tree root, id=0
00381                                 $rootRec = $this->getRootRecord($uid);
00382                                 $firstHtml.=$this->getRootIcon($rootRec);
00383                         }
00384 
00385                         if (is_array($rootRec)) {
00386                                 $uid = $rootRec['uid'];         // In case it was swapped inside getRecord due to workspaces.
00387 
00388                                         // Add the root of the mount to ->tree
00389                                 $this->tree[]=array('HTML'=>$firstHtml, 'row'=>$rootRec, 'bank'=>$this->bank);
00390 
00391                                         // If the mount is expanded, go down:
00392                                 if ($isOpen)    {
00393                                                 // Set depth:
00394                                         $depthD='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/blank.gif','width="18" height="16"').' alt="" />';
00395                                         if ($this->addSelfId)   $this->ids[] = $uid;
00396                                         $this->getTree($uid,999,$depthD,'',$rootRec['_SUBCSSCLASS']);
00397                                 }
00398 
00399                                         // Add tree:
00400                                 $treeArr=array_merge($treeArr,$this->tree);
00401                         }
00402                 }
00403                 return $this->printTree($treeArr);
00404         }
00405 
00412         function printTree($treeArr='') {
00413                 $titleLen=intval($this->BE_USER->uc['titleLen']);
00414                 if (!is_array($treeArr))        $treeArr=$this->tree;
00415                 $out='';
00416 
00417                         // put a table around it with IDs to access the rows from JS
00418                         // not a problem if you don't need it
00419                         // In XHTML there is no "name" attribute of <td> elements - but Mozilla will not be able to highlight rows if the name attribute is NOT there.
00420                 $out .= '
00421 
00422                         <!--
00423                           TYPO3 tree structure.
00424                         -->
00425                         <table cellpadding="0" cellspacing="0" border="0" id="typo3-tree">';
00426 
00427                 foreach($treeArr as $k => $v)   {
00428                         $idAttr = htmlspecialchars($this->domIdPrefix.$this->getId($v['row']).'_'.$v['bank']);
00429 
00430                         $out.='
00431                                 <tr>
00432                                         <td id="'.$idAttr.'"'.
00433                                                 ($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
00434                                                 $v['HTML'].
00435                                                 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$v['bank']).
00436                                         '</td>
00437                                 </tr>
00438                         ';
00439                 }
00440                 $out .= '
00441                         </table>';
00442                 return $out;
00443         }
00444 
00445 
00446 
00447         /*******************************************
00448          *
00449          * rendering parts
00450          *
00451          *******************************************/
00452 
00453 
00454 
00467         function PMicon($row,$a,$c,$nextCount,$exp)     {
00468                 $PM = $nextCount ? ($exp?'minus':'plus') : 'join';
00469                 $BTM = ($a==$c)?'bottom':'';
00470                 $icon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$PM.$BTM.'.gif','width="18" height="16"').' alt="" />';
00471 
00472                 if ($nextCount) {
00473                         $cmd=$this->bank.'_'.($exp?'0_':'1_').$row['uid'].'_'.$this->treeName;
00474                         $bMark=($this->bank.'_'.$row['uid']);
00475                         $icon = $this->PM_ATagWrap($icon,$cmd,$bMark);
00476                 }
00477                 return $icon;
00478         }
00479 
00489         function PM_ATagWrap($icon,$cmd,$bMark='')      {
00490                 if ($this->thisScript) {
00491                         if ($bMark)     {
00492                                 $anchor = '#'.$bMark;
00493                                 $name=' name="'.$bMark.'"';
00494                         }
00495                         $aUrl = $this->thisScript.'?PM='.$cmd.$anchor;
00496                         return '<a href="'.htmlspecialchars($aUrl).'"'.$name.'>'.$icon.'</a>';
00497                 } else {
00498                         return $icon;
00499                 }
00500         }
00501 
00511         function wrapTitle($title,$row,$bank=0) {
00512                 $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'\','.$bank.');';
00513                 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00514         }
00515 
00524         function wrapIcon($icon,$row)   {
00525                 return $icon;
00526         }
00527 
00535         function addTagAttributes($icon,$attr)  {
00536                 return ereg_replace(' ?\/?>$','',$icon).' '.$attr.' />';
00537         }
00538 
00547         function wrapStop($str,$row)    {
00548                 if ($row['php_tree_stop'])      {
00549                         $str.='<span class="typo3-red">+ </span>';
00550                 }
00551                 return $str;
00552         }
00553 
00554 
00555 
00556 
00557 
00558 
00559         /*******************************************
00560          *
00561          * tree handling
00562          *
00563          *******************************************/
00564 
00565 
00575         function expandNext($id)        {
00576                 return ($this->stored[$this->bank][$id] || $this->expandAll)? 1 : 0;
00577         }
00578 
00585         function initializePositionSaving()     {
00586                         // Get stored tree structure:
00587                 $this->stored=unserialize($this->BE_USER->uc['browseTrees'][$this->treeName]);
00588 
00589                         // PM action
00590                         // (If an plus/minus icon has been clicked, the PM GET var is sent and we must update the stored positions in the tree):
00591                 $PM = explode('_',t3lib_div::_GP('PM'));        // 0: mount key, 1: set/clear boolean, 2: item ID (cannot contain "_"), 3: treeName
00592                 if (count($PM)==4 && $PM[3]==$this->treeName)   {
00593                         if (isset($this->MOUNTS[$PM[0]]))       {
00594                                 if ($PM[1])     {       // set
00595                                         $this->stored[$PM[0]][$PM[2]]=1;
00596                                         $this->savePosition();
00597                                 } else {        // clear
00598                                         unset($this->stored[$PM[0]][$PM[2]]);
00599                                         $this->savePosition();
00600                                 }
00601                         }
00602                 }
00603         }
00604 
00612         function savePosition() {
00613                 $this->BE_USER->uc['browseTrees'][$this->treeName] = serialize($this->stored);
00614                 $this->BE_USER->writeUC();
00615         }
00616 
00617 
00618 
00619 
00620 
00621 
00622 
00623 
00624 
00625 
00626 
00627 
00628 
00629         /******************************
00630          *
00631          * Functions that might be overwritten by extended classes
00632          *
00633          ********************************/
00634 
00641         function getRootIcon($rec) {
00642                 return $this->wrapIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' alt="" />',$rec);
00643         }
00644 
00645 
00646 
00654         function getIcon($row) {
00655                 if ($this->iconPath && $this->iconName) {
00656                         $icon = '<img'.t3lib_iconWorks::skinImg('',$this->iconPath.$this->iconName,'width="18" height="16"').' alt=""'.($this->showDefaultTitleAttribute ? ' title="UID: '.$row['uid'].'"':'').' />';
00657                 } else {
00658                         $icon = t3lib_iconWorks::getIconImage($this->table,$row,$this->backPath,'align="top" class="c-recIcon"'.($this->showDefaultTitleAttribute ? ' title="UID: '.$row['uid'].'"':''));
00659                 }
00660 
00661                 return $this->wrapIcon($icon,$row);
00662         }
00663 
00664 
00673         function getTitleStr($row,$titleLen=30) {
00674                 $title = (!strcmp(trim($row['title']),'')) ? '<em>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</em>' : htmlspecialchars(t3lib_div::fixed_lgd_cs($row['title'],$titleLen));
00675                 return $title;
00676         }
00677 
00685         function getTitleAttrib($row) {
00686                 return htmlspecialchars($row['title']);
00687         }
00688 
00695         function getId($row) {
00696                 return $row['uid'];
00697         }
00698 
00705         function getJumpToParam($row) {
00706                 return $this->getId($row);
00707         }
00708 
00709 
00710 
00711 
00712 
00713 
00714 
00715 
00716 
00717 
00718 
00719 
00720 
00721 
00722 
00723         /********************************
00724          *
00725          * tree data buidling
00726          *
00727          ********************************/
00728 
00739         function getTree($uid, $depth=999, $depthData='',$blankLineCode='',$subCSSclass='')     {
00740 
00741                         // Buffer for id hierarchy is reset:
00742                 $this->buffer_idH=array();
00743 
00744 
00745                         // Init vars
00746                 $depth=intval($depth);
00747                 $HTML='';
00748                 $a=0;
00749 
00750                 $res = $this->getDataInit($uid,$subCSSclass);
00751                 $c = $this->getDataCount($res);
00752                 $crazyRecursionLimiter = 999;
00753 
00754                         // Traverse the records:
00755                 while ($crazyRecursionLimiter>0 && $row = $this->getDataNext($res,$subCSSclass))        {
00756                         $a++;
00757                         $crazyRecursionLimiter--;
00758 
00759                         $newID =$row['uid'];
00760                         $this->tree[]=array();          // Reserve space.
00761                         end($this->tree);
00762                         $treeKey = key($this->tree);    // Get the key for this space
00763                         $LN = ($a==$c)?'blank':'line';
00764 
00765                                 // If records should be accumulated, do so
00766                         if ($this->setRecs)     {
00767                                 $this->recs[$row['uid']] = $row;
00768                         }
00769 
00770                                 // Accumulate the id of the element in the internal arrays
00771                         $this->ids[]=$idH[$row['uid']]['uid'] = $row['uid'];
00772                         $this->ids_hierarchy[$depth][] = $row['uid'];
00773 
00774                                 // Make a recursive call to the next level
00775                         $HTML_depthData = $depthData.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.$LN.'.gif','width="18" height="16"').' alt="" />';
00776                         if ($depth>1 && $this->expandNext($newID) && !$row['php_tree_stop'])    {
00777                                 $nextCount=$this->getTree(
00778                                                 $newID,
00779                                                 $depth-1,
00780                                                 $this->makeHTML ? $HTML_depthData : '',
00781                                                 $blankLineCode.','.$LN,
00782                                                 $row['_SUBCSSCLASS']
00783                                         );
00784                                 if (count($this->buffer_idH))   $idH[$row['uid']]['subrow']=$this->buffer_idH;
00785                                 $exp=1; // Set "did expand" flag
00786                         } else {
00787                                 $nextCount=$this->getCount($newID);
00788                                 $exp=0; // Clear "did expand" flag
00789                         }
00790 
00791                                 // Set HTML-icons, if any:
00792                         if ($this->makeHTML)    {
00793                                 $HTML = $depthData.$this->PMicon($row,$a,$c,$nextCount,$exp);
00794                                 $HTML.=$this->wrapStop($this->getIcon($row),$row);
00795                                 #       $HTML.=$this->wrapStop($this->wrapIcon($this->getIcon($row),$row),$row);
00796                         }
00797 
00798                                 // Finally, add the row/HTML content to the ->tree array in the reserved key.
00799                         $this->tree[$treeKey] = Array(
00800                                 'row'=>$row,
00801                                 'HTML'=>$HTML,
00802                                 'HTML_depthData' => $this->makeHTML==2 ? $HTML_depthData : '',
00803                                 'invertedDepth'=>$depth,
00804                                 'blankLineCode'=>$blankLineCode,
00805                                 'bank' => $this->bank
00806                         );
00807                 }
00808 
00809                 $this->getDataFree($res);
00810                 $this->buffer_idH=$idH;
00811                 return $c;
00812         }
00813 
00814 
00815 
00816 
00817 
00818 
00819 
00820 
00821 
00822 
00823 
00824 
00825         /********************************
00826          *
00827          * Data handling
00828          * Works with records and arrays
00829          *
00830          ********************************/
00831 
00839         function getCount($uid) {
00840                 if (is_array($this->data)) {
00841                         $res = $this->getDataInit($uid);
00842                         return $this->getDataCount($res);
00843                 } else {
00844                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00845                                                 'count(*)',
00846                                                 $this->table,
00847                                                 $this->parentField.'='.$GLOBALS['TYPO3_DB']->fullQuoteStr($uid, $this->table).
00848                                                         t3lib_BEfunc::deleteClause($this->table).
00849                                                         t3lib_BEfunc::versioningPlaceholderClause($this->table).
00850                                                         $this->clause   // whereClauseMightContainGroupOrderBy
00851                                         );
00852                         $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
00853                         return $row[0];
00854                 }
00855         }
00856 
00857 
00858 
00865         function getRootRecord($uid) {
00866                 return array('title'=>$this->title, 'uid'=>0);
00867         }
00868 
00869 
00878         function getRecord($uid) {
00879                 if (is_array($this->data)) {
00880                         return $this->dataLookup[$uid];
00881                 } else {
00882                         $row = t3lib_befunc::getRecordWSOL($this->table,$uid);
00883 
00884                         return $row;
00885                 }
00886         }
00887 
00898         function getDataInit($parentId,$subCSSclass='') {
00899                 if (is_array($this->data)) {
00900                         if (!is_array($this->dataLookup[$parentId][$this->subLevelID])) {
00901                                 $parentId = -1;
00902                         } else {
00903                                 reset($this->dataLookup[$parentId][$this->subLevelID]);
00904                         }
00905                         return $parentId;
00906                 } else {
00907                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00908                                                 implode(',',$this->fieldArray),
00909                                                 $this->table,
00910                                                 $this->parentField.'='.$GLOBALS['TYPO3_DB']->fullQuoteStr($parentId, $this->table).
00911                                                         t3lib_BEfunc::deleteClause($this->table).
00912                                                         t3lib_BEfunc::versioningPlaceholderClause($this->table).
00913                                                         $this->clause,  // whereClauseMightContainGroupOrderBy
00914                                                 '',
00915                                                 $this->orderByFields
00916                                         );
00917                         return $res;
00918                 }
00919         }
00920 
00929         function getDataCount(&$res) {
00930                 if (is_array($this->data)) {
00931                         return count($this->dataLookup[$res][$this->subLevelID]);
00932                 } else {
00933                         $c = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
00934                         return $c;
00935                 }
00936         }
00937 
00947         function getDataNext(&$res,$subCSSclass=''){
00948                 if (is_array($this->data)) {
00949                         if ($res<0) {
00950                                 $row=FALSE;
00951                         } else {
00952                                 list(,$row) = each($this->dataLookup[$res][$this->subLevelID]);
00953 
00954                                         // Passing on default <td> class for subelements:
00955                                 if (is_array($row) && $subCSSclass!=='')        {
00956                                         $row['_CSSCLASS'] = $row['_SUBCSSCLASS'] = $subCSSclass;
00957                                 }
00958                         }
00959                         return $row;
00960                 } else {
00961                         $row = @$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00962                         t3lib_BEfunc::workspaceOL($this->table, $row, $this->BE_USER->workspace);
00963 
00964                                 // Passing on default <td> class for subelements:
00965                         if (is_array($row) && $subCSSclass!=='')        {
00966 
00967                                 if ($this->table==='pages' && $this->highlightPagesWithVersions && !isset($row['_CSSCLASS']) && count(t3lib_BEfunc::countVersionsOfRecordsOnPage($this->BE_USER->workspace, $row['uid'], TRUE)))        {
00968                                         $row['_CSSCLASS'] = 'ver-versions';
00969                                 }
00970 
00971                                 if (!isset($row['_CSSCLASS']))  $row['_CSSCLASS'] = $subCSSclass;
00972                                 if (!isset($row['_SUBCSSCLASS']))       $row['_SUBCSSCLASS'] = $subCSSclass;
00973                         }
00974 
00975                         return $row;
00976                 }
00977         }
00978 
00986         function getDataFree(&$res){
00987                 if (is_array($this->data)) {
00988                 #       unset();
00989                 } else {
00990                         $GLOBALS['TYPO3_DB']->sql_free_result($res);
00991                 }
00992         }
00993 
01006         function setDataFromArray(&$dataArr,$traverse=FALSE,$pid=0)     {
01007                 if (!$traverse) {
01008                         $this->data = &$dataArr;
01009                         $this->dataLookup=array();
01010                                 // add root
01011                         $this->dataLookup[0][$this->subLevelID]=&$dataArr;
01012                 }
01013 
01014                 foreach($dataArr as $uid => $val)       {
01015 
01016                         $dataArr[$uid]['uid']=$uid;
01017                         $dataArr[$uid]['pid']=$pid;
01018 
01019                                 // gives quick access to id's
01020                         $this->dataLookup[$uid] = &$dataArr[$uid];
01021 
01022                         if (is_array($val[$this->subLevelID])) {
01023                                 $this->setDataFromArray($dataArr[$uid][$this->subLevelID],TRUE,$uid);
01024                         }
01025                 }
01026         }
01027 
01035         function setDataFromTreeArray(&$treeArr, &$treeLookupArr)       {
01036                 $this->data = &$treeArr;
01037                 $this->dataLookup=&$treeLookupArr;
01038         }
01039 
01040 
01041         /*
01042                 array(
01043                         [id1] => array(
01044                                 'title'=>'title...',
01045                                 'id' => 'id1',
01046                                 'icon' => 'icon ref, relative to typo3/ folder...'
01047                         ),
01048                         [id2] => array(
01049                                 'title'=>'title...',
01050                                 'id' => 'id2',
01051                                 'icon' => 'icon ref, relative to typo3/ folder...'
01052                         ),
01053                         [id3] => array(
01054                                 'title'=>'title...',
01055                                 'id' => 'id3',
01056                                 'icon' => 'icon ref, relative to typo3/ folder...'
01057                                 $this->subLevelID => array(
01058                                         [id3_asdf#1] => array(
01059                                                 'title'=>'title...',
01060                                                 'id' => 'asdf#1',
01061                                                 'icon' => 'icon ref, relative to typo3/ folder...'
01062                                         ),
01063                                         [5] => array(
01064                                                 'title'=>'title...',
01065                                                 'id' => 'id...',
01066                                                 'icon' => 'icon ref, relative to typo3/ folder...'
01067                                         ),
01068                                         [6] => array(
01069                                                 'title'=>'title...',
01070                                                 'id' => 'id...',
01071                                                 'icon' => 'icon ref, relative to typo3/ folder...'
01072                                         ),
01073                                 )
01074                         ),
01075                 )
01076 */
01077 }
01078 
01079 
01080 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_treeview.php'])  {
01081         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_treeview.php']);
01082 }
01083 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6