a3bd085cf4fd9f15cae3c6cd887e8e2fb1de1008
[Packages/TYPO3.CMS.git] / typo3 / alt_menu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Displays the vertical menu in the left most frame of TYPO3s backend
29 *
30 * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
31 * XHTML-trans compliant
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 80: class SC_alt_menu
42 * 91: function init()
43 * 108: function main()
44 * 190: function printContent()
45 *
46 * TOTAL FUNCTIONS: 3
47 * (This index is automatically created/updated by the extension "extdeveval")
48 *
49 * @deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7. The TYPO3 backend is using typo3/backend.php with less frames, which makes this file obsolete.
50 */
51
52
53 require ('init.php');
54 require ('template.php');
55 require_once ('class.alt_menu_functions.inc');
56
57
58 t3lib_div::deprecationLog('alt_palette.php is deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7. The TYPO3 backend is using typo3/backend.php with less frames, which makes this file obsolete.');
59
60
61
62
63
64
65
66
67
68
69
70
71 /**
72 * Script Class for rendering the vertical menu in the left side of the backend frameset
73 *
74 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
75 * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
76 * @package TYPO3
77 * @subpackage core
78 */
79 class SC_alt_menu {
80
81 // Internal, Static: GPvar
82 var $_clearCacheFiles;
83
84 /**
85 * Menu functions object
86 *
87 * @var alt_menu_functions
88 */
89 var $alt_menuObj;
90
91 /**
92 * Initialize
93 * Loads the backend modules available for the logged in user.
94 *
95 * @return void
96 */
97 function init() {
98 global $TBE_MODULES, $TBE_TEMPLATE;
99
100 // Setting GPvars:
101 $this->_clearCacheFiles = t3lib_div::_GP('_clearCacheFiles');
102
103 // Loads the backend modules available for the logged in user.
104 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
105 $this->loadModules->observeWorkspaces = TRUE;
106 $this->loadModules->load($TBE_MODULES);
107
108 // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frame.
109 $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
110
111 $TBE_TEMPLATE->JScodeArray[] = $this->alt_menuObj->generateMenuJScode($this->loadModules->modules);
112 }
113
114 /**
115 * Main content generated
116 *
117 * @return void
118 */
119 function main() {
120 $GLOBALS['TBE_TEMPLATE']->divClass = 'vertical-menu';
121 $GLOBALS['TBE_TEMPLATE']->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
122
123 $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage('Vertical Backend Menu');
124 $backPath = $GLOBALS['BACK_PATH'];
125
126 // Printing the menu
127 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
128 $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
129
130 // clear cache commands for Admins and allowed users
131 if($GLOBALS['BE_USER']->isAdmin()
132 || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')
133 || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {
134 // && $GLOBALS['BE_USER']->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
135 $functionsArray = $alt_menuObj->adminFunctions($backPath);
136
137 $this->content.='
138
139 <!--
140 Menu with admin functions: Clearing cache:
141 -->
142 <div id="typo3-alt-menu-php-adminFunc">';
143
144
145 // Table with those admin functions
146 $this->content.='
147 <table border="0" cellpadding="0" cellspacing="1" width="100%" id="typo3-adminmenu">';
148
149 // Header: Admin functions
150 $this->content.='
151 <tr class="c-mainitem">
152 <td colspan="2"><span class="c-label"><strong>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions',1).'</strong>&nbsp;</span><span class="c-iconCollapse"></span></td>
153 </tr>';
154
155 $rows=array();
156 foreach($functionsArray as $functionsArraySetup) {
157 if(($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')))
158 || ($functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin())) {
159 $rows[]='
160 <tr class="c-subitem">
161 <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
162 <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
163 </tr>';
164 }
165 }
166
167 // Imploding around the divider table row:
168 $this->content.=implode('
169 <tr>
170 <td colspan="2"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
171 </tr>',$rows);
172
173 $this->content.='
174 </table>';
175 $this->content.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_adminFunction', $GLOBALS['BACK_PATH']);
176 $this->content.='
177 </div>
178 ';
179 }
180
181 // superuser mode
182 if ($GLOBALS['BE_USER']->user['ses_backuserid']) {
183 $username = '<p id="username" class="typo3-red-background">[' .
184 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:switchtousershort') . ' ' .
185 htmlspecialchars($GLOBALS['BE_USER']->user['username']) . ']</p>';
186 } else {
187 $username = '<p id="username">[' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . ']</p>';
188 }
189 // Printing buttons (logout button)
190 $this->content.='
191
192
193 <!--
194 Logout button / username
195 -->
196 <div id="typo3-alt-menu-php-logininfo">'.$alt_menuObj->topButtons().$username.'
197 </div>';
198
199 // End page:
200 $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
201 }
202
203 /**
204 * Outputting the accumulated content to screen
205 *
206 * @return void
207 */
208 function printContent() {
209 echo $this->content;
210 }
211 }
212
213
214 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php'])) {
215 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php']);
216 }
217
218
219
220 // Make instance:
221 $SOBE = t3lib_div::makeInstance('SC_alt_menu');
222 $SOBE->init();
223 $SOBE->main();
224 $SOBE->printContent();
225
226 ?>