[!!!][TASK] Move non-namespaced classes into correct places
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Classes / Tree / View / ElementBrowserFolderTreeView.php
1 <?php
2 namespace TYPO3\CMS\Recordlist\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
17 /**
18 * Extension class for the TBE file browser
19 */
20 class ElementBrowserFolderTreeView extends \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView {
21
22 /**
23 * If file-drag mode is set, temp and recycler folders are filtered out.
24 *
25 * @var int
26 */
27 public $ext_noTempRecyclerDirs = 0;
28
29 /**
30 * Returns TRUE if the input "record" contains a folder which can be linked.
31 *
32 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject object with information about the folder element. Contains keys like title, uid, path, _title
33 *
34 * @return bool TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
35 */
36 public function ext_isLinkable($folderObject) {
37 if ($this->ext_noTempRecyclerDirs && (substr($folderObject->getIdentifier(), -7) == '_temp_/' || substr($folderObject->getIdentifier(), -11) == '_recycler_/')) {
38 return FALSE;
39 } else {
40 return TRUE;
41 }
42 }
43
44 /**
45 * Wrapping the title in a link, if applicable.
46 *
47 * @param string $title Title, ready for output.
48 * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folderObject 'record'
49 *
50 * @return string Wrapping title string.
51 */
52 public function wrapTitle($title, $folderObject) {
53 if ($this->ext_isLinkable($folderObject)) {
54 $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
55
56 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
57 } else {
58 return '<span class="typo3-dimmed">' . $title . '</span>';
59 }
60 }
61 }