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