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