[TASK] TYPO3 code must not use the else if construct
[Packages/TYPO3.CMS.git] / typo3 / alt_topmenu_dummy.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 * Alternative top menu
29 * Displays a horizontal menu with the same items as the default left vertical menu
30 * in the backend frameset. Only the icons are displayed and linked.
31 * Will appear as the default document in the top frame if configured to appear.
32 * This is the default menu used during "condensed mode"
33 *
34 * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
35 * XHTML compliant content
36 *
37 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
38 */
39 /**
40 * [CLASS/FUNCTION INDEX of SCRIPT]
41 *
42 *
43 *
44 * 74: class SC_alt_topmenu_dummy
45 * 82: function main()
46 * 162: function dummyContent()
47 * 178: function printContent()
48 *
49 * TOTAL FUNCTIONS: 3
50 * (This index is automatically created/updated by the extension "extdeveval")
51 *
52 * @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.
53 */
54
55
56 require ('init.php');
57 require ('template.php');
58 require_once ('class.alt_menu_functions.inc');
59
60
61 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.');
62
63
64
65
66 /**
67 * Script Class for rendering the topframe dummy view.
68 * 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.
69 *
70 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
71 * @package TYPO3
72 * @subpackage core
73 */
74 class SC_alt_topmenu_dummy {
75 var $content;
76
77 /**
78 * Main function - making the menu happen.
79 *
80 * @return void
81 */
82 function main() {
83
84 // Remember if noMenuMode is set to 'icons' or not because the hook will be ignored in this case.
85 if (!strcmp($GLOBALS['BE_USER']->uc['noMenuMode'],'icons')) { $iconMenuMode = true; }
86
87 $contentArray=array();
88
89 // Hook for adding content to the topmenu. Only works if noMenuMode is not set to "icons" in the users setup!
90 if (!$iconMenuMode && is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_topmenu_dummy.php']['fetchContentTopmenu'])) {
91 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_topmenu_dummy.php']['fetchContentTopmenu'] as $classRef) {
92 $hookObj = t3lib_div::getUserObj($classRef);
93 if (method_exists($hookObj,'fetchContentTopmenu_processContent')) {
94 $tempContent = $hookObj->fetchContentTopmenu_processContent($this);
95
96 // Placement priority handling.
97 if (is_int($hookObj->priority) && ($hookObj->priority>=1 && $hookObj->priority<=9)) {
98 $priority = $hookObj->priority;
99 } else $priority = 5;
100
101 $overrulestyle = isset($hookObj->overrulestyle) ? $hookObj->overrulestyle : 'padding-top: 4px;';
102 $contentArray[$priority][] = '<td class="c-menu" style="'.$overrulestyle.'">'.$tempContent.'</td>';
103 }
104 }
105 ksort($contentArray);
106 }
107
108 // If noMenuMode is set to 'icons' or if a hook was found, display menu instead of nothingness
109 if ($iconMenuMode || count($contentArray)) {
110
111 // Loading the modules for this backend user:
112 $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
113 $loadModules->observeWorkspaces = TRUE;
114 $loadModules->load($GLOBALS['TBE_MODULES']);
115
116 // Creating menu object:
117 $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
118
119 // Start page
120 $GLOBALS['TBE_TEMPLATE']->bodyTagId.= '-iconmenu';
121 $GLOBALS['TBE_TEMPLATE']->JScodeArray[] = $alt_menuObj->generateMenuJScode($loadModules->modules);
122
123 $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage('Top frame icon menu');
124
125 if ($iconMenuMode) {
126 $contentArray[0][] = '<td class="c-menu">'.$alt_menuObj->topMenu($loadModules->modules,0,'',3).'</td>';
127 if ($GLOBALS['BE_USER']->isAdmin()) {
128 $contentArray[1][] = '<td class="c-admin">'.$alt_menuObj->adminButtons().'</td>';
129 }
130 $contentArray[2][] = '<td class="c-logout">'.$alt_menuObj->topButtons().'</td>';
131 }
132
133 // Make menu and add it:
134 $this->content.='
135
136 <!--
137 Alternative module menu made of icons, displayed in top frame:
138 -->
139 <table border="0" cellpadding="0" cellspacing="0" id="typo3-topMenu">
140 <tr>';
141
142 foreach ($contentArray as $key=>$menucontent) {
143 $this->content .= implode(LF, $menucontent);
144 }
145
146 $this->content.='
147 </tr>
148 </table>';
149
150 // End page:
151 $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
152 } else {
153 // Make dummy content:
154 $this->dummyContent();
155 }
156 }
157
158 /**
159 * Creates the dummy content of the top frame if no menu - which is a blank page.
160 *
161 * @return void
162 */
163 function dummyContent() {
164 global $TBE_TEMPLATE;
165
166 // Start page
167 $this->content.=$TBE_TEMPLATE->startPage('Top frame dummy display');
168
169 // End page:
170 $this->content.=$TBE_TEMPLATE->endPage();
171 }
172
173 /**
174 * Outputting the accumulated content to screen
175 *
176 * @return void
177 */
178 function printContent() {
179 echo $this->content;
180 }
181 }
182
183
184 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_topmenu_dummy.php'])) {
185 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_topmenu_dummy.php']);
186 }
187
188
189
190 // Make instance:
191 $SOBE = t3lib_div::makeInstance('SC_alt_topmenu_dummy');
192 $SOBE->main();
193 $SOBE->printContent();
194
195 ?>