[TASK] Remove function index
[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 * @deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7.
36 * The TYPO3 backend is using typo3/backend.php with less frames,
37 * which makes this file obsolete.
38 */
39
40
41 require ('init.php');
42 require ('template.php');
43 require_once ('class.alt_menu_functions.inc');
44
45
46 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.');
47
48
49
50
51
52
53
54
55
56
57
58
59 /**
60 * Script Class for rendering the vertical menu in the left side of the backend frameset
61 *
62 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
63 * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
64 * @package TYPO3
65 * @subpackage core
66 */
67 class SC_alt_menu {
68
69 // Internal, Static: GPvar
70 var $_clearCacheFiles;
71
72 /**
73 * Menu functions object
74 *
75 * @var alt_menu_functions
76 */
77 var $alt_menuObj;
78
79 /**
80 * Initialize
81 * Loads the backend modules available for the logged in user.
82 *
83 * @return void
84 */
85 function init() {
86 // Setting GPvars:
87 $this->_clearCacheFiles = t3lib_div::_GP('_clearCacheFiles');
88
89 // Loads the backend modules available for the logged in user.
90 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
91 $this->loadModules->observeWorkspaces = TRUE;
92 $this->loadModules->load($GLOBALS['TBE_MODULES']);
93
94 // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frame.
95 $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
96
97 $GLOBALS['TBE_TEMPLATE']->JScodeArray[] = $this->alt_menuObj->generateMenuJScode($this->loadModules->modules);
98 }
99
100 /**
101 * Main content generated
102 *
103 * @return void
104 */
105 function main() {
106 $GLOBALS['TBE_TEMPLATE']->divClass = 'vertical-menu';
107 $GLOBALS['TBE_TEMPLATE']->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
108
109 $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage('Vertical Backend Menu');
110 $backPath = $GLOBALS['BACK_PATH'];
111
112 // Printing the menu
113 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
114 $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
115
116 // clear cache commands for Admins and allowed users
117 if($GLOBALS['BE_USER']->isAdmin()
118 || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')
119 || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {
120 // && $GLOBALS['BE_USER']->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
121 $functionsArray = $alt_menuObj->adminFunctions($backPath);
122
123 $this->content.='
124
125 <!--
126 Menu with admin functions: Clearing cache:
127 -->
128 <div id="typo3-alt-menu-php-adminFunc">';
129
130
131 // Table with those admin functions
132 $this->content.='
133 <table border="0" cellpadding="0" cellspacing="1" width="100%" id="typo3-adminmenu">';
134
135 // Header: Admin functions
136 $this->content.='
137 <tr class="c-mainitem">
138 <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>
139 </tr>';
140
141 $rows=array();
142 foreach($functionsArray as $functionsArraySetup) {
143 if(($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')))
144 || ($functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin())) {
145 $rows[]='
146 <tr class="c-subitem">
147 <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
148 <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
149 </tr>';
150 }
151 }
152
153 // Imploding around the divider table row:
154 $this->content.=implode('
155 <tr>
156 <td colspan="2"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
157 </tr>',$rows);
158
159 $this->content.='
160 </table>';
161 $this->content.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_adminFunction', $GLOBALS['BACK_PATH']);
162 $this->content.='
163 </div>
164 ';
165 }
166
167 // superuser mode
168 if ($GLOBALS['BE_USER']->user['ses_backuserid']) {
169 $username = '<p id="username" class="typo3-red-background">[' .
170 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:switchtousershort') . ' ' .
171 htmlspecialchars($GLOBALS['BE_USER']->user['username']) . ']</p>';
172 } else {
173 $username = '<p id="username">[' . htmlspecialchars($GLOBALS['BE_USER']->user['username']) . ']</p>';
174 }
175 // Printing buttons (logout button)
176 $this->content.='
177
178
179 <!--
180 Logout button / username
181 -->
182 <div id="typo3-alt-menu-php-logininfo">'.$alt_menuObj->topButtons().$username.'
183 </div>';
184
185 // End page:
186 $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
187 }
188
189 /**
190 * Outputting the accumulated content to screen
191 *
192 * @return void
193 */
194 function printContent() {
195 echo $this->content;
196 }
197 }
198
199
200 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php'])) {
201 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php']);
202 }
203
204
205
206 // Make instance:
207 $SOBE = t3lib_div::makeInstance('SC_alt_menu');
208 $SOBE->init();
209 $SOBE->main();
210 $SOBE->printContent();
211
212 ?>