TYPO3 API  SVNRelease
alt_topmenu_dummy.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (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 ***************************************************************/
00027 /**
00028  * Alternative top menu
00029  * Displays a horizontal menu with the same items as the default left vertical menu
00030  * in the backend frameset. Only the icons are displayed and linked.
00031  * Will appear as the default document in the top frame if configured to appear.
00032  * This is the default menu used during "condensed mode"
00033  *
00034  * $Id: alt_topmenu_dummy.php 10121 2011-01-18 20:15:30Z ohader $
00035  * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
00036  * XHTML compliant content
00037  *
00038  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00039  */
00040 /**
00041  * [CLASS/FUNCTION INDEX of SCRIPT]
00042  *
00043  *
00044  *
00045  *   74: class SC_alt_topmenu_dummy
00046  *   82:     function main()
00047  *  162:     function dummyContent()
00048  *  178:     function printContent()
00049  *
00050  * TOTAL FUNCTIONS: 3
00051  * (This index is automatically created/updated by the extension "extdeveval")
00052  *
00053  * @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.
00054  */
00055 
00056 
00057 require ('init.php');
00058 require ('template.php');
00059 require_once ('class.alt_menu_functions.inc');
00060 
00061 
00062 t3lib_div::deprecationLog('alt_topmenu_dummy.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.');
00063 
00064 
00065 
00066 
00067 /**
00068  * Script Class for rendering the topframe dummy view.
00069  * In the case where TYPO3 backend is configured to show the menu in the top frame this class will render the horizontal line of module icons in the top frame.
00070  *
00071  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00072  * @package TYPO3
00073  * @subpackage core
00074  */
00075 class SC_alt_topmenu_dummy {
00076     var $content;
00077 
00078     /**
00079      * Main function - making the menu happen.
00080      *
00081      * @return  void
00082      */
00083     function main() {
00084         global $BE_USER,$LANG,$BACK_PATH,$TBE_MODULES,$TBE_TEMPLATE;
00085 
00086             // Remember if noMenuMode is set to 'icons' or not because the hook will be ignored in this case.
00087         if (!strcmp($BE_USER->uc['noMenuMode'],'icons'))    { $iconMenuMode = true; }
00088 
00089         $contentArray=array();
00090 
00091             // Hook for adding content to the topmenu. Only works if noMenuMode is not set to "icons" in the users setup!
00092         if (!$iconMenuMode && is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_topmenu_dummy.php']['fetchContentTopmenu']))   {
00093             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_topmenu_dummy.php']['fetchContentTopmenu'] as $classRef)  {
00094                 $hookObj = t3lib_div::getUserObj($classRef);
00095                 if (method_exists($hookObj,'fetchContentTopmenu_processContent'))   {
00096                     $tempContent = $hookObj->fetchContentTopmenu_processContent($this);
00097 
00098                         // Placement priority handling.
00099                     if (is_int($hookObj->priority) && ($hookObj->priority>=1 && $hookObj->priority<=9)) {
00100                         $priority = $hookObj->priority;
00101                     } else $priority = 5;
00102 
00103                     $overrulestyle = isset($hookObj->overrulestyle) ? $hookObj->overrulestyle : 'padding-top: 4px;';
00104                     $contentArray[$priority][] = '<td class="c-menu" style="'.$overrulestyle.'">'.$tempContent.'</td>';
00105                 }
00106             }
00107             ksort($contentArray);
00108         }
00109 
00110             // If noMenuMode is set to 'icons' or if a hook was found, display menu instead of nothingness
00111         if ($iconMenuMode || count($contentArray))  {
00112 
00113                 // Loading the modules for this backend user:
00114             $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00115             $loadModules->observeWorkspaces = TRUE;
00116             $loadModules->load($TBE_MODULES);
00117 
00118                 // Creating menu object:
00119             $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
00120 
00121                 // Start page
00122             $TBE_TEMPLATE->bodyTagId.= '-iconmenu';
00123             $TBE_TEMPLATE->JScodeArray[] = $alt_menuObj->generateMenuJScode($loadModules->modules);
00124 
00125             $this->content.=$TBE_TEMPLATE->startPage('Top frame icon menu');
00126 
00127             if ($iconMenuMode)  {
00128                 $contentArray[0][] = '<td class="c-menu">'.$alt_menuObj->topMenu($loadModules->modules,0,'',3).'</td>';
00129                 if ($BE_USER->isAdmin())    {
00130                     $contentArray[1][] = '<td class="c-admin">'.$alt_menuObj->adminButtons().'</td>';
00131                 }
00132                 $contentArray[2][] = '<td class="c-logout">'.$alt_menuObj->topButtons().'</td>';
00133             }
00134 
00135                 // Make menu and add it:
00136             $this->content.='
00137 
00138                 <!--
00139                   Alternative module menu made of icons, displayed in top frame:
00140                 -->
00141                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-topMenu">
00142                     <tr>';
00143 
00144             foreach ($contentArray as $key=>$menucontent)   {
00145                 $this->content .= implode(LF, $menucontent);
00146             }
00147 
00148             $this->content.='
00149                     </tr>
00150                 </table>';
00151 
00152                 // End page:
00153             $this->content.=$TBE_TEMPLATE->endPage();
00154         } else {
00155                 // Make dummy content:
00156             $this->dummyContent();
00157         }
00158     }
00159 
00160     /**
00161      * Creates the dummy content of the top frame if no menu - which is a blank page.
00162      *
00163      * @return  void
00164      */
00165     function dummyContent() {
00166         global $TBE_TEMPLATE;
00167 
00168             // Start page
00169         $this->content.=$TBE_TEMPLATE->startPage('Top frame dummy display');
00170 
00171             // End page:
00172         $this->content.=$TBE_TEMPLATE->endPage();
00173     }
00174 
00175     /**
00176      * Outputting the accumulated content to screen
00177      *
00178      * @return  void
00179      */
00180     function printContent() {
00181         echo $this->content;
00182     }
00183 }
00184 
00185 
00186 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_topmenu_dummy.php'])) {
00187     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_topmenu_dummy.php']);
00188 }
00189 
00190 
00191 
00192 // Make instance:
00193 $SOBE = t3lib_div::makeInstance('SC_alt_topmenu_dummy');
00194 $SOBE->main();
00195 $SOBE->printContent();
00196 
00197 ?>