TYPO3 CMS  TYPO3_7-6
ListController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 
27 {
31  public $pid;
32 
38  public $P;
39 
45  public $table;
46 
52  public $id;
53 
57  public function __construct()
58  {
59  parent::__construct();
60  $this->getLanguageService()->includeLLFile('EXT:lang/locallang_wizards.xlf');
61  $GLOBALS['SOBE'] = $this;
62  $this->P = GeneralUtility::_GP('P');
63  $this->table = GeneralUtility::_GP('table');
64  $this->id = GeneralUtility::_GP('id');
65  }
66 
75  public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
76  {
77  $this->main();
78  return $response;
79  }
80 
87  public function main()
88  {
89  // Get this record
90  $origRow = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
91  // Get TSconfig for it.
93  $this->table,
94  is_array($origRow) ? $origRow : ['pid' => $this->P['pid']]
95  );
96  // Set [params][pid]
97  if (substr($this->P['params']['pid'], 0, 3) === '###' && substr($this->P['params']['pid'], -3) === '###') {
98  $keyword = substr($this->P['params']['pid'], 3, -3);
99  if (strpos($keyword, 'PAGE_TSCONFIG_') === 0) {
100  $this->pid = (int)$TSconfig[$this->P['field']][$keyword];
101  } else {
102  $this->pid = (int)$TSconfig['_' . $keyword];
103  }
104  } else {
105  $this->pid = (int)$this->P['params']['pid'];
106  }
107  // Make redirect:
108  // If pid is blank OR if id is set, then return...
109  if ((string)$this->id !== '') {
110  $redirectUrl = GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']);
111  } else {
112  // Otherwise, show the list:
113  $urlParameters = [];
114  $urlParameters['id'] = $this->pid;
115  $urlParameters['table'] = $this->P['params']['table'];
116  $urlParameters['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
117  $redirectUrl = BackendUtility::getModuleUrl('web_list', $urlParameters);
118  }
119  HttpUtility::redirect($redirectUrl);
120  }
121 }
mainAction(ServerRequestInterface $request, ResponseInterface $response)
static redirect($url, $httpStatus=self::HTTP_STATUS_303)
Definition: HttpUtility.php:76
static getRecord($table, $uid, $fields=' *', $where='', $useDeleteClause=true)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']