[TASK] Remove unused property $be_user_Array
[Packages/TYPO3.CMS.git] / typo3 / sysext / info / Classes / Controller / InfoModuleController.php
1 <?php
2 namespace TYPO3\CMS\Info\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 * Script Class for the Web > Info module
21 * This class creates the framework to which other extensions can connect their sub-modules
22 *
23 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
24 */
25 class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
26
27 /**
28 * @todo Define visibility
29 */
30 public $CALC_PERMS;
31
32 /**
33 * @todo Define visibility
34 */
35 public $pageinfo;
36
37 /**
38 * Document Template Object
39 *
40 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
41 * @todo Define visibility
42 */
43 public $doc;
44
45 /**
46 * Constructor
47 */
48 public function __construct() {
49 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_mod_web_info.xlf');
50 $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
51 }
52
53 /**
54 * Initialize module header etc and call extObjContent function
55 *
56 * @return void
57 */
58 public function main() {
59 // Access check...
60 // The page will show only if there is a valid page and if this page may be viewed by the user
61 $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
62 $access = is_array($this->pageinfo);
63 if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
64 $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
65 if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) {
66 $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
67 }
68 $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
69 $this->doc->backPath = $GLOBALS['BACK_PATH'];
70 $this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html');
71 $this->doc->tableLayout = array(
72 '0' => array(
73 '0' => array('<td valign="top"><strong>', '</strong></td>'),
74 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')
75 ),
76 'defRow' => array(
77 '0' => array('<td valign="top">', '</td>'),
78 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')
79 )
80 );
81 // JavaScript
82 $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
83 // Setting up the context sensitive menu:
84 $this->doc->getContextMenuCode();
85 $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">';
86 $vContent = $this->doc->getVersionSelector($this->id, 1);
87 if ($vContent) {
88 $this->content .= $this->doc->section('', $vContent);
89 }
90 $this->extObjContent();
91 // Setting up the buttons and markers for docheader
92 $docHeaderButtons = $this->getButtons();
93 $markers = array(
94 'CSH' => $docHeaderButtons['csh'],
95 'FUNC_MENU' => BackendUtility::getFuncMenu(
96 $this->id,
97 'SET[function]',
98 $this->MOD_SETTINGS['function'],
99 $this->MOD_MENU['function']
100 ),
101 'CONTENT' => $this->content
102 );
103 // Build the <body> for the module
104 $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
105 } else {
106 // If no access or if ID == zero
107 $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
108 $this->doc->backPath = $GLOBALS['BACK_PATH'];
109 $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title'));
110 $this->content .= $this->doc->spacer(5);
111 $this->content .= $this->doc->spacer(10);
112 }
113 // Renders the module page
114 $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
115 }
116
117 /**
118 * Print module content (from $this->content)
119 *
120 * @return void
121 */
122 public function printContent() {
123 $this->content = $this->doc->insertStylesAndJS($this->content);
124 echo $this->content;
125 }
126
127 /**
128 * Create the panel of buttons for submitting the form or otherwise perform operations.
129 *
130 * @return array All available buttons as an assoc. array
131 */
132 protected function getButtons() {
133 $buttons = array(
134 'csh' => '',
135 'view' => '',
136 'shortcut' => ''
137 );
138 // CSH
139 $buttons['csh'] = BackendUtility::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
140 // View page
141 $buttons['view'] = '<a href="#" '
142 . 'onclick="' . htmlspecialchars(
143 BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))
144 ) . '" '
145 . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
146 . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view')
147 . '</a>';
148 // Shortcut
149 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
150 $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
151 }
152 return $buttons;
153 }
154
155 }