‪TYPO3CMS  9.5
AbstractTreeView.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
28 
32 abstract class ‪AbstractTreeView
33 {
34  // EXTERNAL, static:
35  // If set, the first element in the tree is always expanded.
39  public ‪$expandFirst = false;
40 
41  // If set, then ALL items will be expanded, regardless of stored settings.
45  public ‪$expandAll = false;
46 
47  // Holds the current script to reload to.
51  public ‪$thisScript = '';
52 
53  // Which HTML attribute to use: alt/title. See init().
57  public ‪$titleAttrib = 'title';
58 
59  // If TRUE, no context menu is rendered on icons. If set to "titlelink" the
60  // icon is linked as the title is.
64  public ‪$ext_IconMode = false;
65 
69  public ‪$ext_showPathAboveMounts = false;
70 
71  // If set, the id of the mounts will be added to the internal ids array
75  public ‪$addSelfId = 0;
76 
77  // Used if the tree is made of records (not folders for ex.)
81  public ‪$title = 'no title';
82 
83  // If TRUE, a default title attribute showing the UID of the record is shown.
84  // This cannot be enabled by default because it will destroy many applications
85  // where another title attribute is in fact applied later.
89  public ‪$showDefaultTitleAttribute = false;
90 
97  public ‪$BE_USER = '';
98 
108  public ‪$MOUNTS;
109 
116  public ‪$table = '';
117 
123  public ‪$parentField = 'pid';
124 
132  public ‪$clause = '';
133 
141  public ‪$orderByFields = '';
142 
150  public ‪$fieldArray = ['uid', 'pid', 'title', 'is_siteroot'];
151 
158  public ‪$defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate,cruser_id';
159 
169  public ‪$treeName = '';
170 
179  public ‪$domIdPrefix = 'row';
180 
186  public ‪$makeHTML = 1;
187 
193  public ‪$setRecs = 0;
194 
202  public ‪$subLevelID = '_SUB_LEVEL';
203 
204  // *********
205  // Internal
206  // *********
207  // For record trees:
208  // one-dim array of the uid's selected.
212  public ‪$ids = [];
213 
214  // The hierarchy of element uids
218  public ‪$ids_hierarchy = [];
219 
220  // The hierarchy of versioned element uids
225 
226  // Temporary, internal array
230  public ‪$buffer_idH = [];
231 
232  // For FOLDER trees:
233  // Special UIDs for folders (integer-hashes of paths)
237  public ‪$specUIDmap = [];
238 
245  public ‪$data = false;
246 
253  public ‪$dataLookup = false;
254 
255  // For both types
256  // Tree is accumulated in this variable
260  public ‪$tree = [];
261 
262  // Holds (session stored) information about which items in the tree are unfolded and which are not.
266  public ‪$stored = [];
267 
268  // Points to the current mountpoint key
272  public ‪$bank = 0;
273 
274  // Accumulates the displayed records.
278  public ‪$recs = [];
279 
285 
289  public function ‪__construct()
290  {
291  $this->‪determineScriptUrl();
292  }
293 
297  protected function ‪determineScriptUrl()
298  {
299  if ($routePath = GeneralUtility::_GP('route')) {
300  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
301  $this->thisScript = (string)$uriBuilder->buildUriFromRoutePath($routePath);
302  } else {
303  $this->thisScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
304  }
305  }
306 
310  protected function ‪getThisScript()
311  {
312  return strpos($this->thisScript, '?') === false ? $this->thisScript . '?' : $this->thisScript . '&';
313  }
314 
321  public function ‪init(‪$clause = '', ‪$orderByFields = '')
322  {
323  // Setting BE_USER by default
324  $this->BE_USER = ‪$GLOBALS['BE_USER'];
325  // Setting clause
326  if (‪$clause) {
327  $this->clause = ‪$clause;
328  }
329  if (‪$orderByFields) {
330  $this->orderByFields = ‪$orderByFields;
331  }
332  if (!is_array($this->MOUNTS)) {
333  // Dummy
334  $this->MOUNTS = [0 => 0];
335  }
336  // Sets the tree name which is used to identify the tree, used for JavaScript and other things
337  $this->treeName = str_replace('_', '', $this->treeName ?: $this->table);
338 
339  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove with $this->data and friends.
340  // Setting this to FALSE disables the use of array-trees by default
341  $this->data = false;
342  $this->dataLookup = false;
343  }
344 
351  public function ‪addField($field, $noCheck = false)
352  {
353  if ($noCheck || is_array(‪$GLOBALS['TCA'][$this->table]['columns'][$field]) || GeneralUtility::inList($this->defaultList, $field)) {
354  $this->fieldArray[] = $field;
355  }
356  }
357 
361  public function ‪reset()
362  {
363  $this->tree = [];
364  $this->recs = [];
365  $this->ids = [];
366  $this->ids_hierarchy = [];
367  $this->orig_ids_hierarchy = [];
368  }
369 
370  /*******************************************
371  *
372  * output
373  *
374  *******************************************/
381  public function ‪getBrowsableTree()
382  {
383  // Get stored tree structure AND updating it if needed according to incoming PM GET var.
385  // Init done:
386  $lastMountPointPid = 0;
387  $treeArr = [];
388  // Traverse mounts:
389  foreach ($this->MOUNTS as $idx => $uid) {
390  // Set first:
391  $this->bank = $idx;
392  $isOpen = $this->stored[$idx][$uid] || ‪$this->expandFirst;
393  // Save ids while resetting everything else.
394  $curIds = ‪$this->ids;
395  $this->‪reset();
396  $this->ids = $curIds;
397  // Set PM icon for root of mount:
398  $cmd = $this->bank . '_' . ($isOpen ? '0_' : '1_') . $uid . '_' . $this->treeName;
399 
400  $firstHtml = $this->‪PM_ATagWrap('', $cmd, '', $isOpen);
401  // Preparing rootRec for the mount
402  if ($uid) {
403  $rootRec = $this->‪getRecord($uid);
404  if (is_array($rootRec)) {
405  $firstHtml .= $this->‪getIcon($rootRec);
406  }
407 
408  if ($this->ext_showPathAboveMounts) {
409  $mountPointPid = $rootRec['pid'];
410  if ($lastMountPointPid !== $mountPointPid) {
411  ‪$title = $this->‪getMountPointPath((int)$mountPointPid);
412  $this->tree[] = ['isMountPointPath' => true, 'title' => ‪$title];
413  }
414  $lastMountPointPid = $mountPointPid;
415  }
416  } else {
417  // Artificial record for the tree root, id=0
418  $rootRec = $this->‪getRootRecord();
419  $firstHtml .= $this->‪getRootIcon($rootRec);
420  }
421  if (is_array($rootRec)) {
422  // In case it was swapped inside getRecord due to workspaces.
423  $uid = $rootRec['uid'];
424  // Add the root of the mount to ->tree
425  $this->tree[] = ['HTML' => $firstHtml, 'row' => $rootRec, 'hasSub' => $isOpen, 'bank' => ‪$this->bank];
426  // If the mount is expanded, go down:
427  if ($isOpen) {
428  $depthData = '<span class="treeline-icon treeline-icon-clear"></span>';
429  if ($this->addSelfId) {
430  $this->ids[] = $uid;
431  }
432  $this->‪getTree($uid, 999, $depthData);
433  }
434  // Add tree:
435  $treeArr = array_merge($treeArr, $this->tree);
436  }
437  }
438  return $this->‪printTree($treeArr);
439  }
440 
447  public function ‪printTree($treeArr = '')
448  {
449  $titleLen = (int)$this->BE_USER->uc['titleLen'];
450  if (!is_array($treeArr)) {
451  $treeArr = ‪$this->tree;
452  }
453  $out = '';
454  $closeDepth = [];
455  foreach ($treeArr as $treeItem) {
456  $classAttr = '';
457  if ($treeItem['isFirst']) {
458  $out .= '<ul class="list-tree">';
459  }
460 
461  // Add CSS classes to the list item
462  if ($treeItem['hasSub']) {
463  $classAttr .= ' list-tree-control-open';
464  }
465 
466  $idAttr = htmlspecialchars($this->domIdPrefix . $this->‪getId($treeItem['row']) . '_' . $treeItem['bank']);
467  $out .= '
468  <li id="' . $idAttr . '"' . ($classAttr ? ' class="' . trim($classAttr) . '"' : '') . '>
469  <span class="list-tree-group">
470  <span class="list-tree-icon">' . $treeItem['HTML'] . '</span>
471  <span class="list-tree-title">' . $this->‪wrapTitle($this->‪getTitleStr($treeItem['row'], $titleLen), $treeItem['row'], $treeItem['bank']) . '</span>
472  </span>';
473 
474  if (!$treeItem['hasSub']) {
475  $out .= '</li>';
476  }
477 
478  // We have to remember if this is the last one
479  // on level X so the last child on level X+1 closes the <ul>-tag
480  if ($treeItem['isLast']) {
481  $closeDepth[$treeItem['invertedDepth']] = 1;
482  }
483  // If this is the last one and does not have subitems, we need to close
484  // the tree as long as the upper levels have last items too
485  if ($treeItem['isLast'] && !$treeItem['hasSub']) {
486  for ($i = $treeItem['invertedDepth']; $closeDepth[$i] == 1; $i++) {
487  $closeDepth[$i] = 0;
488  $out .= '</ul></li>';
489  }
490  }
491  }
492  $out = '<ul class="list-tree list-tree-root list-tree-root-clean">' . $out . '</ul>';
493  return $out;
494  }
495 
496  /*******************************************
497  *
498  * rendering parts
499  *
500  *******************************************/
513  public function ‪PMicon($row, $a, $c, $nextCount, $isOpen)
514  {
515  if ($nextCount) {
516  $cmd = $this->bank . '_' . ($isOpen ? '0_' : '1_') . $row['uid'] . '_' . $this->treeName;
517  $bMark = $this->bank . '_' . $row['uid'];
518  return $this->‪PM_ATagWrap('', $cmd, $bMark, $isOpen);
519  }
520  return '';
521  }
522 
533  public function ‪PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false)
534  {
535  if ($this->thisScript) {
536  $anchor = $bMark ? '#' . $bMark : '';
537  $name = $bMark ? ' name="' . $bMark . '"' : '';
538  $aUrl = $this->‪getThisScript() . 'PM=' . $cmd . $anchor;
539  return '<a class="list-tree-control ' . ($isOpen ? 'list-tree-control-open' : 'list-tree-control-closed') . '" href="' . htmlspecialchars($aUrl) . '"' . $name . '><i class="fa"></i></a>';
540  }
541  return $icon;
542  }
543 
553  public function ‪wrapTitle(‪$title, $row, ‪$bank = 0)
554  {
555  $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->‪getJumpToParam($row)) . ',this,' . GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->‪getId($row)) . ',' . ‪$bank . ');';
556  return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . ‪$title . '</a>';
557  }
558 
567  public function ‪wrapIcon($icon, $row)
568  {
569  return $icon;
570  }
571 
579  public function ‪addTagAttributes($icon, $attr)
580  {
581  return preg_replace('/ ?\\/?>$/', '', $icon) . ' ' . $attr . ' />';
582  }
583 
592  public function ‪wrapStop($str, $row)
593  {
594  if ($row['php_tree_stop']) {
595  $str .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(['setTempDBmount' => $row['uid']])) . '" class="text-danger">+</a> ';
596  }
597  return $str;
598  }
599 
600  /*******************************************
601  *
602  * tree handling
603  *
604  *******************************************/
615  public function ‪expandNext($id)
616  {
617  return !empty($this->stored[$this->bank][$id]) || ‪$this->expandAll;
618  }
619 
625  public function ‪initializePositionSaving()
626  {
627  // Get stored tree structure:
628  $this->stored = unserialize($this->BE_USER->uc['browseTrees'][$this->treeName], ['allowed_classes' => false]);
629  // PM action
630  // (If an plus/minus icon has been clicked, the PM GET var is sent and we
631  // must update the stored positions in the tree):
632  // 0: mount key, 1: set/clear boolean, 2: item ID (cannot contain "_"), 3: treeName
633  $PM = explode('_', GeneralUtility::_GP('PM'));
634  if (count($PM) === 4 && $PM[3] == $this->treeName) {
635  if (isset($this->MOUNTS[$PM[0]])) {
636  // set
637  if ($PM[1]) {
638  $this->stored[$PM[0]][$PM[2]] = 1;
639  $this->‪savePosition();
640  } else {
641  unset($this->stored[$PM[0]][$PM[2]]);
642  $this->‪savePosition();
643  }
644  }
645  }
646  }
647 
654  public function ‪savePosition()
655  {
656  $this->BE_USER->uc['browseTrees'][‪$this->treeName] = serialize($this->stored);
657  $this->BE_USER->writeUC();
658  }
659 
660  /******************************
661  *
662  * Functions that might be overwritten by extended classes
663  *
664  ********************************/
671  public function ‪getRootIcon($rec)
672  {
673  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
674  return $this->‪wrapIcon($iconFactory->getIcon('apps-pagetree-root', ‪Icon::SIZE_SMALL)->render(), $rec);
675  }
676 
683  public function ‪getIcon($row)
684  {
685  if (is_int($row)) {
686  $row = ‪BackendUtility::getRecord($this->table, $row);
687  }
688  ‪$title = $this->showDefaultTitleAttribute ? htmlspecialchars('UID: ' . $row['uid']) : $this->‪getTitleAttrib($row);
689  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
690  $icon = $row['is_siteroot'] ? $iconFactory->getIcon('apps-pagetree-folder-root', ‪Icon::SIZE_SMALL) : $iconFactory->getIconForRecord($this->table, $row, ‪Icon::SIZE_SMALL);
691  $icon = '<span title="' . ‪$title . '">' . $icon->render() . '</span>';
692  return $this->‪wrapIcon($icon, $row);
693  }
694 
703  public function ‪getTitleStr($row, $titleLen = 30)
704  {
705  ‪$title = htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $titleLen));
706  ‪$title = trim($row['title']) === '' ? '<em>[' . htmlspecialchars($this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title')) . ']</em>' : ‪$title;
707  return ‪$title;
708  }
709 
717  public function ‪getTitleAttrib($row)
718  {
719  return htmlspecialchars($row['title']);
720  }
721 
728  public function ‪getId($row)
729  {
730  return $row['uid'];
731  }
732 
739  public function ‪getJumpToParam($row)
740  {
741  return $this->‪getId($row);
742  }
743 
744  /********************************
745  *
746  * tree data buidling
747  *
748  ********************************/
757  public function ‪getTree($uid, $depth = 999, $depthData = '')
758  {
759  // Buffer for id hierarchy is reset:
760  $this->buffer_idH = [];
761  // Init vars
762  $depth = (int)$depth;
763  $HTML = '';
764  $a = 0;
765  $res = $this->‪getDataInit($uid);
766  $c = $this->‪getDataCount($res);
767  $crazyRecursionLimiter = 9999;
768  $idH = [];
769  // Traverse the records:
770  while ($crazyRecursionLimiter > 0 && ($row = $this->‪getDataNext($res))) {
771  if (!$this->‪getBackendUser()->isInWebMount($this->table === 'pages' ? $row : $row['pid'])) {
772  // Current record is not within web mount => skip it
773  continue;
774  }
775 
776  $a++;
777  $crazyRecursionLimiter--;
778  $newID = $row['uid'];
779  if ($newID == 0) {
780  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. See http://forge.typo3.org/issues/16150 to get more information about a possible cause.', 1294586383);
781  }
782  // Reserve space.
783  $this->tree[] = [];
784  end($this->tree);
785  // Get the key for this space
786  $treeKey = key($this->tree);
787  // If records should be accumulated, do so
788  if ($this->setRecs) {
789  $this->recs[$row['uid']] = $row;
790  }
791  // Accumulate the id of the element in the internal arrays
792  $this->ids[] = ($idH[$row['uid']]['uid'] = $row['uid']);
793  $this->ids_hierarchy[$depth][] = $row['uid'];
794  $this->orig_ids_hierarchy[$depth][] = $row['_ORIG_uid'] ?: $row['uid'];
795 
796  // Make a recursive call to the next level
797  $nextLevelDepthData = $depthData . '<span class="treeline-icon treeline-icon-' . ($a === $c ? 'clear' : 'line') . '"></span>';
798  $hasSub = $this->‪expandNext($newID) && !$row['php_tree_stop'];
799  if ($depth > 1 && $hasSub) {
800  $nextCount = $this->‪getTree($newID, $depth - 1, $nextLevelDepthData);
801  if (!empty($this->buffer_idH)) {
802  $idH[$row['uid']]['subrow'] = ‪$this->buffer_idH;
803  }
804  // Set "did expand" flag
805  $isOpen = 1;
806  } else {
807  $nextCount = $this->‪getCount($newID);
808  // Clear "did expand" flag
809  $isOpen = 0;
810  }
811  // Set HTML-icons, if any:
812  if ($this->makeHTML) {
813  $HTML = $this->‪PMicon($row, $a, $c, $nextCount, $isOpen) . $this->‪wrapStop($this->‪getIcon($row), $row);
814  }
815  // Finally, add the row/HTML content to the ->tree array in the reserved key.
816  $this->tree[$treeKey] = [
817  'row' => $row,
818  'HTML' => $HTML,
819  'invertedDepth' => $depth,
820  'depthData' => $depthData,
821  'bank' => ‪$this->bank,
822  'hasSub' => $nextCount && $hasSub,
823  'isFirst' => $a === 1,
824  'isLast' => $a === $c,
825  ];
826  }
827 
828  $this->‪getDataFree($res);
829  $this->buffer_idH = $idH;
830  return $c;
831  }
832 
833  /********************************
834  *
835  * Data handling
836  * Works with records and arrays
837  *
838  ********************************/
846  public function ‪getCount($uid)
847  {
848  if (is_array($this->data)) {
849  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove the "if" along with $this->data and friends.
850  trigger_error('Handling array data in AbstractTreeView will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
851  $res = $this->‪getDataInit($uid);
852  return $this->‪getDataCount($res);
853  }
854  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
855  $queryBuilder->getRestrictions()
856  ->removeAll()
857  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
858  ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
859  $count = $queryBuilder
860  ->count('uid')
861  ->from($this->table)
862  ->where(
863  $queryBuilder->expr()->eq(
864  $this->parentField,
865  $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)
866  ),
868  )
869  ->execute()
870  ->fetchColumn();
871 
872  return (int)$count;
873  }
874 
880  public function ‪getRootRecord()
881  {
882  return ['title' => ‪$this->title, 'uid' => 0];
883  }
884 
893  public function ‪getRecord($uid)
894  {
895  if (is_array($this->data)) {
896  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove "if" with $this->data and friends.
897  return $this->dataLookup[$uid];
898  }
899  return ‪BackendUtility::getRecordWSOL($this->table, $uid);
900  }
901 
912  public function ‪getDataInit($parentId)
913  {
914  if (is_array($this->data)) {
915  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove "if" with $this->data and friends.
916  if (!is_array($this->dataLookup[$parentId][$this->subLevelID])) {
917  $parentId = -1;
918  } else {
919  ‪reset($this->dataLookup[$parentId][$this->subLevelID]);
920  }
921  return $parentId;
922  }
923  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
924  $queryBuilder->getRestrictions()
925  ->removeAll()
926  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
927  ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
928  $queryBuilder
929  ->select(...$this->fieldArray)
930  ->from($this->table)
931  ->where(
932  $queryBuilder->expr()->eq(
933  $this->parentField,
934  $queryBuilder->createNamedParameter($parentId, \PDO::PARAM_INT)
935  ),
937  );
938 
939  foreach (‪QueryHelper::parseOrderBy($this->orderByFields) as $orderPair) {
940  list($fieldName, $order) = $orderPair;
941  $queryBuilder->addOrderBy($fieldName, $order);
942  }
943 
944  return $queryBuilder->execute();
945  }
946 
955  public function ‪getDataCount(&$res)
956  {
957  if (is_array($this->data)) {
958  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove "if" with $this->data and friends.
959  return count($this->dataLookup[$res][$this->subLevelID]);
960  }
961  return $res->rowCount();
962  }
963 
973  public function ‪getDataNext(&$res)
974  {
975  if (is_array($this->data)) {
976  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove the "if" along with $this->data and friends.
977  if ($res < 0) {
978  $row = false;
979  } else {
980  $key = key($this->dataLookup[$res][$this->subLevelID]);
981  next($this->dataLookup[$res][$this->subLevelID]);
982  $row = $this->dataLookup[$res][‪$this->subLevelID][$key];
983  }
984  return $row;
985  }
986  while ($row = $res->fetch()) {
987  ‪BackendUtility::workspaceOL($this->table, $row, $this->BE_USER->workspace, true);
988  if (is_array($row)) {
989  break;
990  }
991  }
992  return $row;
993  }
994 
1001  public function ‪getDataFree(&$res)
1002  {
1003  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Remove "if" with $this->data and friends. Keep $res->closeCursor().
1004  if (!is_array($this->data)) {
1005  $res->closeCursor();
1006  }
1007  }
1008 
1021  public function ‪setDataFromArray(&$dataArr, $traverse = false, $pid = 0)
1022  {
1023  if (!$this->setDataFromArrayDeprecationThrown) {
1024  // Throw deprecation only once for this recursive method
1025  $this->setDataFromArrayDeprecationThrown = true;
1026  trigger_error('AbstractTreeView->setDataFromArray() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
1027  }
1028 
1029  if (!$traverse) {
1030  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0.
1031  $this->data = &$dataArr;
1032  $this->dataLookup = [];
1033  // Add root
1034  $this->dataLookup[0][‪$this->subLevelID] = &$dataArr;
1035  }
1036  foreach ($dataArr as $uid => $val) {
1037  $dataArr[$uid]['uid'] = $uid;
1038  $dataArr[$uid]['pid'] = $pid;
1039  // Gives quick access to id's
1040  $this->dataLookup[$uid] = &$dataArr[$uid];
1041  if (is_array($val[$this->subLevelID])) {
1042  $this->‪setDataFromArray($dataArr[$uid][$this->subLevelID], true, $uid);
1043  }
1044  }
1045  }
1046 
1054  public function ‪setDataFromTreeArray(&$treeArr, &$treeLookupArr)
1055  {
1056  trigger_error('AbstractTreeView->setDataFromTreeArray() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
1057  $this->data = &$treeArr;
1058  $this->dataLookup = &$treeLookupArr;
1059  }
1060 
1067  protected function ‪getMountPointPath(int $uid): string
1068  {
1069  if ($uid <= 0) {
1070  return '';
1071  }
1072  $rootline = array_reverse(‪BackendUtility::BEgetRootLine($uid));
1073  array_shift($rootline);
1074  $path = [];
1075  foreach ($rootline as $rootlineElement) {
1076  $record = ‪BackendUtility::getRecordWSOL('pages', $rootlineElement['uid'], 'title, nav_title', '', true, true);
1077  $text = $record['title'];
1078  if ((bool)($this->‪getBackendUser()->getTSConfig()['options.']['pageTree.']['showNavTitle'] ?? false)
1079  && trim($record['nav_title'] ?? '') !== ''
1080  ) {
1081  $text = $record['nav_title'];
1082  }
1083  $path[] = htmlspecialchars($text);
1084  }
1085  return '/' . implode('/', $path);
1086  }
1087 
1091  protected function ‪getLanguageService()
1092  {
1093  return ‪$GLOBALS['LANG'];
1094  }
1095 
1099  protected function ‪getBackendUser()
1100  {
1101  return ‪$GLOBALS['BE_USER'];
1102  }
1103 }
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:29
‪TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy
‪static array array[] parseOrderBy(string $input)
Definition: QueryHelper.php:42
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$parentField
‪string $parentField
Definition: AbstractTreeView.php:110
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$fieldArray
‪array $fieldArray
Definition: AbstractTreeView.php:134
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$setDataFromArrayDeprecationThrown
‪bool $setDataFromArrayDeprecationThrown
Definition: AbstractTreeView.php:250
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$dataLookup
‪bool $dataLookup
Definition: AbstractTreeView.php:224
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$clause
‪string $clause
Definition: AbstractTreeView.php:118
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getDataInit
‪mixed getDataInit($parentId)
Definition: AbstractTreeView.php:878
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$stored
‪array $stored
Definition: AbstractTreeView.php:235
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$ext_IconMode
‪bool $ext_IconMode
Definition: AbstractTreeView.php:59
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title
‪string $title
Definition: AbstractTreeView.php:73
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$treeName
‪string $treeName
Definition: AbstractTreeView.php:151
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\init
‪init($clause='', $orderByFields='')
Definition: AbstractTreeView.php:287
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$expandAll
‪bool $expandAll
Definition: AbstractTreeView.php:43
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\initializePositionSaving
‪initializePositionSaving()
Definition: AbstractTreeView.php:591
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$makeHTML
‪int $makeHTML
Definition: AbstractTreeView.php:166
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$ids
‪array $ids
Definition: AbstractTreeView.php:189
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$buffer_idH
‪array $buffer_idH
Definition: AbstractTreeView.php:204
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\PM_ATagWrap
‪string PM_ATagWrap($icon, $cmd, $bMark='', $isOpen=false)
Definition: AbstractTreeView.php:499
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$orig_ids_hierarchy
‪array $orig_ids_hierarchy
Definition: AbstractTreeView.php:199
‪TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction
Definition: BackendWorkspaceRestriction.php:28
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$subLevelID
‪string $subLevelID
Definition: AbstractTreeView.php:180
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$expandFirst
‪bool $expandFirst
Definition: AbstractTreeView.php:38
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:31
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\setDataFromTreeArray
‪setDataFromTreeArray(&$treeArr, &$treeLookupArr)
Definition: AbstractTreeView.php:1020
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getMountPointPath
‪string getMountPointPath(int $uid)
Definition: AbstractTreeView.php:1033
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$table
‪string $table
Definition: AbstractTreeView.php:104
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getDataFree
‪getDataFree(&$res)
Definition: AbstractTreeView.php:967
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$showDefaultTitleAttribute
‪bool $showDefaultTitleAttribute
Definition: AbstractTreeView.php:80
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\savePosition
‪savePosition()
Definition: AbstractTreeView.php:620
‪TYPO3\CMS\Backend\Utility\BackendUtility\BEgetRootLine
‪static array BEgetRootLine($uid, $clause='', $workspaceOL=false, array $additionalFields=[])
Definition: BackendUtility.php:374
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\expandNext
‪bool expandNext($id)
Definition: AbstractTreeView.php:581
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBrowsableTree
‪string getBrowsableTree()
Definition: AbstractTreeView.php:347
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getId
‪int getId($row)
Definition: AbstractTreeView.php:694
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$ext_showPathAboveMounts
‪bool $ext_showPathAboveMounts
Definition: AbstractTreeView.php:63
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getRootRecord
‪array getRootRecord()
Definition: AbstractTreeView.php:846
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getDataCount
‪int getDataCount(&$res)
Definition: AbstractTreeView.php:921
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\reset
‪reset()
Definition: AbstractTreeView.php:327
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$tree
‪array $tree
Definition: AbstractTreeView.php:230
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$specUIDmap
‪array $specUIDmap
Definition: AbstractTreeView.php:210
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\__construct
‪__construct()
Definition: AbstractTreeView.php:255
‪TYPO3\CMS\Core\Database\Query\QueryHelper
Definition: QueryHelper.php:30
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTitleAttrib
‪string getTitleAttrib($row)
Definition: AbstractTreeView.php:683
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getRootIcon
‪string getRootIcon($rec)
Definition: AbstractTreeView.php:637
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:35
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$orderByFields
‪string $orderByFields
Definition: AbstractTreeView.php:126
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$data
‪bool $data
Definition: AbstractTreeView.php:217
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\wrapStop
‪string wrapStop($str, $row)
Definition: AbstractTreeView.php:558
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\addTagAttributes
‪string addTagAttributes($icon, $attr)
Definition: AbstractTreeView.php:545
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: AbstractTreeView.php:1065
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$bank
‪int $bank
Definition: AbstractTreeView.php:240
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:45
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\wrapIcon
‪string wrapIcon($icon, $row)
Definition: AbstractTreeView.php:533
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\setDataFromArray
‪setDataFromArray(&$dataArr, $traverse=false, $pid=0)
Definition: AbstractTreeView.php:987
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\addField
‪addField($field, $noCheck=false)
Definition: AbstractTreeView.php:317
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getJumpToParam
‪string getJumpToParam($row)
Definition: AbstractTreeView.php:705
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$recs
‪array $recs
Definition: AbstractTreeView.php:245
‪TYPO3\CMS\Backend\Tree\View
Definition: AbstractTreeView.php:2
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecordWSOL
‪static array getRecordWSOL( $table, $uid, $fields=' *', $where='', $useDeleteClause=true, $unsetMovePointers=false)
Definition: BackendUtility.php:174
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecord
‪static array null getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)
Definition: BackendUtility.php:130
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getLanguageService
‪LanguageService getLanguageService()
Definition: AbstractTreeView.php:1057
‪TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix
‪static string stripLogicalOperatorPrefix(string $constraint)
Definition: QueryHelper.php:163
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getIcon
‪string getIcon($row)
Definition: AbstractTreeView.php:649
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\determineScriptUrl
‪determineScriptUrl()
Definition: AbstractTreeView.php:263
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Backend\Utility\BackendUtility\workspaceOL
‪static workspaceOL($table, &$row, $wsid=-99, $unsetMovePointers=false)
Definition: BackendUtility.php:4048
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTree
‪int getTree($uid, $depth=999, $depthData='')
Definition: AbstractTreeView.php:723
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:26
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getRecord
‪array getRecord($uid)
Definition: AbstractTreeView.php:859
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$addSelfId
‪int $addSelfId
Definition: AbstractTreeView.php:68
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$MOUNTS
‪array null $MOUNTS
Definition: AbstractTreeView.php:97
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$domIdPrefix
‪string $domIdPrefix
Definition: AbstractTreeView.php:160
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getThisScript
‪string getThisScript()
Definition: AbstractTreeView.php:276
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:44
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$setRecs
‪int $setRecs
Definition: AbstractTreeView.php:172
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\PMicon
‪string PMicon($row, $a, $c, $nextCount, $isOpen)
Definition: AbstractTreeView.php:479
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTitleStr
‪string getTitleStr($row, $titleLen=30)
Definition: AbstractTreeView.php:669
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$ids_hierarchy
‪array $ids_hierarchy
Definition: AbstractTreeView.php:194
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$titleAttrib
‪string $titleAttrib
Definition: AbstractTreeView.php:53
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView
Definition: AbstractTreeView.php:33
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$defaultList
‪array $defaultList
Definition: AbstractTreeView.php:141
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$BE_USER
‪TYPO3 CMS Core Authentication BackendUserAuthentication $BE_USER
Definition: AbstractTreeView.php:87
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\wrapTitle
‪string wrapTitle($title, $row, $bank=0)
Definition: AbstractTreeView.php:519
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\printTree
‪string printTree($treeArr='')
Definition: AbstractTreeView.php:413
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getCount
‪int getCount($uid)
Definition: AbstractTreeView.php:812
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getDataNext
‪array bool getDataNext(&$res)
Definition: AbstractTreeView.php:939
‪TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$thisScript
‪string $thisScript
Definition: AbstractTreeView.php:48