Documentation TYPO3 par Ameos |
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 ***************************************************************/ 00056 require ('init.php'); 00057 require ('template.php'); 00058 require_once (PATH_t3lib.'class.t3lib_loadmodules.php'); 00059 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php'); 00060 require_once ('class.alt_menu_functions.inc'); 00061 00062 00063 00064 00065 00074 class SC_alt_topmenu_dummy { 00075 var $content; 00076 00082 function main() { 00083 global $BE_USER,$LANG,$BACK_PATH,$TBE_MODULES,$TBE_TEMPLATE; 00084 00085 // Remember if noMenuMode is set to 'icons' or not because the hook will be ignored in this case. 00086 if (!strcmp($BE_USER->uc['noMenuMode'],'icons')) { $iconMenuMode = true; } 00087 00088 $contentArray=array(); 00089 00090 // Hook for adding content to the topmenu. Only works if noMenuMode is not set to "icons" in the users setup! 00091 if (!$iconMenuMode && is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_topmenu_dummy.php']['fetchContentTopmenu'])) { 00092 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_topmenu_dummy.php']['fetchContentTopmenu'] as $classRef) { 00093 $hookObj = &t3lib_div::getUserObj($classRef); 00094 if (method_exists($hookObj,'fetchContentTopmenu_processContent')) { 00095 $tempContent = $hookObj->fetchContentTopmenu_processContent($this); 00096 00097 // Placement priority handling. 00098 if (is_int($hookObj->priority) and ($hookObj->priority>=1 and $hookObj->priority<=9)) { 00099 $priority = $hookObj->priority; 00100 } else $priority = 5; 00101 00102 $overrulestyle = isset($hookObj->overrulestyle) ? $hookObj->overrulestyle : 'padding-top: 4px;'; 00103 $contentArray[$priority][] = '<td class="c-menu" style="'.$overrulestyle.'">'.$tempContent.'</td>'; 00104 } 00105 } 00106 ksort($contentArray); 00107 } 00108 00109 // If noMenuMode is set to 'icons' or if a hook was found, display menu instead of nothingness 00110 if ($iconMenuMode || count($contentArray)) { 00111 00112 // Loading the modules for this backend user: 00113 $loadModules = t3lib_div::makeInstance('t3lib_loadModules'); 00114 $loadModules->observeWorkspaces = TRUE; 00115 $loadModules->load($TBE_MODULES); 00116 00117 // Creating menu object: 00118 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions'); 00119 00120 // Start page 00121 $TBE_TEMPLATE->docType = 'xhtml_trans'; 00122 $TBE_TEMPLATE->bodyTagId.= '-iconmenu'; 00123 $this->content.=$TBE_TEMPLATE->startPage('Top frame icon menu'); 00124 00125 if ($iconMenuMode) { 00126 $contentArray[0][] = '<td class="c-menu">'.$alt_menuObj->topMenu($loadModules->modules,0,'',3).'</td>'; 00127 if ($BE_USER->isAdmin()) { 00128 $contentArray[1][] = '<td class="c-admin">'.$alt_menuObj->adminButtons().'</td>'; 00129 } 00130 $contentArray[2][] = '<td class="c-logout">'.$alt_menuObj->topButtons().'</td>'; 00131 } 00132 00133 // Make menu and add it: 00134 $this->content.=' 00135 00136 <!-- 00137 Alternative module menu made of icons, displayed in top frame: 00138 --> 00139 <table border="0" cellpadding="0" cellspacing="0" id="typo3-topMenu"> 00140 <tr>'; 00141 00142 foreach ($contentArray as $key=>$menucontent) { 00143 $this->content .= implode(chr(10), $menucontent); 00144 } 00145 00146 $this->content.=' 00147 </tr> 00148 </table>'; 00149 00150 // End page: 00151 $this->content.=$TBE_TEMPLATE->endPage(); 00152 } else { 00153 // Make dummy content: 00154 $this->dummyContent(); 00155 } 00156 } 00157 00163 function dummyContent() { 00164 global $TBE_TEMPLATE; 00165 00166 // Start page 00167 $TBE_TEMPLATE->docType = 'xhtml_trans'; 00168 $this->content.=$TBE_TEMPLATE->startPage('Top frame dummy display'); 00169 00170 // End page: 00171 $this->content.=$TBE_TEMPLATE->endPage(); 00172 } 00173 00179 function printContent() { 00180 echo $this->content; 00181 } 00182 } 00183 00184 // Include extension? 00185 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_topmenu_dummy.php']) { 00186 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_topmenu_dummy.php']); 00187 } 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 // Make instance: 00201 $SOBE = t3lib_div::makeInstance('SC_alt_topmenu_dummy'); 00202 $SOBE->main(); 00203 $SOBE->printContent(); 00204 ?>