[TASK] CGL FunctionCallArgumentSpacingNoSpaceAfterComma in /typo3/
[Packages/TYPO3.CMS.git] / typo3 / wizard_list.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (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 list records from a page id.
29 *
30 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
31 * XHTML compliant
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35
36
37
38 $BACK_PATH='';
39 require ('init.php');
40 require ('template.php');
41 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
42
43
44
45
46
47
48
49
50
51
52
53 /**
54 * Script Class for redirecting the user to the Web > List module if a wizard-link has been clicked in TCEforms
55 *
56 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
57 * @package TYPO3
58 * @subpackage core
59 */
60 class SC_wizard_list {
61
62 // Internal, static:
63 var $pid; // PID
64
65 // Internal, static: GPvars
66 var $P; // Wizard parameters, coming from TCEforms linking to the wizard.
67 var $table; // Table to show, if none, then all tables are listed in list module.
68 var $id; // Page id to list.
69
70
71
72
73
74 /**
75 * Initialization of the class, setting GPvars.
76 *
77 * @return void
78 */
79 function init() {
80 $this->P = t3lib_div::_GP('P');
81 $this->table = t3lib_div::_GP('table');
82 $this->id = t3lib_div::_GP('id');
83 }
84
85 /**
86 * Main function
87 * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
88 *
89 * @return void
90 */
91 function main() {
92
93 // Get this record
94 $origRow = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
95
96 // Get TSconfig for it.
97 $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table, is_array($origRow)?$origRow:array('pid'=>$this->P['pid']));
98
99 // Set [params][pid]
100 if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
101 $this->pid = intval($TSconfig['_'.substr($this->P['params']['pid'], 3, -3)]);
102 } else $this->pid = intval($this->P['params']['pid']);
103
104 // Make redirect:
105 if (!strcmp($this->pid, '') || strcmp($this->id, '')) { // If pid is blank OR if id is set, then return...
106 $redirectUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']);
107 } else { // Otherwise, show the list:
108 $urlParameters = array();
109 $urlParameters['id'] = $this->pid;
110 $urlParameters['table'] = $this->P['params']['table'];
111 $urlParameters['returnUrl'] = t3lib_div::getIndpEnv('REQUEST_URI');
112 $redirectUrl = t3lib_BEfunc::getModuleUrl('web_list', $urlParameters);
113 }
114 t3lib_utility_Http::redirect($redirectUrl);
115 }
116 }
117
118 // Make instance:
119 $SOBE = t3lib_div::makeInstance('SC_wizard_list');
120 $SOBE->init();
121 $SOBE->main();
122
123 ?>