68 public function __construct(
$nodeLimit = NULL) {
74 $this->showRootlineAboveMounts =
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.pageTree.showPathAboveMounts');
77 $hookElements =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php'][
'postProcessCollections'];
78 if (is_array($hookElements)) {
79 foreach ($hookElements as $classRef) {
83 $this->processCollectionHookObjects[] = $hookObject;
98 $node->setExpanded(TRUE);
114 return $nodeCollection;
116 $isVirtualRootNode = FALSE;
120 if ((
int)$node->getId() === 0) {
122 if (!(
int)
$GLOBALS[
'BE_USER']->uc[
'pageTree_temporaryMountPoint']) {
123 $mountPoints = array_map(
'intval',
$GLOBALS[
'BE_USER']->returnWebmounts());
124 $mountPoints = array_unique($mountPoints);
125 if (!in_array(0, $mountPoints)) {
128 $isVirtualRootNode = TRUE;
130 foreach ($mountPoints as $webMountPoint) {
132 'uid' => $webMountPoint,
133 'isMountPoint' => TRUE
139 if (is_array($subpages) && count($subpages) > 0) {
140 foreach ($subpages as $subpage) {
141 if (in_array($subpage[
'uid'], $this->hiddenRecords)) {
146 $isMountPoint = $subpage[
'isMountPoint'] === TRUE;
147 if ($isVirtualRootNode) {
148 $mountPoint = (int)$subpage[
'uid'];
154 $subNode = Commands::getNewNode($subpage, $mountPoint);
155 $subNode->setIsMountPoint($isMountPoint);
156 if ($isMountPoint && $this->showRootlineAboveMounts) {
158 $subNode->setReadableRootline($rootline);
160 if ($this->nodeCounter < $this->nodeLimit) {
161 $childNodes = $this->
getNodes($subNode, $mountPoint, $level + 1);
162 $subNode->setChildNodes($childNodes);
163 $this->nodeCounter += $childNodes->count();
167 $nodeCollection->append($subNode);
170 foreach ($this->processCollectionHookObjects as $hookObject) {
172 $hookObject->postProcessGetNodes($node, $mountPoint, $level, $nodeCollection);
174 return $nodeCollection;
196 public function getFilteredNodes(\
TYPO3\CMS\Backend\Tree\
TreeNode $node, $searchFilter, $mountPoint = 0) {
200 if (!is_array($records) || !count($records)) {
201 return $nodeCollection;
202 } elseif (count($records) > 500) {
203 return $nodeCollection;
206 $mountPoints = (int)
$GLOBALS[
'BE_USER']->uc[
'pageTree_temporaryMountPoint'];
208 $mountPoints = array_map(
'intval',
$GLOBALS[
'BE_USER']->returnWebmounts());
209 $mountPoints = array_unique($mountPoints);
211 $mountPoints = array($mountPoints);
213 $isNumericSearchFilter = is_numeric($searchFilter) && $searchFilter > 0;
214 $searchFilterQuoted = preg_quote($searchFilter,
'/');
215 $nodeId = (int)$node->getId();
216 $processedRecordIds = array();
217 foreach ($records as $record) {
218 if ((
int)$record[
't3ver_wsid'] !== (
int)
$GLOBALS[
'BE_USER']->workspace && (
int)$record[
't3ver_wsid'] !== 0) {
222 if ($liveVersion !== NULL) {
223 $record = $liveVersion;
227 if ((
int)$record[
'pid'] === -1
228 || in_array($record[
'uid'], $this->hiddenRecords)
229 || in_array($record[
'uid'], $processedRecordIds)
233 $processedRecordIds[] = $record[
'uid'];
236 $rootline = array_reverse($rootline);
237 if (!in_array(0, $mountPoints, TRUE)) {
238 $isInsideMountPoints = FALSE;
239 foreach ($rootline as $rootlineElement) {
240 if (in_array((
int)$rootlineElement[
'uid'], $mountPoints, TRUE)) {
241 $isInsideMountPoints = TRUE;
245 if (!$isInsideMountPoints) {
249 $reference = $nodeCollection;
250 $inFilteredRootline = FALSE;
251 $amountOfRootlineElements = count($rootline);
252 for ($i = 0; $i < $amountOfRootlineElements; ++$i) {
253 $rootlineElement = $rootline[$i];
254 $rootlineElement[
'uid'] = (int)$rootlineElement[
'uid'];
255 $isInWebMount = (int)
$GLOBALS[
'BE_USER']->isInWebMount($rootlineElement[
'uid']);
257 || ($rootlineElement[
'uid'] === (
int)$mountPoints[0]
258 && $rootlineElement[
'uid'] !== $isInWebMount)
262 if ((
int)$rootlineElement[
'pid'] === $nodeId
263 || $rootlineElement[
'uid'] === $nodeId
264 || ($rootlineElement[
'uid'] === $isInWebMount
265 && in_array($rootlineElement[
'uid'], $mountPoints, TRUE))
267 $inFilteredRootline = TRUE;
269 if (!$inFilteredRootline || $rootlineElement[
'uid'] === $mountPoint) {
273 $ident = (int)$rootlineElement[
'sorting'] . (
int)$rootlineElement[
'uid'];
274 if ($reference && $reference->offsetExists($ident)) {
276 $refNode = $reference->offsetGet($ident);
277 $refNode->setExpanded(TRUE);
278 $refNode->setLeaf(FALSE);
279 $reference = $refNode->getChildNodes();
280 if ($reference == NULL) {
282 $refNode->setChildNodes($reference);
285 $refNode = Commands::getNewNode($rootlineElement, $mountPoint);
286 $replacement =
'<span class="typo3-pagetree-filteringTree-highlight">$1</span>';
287 if ($isNumericSearchFilter && (
int)$rootlineElement[
'uid'] === (
int)$searchFilter) {
288 $text = str_replace(
'$1', $refNode->getText(), $replacement);
290 $text = preg_replace(
'/(' . $searchFilterQuoted .
')/i', $replacement, $refNode->getText());
292 $refNode->setText($text, $refNode->getTextSourceField(), $refNode->getPrefix(), $refNode->getSuffix());
295 if ($i + 1 >= $amountOfRootlineElements) {
296 $childNodes = $this->
getNodes($refNode, $mountPoint);
297 foreach ($childNodes as $childNode) {
299 $childRecord = $childNode->getRecord();
300 $childIdent = (int)$childRecord[
'sorting'] . (
int)$childRecord[
'uid'];
301 $childCollection->offsetSet($childIdent, $childNode);
303 $refNode->setChildNodes($childNodes);
305 $refNode->setChildNodes($childCollection);
306 $reference->offsetSet($ident, $refNode);
308 $reference = $childCollection;
312 foreach ($this->processCollectionHookObjects as $hookObject) {
314 $hookObject->postProcessFilteredNodes($node, $searchFilter, $mountPoint, $nodeCollection);
316 return $nodeCollection;
327 public function getTreeMounts($searchFilter =
'') {
330 $isTemporaryMountPoint = FALSE;
331 $rootNodeIsVirtual = FALSE;
332 $mountPoints = (int)
$GLOBALS[
'BE_USER']->uc[
'pageTree_temporaryMountPoint'];
334 $mountPoints = array_map(
'intval',
$GLOBALS[
'BE_USER']->returnWebmounts());
335 $mountPoints = array_unique($mountPoints);
336 if (!in_array(0, $mountPoints)) {
337 $rootNodeIsVirtual = TRUE;
341 $mountPoints = array(0);
344 $isTemporaryMountPoint = TRUE;
345 $mountPoints = array($mountPoints);
347 if (!count($mountPoints)) {
348 return $nodeCollection;
351 foreach ($mountPoints as $mountPoint) {
352 if ($mountPoint === 0) {
354 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] !==
'') {
355 $sitename =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'];
361 $subNode = Commands::getNewNode($record);
362 $subNode->setLabelIsEditable(FALSE);
363 if ($rootNodeIsVirtual) {
364 $subNode->setType(
'virtual_root');
365 $subNode->setIsDropTarget(FALSE);
367 $subNode->setType(
'pages_root');
368 $subNode->setIsDropTarget(TRUE);
371 if (in_array($mountPoint, $this->hiddenRecords)) {
378 $subNode = Commands::getNewNode($record, $mountPoint);
379 if ($this->showRootlineAboveMounts && !$isTemporaryMountPoint) {
381 $subNode->setReadableRootline($rootline);
384 if (count($mountPoints) <= 1) {
385 $subNode->setExpanded(TRUE);
386 $subNode->setCls(
'typo3-pagetree-node-notExpandable');
388 $subNode->setIsMountPoint(TRUE);
389 $subNode->setDraggable(FALSE);
390 if ($searchFilter ===
'') {
391 $childNodes = $this->
getNodes($subNode, $mountPoint);
393 $childNodes = $this->getFilteredNodes($subNode, $searchFilter, $mountPoint);
394 $subNode->setExpanded(TRUE);
396 $subNode->setChildNodes($childNodes);
397 $nodeCollection->append($subNode);
399 foreach ($this->processCollectionHookObjects as $hookObject) {
401 $hookObject->postProcessGetTreeMounts($searchFilter, $nodeCollection);
403 return $nodeCollection;
415 if (is_numeric($id) && $id >= 0) {
416 $where .=
' AND pid= ' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr((
int)$id,
'pages');
419 $excludedDoktypes =
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.pageTree.excludeDoktypes');
420 if (!empty($excludedDoktypes)) {
422 $where .=
' AND doktype NOT IN (' . implode(
',', $excludedDoktypes) .
')';
425 if ($searchFilter !==
'') {
426 if (is_numeric($searchFilter) && $searchFilter > 0) {
427 $searchWhere .=
'uid = ' . (int)$searchFilter .
' OR ';
429 $searchFilter =
$GLOBALS[
'TYPO3_DB']->fullQuoteStr(
'%' . $searchFilter .
'%',
'pages');
430 $useNavTitle =
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.pageTree.showNavTitle');
431 $useAlias =
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.pageTree.searchInAlias');
433 $searchWhereAlias =
'';
435 $searchWhereAlias =
' OR alias LIKE ' . $searchFilter;
439 $searchWhere .=
'(nav_title LIKE ' . $searchFilter .
440 ' OR (nav_title = "" AND title LIKE ' . $searchFilter .
')' . $searchWhereAlias .
')';
442 $searchWhere .=
'title LIKE ' . $searchFilter . $searchWhereAlias;
445 $where .=
' AND (' . $searchWhere .
')';
459 return $GLOBALS[
'TYPO3_DB']->exec_SELECTgetRows(
'uid,t3ver_wsid',
'pages', $where,
'',
'sorting',
'',
'uid');
470 $subpage =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetSingleRow(
'uid',
'pages', $where,
'',
'sorting',
'',
'uid');
472 if (!$subpage[
'uid']) {
473 $returnValue = FALSE;
static getRecordWSOL($table, $uid, $fields=' *', $where='', $useDeleteClause=TRUE, $unsetMovePointers=FALSE)
getNodes(\TYPO3\CMS\Backend\Tree\TreeNode $node)
static BEgetRootLine($uid, $clause='', $workspaceOL=FALSE)
getWhereClause($id, $searchFilter='')
static intExplode($delimiter, $string, $removeEmptyValues=FALSE, $limit=0)
getSubpages($id, $searchFilter='')
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
$processCollectionHookObjects
static getMountPointPath($uid=-1)
static versioningPlaceholderClause($table)
static getNodeRecord($nodeId, $unsetMovePointers=TRUE)
static getLiveVersionOfRecord($table, $uid, $fields=' *')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
getRecordWithWorkspaceOverlay($uid, $unsetMovePointers=FALSE)
static deleteClause($table, $tableAlias='')