PageRenderTime 34ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/typo3/alt_topmenu_dummy.php

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