158 public $defaultList =
'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate,cruser_id';
318 return strpos($this->thisScript,
'?') === FALSE ? $this->thisScript .
'?' : $this->thisScript .
'&';
332 $this->BE_USER =
$GLOBALS[
'BE_USER'];
334 $this->titleAttrib =
'title';
336 $this->backPath =
$GLOBALS[
'BACK_PATH'];
344 if (!is_array($this->MOUNTS)) {
346 $this->MOUNTS = array(0 => 0);
351 $this->dataLookup = FALSE;
365 $this->treeName = str_replace(
'_',
'', $this->treeName);
378 $this->fieldArray[] = $field;
389 $this->tree = array();
390 $this->recs = array();
391 $this->ids = array();
392 $this->ids_hierarchy = array();
393 $this->orig_ids_hierarchy = array();
414 foreach ($this->MOUNTS as $idx =>
$uid) {
421 $this->ids = $curIds;
423 $cmd = $this->bank .
'_' . ($isOpen ?
'0_' :
'1_') .
$uid .
'_' . $this->treeName;
430 $firstHtml .= $this->
getIcon($rootRec);
436 if (is_array($rootRec)) {
438 $uid = $rootRec[
'uid'];
440 $this->tree[] = array(
'HTML' => $firstHtml,
'row' => $rootRec,
'bank' => $this->bank);
445 if ($this->addSelfId) {
448 $this->
getTree(
$uid, 999, $depthD,
'', $rootRec[
'_SUBCSSCLASS']);
451 $treeArr = array_merge($treeArr, $this->tree);
465 $titleLen = (int)$this->BE_USER->uc[
'titleLen'];
466 if (!is_array($treeArr)) {
478 TYPO3 tree structure. 480 <table cellpadding="0" cellspacing="0" border="0" id="typo3-tree">';
481 foreach ($treeArr as $k => $v) {
482 $idAttr = htmlspecialchars($this->domIdPrefix . $this->
getId($v[
'row']) .
'_' . $v[
'bank']);
485 <td id="' . $idAttr .
'"' . ($v[
'row'][
'_CSSCLASS'] ?
' class="' . $v[
'row'][
'_CSSCLASS'] .
'"' :
'') .
'>' . $v[
'HTML'] . $this->
wrapTitle($this->
getTitleStr($v[
'row'], $titleLen), $v[
'row'], $v[
'bank']) .
'</td> 512 public function PMicon($row, $a, $c, $nextCount, $exp) {
513 $PM = $nextCount ? ($exp ?
'minus' :
'plus') :
'join';
514 $BTM = $a == $c ?
'bottom' :
'';
517 $cmd = $this->bank .
'_' . ($exp ?
'0_' :
'1_') . $row[
'uid'] .
'_' . $this->treeName;
518 $bMark = $this->bank .
'_' . $row[
'uid'];
535 if ($this->thisScript) {
537 $anchor =
'#' . $bMark;
538 $name =
' name="' . $bMark .
'"';
541 return '<a href="' . htmlspecialchars($aUrl) .
'"' . $name .
'>' . $icon .
'</a>';
558 $aOnClick =
'return jumpTo(\'' . $this->
getJumpToParam($row) .
'\',
this,\
'' . $this->domIdPrefix . $this->
getId($row) .
'\',
' . $bank . ');
'; 559 return '<a href=
"#" onclick=
"' . htmlspecialchars($aOnClick) . '">
' . $title . '</a>
'; 571 public function wrapIcon($icon, $row) { 583 public function addTagAttributes($icon, $attr) { 584 return preg_replace('/ ?\\/?>$/
', '', $icon) . ' ' . $attr . ' />
'; 596 public function wrapStop($str, $row) { 597 if ($row['php_tree_stop
']) { 598 $str .= '<span
class=
"typo3-red"><a href=
"' . htmlspecialchars(GeneralUtility::linkThisScript(array('setTempDBmount' => $row['uid']))) . '" class=
"typo3-red">+</a> </span>
'; 603 /******************************************* 607 *******************************************/ 619 public function expandNext($id) { 620 return $this->stored[$this->bank][$id] || $this->expandAll ? 1 : 0; 630 public function initializePositionSaving() { 631 // Get stored tree structure: 632 $this->stored = unserialize($this->BE_USER->uc['browseTrees
'][$this->treeName]); 634 // (If an plus/minus icon has been clicked, the PM GET var is sent and we 635 // must update the stored positions in the tree): 636 // 0: mount key, 1: set/clear boolean, 2: item ID (cannot contain "_"), 3: treeName 637 $PM = explode('_
', GeneralUtility::_GP('PM
')); 638 if (count($PM) == 4 && $PM[3] == $this->treeName) { 639 if (isset($this->MOUNTS[$PM[0]])) { 642 $this->stored[$PM[0]][$PM[2]] = 1; 643 $this->savePosition(); 645 unset($this->stored[$PM[0]][$PM[2]]); 646 $this->savePosition(); 660 public function savePosition() { 661 $this->BE_USER->uc['browseTrees
'][$this->treeName] = serialize($this->stored); 662 $this->BE_USER->writeUC(); 665 /****************************** 667 * Functions that might be overwritten by extended classes 669 ********************************/ 677 public function getRootIcon($rec) { 678 return $this->wrapIcon(IconUtility::getSpriteIcon('apps-pagetree-root
'), $rec); 689 public function getIcon($row) { 690 if ($this->iconPath && $this->iconName) { 691 $icon = '<img
' . IconUtility::skinImg('', ($this->iconPath . $this->iconName), 'width=
"18" height=
"16"') . ' alt=
""' . ($this->showDefaultTitleAttribute ? ' title=
"UID: ' . $row['uid'] . '"' : '') . ' />
'; 693 $icon = IconUtility::getSpriteIconForRecord($this->table, $row, array( 694 'title
' => $this->showDefaultTitleAttribute ? 'UID:
' . $row['uid
'] : $this->getTitleAttrib($row), 695 'class' => 'c-recIcon
' 698 return $this->wrapIcon($icon, $row); 710 public function getTitleStr($row, $titleLen = 30) { 711 if ($this->ext_showNavTitle && strlen(trim($row['nav_title
'])) > 0) { 712 $title = '<span title=
"' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:title', TRUE) . ' ' . htmlspecialchars(trim($row['title'])) . '">
' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['nav_title
'], $titleLen)) . '</span>
'; 714 $title = htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title
'], $titleLen)); 715 if (strlen(trim($row['nav_title
'])) > 0) { 716 $title = '<span title=
"' . $GLOBALS['LANG']->sL('LLL:EXT:cms/locallang_tca.xlf:pages.nav_title', TRUE) . ' ' . htmlspecialchars(trim($row['nav_title'])) . '">
' . $title . '</span>
'; 718 $title = strlen(trim($row['title
'])) == 0 ? '<em>[
' . $GLOBALS['LANG
']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title
', TRUE) . ']</em>
' : $title; 731 public function getTitleAttrib($row) { 732 return htmlspecialchars($row['title
']); 742 public function getId($row) { 753 public function getJumpToParam($row) { 754 return $this->getId($row); 757 /******************************** 761 ********************************/ 773 public function getTree($uid, $depth = 999, $depthData = '', $blankLineCode = '', $subCSSclass = '') { 774 // Buffer for id hierarchy is reset: 775 $this->buffer_idH = array(); 777 $depth = (int)$depth; 780 $res = $this->getDataInit($uid, $subCSSclass); 781 $c = $this->getDataCount($res); 782 $crazyRecursionLimiter = 999; 784 // Traverse the records: 785 while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res, $subCSSclass))) { 786 $pageUid = ($this->table === 'pages
') ? $row['uid
'] : $row['pid
']; 787 if (!$GLOBALS['BE_USER
']->isInWebMount($pageUid)) { 788 // Current record is not within web mount => skip it 793 $crazyRecursionLimiter--; 794 $newID = $row['uid
']; 796 throw new \RuntimeException('Endless recursion detected:
TYPO3 has detected an error in the database. Please fix it manually (e.g.
using phpMyAdmin) and change the UID of
' . $this->table . ':0 to a
new value.<br /><br />See <a href=
"http://forge.typo3.org/issues/16150" target=
"_blank">forge.typo3.org/issues/16150</a> to
get more information about a possible cause.
', 1294586383); 799 $this->tree[] = array(); 801 // Get the key for this space 802 $treeKey = key($this->tree); 803 $LN = $a == $c ? 'blank
' : 'line
'; 804 // If records should be accumulated, do so 805 if ($this->setRecs) { 806 $this->recs[$row['uid
']] = $row; 808 // Accumulate the id of the element in the internal arrays 809 $this->ids[] = ($idH[$row['uid
']]['uid
'] = $row['uid
']); 810 $this->ids_hierarchy[$depth][] = $row['uid
']; 811 $this->orig_ids_hierarchy[$depth][] = $row['_ORIG_uid
'] ?: $row['uid
']; 813 // Make a recursive call to the next level 814 $HTML_depthData = $depthData . IconUtility::getSpriteIcon('treeline-
' . $LN); 815 if ($depth > 1 && $this->expandNext($newID) && !$row['php_tree_stop
']) { 816 $nextCount = $this->getTree($newID, $depth - 1, $this->makeHTML ? $HTML_depthData : '', $blankLineCode . ',
' . $LN, $row['_SUBCSSCLASS
']); 817 if (count($this->buffer_idH)) { 818 $idH[$row['uid
']]['subrow
'] = $this->buffer_idH; 820 // Set "did expand" flag 823 $nextCount = $this->getCount($newID); 824 // Clear "did expand" flag 827 // Set HTML-icons, if any: 828 if ($this->makeHTML) { 829 $HTML = $depthData . $this->PMicon($row, $a, $c, $nextCount, $exp); 830 $HTML .= $this->wrapStop($this->getIcon($row), $row); 832 // Finally, add the row/HTML content to the ->tree array in the reserved key. 833 $this->tree[$treeKey] = array( 836 'HTML_depthData
' => $this->makeHTML == 2 ? $HTML_depthData : '', 837 'invertedDepth
' => $depth, 838 'blankLineCode
' => $blankLineCode, 839 'bank
' => $this->bank 842 $this->getDataFree($res); 843 $this->buffer_idH = $idH; 847 /******************************** 850 * Works with records and arrays 852 ********************************/ 861 public function getCount($uid) { 862 if (is_array($this->data)) { 863 $res = $this->getDataInit($uid); 864 return $this->getDataCount($res); 866 return $GLOBALS['TYPO3_DB
']->exec_SELECTcountRows('uid
', $this->table, $this->parentField . '=
' . $GLOBALS['TYPO3_DB
']->fullQuoteStr($uid, $this->table) . BackendUtility::deleteClause($this->table) . BackendUtility::versioningPlaceholderClause($this->table) . $this->clause); 877 public function getRootRecord($uid) { 878 return array('title
' => $this->title, 'uid
' => 0); 890 public function getRecord($uid) { 891 if (is_array($this->data)) { 892 return $this->dataLookup[$uid]; 894 return BackendUtility::getRecordWSOL($this->table, $uid); 909 public function getDataInit($parentId, $subCSSclass = '') { 910 if (is_array($this->data)) { 911 if (!is_array($this->dataLookup[$parentId][$this->subLevelID])) { 914 reset($this->dataLookup[$parentId][$this->subLevelID]); 918 $res = $GLOBALS['TYPO3_DB
']->exec_SELECTquery(implode(',
', $this->fieldArray), $this->table, $this->parentField . '=
' . $GLOBALS['TYPO3_DB
']->fullQuoteStr($parentId, $this->table) . BackendUtility::deleteClause($this->table) . BackendUtility::versioningPlaceholderClause($this->table) . $this->clause, '', $this->orderByFields); 932 public function getDataCount(&$res) { 933 if (is_array($this->data)) { 934 return count($this->dataLookup[$res][$this->subLevelID]); 936 $c = $GLOBALS['TYPO3_DB
']->sql_num_rows($res); 951 public function getDataNext(&$res, $subCSSclass = '') { 952 if (is_array($this->data)) { 956 list(, $row) = each($this->dataLookup[$res][$this->subLevelID]); 957 // Passing on default <td> class for subelements: 958 if (is_array($row) && $subCSSclass !== '') { 959 $row['_CSSCLASS
'] = ($row['_SUBCSSCLASS
'] = $subCSSclass); 964 while ($row = @$GLOBALS['TYPO3_DB
']->sql_fetch_assoc($res)) { 965 BackendUtility::workspaceOL($this->table, $row, $this->BE_USER->workspace, TRUE); 966 if (is_array($row)) { 970 // Passing on default <td> class for subelements: 971 if (is_array($row) && $subCSSclass !== '') { 972 if ($this->table === 'pages
' && $this->highlightPagesWithVersions && !isset($row['_CSSCLASS
']) && $this->hasPageRecordVersions($this->BE_USER->workspace, $row['uid
'])) { 973 $row['_CSSCLASS
'] = 'ver-versions
'; 975 if (!isset($row['_CSSCLASS
'])) { 976 $row['_CSSCLASS
'] = $subCSSclass; 978 if (!isset($row['_SUBCSSCLASS
'])) { 979 $row['_SUBCSSCLASS
'] = $subCSSclass; 994 public function getDataFree(&$res) { 995 if (!is_array($this->data)) { 996 $GLOBALS['TYPO3_DB
']->sql_free_result($res); 1013 public function setDataFromArray(&$dataArr, $traverse = FALSE, $pid = 0) { 1015 $this->data = &$dataArr; 1016 $this->dataLookup = array(); 1018 $this->dataLookup[0][$this->subLevelID] = &$dataArr; 1020 foreach ($dataArr as $uid => $val) { 1021 $dataArr[$uid]['uid
'] = $uid; 1022 $dataArr[$uid]['pid
'] = $pid; 1023 // Gives quick access to id's
1024 $this->dataLookup[
$uid] = &$dataArr[
$uid];
1025 if (is_array($val[$this->subLevelID])) {
1040 $this->data = &$treeArr;
1041 $this->dataLookup = &$treeLookupArr;
1062 if ($this->workspaceService === NULL) {
PMicon($row, $a, $c, $nextCount, $exp)
$highlightPagesWithVersions
init($clause='', $orderByFields='')
getTitleStr($row, $titleLen=30)
setTreeName($treeName='')
hasPageRecordVersions($workspaceId, $pageId)
PM_ATagWrap($icon, $cmd, $bMark='')
static getIndpEnv($getEnvName)
$showDefaultTitleAttribute
setDataFromArray(&$dataArr, $traverse=FALSE, $pid=0)
static makeInstance($className)
initializePositionSaving()
getTree($uid, $depth=999, $depthData='', $blankLineCode='', $subCSSclass='')
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
wrapTitle($title, $row, $bank=0)
static isLoaded($key, $exitOnError=FALSE)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
setDataFromTreeArray(&$treeArr, &$treeLookupArr)
if(isset($ajaxID)) if(in_array( $ajaxID, $noUserAjaxIDs))
Re-apply pairs of single-quotes to the text.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
addField($field, $noCheck=0)