TYPO3  7.6
ExportPageTreeView.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Impexp\View;
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 
22 
27 {
31  public function __construct()
32  {
33  parent::__construct();
34  $this->init();
35  }
36 
44  public function wrapTitle($title, $v)
45  {
46  return trim($title) === '' ? '<em>[' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', true) . ']</em>' : htmlspecialchars($title);
47  }
48 
58  public function PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false)
59  {
60  return $icon;
61  }
62 
70  public function wrapIcon($icon, $row)
71  {
72  return $icon;
73  }
74 
82  public function ext_tree($pid, $clause = '')
83  {
84  // Initialize:
85  $this->init(' AND ' . $this->BE_USER->getPagePermsClause(1) . $clause);
86  // Get stored tree structure:
87  $this->stored = unserialize($this->BE_USER->uc['browseTrees']['browsePages']);
88  $treeArr = array();
89  $idx = 0;
90  // Set first:
91  $this->bank = $idx;
92  $isOpen = $this->stored[$idx][$pid] || $this->expandFirst;
93  // save ids
94  $curIds = $this->ids;
95  $this->reset();
96  $this->ids = $curIds;
97  if ($pid > 0) {
98  $rootRec = BackendUtility::getRecordWSOL('pages', $pid);
99  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
100  $firstHtml = $iconFactory->getIconForRecord('pages', $rootRec, Icon::SIZE_SMALL)->render();
101  } else {
102  $rootRec = array(
103  'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
104  'uid' => 0
105  );
106  $firstHtml = $this->getRootIcon($rootRec);
107  }
108  $this->tree[] = array('HTML' => $firstHtml, 'row' => $rootRec, 'hasSub' => $isOpen);
109  if ($isOpen) {
110  // Set depth:
111  if ($this->addSelfId) {
112  $this->ids[] = $pid;
113  }
114  $this->getTree($pid, 999, '');
115  $idH = array();
116  $idH[$pid]['uid'] = $pid;
117  if (!empty($this->buffer_idH)) {
118  $idH[$pid]['subrow'] = $this->buffer_idH;
119  }
120  $this->buffer_idH = $idH;
121  }
122  // Add tree:
123  return array_merge($treeArr, $this->tree);
124  }
125 }