[TASK] Make use of "use"-statement for BackendUtility
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / layout / db_layout.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 /**
29 * Module: Web>Page
30 *
31 * This module lets you view a page in a more Content Management like style than the ordinary record-list
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 */
35 unset($MCONF);
36 require __DIR__ . '/conf.php';
37 require $BACK_PATH . 'init.php';
38 $LANG->includeLLFile('EXT:cms/layout/locallang.xlf');
39
40 $BE_USER->modAccess($MCONF, 1);
41 // Will open up records locked by current user. It's assumed that the locking should end if this script is hit.
42 \TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
43 // Exits if 'cms' extension is not loaded:
44 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms', 1);
45 /**
46 * Local extension of position map class
47 *
48 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
49 */
50 class ext_posMap extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
51
52 /**
53 * @todo Define visibility
54 */
55 public $dontPrintPageInsertIcons = 1;
56
57 /**
58 * @todo Define visibility
59 */
60 public $l_insertNewRecordHere = 'newContentElement';
61
62 /**
63 * Wrapping the title of the record.
64 *
65 * @param string $str The title value.
66 * @param array $row The record row.
67 * @return string Wrapped title string.
68 * @todo Define visibility
69 */
70 public function wrapRecordTitle($str, $row) {
71 $aOnClick = 'jumpToUrl(\'' . $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('tt_content:' . $row['uid']))) . '\');return false;';
72 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>';
73 }
74
75 /**
76 * Wrapping the column header
77 *
78 * @param string $str Header value
79 * @param string $vv Column info.
80 * @return string
81 * @see printRecordMap()
82 * @todo Define visibility
83 */
84 public function wrapColumnHeader($str, $vv) {
85 $aOnClick = 'jumpToUrl(\'' . $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => ('_EDIT_COL:' . $vv))) . '\');return false;';
86 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $str . '</a>';
87 }
88
89 /**
90 * Create on-click event value.
91 *
92 * @param array $row The record.
93 * @param string $vv Column position value.
94 * @param integer $moveUid Move uid
95 * @param integer $pid PID value.
96 * @param integer $sys_lang System language
97 * @return string
98 * @todo Define visibility
99 */
100 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0) {
101 if (is_array($row)) {
102 $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/-' . $row['uid'] . '/' . $row['colPos']));
103 } else {
104 $location = $GLOBALS['SOBE']->local_linkThisScript(array('edit_record' => 'tt_content:new/' . $pid . '/' . $vv));
105 }
106 return 'jumpToUrl(\'' . $location . '\');return false;';
107 }
108
109 /**
110 * Wrapping the record header (from getRecordHeader())
111 *
112 * @param string $str HTML content
113 * @param array $row Record array.
114 * @return string HTML content
115 * @todo Define visibility
116 */
117 public function wrapRecordHeader($str, $row) {
118 if ($row['uid'] == $this->moveUid) {
119 return '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/content_client.gif', 'width="7" height="10"') . ' alt="" />' . $str;
120 } else {
121 return $str;
122 }
123 }
124
125 }
126
127 /*
128 * @deprecated since 6.0, the classname SC_db_layout and this file is obsolete
129 * and will be removed with 6.2. The class was renamed and is now located at:
130 * typo3/sysext/backend/Classes/Controller/PageLayoutController.php
131 */
132 require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('backend') . 'Classes/Controller/PageLayoutController.php';
133 // Make instance:
134 $SOBE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\PageLayoutController');
135 $SOBE->init();
136 // Include files?
137 foreach ($SOBE->include_once as $INC_FILE) {
138 include_once $INC_FILE;
139 }
140 $SOBE->clearCache();
141 $SOBE->main();
142 $SOBE->printContent();
143 ?>