8130fcb0b23e95f4c0c388d54aff0847fc5c3ace
[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 use TYPO3\CMS\Backend\View\PageLayoutView;
19 use TYPO3\CMS\Core\Utility\GeneralUtility;
20
21 /**
22 * Class for displaying page information (records, page record properties)
23 */
24 class PageInformationController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule
25 {
26 /**
27 * Returns the menu array
28 *
29 * @return array
30 */
31 public function modMenu()
32 {
33 return array(
34 'pages' => array(
35 0 => $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_0'),
36 2 => $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_2'),
37 1 => $GLOBALS['LANG']->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_1')
38 ),
39 'depth' => array(
40 0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'),
41 1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'),
42 2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'),
43 3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'),
44 4 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_4'),
45 999 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')
46 )
47 );
48 }
49
50 /**
51 * MAIN function for page information display
52 *
53 * @return string Output HTML for the module.
54 */
55 public function main()
56 {
57 $theOutput = $this->pObj->doc->header($this->getLanguageService()->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:page_title'));
58 $dblist = GeneralUtility::makeInstance(PageLayoutView::class);
59 $dblist->descrTable = '_MOD_web_info';
60 $dblist->thumbs = 0;
61 $dblist->script = BackendUtility::getModuleUrl('web_info');
62 $dblist->showIcon = 0;
63 $dblist->setLMargin = 0;
64 $dblist->agePrefixes = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
65 $dblist->pI_showUser = 1;
66 // PAGES:
67 $this->pObj->MOD_SETTINGS['pages_levels'] = $this->pObj->MOD_SETTINGS['depth'];
68 // ONLY for the sake of dblist module which uses this value.
69 $h_func = BackendUtility::getDropdownMenu($this->pObj->id, 'SET[depth]', $this->pObj->MOD_SETTINGS['depth'], $this->pObj->MOD_MENU['depth']);
70 $h_func .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[pages]', $this->pObj->MOD_SETTINGS['pages'], $this->pObj->MOD_MENU['pages']);
71 $dblist->start($this->pObj->id, 'pages', 0);
72 $dblist->generateList();
73 // CSH
74 $theOutput .= $this->pObj->doc->section(
75 '',
76 BackendUtility::cshItem($dblist->descrTable, 'pagetree_overview', null, '|<br />')
77 . '<div class="form-inline form-inline-spaced">'
78 . $h_func
79 . '</div>'
80 . $dblist->HTMLcode,
81 0,
82 1
83 );
84 // Additional footer content
85 $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook'];
86 if (is_array($footerContentHook)) {
87 foreach ($footerContentHook as $hook) {
88 $params = array();
89 $theOutput .= GeneralUtility::callUserFunction($hook, $params, $this);
90 }
91 }
92 return $theOutput;
93 }
94 }