[TASK] Remove trailing newlines from EOF
[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 * [CLASS/FUNCTION INDEX of SCRIPT]
37 *
38 *
39 *
40 * 74: class SC_wizard_list
41 * 93: function init()
42 * 105: function main()
43 *
44 * TOTAL FUNCTIONS: 2
45 * (This index is automatically created/updated by the extension "extdeveval")
46 *
47 */
48
49
50
51 $BACK_PATH='';
52 require ('init.php');
53 require ('template.php');
54 $LANG->includeLLFile('EXT:lang/locallang_wizards.xml');
55
56
57
58
59
60
61
62
63
64
65
66 /**
67 * Script Class for redirecting the user to the Web > List module if a wizard-link has been clicked in TCEforms
68 *
69 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
70 * @package TYPO3
71 * @subpackage core
72 */
73 class SC_wizard_list {
74
75 // Internal, static:
76 var $pid; // PID
77
78 // Internal, static: GPvars
79 var $P; // Wizard parameters, coming from TCEforms linking to the wizard.
80 var $table; // Table to show, if none, then all tables are listed in list module.
81 var $id; // Page id to list.
82
83
84
85
86
87 /**
88 * Initialization of the class, setting GPvars.
89 *
90 * @return void
91 */
92 function init() {
93 $this->P = t3lib_div::_GP('P');
94 $this->table = t3lib_div::_GP('table');
95 $this->id = t3lib_div::_GP('id');
96 }
97
98 /**
99 * Main function
100 * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
101 *
102 * @return void
103 */
104 function main() {
105
106 // Get this record
107 $origRow = t3lib_BEfunc::getRecord($this->P['table'],$this->P['uid']);
108
109 // Get TSconfig for it.
110 $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table,is_array($origRow)?$origRow:array('pid'=>$this->P['pid']));
111
112 // Set [params][pid]
113 if (substr($this->P['params']['pid'],0,3)=='###' && substr($this->P['params']['pid'],-3)=='###') {
114 $this->pid = intval($TSconfig['_'.substr($this->P['params']['pid'],3,-3)]);
115 } else $this->pid = intval($this->P['params']['pid']);
116
117 // Make redirect:
118 if (!strcmp($this->pid,'') || strcmp($this->id,'')) { // If pid is blank OR if id is set, then return...
119 $redirectUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']);
120 } else { // Otherwise, show the list:
121 $urlParameters = array();
122 $urlParameters['id'] = $this->pid;
123 $urlParameters['table'] = $this->P['params']['table'];
124 $urlParameters['returnUrl'] = t3lib_div::getIndpEnv('REQUEST_URI');
125 $redirectUrl = t3lib_BEfunc::getModuleUrl('web_list', $urlParameters);
126 }
127 t3lib_utility_Http::redirect($redirectUrl);
128 }
129 }
130
131
132 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/wizard_list.php'])) {
133 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/wizard_list.php']);
134 }
135
136
137
138 // Make instance:
139 $SOBE = t3lib_div::makeInstance('SC_wizard_list');
140 $SOBE->init();
141 $SOBE->main();
142
143 ?>