Revert "[TASK] Rebuild the calcAge functionality"
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Controller / PageInformationController.php
1 <?php
2 namespace TYPO3\CMS\Frontend\Controller;
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 use TYPO3\CMS\Backend\Utility\BackendUtility;
18
19 /**
20 * Class for displaying page information (records, page record properties)
21 *
22 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
23 */
24 class PageInformationController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
25
26 /**
27 * Returns the menu array
28 *
29 * @return array
30 * @todo Define visibility
31 */
32 public function modMenu() {
33 global $LANG;
34 return array(
35 'pages' => array(
36 0 => $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:pages_0'),
37 2 => $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:pages_2'),
38 1 => $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:pages_1')
39 ),
40 'stat_type' => array(
41 0 => $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:stat_type_0'),
42 1 => $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:stat_type_1'),
43 2 => $LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:stat_type_2')
44 ),
45 'depth' => array(
46 0 => $LANG->getLL('depth_0'),
47 1 => $LANG->getLL('depth_1'),
48 2 => $LANG->getLL('depth_2'),
49 3 => $LANG->getLL('depth_3'),
50 999 => $LANG->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')
51 )
52 );
53 }
54
55 /**
56 * MAIN function for page information display
57 *
58 * @return string Output HTML for the module.
59 * @todo Define visibility
60 */
61 public function main() {
62 global $BACK_PATH, $LANG, $SOBE;
63 $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\View\\PageLayoutView');
64 $dblist->descrTable = '_MOD_' . $GLOBALS['MCONF']['name'];
65 $dblist->backPath = $BACK_PATH;
66 $dblist->thumbs = 0;
67 $dblist->script = BackendUtility::getModuleUrl('web_info');
68 $dblist->showIcon = 0;
69 $dblist->setLMargin = 0;
70 $dblist->agePrefixes = $LANG->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
71 $dblist->pI_showUser = 1;
72 // PAGES:
73 $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
74 // ONLY for the sake of dblist module which uses this value.
75 $h_func = BackendUtility::getFuncMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']);
76 $h_func .= BackendUtility::getFuncMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']);
77 $dblist->start($this->pObj->id, 'pages', 0);
78 $dblist->generateList();
79 // CSH
80 $theOutput = $this->pObj->doc->header($LANG->sL('LLL:EXT:cms/web_info/locallang.xlf:page_title'));
81 $theOutput .= $this->pObj->doc->section('', BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . $h_func . $dblist->HTMLcode, 0, 1);
82 // Additional footer content
83 $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook'];
84 if (is_array($footerContentHook)) {
85 foreach ($footerContentHook as $hook) {
86 $params = array();
87 $theOutput .= \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($hook, $params, $this);
88 }
89 }
90 return $theOutput;
91 }
92
93 }