PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/typo3/alt_topmenu_dummy.php

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