[TASK] Re-work/simplify copyright header in PHP files - Part 8
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Classes / ExtDirect / PagetreeCollectionsProcessor.php
1 <?php
2 namespace TYPO3\CMS\Workspaces\ExtDirect;
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 * Interface for classes which perform pre or post processing
18 *
19 * @author Tolleiv Nietsch <typo3@tolleiv.de>
20 */
21 class PagetreeCollectionsProcessor implements \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface {
22
23 /**
24 * @abstract
25 * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node
26 * @param integer $mountPoint
27 * @param integer $level
28 * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection
29 * @return void
30 */
31 public function postProcessGetNodes($node, $mountPoint, $level, $nodeCollection) {
32 foreach ($nodeCollection as $node) {
33 /** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */
34 $this->highlightVersionizedElements($node);
35 }
36 }
37
38 /**
39 * @abstract
40 * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node
41 * @param string $searchFilter
42 * @param integer $mountPoint
43 * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection
44 * @return void
45 */
46 public function postProcessFilteredNodes($node, $searchFilter, $mountPoint, $nodeCollection) {
47 foreach ($nodeCollection as $node) {
48 /** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */
49 $this->highlightVersionizedElements($node);
50 }
51 }
52
53 /**
54 * @abstract
55 * @param string $searchFilter
56 * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection
57 * @return void
58 */
59 public function postProcessGetTreeMounts($searchFilter, $nodeCollection) {
60 foreach ($nodeCollection as $node) {
61 /** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */
62 $this->highlightVersionizedElements($node);
63 }
64 }
65
66 /**
67 * Sets the CSS Class on all pages which have versioned records
68 * in the current workspace
69 *
70 * @param \TYPO3\CMS\Backend\Tree\TreeNode $node
71 * @return void
72 */
73 protected function highlightVersionizedElements(\TYPO3\CMS\Backend\Tree\TreeNode $node) {
74 if (!$node->getCls() && count(\TYPO3\CMS\Backend\Utility\BackendUtility::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $node->getId(), TRUE))) {
75 $node->setCls('ver-versions');
76 }
77 }
78
79 }