TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
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 
20 
25 {
29  public $fieldArray = [
30  'uid',
31  'pid',
32  'title',
33  'doktype',
34  'nav_title',
35  'mount_pid',
36  'php_tree_stop',
37  't3ver_id',
38  't3ver_state',
39  'hidden',
40  'starttime',
41  'endtime',
42  'fe_group',
43  'module',
44  'extendToSubpages',
45  'nav_hide',
46  't3ver_wsid',
47  't3ver_move_id',
48  'is_siteroot'
49  ];
50 
55  public $treeName = 'browsePages';
56 
61  public $table = 'pages';
62 
67  public $domIdPrefix = 'pages';
68 
72  public $ext_showNavTitle = false;
73 
82  public function init($clause = '', $orderByFields = '')
83  {
84  // This will hide records from display - it has nothing to do with user rights!!
85  $clauseExcludePidList = '';
86  if ($pidList = $this->getBackendUser()->getTSConfigVal('options.hideRecords.pages')) {
87  if ($pidList = implode(',', GeneralUtility::intExplode(',', $pidList))) {
88  $clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
89  }
90  }
91  // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
92  parent::init(' AND ' . $this->getBackendUser()->getPagePermsClause(1) . ' ' . $clause . $clauseExcludePidList, 'sorting');
93  $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
94  $this->MOUNTS = $this->getBackendUser()->returnWebmounts();
95  if ($pidList) {
96  // Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
97  $hideList = explode(',', $pidList);
98  $this->MOUNTS = array_diff($this->MOUNTS, $hideList);
99  }
100  }
101 
109  public function getTitleAttrib($row)
110  {
111  return BackendUtility::titleAttribForPages($row, '1=1 ' . $this->clause, 0);
112  }
113 
122  public function wrapIcon($icon, $row)
123  {
124  // Wrap icon in click-menu link.
125  $theIcon = '';
126  if (!$this->ext_IconMode) {
127  $theIcon = BackendUtility::wrapClickMenuOnIcon($icon, $this->treeName, $this->getId($row), 0);
128  } elseif ($this->ext_IconMode === 'titlelink') {
129  $aOnClick = 'return jumpTo(' . GeneralUtility::quoteJSvalue($this->getJumpToParam($row)) . ',this,'
130  . GeneralUtility::quoteJSvalue($this->domIdPrefix . $this->getId($row)) . ',' . $this->bank . ');';
131  $theIcon = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
132  }
133  return $theIcon;
134  }
135 
144  public function getTitleStr($row, $titleLen = 30)
145  {
146  if ($this->ext_showNavTitle && isset($row['nav_title']) && trim($row['nav_title']) !== '') {
147  $title = parent::getTitleStr(['title' => $row['nav_title']], $titleLen);
148  } else {
149  $title = parent::getTitleStr($row, $titleLen);
150  }
151  if (!empty($row['is_siteroot']) && $this->getBackendUser()->getTSConfigVal('options.pageTree.showDomainNameWithTitle')) {
152  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_domain');
153  $row = $queryBuilder
154  ->select('domainName', 'sorting')
155  ->from('sys_domain')
156  ->where(
157  $queryBuilder->expr()->eq(
158  'pid',
159  $queryBuilder->createNamedParameter($row['uid'], \PDO::PARAM_INT)
160  )
161  )
162  ->orderBy('sorting')
163  ->setMaxResults(1)
164  ->execute()
165  ->fetch();
166 
167  if ($row !== false) {
168  $title = sprintf('%s [%s]', $title, htmlspecialchars($row['domainName']));
169  }
170  }
171  return $title;
172  }
173 }
static titleAttribForPages($row, $perms_clause= '', $includeAttrib=true)
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)
init($clause= '', $orderByFields= '')
static wrapClickMenuOnIcon($content, $table, $uid=0, $listFrame=true, $addParams= '', $enDisItems= '', $returnTagParameters=false)
static intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)