TYPO3 API  SVNRelease
logomenu.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2006-2011 Kasper Skårhøj (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 ***************************************************************/
00027 /**
00028  * Logo menu
00029  *
00030  * $Id: logomenu.php 10317 2011-01-26 00:56:49Z baschny $
00031  *
00032  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00033  */
00034 /**
00035  * [CLASS/FUNCTION INDEX of SCRIPT]
00036  *
00037  */
00038 
00039 
00040 require ('init.php');
00041 require ('template.php');
00042 
00043 
00044 /**
00045  * Script Class for rendering logo menu
00046  *
00047  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00048  * @package TYPO3
00049  * @subpackage core
00050  */
00051 class SC_logomenu extends t3lib_topmenubase {
00052 
00053     var $id = '_logomenu';
00054 
00055     /**
00056      * Main function
00057      *
00058      * @return  void
00059      */
00060     function main() {
00061         switch((string)t3lib_div::_GET('cmd'))  {
00062             case 'menuitem':
00063                 echo '
00064                 <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />';
00065 
00066                 $menuItems = array(
00067                     array(
00068                         'title' => 'About TYPO3',
00069                         'xurl' => TYPO3_URL_GENERAL,
00070                         'subitems' => array(
00071                             array(
00072                                 'title' => 'License',
00073                                 'xurl' => TYPO3_URL_LICENSE,
00074                             ),
00075                             array(
00076                                 'title' => 'Support',
00077                                 'subitems' => array(
00078                                     array(
00079                                         'title' => 'Mailing lists',
00080                                         'xurl' => TYPO3_URL_MAILINGLISTS,
00081                                     ),
00082                                     array(
00083                                         'title' => 'Documentation',
00084                                         'xurl' => TYPO3_URL_DOCUMENTATION,
00085                                     ),
00086                                     array(
00087                                         'title' => 'Find consultancy',
00088                                         'xurl' => TYPO3_URL_CONSULTANCY,
00089                                     ),
00090                                 )
00091                             ),
00092                             array(
00093                                 'title' => 'Contribute',
00094                                 'xurl' => TYPO3_URL_CONTRIBUTE
00095                             ),
00096                             array(
00097                                 'title' => 'Donate',
00098                                 'xurl' => TYPO3_URL_DONATE,
00099                                 'icon' => '1'
00100                             )
00101                         )
00102                     ),
00103                     array(
00104                         'title' => 'Extensions',
00105                         'url' => 'mod/tools/em/index.php'
00106                     ),
00107                     array(
00108                         'title' => 'Menu preferences and such things',
00109                         'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();',
00110                         'state' => 'checked'
00111                     ),
00112                     array(
00113                         'title' => '--div--'
00114                     ),
00115                     array(
00116                         'title' => 'Recent Items',
00117                         'id' => $this->id.'_recent',
00118                         'subitems' => array(),
00119                         'html' => $this->menuItemObject($this->id.'_recent','
00120                             fetched: false,
00121                             onActivate: function() {
00122 //                              if (!this.fetched)  {
00123                                     //Element.update("'.$this->id.'_recent-layer","asdfasdf");
00124                                     getElementContent("'.$this->id.'_recent-layer", 0, "logomenu.php?cmd=recent")
00125                                     this.fetched = true;
00126 //                              }
00127                             }
00128                         ')
00129                     ),
00130                     array(
00131                         'title' => '--div--'
00132                     ),
00133                     array(
00134                         'title' => 'View frontend',
00135                         'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')
00136                     ),
00137                     array(
00138                         'title' => 'Log out',
00139                         'onclick' => "top.document.location='logout.php';"
00140                     ),
00141                 );
00142 
00143                 echo $this->menuLayer($menuItems);
00144             break;
00145             case 'recent':
00146 
00147                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00148                             'sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX',
00149                             'sys_log,pages',
00150                             'pages.uid=sys_log.event_pid AND sys_log.userid='.intval($GLOBALS['BE_USER']->user['uid']).
00151                                 ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0',
00152                             'tablename,recuid',
00153                             'tstamp_MAX DESC',
00154                             20
00155                         );
00156 
00157                 $items = array();
00158 
00159                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00160                     $elRow = t3lib_BEfunc::getRecord($row['tablename'],$row['recuid']);
00161                     if (is_array($elRow))   {
00162                         $items[] = array(
00163                             'title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'], $elRow), $GLOBALS['BE_USER']->uc['titleLen']) . ' - ' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $row['tstamp_MAX']),
00164                             'icon' => array(t3lib_iconworks::getIcon($row['tablename'],$elRow),'width="18" height="16"'),
00165                             'onclick' => 'content.'.t3lib_BEfunc::editOnClick('&edit['.$row['tablename'].']['.$row['recuid'].']=edit','','dummy.php')
00166                         );
00167                     }
00168                 }
00169 
00170                 echo $this->menuItems($items);
00171             break;
00172         }
00173     }
00174 }
00175 
00176 
00177 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/logomenu.php'])) {
00178     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/logomenu.php']);
00179 }
00180 
00181 
00182 
00183 // Make instance:
00184 $SOBE = t3lib_div::makeInstance('SC_logomenu');
00185 $SOBE->main();
00186 
00187 ?>