[TASK] Remove old code related to the extension tstemplate_styler
[Packages/TYPO3.CMS.git] / typo3 / logomenu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2006-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 * Logo menu
29 *
30 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
31 */
32
33
34 require ('init.php');
35 require ('template.php');
36
37
38 /**
39 * Script Class for rendering logo menu
40 *
41 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
42 * @package TYPO3
43 * @subpackage core
44 */
45 class SC_logomenu extends t3lib_topmenubase {
46
47 var $id = '_logomenu';
48
49 /**
50 * Main function
51 *
52 * @return void
53 */
54 function main() {
55 switch((string)t3lib_div::_GET('cmd')) {
56 case 'menuitem':
57 echo '
58 <img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />';
59
60 $menuItems = array(
61 array(
62 'title' => 'About TYPO3',
63 'xurl' => TYPO3_URL_GENERAL,
64 'subitems' => array(
65 array(
66 'title' => 'License',
67 'xurl' => TYPO3_URL_LICENSE,
68 ),
69 array(
70 'title' => 'Support',
71 'subitems' => array(
72 array(
73 'title' => 'Mailing lists',
74 'xurl' => TYPO3_URL_MAILINGLISTS,
75 ),
76 array(
77 'title' => 'Documentation',
78 'xurl' => TYPO3_URL_DOCUMENTATION,
79 ),
80 array(
81 'title' => 'Find consultancy',
82 'xurl' => TYPO3_URL_CONSULTANCY,
83 ),
84 )
85 ),
86 array(
87 'title' => 'Contribute',
88 'xurl' => TYPO3_URL_CONTRIBUTE
89 ),
90 array(
91 'title' => 'Donate',
92 'xurl' => TYPO3_URL_DONATE,
93 'icon' => '1'
94 )
95 )
96 ),
97 array(
98 'title' => 'Extensions',
99 'url' => 'mod/tools/em/index.php'
100 ),
101 array(
102 'title' => 'Menu preferences and such things',
103 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();',
104 'state' => 'checked'
105 ),
106 array(
107 'title' => '--div--'
108 ),
109 array(
110 'title' => 'Recent Items',
111 'id' => $this->id.'_recent',
112 'subitems' => array(),
113 'html' => $this->menuItemObject($this->id.'_recent','
114 fetched: false,
115 onActivate: function() {
116 // if (!this.fetched) {
117 //Element.update("'.$this->id.'_recent-layer","asdfasdf");
118 getElementContent("'.$this->id.'_recent-layer", 0, "logomenu.php?cmd=recent")
119 this.fetched = true;
120 // }
121 }
122 ')
123 ),
124 array(
125 'title' => '--div--'
126 ),
127 array(
128 'title' => 'View frontend',
129 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')
130 ),
131 array(
132 'title' => 'Log out',
133 'onclick' => "top.document.location='logout.php';"
134 ),
135 );
136
137 echo $this->menuLayer($menuItems);
138 break;
139 case 'recent':
140
141 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
142 'sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX',
143 'sys_log,pages',
144 'pages.uid=sys_log.event_pid AND sys_log.userid='.intval($GLOBALS['BE_USER']->user['uid']).
145 ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0',
146 'tablename,recuid',
147 'tstamp_MAX DESC',
148 20
149 );
150
151 $items = array();
152
153 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
154 $elRow = t3lib_BEfunc::getRecord($row['tablename'],$row['recuid']);
155 if (is_array($elRow)) {
156 $items[] = array(
157 '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']),
158 'icon' => array(t3lib_iconworks::getIcon($row['tablename'],$elRow),'width="18" height="16"'),
159 'onclick' => 'content.'.t3lib_BEfunc::editOnClick('&edit['.$row['tablename'].']['.$row['recuid'].']=edit','','dummy.php')
160 );
161 }
162 }
163
164 echo $this->menuItems($items);
165 break;
166 }
167 }
168 }
169
170
171 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/logomenu.php'])) {
172 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/logomenu.php']);
173 }
174
175
176
177 // Make instance:
178 $SOBE = t3lib_div::makeInstance('SC_logomenu');
179 $SOBE->main();
180
181 ?>