[TASK] Use BE Routing / PSR-7 instead of BackendUtility::getModuleUrl
[Packages/TYPO3.CMS.git] / typo3 / sysext / sys_action / Classes / ActionList.php
1 <?php
2 namespace TYPO3\CMS\SysAction;
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
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * Class for the list rendering of Web>Task Center module
21 */
22 class ActionList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
23 {
24 /**
25 * Creates the URL to this script, including all relevant GPvars
26 * Fixed GPvars are id, table, imagemode, returnUrl, search_field, search_levels and showLimit
27 * The GPvars "sortField" and "sortRev" are also included UNLESS they are found in the $excludeList variable.
28 *
29 * @param string $alternativeId Alternative id value. Enter blank string for the current id ($this->id)
30 * @param string $table Table name to display. Enter "-1" for the current table.
31 * @param string $excludeList Comma separated list of fields NOT to include ("sortField" or "sortRev")
32 * @return string
33 */
34 public function listURL($alternativeId = '', $table = '-1', $excludeList = '')
35 {
36 $urlParameters = [];
37 if ((string)$alternativeId !== '') {
38 $urlParameters['id'] = $alternativeId;
39 } else {
40 $urlParameters['id'] = $this->id;
41 }
42 if ($table === '-1') {
43 $urlParameters['table'] = $this->table;
44 } else {
45 $urlParameters['table'] = $table;
46 }
47 if ($this->thumbs) {
48 $urlParameters['imagemode'] = $this->thumbs;
49 }
50 if ($this->returnUrl) {
51 $urlParameters['returnUrl'] = $this->returnUrl;
52 }
53 if ($this->searchString) {
54 $urlParameters['search_field'] = $this->searchString;
55 }
56 if ($this->searchLevels) {
57 $urlParameters['search_levels'] = $this->searchLevels;
58 }
59 if ($this->showLimit) {
60 $urlParameters['showLimit'] = $this->showLimit;
61 }
62 if ($this->firstElementNumber) {
63 $urlParameters['pointer'] = $this->firstElementNumber;
64 }
65 if ((!$excludeList || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($excludeList, 'sortField')) && $this->sortField) {
66 $urlParameters['sortField'] = $this->sortField;
67 }
68 if ((!$excludeList || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($excludeList, 'sortRev')) && $this->sortRev) {
69 $urlParameters['sortRev'] = $this->sortRev;
70 }
71 if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET')) {
72 $urlParameters['SET'] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SET');
73 }
74 if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('show')) {
75 $urlParameters['show'] = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('show');
76 }
77 /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
78 $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
79 return (string)$uriBuilder->buildUriFromRoute('user_task', $urlParameters);
80 }
81 }