2005-04-04 Robert Lemke <robert@typo3.org>
[Packages/TYPO3.CMS.git] / typo3 / class.alt_menu_functions.inc
1 <?php
2 /***************************************************************
3 *  Copyright notice
4 *
5 *  (c) 1999-2004 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  * Class for generation of the module menu.
29  * Will make the vertical, horizontal, selectorbox based menus AND the "about modules" display.
30  * Basically it traverses the module structure and generates output based on that.
31  *
32  * $Id$
33  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
34  * XHTML compliant content
35  *
36  * @author      Kasper Skaarhoj <kasperYYYY@typo3.com>
37  */
38 /**
39  * [CLASS/FUNCTION INDEX of SCRIPT]
40  *
41  *
42  *
43  *   73: class alt_menu_functions
44  *   94:     function topMenu($theModules,$dontLink=0,$backPath='',$descr=0)
45  *  402:     function getNavFramePrefix ($moduleInfo, $subModuleInfo=array())
46  *  429:     function mIconFile($Ifilename,$backPath)
47  *  444:     function mIconFilename($Ifilename,$backPath)
48  *  456:     function topButtons()
49  *  468:     function adminButtons()
50  *  487:     function adminFunctions($backPath)
51  *  520:     function wrapLinkWithAB($link)
52  *
53  * TOTAL FUNCTIONS: 8
54  * (This index is automatically created/updated by the extension "extdeveval")
55  *
56  */
57
58
59
60
61
62
63
64
65
66 /**
67  * Class with menu functions
68  *
69  * @author      Kasper Skaarhoj <kasperYYYY@typo3.com>
70  * @package TYPO3
71  * @subpackage core
72  */
73 class alt_menu_functions {
74
75                 // Internal
76         var $fsMod = array();
77
78         /**
79          * Creates the menu of modules.
80          *
81          * $descr determines the type of menu made:
82          *              0 = Ordinary vertical menu
83          *              1 = Descriptions for 'About modules' display
84          *              2 = selector-box menu
85          *              3 = topmenu - horizontal line of icons!
86          *              4 = part of JavaScript switch contruct for alt_main.php frameset.
87          *
88          * @param       array           $theModules is the output from load_modules class ($this->loadModules->modules)
89          * @param       boolean         $dontLink == true will prevent the output from being linked with A-tags (used in the 'beuser' extension)
90          * @param       string          $backPath must be the 'backPath' to PATH_typo3 from where the menu is displayed.
91          * @param       integer         $descr determines the type of menu made (see above)
92          * @return      string          The menu HTML
93          */
94         function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) {
95                 global $LANG, $TBE_TEMPLATE, $BE_USER;
96
97                         // By default module sections are collapsable, only if they are explicitly turned off via TSconfig, they are not:
98                 $tmpArr = $BE_USER->getTSConfig('options.moduleMenuCollapsable');                       
99                 $collapsable = ($tmpArr['value'] ? 0 : 1);
100                 unset($tmpArr);
101                 
102                         // Initialize vars:
103                 $final='';
104                 $menuCode='';
105                 $descrCode='';
106                 $menuCode_sub='';
107                 $selectItems=array();
108                 $mIcons=array();
109                 $mJScmds=array();
110                 $onBlur=$GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : '';
111
112                 $selectItems[] = '<option value="">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.selMenu_modules',1).' ]</option>';
113                 $mC=0;
114
115                         // Remove the 'doc' module?
116                 if ($BE_USER->getTSConfigVal('options.disableDocModuleInAB'))   {
117                         unset($theModules['doc']);
118                 }
119
120                         // Get collapsed configuration
121                 if ($collapsable == 1) {
122                         $config = is_array ($BE_USER->uc['moduleData']['alt_menu.php']) ? $BE_USER->uc['moduleData']['alt_menu.php'] : array(); 
123                         $collapsedOverride = t3lib_div::_GP('collapsedOverride');
124                         if (is_array ($collapsedOverride)) {
125                                 $config = array_merge ($config, $collapsedOverride);
126                         }
127                         
128                         if (t3lib_div::_GP('collapsableExpandAll') == 1) {
129                                 $config['expandAll'] = t3lib_div::_GP('expandAll');
130                         }
131                         
132                         if ($config['expandAll'] && is_array($collapsedOverride)) {
133                                 $config = $collapsedOverride;
134                         }
135                         
136                         $BE_USER->uc['moduleData']['alt_menu.php'] = $config;
137                         $BE_USER->writeUC($BE_USER->uc);
138                         
139                                 // all items have to be expanded when expandAll is set
140                         if($config['expandAll'] == 1) {
141                                 foreach($config as $key => $value) {
142                                         if($key != 'expandAll')
143                                                 $config[$key] = 0;
144                                 }
145                         }
146                 }
147                 
148                         // Traverse array with modules
149                 reset($theModules);
150                 while(list($moduleName,$moduleInfo)=each($theModules))  {
151                         $mC++;
152
153                         $prefix=$this->getNavFramePrefix ($moduleInfo);
154                         if ($prefix) {
155                                 $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";';
156                         }
157
158                                 // If there are submodules:
159                         if (is_array($moduleInfo['sub']))       {
160                                         // Finding the default module to display
161                                 if ($moduleInfo['defaultMod'])  {
162                                         $link = $moduleInfo['sub'][$moduleInfo['defaultMod']]['script'];
163                                 } else {
164                                         reset($moduleInfo['sub']);
165                                         $subTemp = current($moduleInfo['sub']);
166                                         $link = $subTemp['script'];
167                                 }
168                                 $link_sub = 1;  // Tells that the main modules links to a submodule
169                                 $link = '';     // Does not link to submodules...
170                         } else {
171                                 $link = $moduleInfo['script'];
172                                 $link_sub = 0;
173                         }
174
175                         $moduleKey = $moduleName.'_tab';
176                         $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName);
177
178                                 // Creating image icon
179                         $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath));
180                         $imageCode='';
181                         $descr3_title = $LANG->moduleLabels['tabs'][$moduleKey].' ';
182                         if ($image)     {
183                                 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath);
184                                 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />';
185                                 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
186                         } else {
187                                 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
188                         }
189
190                                 // Creating the various links:
191                         $label = $LANG->moduleLabels['tabs'][$moduleKey];
192                         if ($link && $prefix)   $link=$prefix.rawurlencode($link);
193                         if ($link && !$dontLink)        {
194                                 $label = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;">'.$label.'</a>';   //  && !$link_sub
195
196                                 $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
197
198                                 $JScmd = '
199                                                 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+\''.$this->wrapLinkWithAB($link).'\'+additionalGetVariables);
200                                                 top.highlightModuleMenuItem("'.$moduleCSSId.'",1);';
201                                 $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;";
202                         }
203
204                         $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($LANG->moduleLabels['tabs'][$moduleKey]).'</option>';
205                         $label='&nbsp;<b>'.$label.'</b>&nbsp;';
206
207                         
208                                 // make menu collapsable
209                         if($collapsable == 1 && is_array($moduleInfo['sub'])) {
210                                 $collapseJS = 'onclick="window.location.href=\'alt_menu.php?collapsedOverride['.$moduleName.']='.($config[$moduleName] ? '0' : '1').'\'"';                              
211                                 $collapseIcon = '<span class="c-iconCollapse"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/ol/'.($config[$moduleName] ? 'plusbullet.gif':'minusbullet.gif'),'width="18" height="16"').' title="" alt="" /></span>';                            
212                         } else {
213                                 $collapseJS = $collapseIcon = '';
214                         }
215                         
216                                 // Creating a main item for the vertical menu (descr=0)
217                         $menuCode.='
218                                                 <tr class="c-mainitem" id="'.$moduleCSSId.'">
219                                                         <td colspan="3" '.$collapseJS.' >'.$imageCode.'<span class="c-label">'.$label.'</span>'.$collapseIcon.'</td>
220                                                 </tr>';
221
222                                 // Code for "About modules"
223                         $descrCode.='
224                                                 <tr class="c-mainitem bgColor4">
225                                                         <td colspan="3">'.$imageCode.$label.'</td>
226                                                 </tr>';
227
228
229                                 // Hide submodules when collapsed:
230                         if($collapsable == 1 && $config[$moduleName] == 1 && $descr == 0 && $config['expandAll'] != 1) {
231                                 unset($moduleInfo['sub']);
232                         }
233
234                                 // Traversing submodules
235                         $subCode='';
236                         if (is_array($moduleInfo['sub']))       {
237                                 reset($moduleInfo['sub']);
238                                 $c=0;
239                                 while(list($subName,$subInfo)=each($moduleInfo['sub'])) {
240                                         if ($c==0)              {
241                                                 $subCode.='
242                                                                 <tr class="c-first">
243                                                                         <td colspan="3"></td>
244                                                                 </tr>';
245                                                 $descrCode.='
246                                                                 <tr class="c-first">
247                                                                         <td colspan="3"></td>
248                                                                 </tr>';
249                                         }
250
251                                         $link = $subInfo['script'];
252                                         $prefix=$this->getNavFramePrefix ($moduleInfo, $subInfo);
253
254                                         $subKey = $moduleName.'_'.$subName.'_tab';
255                                         $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName);
256
257                                                 // Creating image icon
258                                         $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$subKey],$backPath));
259                                         $imageCode='';
260                                         $descr3_title = $LANG->moduleLabels['tabs'][$subKey].': '.$LANG->moduleLabels['labels'][$subKey.'label'];
261                                         if ($image)     {
262                                                 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$subKey],$backPath);
263                                                 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'" alt="" />';
264                                                 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
265                                         } else {
266                                                 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
267                                         }
268
269                                                 // Label for submodule:
270                                         $label = $LANG->moduleLabels['tabs'][$subKey];
271                                         $label_descr = ' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'"';
272                                         $flabel = htmlspecialchars($label);
273                                         $origLink = $link;
274                                         if ($link && $prefix)   $link=$prefix.rawurlencode($link);
275
276                                                 // Setting additional JavaScript if frameset script:
277                                         $addJS = '';
278                                         if ($moduleInfo['navFrameScript'])      {$addJS="+'&id='+top.rawurlencode(top.fsMod.recentIds['".$moduleName."'])";}
279
280                                                 // If there is a script to link to (and linking is not disabled.
281                                         if ($link && !$dontLink)        {
282                                                         // For condensed mode, send &cMR parameter to frameset script.
283                                                 if ($addJS && $BE_USER->uc['condensedMode'])    {$addJS.=  "+(cMR?'&cMR=1':'')";}
284
285                                                         // Command for the selector box:
286                                                 $JScmd = "
287                                                                 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+'".$this->wrapLinkWithAB($link)."'".$addJS.'+additionalGetVariables);
288                                                                 top.fsMod.currentMainLoaded="'.$moduleName.'";
289                                                                 ';
290
291                                                         // If there is a frameset script in place:
292                                                 if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript'])    {
293
294                                                                 // use special nav script from sub module, otherwise from the main module
295                                                         $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'] ;
296
297                                                                 // add GET params for sub module to the nav script
298                                                         $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam'];
299
300                                                         $JScmd = '
301                                                                 if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") {
302                                                                         top.currentSubScript="'.$origLink.'";
303                                                                         top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.'+additionalGetVariables);
304                                                                         if(top.currentSubNavScript!="'.$subNavFrameScript.'") {
305                                                                                 top.currentSubNavScript="'.$subNavFrameScript.'";
306                                                                                 top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$subNavFrameScript.'");
307                                                                         }
308                                                                 } else {
309                                                                         top.content.location=top.TS.PATH_typo3+(
310                                                                                 top.nextLoadModuleUrl?
311                                                                                 "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php":
312                                                                                 "'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables
313                                                                         );
314                                                                         top.fsMod.currentMainLoaded="'.$moduleName.'";
315                                                                         top.currentSubScript="'.$origLink.'";
316                                                                 }
317                                                                 ';
318                                                 }
319                                                 $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'_'.$subName.'\');">'.htmlspecialchars('- '.$label).'</option>';
320                                                 $onClickString = htmlspecialchars('top.goToModule(\''.$moduleName.'_'.$subName.'\');'.$onBlur.'return false;');
321
322                                                 $flabel = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.'>'.htmlspecialchars($label).'</a>';
323
324                                                 $mIcons[] = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.' class="c-subitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
325
326                                                 $JScmd.= '
327                                                                 top.highlightModuleMenuItem("'.$moduleCSSId.'");';
328                                                 $mJScmds[] = "case '".$moduleName.'_'.$subName."': \n ".$JScmd." \n break;";
329                                         }
330
331                                         $subCode.='
332                                                         <tr class="c-subitem-row" id="'.$moduleCSSId.'">
333                                                                 <td></td>
334                                                                 <td align="center">'.(!$BE_USER->uc['hideSubmoduleIcons']?$imageCode:'').'</td>
335                                                                 <td class="c-subitem-label">'.$flabel.'</td>
336                                                         </tr>';
337
338                                                 // For "About modules":
339                                         $descrCode.='
340                                                         <tr class="c-subitem-row">
341                                                                 <td align="center">'.$imageCode.'</td>
342                                                                 <td>'.$flabel.'&nbsp;&nbsp;</td>
343                                                                 <td><strong>'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'</strong><br />'.$LANG->moduleLabels['labels'][$subKey.'descr'].'</td>
344                                                         </tr>';
345
346                                                 // Possibly adding a divider line
347                                         $c++;
348                                         if ($c<count($moduleInfo['sub']))       {
349                                                         // Divider
350                                                 $subCode.='
351                                                         <tr class="c-divrow">
352                                                                 <td colspan="3"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
353                                                         </tr>';
354                                         }
355                                 }
356                                         // Spacer gif for top menu:
357                                 if (count($theModules)>$mC)     {
358                                         $mIcons[]='<img src="'.$backPath.'gfx/acm_spacer2.gif" width="8" height="12" hspace="3" alt="" />';
359                                 }
360                         }
361
362                                 // Add spacers after each main section:
363                         $subCode.='
364                                         <tr class="c-endrow">
365                                                 <td colspan="3"></td>
366                                         </tr>';
367                         $descrCode.='
368                                         <tr class="c-endrow">
369                                                 <td colspan="3"></td>
370                                         </tr>';
371
372                                 // Add sub-code:
373                         $menuCode.=$subCode;
374                 }
375
376                         // $descr==0:   Ordinary vertical menu
377                 if ($menuCode)  {
378                         if($collapsable == 1 || $config['expandAll'] == 1) {
379                                 $collapseAllHTML = '<tr class="c-endrow">
380                                                 <td></td>
381                                                 <td align="center">
382                                                                 <form action="alt_menu.php" method="get">
383                                                                         <input type="hidden" name="collapsableExpandAll" value="1" />
384                                                                         <input type="checkbox" name="expandAll" value="1" onclick="this.form.submit();" '.($config['expandAll']?'checked="checked"':'').' />
385                                                                 </form>
386                                                 </td>
387                                                 <td class="c-subitem-label">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.expandAll',1).'</td>
388                                         </tr>';
389                         } else {
390                                 $collapseAllHTML = '';
391                         }
392                         
393                         $final = '
394
395
396                                 <!--
397                                         Vertical module menu, shown in left frame of backend.
398                                 -->
399                                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu">
400                                         '.$menuCode.'
401                                         <tr class="c-endrow">
402                                                 <td colspan="3">'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_modules', $GLOBALS['BACK_PATH']).'</td></tr>
403                                         '.$collapseAllHTML.'
404                                 </table>';
405                 }
406
407                         // Output for the "About modules" module
408                 if ($descr==1)  {
409                         $descrCode = '
410
411
412                                 <!--
413                                         Listing of modules, for Help > About modules
414                                 -->
415                                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-about-modules">
416                                         '.$descrCode.'
417                                 </table>';
418                         $final = $descrCode;
419                 }
420
421                         // selector-box menu
422                 if ($descr==2)  {
423
424                                 // Add admin-functions for clearing caches:
425                         if ($BE_USER->isAdmin())        {
426                                 $functionArray = $this->adminFunctions($backPath);
427                                 if (count($functionArray))      {
428                                         $selectItems[] = '<option value=""></option>';
429                                         foreach($functionArray as $fAoptions)   {
430                                                 $selectItems[] = '<option value="'.htmlspecialchars("document.location='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>';
431                                         }
432                                 }
433                         }
434
435                                 // Logout item:
436                         $selectItems[] = '<option value=""></option>';
437                         $selectItems[] = '<option value="'.htmlspecialchars("top.location='logout.php';").'">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).' ]</option>';
438                         $final = '
439                                 <select name="menuselector" onchange="eval(this.options[this.selectedIndex].value);">
440                                         '.implode('
441                                         ',$selectItems).'
442                                 </select>';
443                 }
444                         // topmenu - horizontal line of icons!
445                 if ($descr==3)  {
446                         $final = ''.implode('',$mIcons).'';
447                 }
448
449                         // Output for the goToModules() function in main frameset.
450                 if ($descr==4)  {
451                         $final = chr(10).implode(chr(10),$mJScmds).chr(10);
452                 }
453
454                         // Return result:
455                 return $final;
456         }
457
458         /**
459          * Returns a prefix used to call the navframe with parameters to call the scripts defined in the modules info array.
460          *
461          * @param       string          Module info array
462          * @param       string          Submodule info array
463          * @return      string          Result url string
464          */
465         function getNavFramePrefix ($moduleInfo, $subModuleInfo=array()) {
466                 global $BE_USER;
467
468                 $prefix = '';
469                 $navFrameScriptParam = $subModuleInfo['navFrameScriptParam'] ? $subModuleInfo['navFrameScriptParam'] : $moduleInfo['navFrameScriptParam'];
470                 if ($moduleInfo['navFrameScript'])      {
471                         if ($BE_USER->uc['condensedMode'])      {
472                                 $prefix=$this->wrapLinkWithAB($moduleInfo['navFrameScript']).$navFrameScriptParam.'&currentSubScript=';
473                         } else {
474                                 $prefix='alt_mod_frameset.php?'.
475                                         'fW="+top.TS.navFrameWidth+"'.
476                                         '&nav="+top.TS.PATH_typo3+"'.rawurlencode($this->wrapLinkWithAB($moduleInfo['navFrameScript']).$navFrameScriptParam).
477                                         '&script=';
478                         }
479                 }
480                 return $prefix;
481         }
482
483         /**
484          * Returns $Ifilename readable for script in PATH_typo3.
485          * That means absolute names are just returned while relative names are prepended with $backPath (pointing back to typo3/ dir)
486          *
487          * @param       string          Icon filename
488          * @param       string          Back path
489          * @return      string          Result
490          * @see mIconFilename()
491          */
492         function mIconFile($Ifilename,$backPath)        {
493                 if (t3lib_div::isAbsPath($Ifilename))   {
494                         return $Ifilename;
495                 }
496                 return $backPath.$Ifilename;
497         }
498
499         /**
500          * Returns relative filename to the $Ifilename (for use in img-tags)
501          *
502          * @param       string          Icon filename
503          * @param       string          Back path
504          * @return      string          Result
505          * @see mIconFile()
506          */
507         function mIconFilename($Ifilename,$backPath)    {
508                 if (t3lib_div::isAbsPath($Ifilename))   {
509                         $Ifilename = '../'.substr($Ifilename,strlen(PATH_site));
510                 }
511                 return $backPath.$Ifilename;
512         }
513
514         /**
515          * Returns logout button.
516          *
517          * @return      string
518          */
519         function topButtons()   {
520                 global $LANG;
521
522                 $out.= '<form action="logout.php" target="_top"><input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).'" /></form>';
523                 return $out;
524         }
525
526         /**
527          * Returns logout button.
528          *
529          * @return      string
530          */
531         function adminButtons() {
532                 global $LANG;
533
534                 $functionArray = $this->adminFunctions('');
535
536                 $icons=array();
537                 foreach($functionArray as $fAoptions)   {
538                         $icons[]= '<a href="'.htmlspecialchars($fAoptions['href']).'">'.$fAoptions['icon'].'</a>';
539                 }
540
541                 return implode('',$icons);
542         }
543
544         /**
545          * Returns array with parts from which the admin functions can be constructed.
546          *
547          * @param       string          Backpath.
548          * @return      array
549          */
550         function adminFunctions($backPath)      {
551                 global $LANG,$BE_USER,$TYPO3_CONF_VARS;
552
553                 $functions=array();
554
555                         // Clearing of cache-files in typo3conf/ + menu
556                 if ($TYPO3_CONF_VARS['EXT']['extCache'])        {
557                         $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
558                         $functions[]=array(
559                                 'title' => $title,
560                                 'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=temp_CACHED',
561                                 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
562                         );
563                 }
564
565                         // Clear all page cache
566                 $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
567                 $functions[]=array(
568                         'title' => $title,
569                         'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=all',
570                         'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
571                 );
572
573                         // Return functions
574                 return $functions;
575         }
576
577         /**
578          * Appends a '?' if there is none in the string already
579          *
580          * @param       string          Link URL
581          * @return      string
582          */
583         function wrapLinkWithAB($link)  {
584                 if (!strstr($link,'?')) {
585                         return $link.'?';
586                 } else return $link;
587         }
588 }
589
590
591 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc'])      {
592         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']);
593 }
594 ?>