2 namespace TYPO3\CMS\Impexp
;
4 /***************************************************************
7 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
30 * Extension of the page tree class. Used to get the tree of pages to export.
32 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 class LocalPageTree
extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView
{
39 * @todo Define visibility
41 public function __construct() {
46 * Wrapping title from page tree.
48 * @param string $title Title to wrap
49 * @param mixed $v (See parent class)
50 * @return string Wrapped title
51 * @todo Define visibility
53 public function wrapTitle($title, $v) {
54 $title = !strcmp(trim($title), '') ?
'<em>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title', 1) . ']</em>' : htmlspecialchars($title);
59 * Wrapping Plus/Minus icon
61 * @param string $icon Icon HTML
62 * @param mixed $cmd (See parent class)
63 * @param mixed $bMark (See parent class)
64 * @return string Icon HTML
65 * @todo Define visibility
67 public function PM_ATagWrap($icon, $cmd, $bMark = '') {
74 * @param string $icon Icon HTML
75 * @param array $row Record row (page)
76 * @return string Icon HTML
77 * @todo Define visibility
79 public function wrapIcon($icon, $row) {
86 * @return string SQL where clause
87 * @todo Define visibility
89 public function permsC() {
90 return $this->BE_USER
->getPagePermsClause(1);
96 * @param integer $pid PID value
97 * @param string $clause Additional where clause
98 * @return array Array of tree elements
99 * @todo Define visibility
101 public function ext_tree($pid, $clause = '') {
103 $this->init(' AND ' . $this->permsC() . $clause);
104 // Get stored tree structure:
105 $this->stored
= unserialize($this->BE_USER
->uc
['browseTrees']['browsePages']);
107 $PM = \TYPO3\CMS\Core\Utility\GeneralUtility
::intExplode('_', \TYPO3\CMS\Core\Utility\GeneralUtility
::_GP('PM'));
109 $titleLen = intval($this->BE_USER
->uc
['titleLen']);
114 $isOpen = $this->stored
[$idx][$pid] ||
$this->expandFirst
;
116 $curIds = $this->ids
;
118 $this->ids
= $curIds;
120 $cmd = $this->bank
. '_' . ($isOpen ?
'0_' : '1_') . $pid;
121 $icon = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility
::skinImg($this->backPath
, ('gfx/ol/' . ($isOpen ?
'minus' : 'plus') . 'only.gif'), 'width="18" height="16"') . ' align="top" alt="" />';
122 $firstHtml = $this->PM_ATagWrap($icon, $cmd);
124 $rootRec = \t3lib_befunc
::getRecordWSOL('pages', $pid);
125 $firstHtml .= $this->wrapIcon(\TYPO3\CMS\Backend\Utility\IconUtility
::getSpriteIconForRecord('pages', $rootRec), $rootRec);
128 'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
131 $firstHtml .= $this->wrapIcon('<img' . \TYPO3\CMS\Backend\Utility\IconUtility
::skinImg($this->backPath
, 'gfx/i/_icon_website.gif', 'width="18" height="16"') . ' align="top" alt="" />', $rootRec);
133 $this->tree
[] = array('HTML' => $firstHtml, 'row' => $rootRec);
136 $depthD = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility
::skinImg($this->backPath
, 'gfx/ol/blank.gif', 'width="18" height="16"') . ' align="top" alt="" />';
137 if ($this->addSelfId
) {
140 $this->getTree($pid, 999, $depthD);
142 $idH[$pid]['uid'] = $pid;
143 if (count($this->buffer_idH
)) {
144 $idH[$pid]['subrow'] = $this->buffer_idH
;
146 $this->buffer_idH
= $idH;
149 $treeArr = array_merge($treeArr, $this->tree
);