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