* Added Hindi language
[Packages/TYPO3.CMS.git] / typo3 / wizard_table.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 * Wizard to help make tables (eg. for tt_content elements) of type "table".
29 * Each line is a table row, each cell divided by a |
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 * 84: class SC_wizard_table
43 * 112: function init()
44 * 153: function main()
45 * 169: function printContent()
46 * 178: function tableWizard()
47 *
48 * SECTION: Helper functions
49 * 217: function getConfigCode($row)
50 * 282: function getTableHTML($cfgArr,$row)
51 * 438: function changeFunc()
52 * 554: function cfgArray2CfgString($cfgArr)
53 * 585: function cfgString2CfgArray($cfgStr,$cols)
54 *
55 * TOTAL FUNCTIONS: 9
56 * (This index is automatically created/updated by the extension "extdeveval")
57 *
58 */
59
60
61
62 $BACK_PATH='';
63 require ('init.php');
64 require ('template.php');
65 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
66
67
68
69
70
71
72
73
74
75
76
77 /**
78 * Script Class for rendering the Table Wizard
79 *
80 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
81 * @package TYPO3
82 * @subpackage core
83 */
84 class SC_wizard_table {
85
86 // Internal, dynamic:
87 var $doc; // Document template object
88 var $content; // Content accumulation for the module.
89 var $include_once=array(); // List of files to include.
90 var $inputStyle=0; // True, then <input> fields are shown, not textareas.
91
92
93 // Internal, static:
94 var $xmlStorage=0; // If set, the string version of the content is interpreted/written as XML instead of the original linebased kind. This variable still needs binding to the wizard parameters - but support is ready!
95 var $numNewRows=1; // Number of new rows to add in bottom of wizard
96 var $colsFieldName='cols'; // Name of field in parent record which MAY contain the number of columns for the table - here hardcoded to the value of tt_content. Should be set by TCEform parameters (from P)
97
98
99 // Internal, static: GPvars
100 var $P; // Wizard parameters, coming from TCEforms linking to the wizard.
101 var $TABLECFG; // The array which is constantly submitted by the multidimensional form of this wizard.
102
103
104
105
106
107
108 /**
109 * Initialization of the class
110 *
111 * @return void
112 */
113 function init() {
114 global $BACK_PATH;
115
116 // GPvars:
117 $this->P = t3lib_div::_GP('P');
118 $this->TABLECFG = t3lib_div::_GP('TABLE');
119
120 // Setting options:
121 $this->xmlStorage = $this->P['params']['xmlOutput'];
122 $this->numNewRows = t3lib_div::intInRange($this->P['params']['numNewRows'],1,50,5);
123
124 // Textareas or input fields:
125 $this->inputStyle=isset($this->TABLECFG['textFields']) ? $this->TABLECFG['textFields'] : 1;
126
127 // Document template object:
128 $this->doc = t3lib_div::makeInstance('mediumDoc');
129 $this->doc->docType = 'xhtml_trans';
130 $this->doc->backPath = $BACK_PATH;
131 $this->doc->JScode=$this->doc->wrapScriptTags('
132 function jumpToUrl(URL,formEl) { //
133 document.location = URL;
134 }
135 ');
136
137 // Setting form tag:
138 list($rUri) = explode('#',t3lib_div::getIndpEnv('REQUEST_URI'));
139 $this->doc->form ='<form action="'.htmlspecialchars($rUri).'" method="post" name="wizardForm">';
140
141 // Start page:
142 $this->content.=$this->doc->startPage('Table');
143
144 // If save command found, include tcemain:
145 if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) {
146 $this->include_once[]=PATH_t3lib.'class.t3lib_tcemain.php';
147 }
148 }
149
150 /**
151 * Main function, rendering the table wizard
152 *
153 * @return void
154 */
155 function main() {
156 global $LANG;
157
158 if ($this->P['table'] && $this->P['field'] && $this->P['uid']) {
159 $this->content.=$this->doc->section($LANG->getLL('table_title'),$this->tableWizard(),0,1);
160 } else {
161 $this->content.=$this->doc->section($LANG->getLL('table_title'),'<span class="typo3-red">'.$LANG->getLL('table_noData',1).'</span>',0,1);
162 }
163 $this->content.=$this->doc->endPage();
164 }
165
166 /**
167 * Outputting the accumulated content to screen
168 *
169 * @return void
170 */
171 function printContent() {
172 echo $this->content;
173 }
174
175 /**
176 * Draws the table wizard content
177 *
178 * @return string HTML content for the form.
179 */
180 function tableWizard() {
181
182 // First, check the references by selecting the record:
183 $row=t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
184 if (!is_array($row)) {
185 t3lib_BEfunc::typo3PrintError ('Wizard Error','No reference to record',0);
186 exit;
187 }
188
189 // This will get the content of the form configuration code field to us - possibly cleaned up, saved to database etc. if the form has been submitted in the meantime.
190 $tableCfgArray = $this->getConfigCode($row);
191
192 // Generation of the Table Wizards HTML code:
193 $content = $this->getTableHTML($tableCfgArray,$row);
194
195 // Return content:
196 return $content;
197 }
198
199
200
201
202
203
204
205 /***************************
206 *
207 * Helper functions
208 *
209 ***************************/
210
211 /**
212 * Will get and return the configuration code string
213 * Will also save (and possibly redirect/exit) the content if a save button has been pressed
214 *
215 * @param array Current parent record row
216 * @return array Table config code in an array
217 * @access private
218 */
219 function getConfigCode($row) {
220
221 // If some data has been submitted, then construct
222 if (isset($this->TABLECFG['c'])) {
223
224 // Process incoming:
225 $this->changeFunc();
226
227
228 // Convert to string (either line based or XML):
229 if ($this->xmlStorage) {
230 // Convert the input array to XML:
231 $bodyText = t3lib_div::array2xml($this->TABLECFG['c'],'',0,'T3TableWizard');
232
233 // Setting cfgArr directly from the input:
234 $cfgArr = $this->TABLECFG['c'];
235 } else {
236 // Convert the input array to a string of configuration code:
237 $bodyText = $this->cfgArray2CfgString($this->TABLECFG['c']);
238
239 // Create cfgArr from the string based configuration - that way it is cleaned up and any incompatibilities will be removed!
240 $cfgArr = $this->cfgString2CfgArray($bodyText,$row[$this->colsFieldName]);
241 }
242
243 // If a save button has been pressed, then save the new field content:
244 if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) {
245
246 // Make TCEmain object:
247 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
248 $tce->stripslashes_values=0;
249
250 // Put content into the data array:
251 $data=array();
252 $data[$this->P['table']][$this->P['uid']][$this->P['field']]=$bodyText;
253
254 // Perform the update:
255 $tce->start($data,array());
256 $tce->process_datamap();
257
258 // If the save/close button was pressed, then redirect the screen:
259 if ($_POST['saveandclosedok_x']) {
260 header('Location: '.t3lib_div::locationHeaderUrl($this->P['returnUrl']));
261 exit;
262 }
263 }
264 } else { // If nothing has been submitted, load the $bodyText variable from the selected database row:
265 if ($this->xmlStorage) {
266 $cfgArr = t3lib_div::xml2array($row[$this->P['field']]);
267 } else { // Regular linebased table configuration:
268 $cfgArr = $this->cfgString2CfgArray($row[$this->P['field']],$row[$this->colsFieldName]);
269 }
270 $cfgArr = is_array($cfgArr) ? $cfgArr : array();
271 }
272
273 return $cfgArr;
274 }
275
276 /**
277 * Creates the HTML for the Table Wizard:
278 *
279 * @param array Table config array
280 * @param array Current parent record array
281 * @return string HTML for the table wizard
282 * @access private
283 */
284 function getTableHTML($cfgArr,$row) {
285 global $LANG;
286
287 // Traverse the rows:
288 $tRows=array();
289 $k=0;
290 foreach($cfgArr as $cellArr) {
291 if (is_array($cellArr)) {
292 // Initialize:
293 $cells=array();
294 $a=0;
295
296 // Traverse the columns:
297 foreach($cellArr as $cellContent) {
298 if ($this->inputStyle) {
299 $cells[]='<input type="text"'.$this->doc->formWidth(20).' name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']" value="'.htmlspecialchars($cellContent).'" />';
300 } else {
301 $cellContent=eregi_replace('<br[ ]?[\/]?>',chr(10),$cellContent);
302 $cells[]='<textarea '.$this->doc->formWidth(20).' rows="5" name="TABLE[c]['.(($k+1)*2).']['.(($a+1)*2).']">'.t3lib_div::formatForTextarea($cellContent).'</textarea>';
303 }
304
305 // Increment counter:
306 $a++;
307 }
308
309 // CTRL panel for a table row (move up/down/around):
310 $onClick="document.wizardForm.action+='#ANC_".(($k+1)*2-2)."';";
311 $onClick=' onclick="'.htmlspecialchars($onClick).'"';
312 $ctrl='';
313
314 $brTag=$this->inputStyle?'':'<br />';
315 if ($k!=0) {
316 $ctrl.='<input type="image" name="TABLE[row_up]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/pil2up.gif','').$onClick.' title="'.$LANG->getLL('table_up',1).'" />'.$brTag;
317 } else {
318 $ctrl.='<input type="image" name="TABLE[row_bottom]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/turn_up.gif','').$onClick.' title="'.$LANG->getLL('table_bottom',1).'" />'.$brTag;
319 }
320 $ctrl.='<input type="image" name="TABLE[row_remove]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/garbage.gif','').$onClick.' title="'.$LANG->getLL('table_removeRow',1).'" />'.$brTag;
321
322 if (($k+1)!=count($tLines)) {
323 $ctrl.='<input type="image" name="TABLE[row_down]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/pil2down.gif','').$onClick.' title="'.$LANG->getLL('table_down',1).'" />'.$brTag;
324 } else {
325 $ctrl.='<input type="image" name="TABLE[row_top]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/turn_down.gif','').$onClick.' title="'.$LANG->getLL('table_top',1).'" />'.$brTag;
326 }
327 $ctrl.='<input type="image" name="TABLE[row_add]['.(($k+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/add.gif','').$onClick.' title="'.$LANG->getLL('table_addRow',1).'" />'.$brTag;
328
329 $tRows[]='
330 <tr class="bgColor4">
331 <td class="bgColor5"><a name="ANC_'.(($k+1)*2).'"></a><span class="c-wizButtonsV">'.$ctrl.'</span></td>
332 <td>'.implode('</td>
333 <td>',$cells).'</td>
334 </tr>';
335
336 // Increment counter:
337 $k++;
338 }
339 }
340
341 // CTRL panel for a table column (move left/right/around/delete)
342 $cells=array();
343 $cells[]='';
344 // Finding first row:
345 reset($cfgArr);
346 $firstRow=current($cfgArr);
347 if (is_array($firstRow)) {
348
349 // Init:
350 $a=0;
351 $cols=count($firstRow);
352
353 // Traverse first row:
354 foreach($firstRow as $temp) {
355 $ctrl='';
356 if ($a!=0) {
357 $ctrl.='<input type="image" name="TABLE[col_left]['.(($a+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/pil2left.gif','').' title="'.$LANG->getLL('table_left',1).'" />';
358 } else {
359 $ctrl.='<input type="image" name="TABLE[col_end]['.(($a+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/turn_left.gif','').' title="'.$LANG->getLL('table_end',1).'" />';
360 }
361 $ctrl.='<input type="image" name="TABLE[col_remove]['.(($a+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/garbage.gif','').' title="'.$LANG->getLL('table_removeColumn',1).'" />';
362 if (($a+1)!=$cols) {
363 $ctrl.='<input type="image" name="TABLE[col_right]['.(($a+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/pil2right.gif','').' title="'.$LANG->getLL('table_right',1).'" />';
364 } else {
365 $ctrl.='<input type="image" name="TABLE[col_start]['.(($a+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/turn_right.gif','').' title="'.$LANG->getLL('table_start',1).'" />';
366 }
367 $ctrl.='<input type="image" name="TABLE[col_add]['.(($a+1)*2).']"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/add.gif','').' title="'.$LANG->getLL('table_addColumn',1).'" />';
368 $cells[]='<span class="c-wizButtonsH">'.$ctrl.'</span>';
369
370 // Incr. counter:
371 $a++;
372 }
373 $tRows[]='
374 <tr class="bgColor5">
375 <td align="center">'.implode('</td>
376 <td align="center">',$cells).'</td>
377 </tr>';
378 }
379
380 $content = '';
381
382 // Add CSH:
383 $content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_table_wiz', $GLOBALS['BACK_PATH'],'');
384
385 // Implode all table rows into a string, wrapped in table tags.
386 $content.= '
387
388
389 <!--
390 Table wizard
391 -->
392 <table border="0" cellpadding="0" cellspacing="1" id="typo3-tablewizard">
393 '.implode('',$tRows).'
394 </table>';
395
396 // Add saving buttons in the bottom:
397 $content.= '
398
399 <!--
400 Save buttons:
401 -->
402 <div id="c-saveButtonPanel">';
403 $content.= '<input type="image" class="c-inputButton" name="savedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/savedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" />';
404 $content.= '<input type="image" class="c-inputButton" name="saveandclosedok"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/saveandclosedok.gif','').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
405 $content.= '<a href="#" onclick="'.htmlspecialchars('jumpToUrl(unescape(\''.rawurlencode($this->P['returnUrl']).'\')); return false;').'">'.
406 '<img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/closedok.gif','width="21" height="16"').' class="c-inputButton" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" alt="" />'.
407 '</a>';
408 $content.= '<input type="image" class="c-inputButton" name="_refresh"'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/refresh_n.gif','').' title="'.$LANG->getLL('forms_refresh',1).'" />';
409 $content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'wizard_table_wiz_buttons', $GLOBALS['BACK_PATH'],'');
410 $content.= '
411 </div>
412 ';
413
414 // Input type checkbox:
415 $content.= '
416
417 <!--
418 Input mode check box:
419 -->
420 <div id="c-inputMode">
421 '.
422 '<input type="hidden" name="TABLE[textFields]" value="0" />'.
423 '<input type="checkbox" name="TABLE[textFields]" value="1"'.($this->inputStyle?' checked="checked"':'').' /> '.
424 $LANG->getLL('table_smallFields').'
425 </div>
426
427 <br /><br />
428 ';
429
430 // Return content:
431 return $content;
432 }
433
434 /**
435 * Detects if a control button (up/down/around/delete) has been pressed for an item and accordingly it will manipulate the internal TABLECFG array
436 *
437 * @return void
438 * @access private
439 */
440 function changeFunc() {
441 if ($this->TABLECFG['col_remove']) {
442 $kk = key($this->TABLECFG['col_remove']);
443 $cmd='col_remove';
444 } elseif ($this->TABLECFG['col_add']) {
445 $kk = key($this->TABLECFG['col_add']);
446 $cmd='col_add';
447 } elseif ($this->TABLECFG['col_start']) {
448 $kk = key($this->TABLECFG['col_start']);
449 $cmd='col_start';
450 } elseif ($this->TABLECFG['col_end']) {
451 $kk = key($this->TABLECFG['col_end']);
452 $cmd='col_end';
453 } elseif ($this->TABLECFG['col_left']) {
454 $kk = key($this->TABLECFG['col_left']);
455 $cmd='col_left';
456 } elseif ($this->TABLECFG['col_right']) {
457 $kk = key($this->TABLECFG['col_right']);
458 $cmd='col_right';
459 } elseif ($this->TABLECFG['row_remove']) {
460 $kk = key($this->TABLECFG['row_remove']);
461 $cmd='row_remove';
462 } elseif ($this->TABLECFG['row_add']) {
463 $kk = key($this->TABLECFG['row_add']);
464 $cmd='row_add';
465 } elseif ($this->TABLECFG['row_top']) {
466 $kk = key($this->TABLECFG['row_top']);
467 $cmd='row_top';
468 } elseif ($this->TABLECFG['row_bottom']) {
469 $kk = key($this->TABLECFG['row_bottom']);
470 $cmd='row_bottom';
471 } elseif ($this->TABLECFG['row_up']) {
472 $kk = key($this->TABLECFG['row_up']);
473 $cmd='row_up';
474 } elseif ($this->TABLECFG['row_down']) {
475 $kk = key($this->TABLECFG['row_down']);
476 $cmd='row_down';
477 }
478
479 if ($cmd && t3lib_div::testInt($kk)) {
480 if (substr($cmd,0,4)=='row_') {
481 switch($cmd) {
482 case 'row_remove':
483 unset($this->TABLECFG['c'][$kk]);
484 break;
485 case 'row_add':
486 for($a=1;$a<=$this->numNewRows;$a++) {
487 if (!isset($this->TABLECFG['c'][$kk+$a])) { // Checking if set: The point is that any new row inbetween existing rows will be true after one row is added while if rows are added in the bottom of the table there will be no existing rows to stop the addition of new rows which means it will add up to $this->numNewRows rows then.
488 $this->TABLECFG['c'][$kk+$a] = array();
489 } else {
490 break;
491 }
492 }
493 break;
494 case 'row_top':
495 $this->TABLECFG['c'][1]=$this->TABLECFG['c'][$kk];
496 unset($this->TABLECFG['c'][$kk]);
497 break;
498 case 'row_bottom':
499 $this->TABLECFG['c'][10000000]=$this->TABLECFG['c'][$kk];
500 unset($this->TABLECFG['c'][$kk]);
501 break;
502 case 'row_up':
503 $this->TABLECFG['c'][$kk-3]=$this->TABLECFG['c'][$kk];
504 unset($this->TABLECFG['c'][$kk]);
505 break;
506 case 'row_down':
507 $this->TABLECFG['c'][$kk+3]=$this->TABLECFG['c'][$kk];
508 unset($this->TABLECFG['c'][$kk]);
509 break;
510 }
511 ksort($this->TABLECFG['c']);
512 }
513 if (substr($cmd,0,4)=='col_') {
514 reset($this->TABLECFG['c']);
515 while(list($cAK)=each($this->TABLECFG['c'])) {
516 switch($cmd) {
517 case 'col_remove':
518 unset($this->TABLECFG['c'][$cAK][$kk]);
519 break;
520 case 'col_add':
521 $this->TABLECFG['c'][$cAK][$kk+1]='';
522 break;
523 case 'col_start':
524 $this->TABLECFG['c'][$cAK][1]=$this->TABLECFG['c'][$cAK][$kk];
525 unset($this->TABLECFG['c'][$cAK][$kk]);
526 break;
527 case 'col_end':
528 $this->TABLECFG['c'][$cAK][1000000]=$this->TABLECFG['c'][$cAK][$kk];
529 unset($this->TABLECFG['c'][$cAK][$kk]);
530 break;
531 case 'col_left':
532 $this->TABLECFG['c'][$cAK][$kk-3]=$this->TABLECFG['c'][$cAK][$kk];
533 unset($this->TABLECFG['c'][$cAK][$kk]);
534 break;
535 case 'col_right':
536 $this->TABLECFG['c'][$cAK][$kk+3]=$this->TABLECFG['c'][$cAK][$kk];
537 unset($this->TABLECFG['c'][$cAK][$kk]);
538 break;
539 }
540 ksort($this->TABLECFG['c'][$cAK]);
541 }
542 }
543 }
544
545 // Convert line breaks to <br /> tags:
546 reset($this->TABLECFG['c']);
547 while(list($a)=each($this->TABLECFG['c'])) {
548 reset($this->TABLECFG['c'][$a]);
549 while(list($b)=each($this->TABLECFG['c'][$a])) {
550 $this->TABLECFG['c'][$a][$b] = str_replace(chr(10),'<br />',str_replace(chr(13),'',$this->TABLECFG['c'][$a][$b]));
551 }
552 }
553 }
554
555 /**
556 * Converts the input array to a configuration code string
557 *
558 * @param array Array of table configuration (follows the input structure from the table wizard POST form)
559 * @return string The array converted into a string with line-based configuration.
560 * @see cfgString2CfgArray()
561 */
562 function cfgArray2CfgString($cfgArr) {
563
564 // Initialize:
565 $inLines=array();
566
567 // Traverse the elements of the table wizard and transform the settings into configuration code.
568 reset($this->TABLECFG['c']);
569 while(list($a)=each($this->TABLECFG['c'])) {
570 $thisLine=array();
571 reset($this->TABLECFG['c'][$a]);
572 while(list($b)=each($this->TABLECFG['c'][$a])) {
573 $thisLine[]=str_replace('|','',$this->TABLECFG['c'][$a][$b]);
574 }
575 $inLines[]=implode('|',$thisLine);
576 }
577
578 // Finally, implode the lines into a string:
579 $bodyText = implode(chr(10),$inLines);
580
581 // Return the configuration code:
582 return $bodyText;
583 }
584
585 /**
586 * Converts the input configuration code string into an array
587 *
588 * @param string Configuration code
589 * @param integer Default number of columns
590 * @return array Configuration array
591 * @see cfgArray2CfgString()
592 */
593 function cfgString2CfgArray($cfgStr,$cols) {
594
595 // Explode lines in the configuration code - each line is a table row.
596 $tLines=explode(chr(10),$cfgStr);
597
598 // Setting number of columns
599 if (!$cols && trim($tLines[0])) { // auto...
600 $cols = count(explode('|',$tLines[0]));
601 }
602 $cols=$cols?$cols:4;
603
604 // Traverse the number of table elements:
605 $cfgArr=array();
606 foreach($tLines as $k => $v) {
607
608 // Initialize:
609 $vParts = explode('|',$v);
610
611 // Traverse columns:
612 for ($a=0;$a<$cols;$a++) {
613 $cfgArr[$k][$a]=$vParts[$a];
614 }
615 }
616
617 // Return configuration array:
618 return $cfgArr;
619 }
620 }
621
622 // Include extension?
623 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_table.php']) {
624 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/wizard_table.php']);
625 }
626
627
628
629
630
631
632
633
634
635
636
637
638 // Make instance:
639 $SOBE = t3lib_div::makeInstance('SC_wizard_table');
640 $SOBE->init();
641
642 // Include files?
643 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
644
645 $SOBE->main();
646 $SOBE->printContent();
647 ?>