(trivial) Fixed bug #6170: CSC - File locallang.php used in static template instead...
[Packages/TYPO3.CMS.git] / typo3 / alt_doc_nodoc.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 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 * No-document script
29 * This is used by eg. the Doc module if no documents is registered as "open" (a concept which is better known from the "classic backend"...)
30 *
31 * $Id$
32 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
33 * XHTML compliant
34 *
35 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
36 */
37 /**
38 * [CLASS/FUNCTION INDEX of SCRIPT]
39 *
40 *
41 *
42 * 72: class SC_alt_doc_nodoc
43 * 84: function init()
44 * 108: function main()
45 * 168: function printContent()
46 *
47 * TOTAL FUNCTIONS: 3
48 * (This index is automatically created/updated by the extension "extdeveval")
49 *
50 */
51
52 require('init.php');
53 require('template.php');
54 $LANG->includeLLFile('EXT:lang/locallang_alt_doc.xml');
55 require_once(PATH_t3lib.'class.t3lib_loadmodules.php');
56
57
58 if (t3lib_extMgm::isLoaded('taskcenter') && t3lib_extMgm::isLoaded('taskcenter_recent')) {
59 require_once(t3lib_extMgm::extPath('taskcenter').'task/class.mod_user_task.php');
60 require_once(t3lib_extMgm::extPath('taskcenter_recent').'class.tx_taskcenterrecent.php');
61 }
62
63
64
65 /**
66 * Script Class for the "No-doc" display; This shows most recently edited records.
67 *
68 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
69 * @package TYPO3
70 * @subpackage core
71 */
72 class SC_alt_doc_nodoc {
73
74 // Internal:
75 var $content; // Content accumulation
76
77 /**
78 * Document template object
79 *
80 * @var mediumDoc
81 */
82 var $doc;
83
84 /**
85 * Object for backend modules.
86 *
87 * @var t3lib_loadModules
88 */
89 var $loadModules;
90
91 /**
92 * Constructor, initialize.
93 *
94 * @return void
95 */
96 function init() {
97 global $BACK_PATH;
98
99 // Start the template object:
100 $this->doc = t3lib_div::makeInstance('mediumDoc');
101 $this->doc->docType = 'xhtml_trans';
102 $this->doc->bodyTagMargins['x']=5;
103 $this->doc->bodyTagMargins['y']=5;
104 $this->doc->backPath = $BACK_PATH;
105
106 // Start the page:
107 $this->content='';
108 $this->content.=$this->doc->startPage('TYPO3 Edit Document');
109
110 // Loads the backend modules available for the logged in user.
111 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
112 $this->loadModules->load($GLOBALS['TBE_MODULES']);
113 }
114
115 /**
116 * Rendering the content.
117 *
118 * @return void
119 */
120 function main() {
121 global $BE_USER,$LANG,$BACK_PATH;
122
123 $msg=array();
124
125 // Add a message, telling that no documents were open...
126 $msg[]='<p>'.$LANG->getLL('noDocuments_msg',1).'</p><br />';
127
128 // If another page module was specified, replace the default Page module with the new one
129 $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
130 $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
131
132 // Perform some acccess checks:
133 $a_wl = $BE_USER->check('modules','web_list');
134 $a_wp = t3lib_extMgm::isLoaded('cms') && $BE_USER->check('modules',$pageModule);
135
136
137 // Finding module images: PAGE
138 $imgFile = $LANG->moduleLabels['tabs_images']['web_layout_tab'];
139 $imgInfo = @getimagesize($imgFile);
140 $img_web_layout = is_array($imgInfo) ? '<img src="../'.substr($imgFile,strlen(PATH_site)).'" '.$imgInfo[3].' alt="" />' : '';
141
142 // Finding module images: LIST
143 $imgFile = $LANG->moduleLabels['tabs_images']['web_list_tab'];
144 $imgInfo = @getimagesize($imgFile);
145 $img_web_list = is_array($imgInfo) ? '<img src="../'.substr($imgFile,strlen(PATH_site)).'" '.$imgInfo[3].' alt="" />' : '';
146
147
148 // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
149 if ($a_wl || $a_wp) {
150 $msg_2 = array();
151 if ($a_wp) { // Web>Page:
152 $msg_2[]='<strong><a href="#" onclick="top.goToModule(\''.$pageModule.'\'); return false;">'.$LANG->getLL('noDocuments_pagemodule',1).$img_web_layout.'</a></strong>';
153 if ($a_wl) $msg_2[]=$LANG->getLL('noDocuments_OR');
154 }
155 if ($a_wl) { // Web>List
156 $msg_2[]='<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">'.$LANG->getLL('noDocuments_listmodule',1).$img_web_list.'</a></strong>';
157 }
158 $msg[]='<p>'.sprintf($LANG->getLL('noDocuments_msg2',1),implode(' ',$msg_2)).'</p><br />';
159 }
160
161 // If the task center is loaded and the module of recent documents is, then display the list of the most recently edited documents:
162 if ($BE_USER->check('modules','user_task') && t3lib_extMgm::isLoaded('taskcenter_recent')) {
163 $modObj = t3lib_div::makeInstance('tx_taskcenterrecent');
164 $modObj->backPath = $BACK_PATH;
165 $modObj->BE_USER = $BE_USER;
166 $modObj->perms_clause = $BE_USER->getPagePermsClause(1);
167
168 $msg[]='<p>'.$LANG->getLL('noDocuments_msg3',1).'</p><br />'.$modObj->_renderRecent();
169 }
170
171 // Adding the content:
172 $this->content.=$this->doc->section($LANG->getLL('noDocuments'),implode(' ',$msg),0,1);
173 }
174
175 /**
176 * Printing the content.
177 *
178 * @return void
179 */
180 function printContent() {
181 $this->content.= $this->doc->endPage();
182 $this->content = $this->doc->insertStylesAndJS($this->content);
183 echo $this->content;
184 }
185 }
186
187 // Include extension?
188 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc_nodoc.php']) {
189 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_doc_nodoc.php']);
190 }
191
192
193
194
195
196
197
198
199
200
201
202 // Make instance:
203 $SOBE = t3lib_div::makeInstance('SC_alt_doc_nodoc');
204 $SOBE->init();
205 $SOBE->main();
206 $SOBE->printContent();
207 ?>