/src/typo3_src-4.2.0alpha1/typo3/alt_menu.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00053 require ('init.php');
00054 require ('template.php');
00055 require_once (PATH_t3lib.'class.t3lib_loadmodules.php');
00056 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00057 require_once ('class.alt_menu_functions.inc');
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00080 class SC_alt_menu {
00081 
00082                 // Internal, Static: GPvar
00083         var $_clearCacheFiles;
00084 
00090         var $alt_menuObj;
00091 
00098         function init() {
00099                 global $TBE_MODULES, $TBE_TEMPLATE;
00100 
00101                         // Setting GPvars:
00102                 $this->_clearCacheFiles = t3lib_div::_GP('_clearCacheFiles');
00103 
00104                         // Loads the backend modules available for the logged in user.
00105                 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00106                 $this->loadModules->observeWorkspaces = TRUE;
00107                 $this->loadModules->load($TBE_MODULES);
00108 
00109                         // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frame.
00110                 $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
00111 
00112                 $TBE_TEMPLATE->JScodeArray[] = $this->alt_menuObj->generateMenuJScode($this->loadModules->modules);
00113         }
00114 
00120         function main() {
00121                 global $BE_USER,$TYPO3_CONF_VARS,$TBE_TEMPLATE;
00122 
00123                 $TBE_TEMPLATE->docType='xhtml_trans';
00124                 $TBE_TEMPLATE->divClass='vertical-menu';
00125                 $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
00126 
00127                 $this->content.=$TBE_TEMPLATE->startPage('Vertical Backend Menu');
00128                 $backPath = $GLOBALS['BACK_PATH'];
00129 
00130                         // Printing the menu
00131                 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
00132                 $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
00133 
00134                         // clear cache commands for Admins
00135                 if($BE_USER->isAdmin()) {       //  && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
00136                         $functionsArray = $alt_menuObj->adminFunctions($backPath);
00137 
00138                         $this->content.='
00139 
00140 <!--
00141   Menu with admin functions: Clearing cache:
00142 -->
00143 <div id="typo3-alt-menu-php-adminFunc">';
00144 
00145 
00146                                 // Table with those admin functions
00147                         $this->content.='
00148                                 <table border="0" cellpadding="0" cellspacing="1" width="100%" id="typo3-adminmenu">';
00149 
00150                                 // Header: Admin functions
00151                         $this->content.='
00152                                         <tr class="c-mainitem">
00153                                                 <td colspan="2"><span class="c-label"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions',1).'</b>&nbsp;</span><span class="c-iconCollapse"></span></td>
00154                                         </tr>';
00155 
00156                         $rows=array();
00157                         foreach($functionsArray as $functionsArraySetup)        {
00158                                 $rows[]='
00159                                         <tr class="c-subitem">
00160                                                 <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
00161                                                 <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
00162                                         </tr>';
00163                         }
00164 
00165                                 // Imploding around the divider table row:
00166                         $this->content.=implode('
00167                                         <tr>
00168                                                 <td colspan="2"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
00169                                         </tr>',$rows);
00170 
00171                         $this->content.='
00172                                 </table>';
00173                         $this->content.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_adminFunction', $GLOBALS['BACK_PATH']);
00174                         $this->content.='
00175 </div>
00176 ';
00177                 }
00178 
00179                         // superuser mode
00180                 if($BE_USER->user['ses_backuserid']) {
00181                         $username = '<p id="username" class="typo3-red-background">[SU: '.htmlspecialchars($BE_USER->user['username']).']</p>';
00182                 } else {
00183                         $username = '<p id="username">['.htmlspecialchars($BE_USER->user['username']).']</p>';
00184                 }
00185                         // Printing bottons (logout button)
00186                 $this->content.='
00187 
00188 
00189 <!--
00190   Logout button / username
00191 -->
00192 <div id="typo3-alt-menu-php-logininfo">'.$alt_menuObj->topButtons().$username.'
00193 </div>';
00194 
00195                         // End page:
00196                 $this->content.=$TBE_TEMPLATE->endPage();
00197         }
00198 
00204         function printContent() {
00205                 echo $this->content;
00206         }
00207 }
00208 
00209 // Include extension?
00210 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_menu.php'])      {
00211         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_menu.php']);
00212 }
00213 
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 // Make instance:
00226 $SOBE = t3lib_div::makeInstance('SC_alt_menu');
00227 $SOBE->init();
00228 $SOBE->main();
00229 $SOBE->printContent();
00230 ?>

This documentation has been generated automatically from TYPO3 source code using Doxygen and is provided as is by Cast Iron Coding as a courtesy to other TYPO3 developers and users. Please consider Cast Iron Coding — a full-service web development agency in Portland, Oregon specializing in TYPO3 extension development — for all of your TYPO3 development and consulting needs!