TYPO3  7.6
ElementBrowserFolderTreeView.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 
30 {
34  public $ext_IconMode = 1;
35 
40 
47  {
48  $this->linkParameterProvider = $linkParameterProvider;
49  $this->thisScript = $linkParameterProvider->getScriptUrl();
50  }
51 
60  public function wrapTitle($title, $folderObject, $bank = 0)
61  {
62  if ($this->ext_isLinkable($folderObject)) {
63  $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['identifier' => $folderObject->getCombinedIdentifier()]));
64  return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&'))) . ');">' . $title . '</a>';
65  } else {
66  return '<span class="text-muted">' . $title . '</span>';
67  }
68  }
69 
76  public function ext_isLinkable(Folder $folderObject)
77  {
78  $identifier = $folderObject->getIdentifier();
79  return !$this->ext_noTempRecyclerDirs || substr($identifier, -7) !== '_temp_/' && substr($identifier, -11) !== '_recycler_/';
80  }
81 
87  protected function renderPMIconAndLink($cmd, $isOpen)
88  {
89  if (get_class($this) === __CLASS__) {
90  return $this->PMiconATagWrap('', $cmd, !$isOpen);
91  }
92  return parent::renderPMIconAndLink($cmd, $isOpen);
93  }
94 
105  public function PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false)
106  {
107  $anchor = $bMark ? '#' . $bMark : '';
108  $name = $bMark ? ' name=' . $bMark : '';
109  $urlParameters = $this->linkParameterProvider->getUrlParameters([]);
110  $urlParameters['PM'] = $cmd;
111  $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParameters), '&')) . ',' . GeneralUtility::quoteJSvalue($anchor) . ');';
112  return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
113  }
114 
124  public function PMiconATagWrap($icon, $cmd, $isExpand = true)
125  {
126  if (empty($this->scope)) {
127  $this->scope = array(
128  'class' => get_class($this),
129  'script' => $this->thisScript,
130  'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs,
131  'browser' => $this->linkParameterProvider->getUrlParameters([]),
132  );
133  }
134 
135  return parent::PMiconATagWrap($icon, $cmd, $isExpand);
136  }
137 }