TYPO3  7.6
BrowseTreeView.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tree\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 
18 
23 {
27  public $fieldArray = array(
28  'uid',
29  'pid',
30  'title',
31  'doktype',
32  'nav_title',
33  'mount_pid',
34  'php_tree_stop',
35  't3ver_id',
36  't3ver_state',
37  'hidden',
38  'starttime',
39  'endtime',
40  'fe_group',
41  'module',
42  'extendToSubpages',
43  'nav_hide',
44  't3ver_wsid',
45  't3ver_move_id',
46  'is_siteroot'
47  );
48 
53  public $treeName = 'browsePages';
54 
59  public $table = 'pages';
60 
65  public $domIdPrefix = 'pages';
66 
75  public function init($clause = '', $orderByFields = '')
76  {
77  // This will hide records from display - it has nothing todo with user rights!!
78  $clauseExcludePidList = '';
79  if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
80  if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) {
81  $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
82  }
83  }
84  // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
85  parent::init(' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' ' . $clause . $clauseExcludePidList, 'sorting');
86  $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
87  $this->MOUNTS = $GLOBALS['BE_USER']->returnWebmounts();
88  if ($pidList) {
89  // Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
90  $hideList = explode(',', $pidList);
91  $this->MOUNTS = array_diff($this->MOUNTS, $hideList);
92  }
93  }
94 
102  public function getTitleAttrib($row)
103  {
104  return BackendUtility::titleAttribForPages($row, '1=1 ' . $this->clause, 0);
105  }
106 
115  public function wrapIcon($icon, $row)
116  {
117  // Wrap icon in click-menu link.
118  $theIcon = '';
119  if (!$this->ext_IconMode) {
120  $theIcon = BackendUtility::wrapClickMenuOnIcon($icon, $this->treeName, $this->getId($row), 0);
121  } elseif ($this->ext_IconMode === 'titlelink') {
122  $aOnClick = 'return jumpTo(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getJumpToParam($row)) . ',this,' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->getId($row)) . ',' . $this->bank . ');';
123  $theIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
124  }
125  return $theIcon;
126  }
127 
136  public function getTitleStr($row, $titleLen = 30)
137  {
138  $title = parent::getTitleStr($row, $titleLen);
139  if (isset($row['is_siteroot']) && $row['is_siteroot'] != 0 && $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle')) {
140  $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('domainName,sorting', 'sys_domain', 'pid=' . $GLOBALS['TYPO3_DB']->quoteStr(($row['uid'] . BackendUtility::deleteClause('sys_domain') . BackendUtility::BEenableFields('sys_domain')), 'sys_domain'), '', 'sorting', 1);
141  if (is_array($rows) && !empty($rows)) {
142  $title = sprintf('%s [%s]', $title, htmlspecialchars($rows[0]['domainName']));
143  }
144  }
145  return $title;
146  }
147 }