[TASK] Use BE Routing / PSR-7 instead of BackendUtility::getModuleUrl
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Tree / View / PageMovingPagePositionMap.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tree\View;
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\Backend\Routing\UriBuilder;
18 use TYPO3\CMS\Core\Utility\GeneralUtility;
19
20 /**
21 * Position map class for moving pages,
22 * previously resided in typo3/move_el.php
23 */
24 class PageMovingPagePositionMap extends PagePositionMap
25 {
26 /**
27 * @var string
28 */
29 public $l_insertNewPageHere = 'movePageToHere';
30
31 /**
32 * Page tree implementation class name
33 *
34 * @var string
35 */
36 protected $pageTreeClassName = PageTreeView::class;
37
38 /**
39 * Creates the onclick event for the insert-icons.
40 *
41 * @param int $pid The pid.
42 * @param int $newPagePID New page id.
43 * @return string Onclick attribute content
44 */
45 public function onClickEvent($pid, $newPagePID)
46 {
47 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
48 return 'window.location.href=' . GeneralUtility::quoteJSvalue((string)$uriBuilder->buildUriFromRoute('tce_db', [
49 'cmd[pages][' . $GLOBALS['SOBE']->moveUid . '][' . $this->moveOrCopy . ']' => $pid,
50 'redirect' => rawurlencode($this->R_URI)
51 ])) . ';return false;';
52 }
53
54 /**
55 * Wrapping page title.
56 *
57 * @param string $str Page title.
58 * @param array $rec Page record (?)
59 * @return string Wrapped title.
60 */
61 public function linkPageTitle($str, $rec)
62 {
63 $url = GeneralUtility::linkThisScript(['uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid]);
64 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
65 }
66
67 /**
68 * Wrap $t_code in bold IF the $dat uid matches $id
69 *
70 * @param string $t_code Title string
71 * @param array $dat Information array with record array inside.
72 * @param int $id The current id.
73 * @return string The title string.
74 */
75 public function boldTitle($t_code, $dat, $id)
76 {
77 return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
78 }
79 }