even more intendation changes in typo3/sysext/taskcenter/task/*
[Packages/TYPO3.CMS.git] / typo3 / sysext / taskcenter / task / index.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 * User Task Center
29 *
30 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
31 * @author Christian Jul Jensen <christian(at)jul(dot)net>
32 * Revision for TYPO3 3.8.0 / Native Workflow System
33 */
34
35 unset($MCONF);
36 require ('conf.php');
37 require ($BACK_PATH.'init.php');
38 require ($BACK_PATH.'template.php');
39 $LANG->includeLLFile('EXT:taskcenter/task/locallang.php');
40 require_once(PATH_t3lib.'class.t3lib_scbase.php');
41 require_once('class.mod_user_task.php');
42
43 $BE_USER->modAccess($MCONF, 1);
44
45
46 // ***************************
47 // Script Classes
48 // ***************************
49 class SC_mod_user_task_index extends t3lib_SCbase {
50 var $allExtClassConf = array();
51 var $backPath;
52
53 /**
54 * BE user
55 *
56 * @var t3lib_beUserAuth
57 */
58 var $BE_USER;
59
60 /**
61 * document template object
62 *
63 * @var noDoc
64 */
65 var $doc;
66
67 /**
68 * This makes sure that all classes of task-center related extensions are included
69 * Further it registers the classes in the variable $this->allExtClassConf
70 *
71 * @return void
72 */
73 function includeAllClasses() {
74 foreach($this->MOD_MENU['function'] as $key => $name) {
75 $curExtClassConf = $this->getExternalItemConfig($this->MCONF['name'], 'function', $key);
76 if (is_array($curExtClassConf) && $curExtClassConf['path']) {
77 $this->allExtClassConf[] = $curExtClassConf;
78 $this->include_once[] = $curExtClassConf['path'];
79 }
80 }
81 }
82
83 /**
84 * This is the main function called by the TYPO3 framework
85 *
86 * @return string The conntent of the module (HTML)
87 */
88 function main() {
89 global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
90
91 /* Setup document template */
92 $this->doc = t3lib_div::makeInstance('noDoc');
93 $this->doc->docType = 'xhtml_trans';
94 $this->doc->divClass = '';
95 $this->doc->form = '<form action="index.php" method="POST" name="editform">';
96 $this->backPath = $this->doc->backPath = $BACK_PATH;
97 $this->doc->JScode = ' <script language="javascript" type="text/javascript">
98 script_ended = 0;
99 function jumpToUrl(URL) {
100 window.location.href = URL;
101 }
102 '.(is_object($this->extObj)?$this->extObj->JScode():"").'
103 </script>
104 ';
105 $this->doc->JScode .= $this->doc->getDynTabMenuJScode();
106 $this->doc->JScode .= '<script language="javascript" type="text/javascript">
107 function resizeIframe(frame,max) {
108 try {
109 innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
110 if(max==0) {
111 frame.height = innerDoc.body.scrollHeight + 30;
112 } else {
113 frame.height = Math.max(innerDoc.body.scrollHeight + 30,document.body.scrollHeight);
114 }
115 }
116 catch (e) {
117 window.status = e.message;
118 }
119 }
120 </script>';
121
122 /* call getMainContent first, because what happens here might affect leftContent */
123 $mainContent = $this->getMainContent();
124
125 /* content... */
126 $this->content = '';
127 $this->content .= $this->doc->startPage($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']]);
128 $this->content .= '<table style="width: 98%;"><tr>';
129 $this->content .= '<td valign="top" style="width: 20%;">'.$this->getleftHeader().$this->getDynTabMenu().'</td>';
130 $this->content .= '<td valign="top" style="height:100%">'.$mainContent.'</td>';
131 $this->content .= '</tr></table>';
132 }
133
134 /** Generate the dynamic tab menu in the left side by iterating
135 * over all submodules and creating configurations.
136 *
137 * @return string the code for the dynamic tab menu (HTML)
138 */
139 function getDynTabMenu() {
140 //walk through registered submodules and generate configuration
141 //for tabmenu
142 $parts = Array();
143 foreach($this->allExtClassConf as $conf) {
144 $extObj = t3lib_div::makeInstance($conf['name']);
145 /* call init to make sure the LOCAL_LANG is included for all listed
146 * extensions. If they OVERRIDE each other there is trouble! */
147 $extObj->init($this, $conf);
148 $extObj->backPath = $this->backPath;
149 $extObj->mod_user_task_init($GLOBALS['BE_USER']);
150 $part = $extObj->overview_main();
151 if (is_array($part)) {
152 $parts[] = $part;
153 }
154 }
155 return $this->doc->getDynTabMenu($parts, 'tx_taskcenter', 1, true);
156 }
157
158 /**
159 * Generate the header of the left column
160 *
161 * @return string header in the left side (HTML)
162 */
163 function getleftHeader() {
164 $name = $GLOBALS['BE_USER']->user['realName']?$GLOBALS['BE_USER']->user['realName']:
165 $GLOBALS['BE_USER']->user['username'];
166 return '<h1>TYPO3 taskcenter <br />'.$name.'</h1>';
167 }
168
169 /**
170 * Get the main content for the module by initiating the external object (if any) and calling it's main function.
171 *
172 * @return string main content (HTML)
173 */
174 function getMainContent() {
175 if (is_object($this->extObj)) {
176 $this->extObj->backPath = $this->backPath;
177 $this->extObj->mod_user_task_init($GLOBALS['BE_USER']);
178 return $this->extObj->main();
179 }
180 }
181
182 /**
183 * Output the content of the object to the browser
184 *
185 * @return void
186 */
187 function printContent() {
188 $this->content .= $this->doc->endPage();
189 echo $this->content;
190 }
191
192 }
193
194
195
196 // Include extension?
197 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/taskcenter/task/index.php']) {
198 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/taskcenter/task/index.php']);
199 }
200
201
202
203 // Make instance:
204 $SOBE = t3lib_div::makeInstance('SC_mod_user_task_index');
205 $SOBE->init();
206 $SOBE->includeAllClasses();
207
208 // Include files?
209 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
210 $SOBE->checkExtObj(); // Checking for first level external objects
211
212 $SOBE->main();
213 $SOBE->printContent();
214
215 ?>