[TASK] Remove "require_once" in /typo3/
[Packages/TYPO3.CMS.git] / typo3 / move_el.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2013 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 * Move element wizard:
29 * Moving pages or content elements (tt_content) around in the system via a page tree navigation.
30 *
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
32 * XHTML compatible.
33 *
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
35 */
36
37 $BACK_PATH = '';
38 require 'init.php';
39 $LANG->includeLLFile('EXT:lang/locallang_misc.xlf');
40
41 /**
42 * Local extension of the page tree class
43 *
44 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
45 */
46 class localPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
47
48 /**
49 * Inserting uid-information in title-text for an icon
50 *
51 * @param string $icon Icon image
52 * @param array $row Item row
53 * @return string Wrapping icon image.
54 * @todo Define visibility
55 */
56 public function wrapIcon($icon, $row) {
57 return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
58 }
59
60 }
61
62 /**
63 * Extension of position map for pages
64 *
65 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
66 */
67 class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
68
69 /**
70 * @todo Define visibility
71 */
72 public $l_insertNewPageHere = 'movePageToHere';
73
74 /**
75 * Creates the onclick event for the insert-icons.
76 *
77 * @param integer $pid The pid.
78 * @param integer $newPagePID New page id.
79 * @return string Onclick attribute content
80 * @todo Define visibility
81 */
82 public function onClickEvent($pid, $newPagePID) {
83 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;';
84 }
85
86 /**
87 * Wrapping page title.
88 *
89 * @param string $str Page title.
90 * @param array $rec Page record (?)
91 * @return string Wrapped title.
92 * @todo Define visibility
93 */
94 public function linkPageTitle($str, $rec) {
95 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($rec['uid']), 'moveUid' => $GLOBALS['SOBE']->moveUid));
96 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
97 }
98
99 /**
100 * Wrap $t_code in bold IF the $dat uid matches $id
101 *
102 * @param string $t_code Title string
103 * @param array $dat Infomation array with record array inside.
104 * @param integer $id The current id.
105 * @return string The title string.
106 * @todo Define visibility
107 */
108 public function boldTitle($t_code, $dat, $id) {
109 return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
110 }
111
112 }
113
114 /**
115 * Extension of position map for content elements
116 *
117 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
118 */
119 class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
120
121 /**
122 * @todo Define visibility
123 */
124 public $dontPrintPageInsertIcons = 1;
125
126 /**
127 * Wrapping page title.
128 *
129 * @param string $str Page title.
130 * @param array $rec Page record (?)
131 * @return string Wrapped title.
132 * @todo Define visibility
133 */
134 public function linkPageTitle($str, $rec) {
135 $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => intval($rec['uid']), 'moveUid' => $GLOBALS['SOBE']->moveUid));
136 return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
137 }
138
139 /**
140 * Wrapping the title of the record.
141 *
142 * @param string $str The title value.
143 * @param array $row The record row.
144 * @return string Wrapped title string.
145 * @todo Define visibility
146 */
147 public function wrapRecordTitle($str, $row) {
148 if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
149 $str = '<strong>' . $str . '</strong>';
150 }
151 return parent::wrapRecordTitle($str, $row);
152 }
153 }
154
155 // Make instance:
156 $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController');
157 $SOBE->init();
158 $SOBE->main();
159 $SOBE->printContent();
160 ?>