[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / move_el.php
1 <?php
2 /**
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 /**
16 * Move element wizard:
17 * Moving pages or content elements (tt_content) around in the system via a page tree navigation.
18 *
19 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
20 */
21 require __DIR__ . '/init.php';
22
23 /**
24 * Local extension of the page tree class
25 *
26 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
27 */
28 class moveElementLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
29
30 /**
31 * Inserting uid-information in title-text for an icon
32 *
33 * @param string $icon Icon image
34 * @param array $row Item row
35 * @return string Wrapping icon image.
36 * @todo Define visibility
37 */
38 public function wrapIcon($icon, $row) {
39 return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
40 }
41
42 }
43
44 /**
45 * Extension of position map for pages
46 *
47 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
48 */
49 class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
50
51 /**
52 * @todo Define visibility
53 */
54 public $l_insertNewPageHere = 'movePageToHere';
55
56 /**
57 * Page tree implementation class name
58 *
59 * @var string
60 */
61 protected $pageTreeClassName = 'moveElementLocalPageTree';
62
63 /**
64 * Creates the onclick event for the insert-icons.
65 *
66 * @param integer $pid The pid.
67 * @param integer $newPagePID New page id.
68 * @return string Onclick attribute content
69 * @todo Define visibility
70 */
71 public function onClickEvent($pid, $newPagePID) {
72 return 'window.location.href=\'tce_db.php?cmd[pages][' . $GLOBALS['SOBE']->moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&redirect=' . rawurlencode($this->R_URI) . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '\';return false;';
73 }
74
75 /**
76 * Wrapping page title.
77 *
78 * @param string $str Page title.
79 * @param array $rec Page record (?)
80 * @return string Wrapped title.
81 * @todo Define visibility
82 */
83 public function linkPageTitle($str, $rec) {
84 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
85 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
86 }
87
88 /**
89 * Wrap $t_code in bold IF the $dat uid matches $id
90 *
91 * @param string $t_code Title string
92 * @param array $dat Information array with record array inside.
93 * @param integer $id The current id.
94 * @return string The title string.
95 * @todo Define visibility
96 */
97 public function boldTitle($t_code, $dat, $id) {
98 return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
99 }
100
101 }
102
103 /**
104 * Extension of position map for content elements
105 *
106 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
107 */
108 class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
109
110 /**
111 * @todo Define visibility
112 */
113 public $dontPrintPageInsertIcons = 1;
114
115 /**
116 * Page tree implementation class name
117 *
118 * @var string
119 */
120 protected $pageTreeClassName = 'moveElementLocalPageTree';
121
122 /**
123 * Wrapping page title.
124 *
125 * @param string $str Page title.
126 * @param array $rec Page record (?)
127 * @return string Wrapped title.
128 * @todo Define visibility
129 */
130 public function linkPageTitle($str, $rec) {
131 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
132 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
133 }
134
135 /**
136 * Wrapping the title of the record.
137 *
138 * @param string $str The title value.
139 * @param array $row The record row.
140 * @return string Wrapped title string.
141 * @todo Define visibility
142 */
143 public function wrapRecordTitle($str, $row) {
144 if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
145 $str = '<strong>' . $str . '</strong>';
146 }
147 return parent::wrapRecordTitle($str, $row);
148 }
149 }
150
151 $moveElementController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController');
152 $moveElementController->main();
153 $moveElementController->printContent();