[BUGFIX] Changes indentation in new page wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Tree / View / PagePositionMap.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\Utility\BackendUtility;
18 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
19 use TYPO3\CMS\Core\Database\DatabaseConnection;
20 use TYPO3\CMS\Core\Imaging\Icon;
21 use TYPO3\CMS\Core\Imaging\IconFactory;
22 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
23 use TYPO3\CMS\Core\Utility\GeneralUtility;
24 use TYPO3\CMS\Lang\LanguageService;
25
26 /**
27 * Position map class - generating a page tree / content element list which links for inserting (copy/move) of records.
28 * Used for pages / tt_content element wizards of various kinds.
29 */
30 class PagePositionMap
31 {
32 // EXTERNAL, static:
33 /**
34 * @var string
35 */
36 public $moveOrCopy = 'move';
37
38 /**
39 * @var int
40 */
41 public $dontPrintPageInsertIcons = 0;
42
43 // How deep the position page tree will go.
44 /**
45 * @var int
46 */
47 public $depth = 2;
48
49 // Can be set to the sys_language uid to select content elements for.
50 /**
51 * @var string
52 */
53 public $cur_sys_language;
54
55 // INTERNAL, dynamic:
56 // Request uri
57 /**
58 * @var string
59 */
60 public $R_URI = '';
61
62 // Element id.
63 /**
64 * @var string
65 */
66 public $elUid = '';
67
68 // tt_content element uid to move.
69 /**
70 * @var string
71 */
72 public $moveUid = '';
73
74 // Caching arrays:
75 /**
76 * @var array
77 */
78 public $getModConfigCache = [];
79
80 /**
81 * @var array
82 */
83 public $checkNewPageCache = [];
84
85 // Label keys:
86 /**
87 * @var string
88 */
89 public $l_insertNewPageHere = 'insertNewPageHere';
90
91 /**
92 * @var string
93 */
94 public $l_insertNewRecordHere = 'insertNewRecordHere';
95
96 /**
97 * @var string
98 */
99 public $modConfigStr = 'mod.web_list.newPageWiz';
100
101 /**
102 * Page tree implementation class name
103 *
104 * @var string
105 */
106 protected $pageTreeClassName = ElementBrowserPageTreeView::class;
107
108 /**
109 * @var IconFactory
110 */
111 protected $iconFactory;
112
113 /**
114 * Constructor allowing to set pageTreeImplementation
115 *
116 * @param string $pageTreeClassName
117 */
118 public function __construct($pageTreeClassName = null)
119 {
120 if ($pageTreeClassName !== null) {
121 $this->pageTreeClassName = $pageTreeClassName;
122 }
123 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
124 }
125
126 /*************************************
127 *
128 * Page position map:
129 *
130 **************************************/
131 /**
132 * Creates a "position tree" based on the page tree.
133 *
134 * @param int $id Current page id
135 * @param array $pageinfo Current page record.
136 * @param string $perms_clause Page selection permission clause.
137 * @param string $R_URI Current REQUEST_URI
138 * @return string HTML code for the tree.
139 */
140 public function positionTree($id, $pageinfo, $perms_clause, $R_URI)
141 {
142 // Make page tree object:
143 /** @var \TYPO3\CMS\Backend\Tree\View\PageTreeView $pageTree */
144 $pageTree = GeneralUtility::makeInstance($this->pageTreeClassName);
145 $pageTree->init(' AND ' . $perms_clause);
146 $pageTree->addField('pid');
147 // Initialize variables:
148 $this->R_URI = $R_URI;
149 $this->elUid = $id;
150 // Create page tree, in $this->depth levels.
151 $pageTree->getTree($pageinfo['pid'], $this->depth);
152 // Initialize variables:
153 $saveLatestUid = [];
154 $latestInvDepth = $this->depth;
155 // Traverse the tree:
156 $lines = [];
157 foreach ($pageTree->tree as $cc => $dat) {
158 if ($latestInvDepth > $dat['invertedDepth']) {
159 $margin = 'style="margin-left: ' . ($dat['invertedDepth'] * 16 + 9) . 'px;"';
160 $lines[] = '<ul class="list-tree" ' . $margin . '>';
161 }
162 // Make link + parameters.
163 $latestInvDepth = $dat['invertedDepth'];
164 $saveLatestUid[$latestInvDepth] = $dat;
165 if (isset($pageTree->tree[$cc - 1])) {
166 $prev_dat = $pageTree->tree[$cc - 1];
167 // If current page, subpage?
168 if ($prev_dat['row']['uid'] == $id) {
169 // 1) It must be allowed to create a new page and 2) If there are subpages there is no need to render a subpage icon here - it'll be done over the subpages...
170 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id) && !($prev_dat['invertedDepth'] > $pageTree->tree[$cc]['invertedDepth'])) {
171 end($lines);
172 $margin = 'style="margin-left: ' . (($dat['invertedDepth'] - 1) * 16 + 9) . 'px;"';
173 $lines[] = '<ul class="list-tree" ' . $margin . '><li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($id, $id)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span></li></ul>';
174 }
175 }
176 // If going down
177 if ($prev_dat['invertedDepth'] > $pageTree->tree[$cc]['invertedDepth']) {
178 $prevPid = $pageTree->tree[$cc]['row']['pid'];
179 } elseif ($prev_dat['invertedDepth'] < $pageTree->tree[$cc]['invertedDepth']) {
180 // If going up
181 // First of all the previous level should have an icon:
182 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($prev_dat['row']['pid'])) {
183 $prevPid = -$prev_dat['row']['uid'];
184 end($lines);
185 $lines[] = '<li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $prev_dat['row']['pid'], 2)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span></li>';
186 }
187 // Then set the current prevPid
188 $prevPid = -$prev_dat['row']['pid'];
189 if ($prevPid !== $dat['row']['pid']) {
190 $lines[] = '</ul>';
191 }
192 } else {
193 // In on the same level
194 $prevPid = -$prev_dat['row']['uid'];
195 }
196 } else {
197 // First in the tree
198 $prevPid = $dat['row']['pid'];
199 }
200 // print arrow on the same level
201 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
202 $lines[] = '<span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'], 3)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span>';
203 }
204 // The line with the icon and title:
205 $toolTip = BackendUtility::getRecordToolTip($dat['row'], 'pages');
206 $icon = '<span ' . $toolTip . '>' . $this->iconFactory->getIconForRecord('pages', $dat['row'], Icon::SIZE_SMALL)->render() . '</span>';
207
208 $lines[] = '<span class="text-nowrap">' . $icon . $this->linkPageTitle($this->boldTitle(htmlspecialchars(GeneralUtility::fixed_lgd_cs($dat['row']['title'], $this->getBackendUser()->uc['titleLen'])), $dat, $id), $dat['row']) . '</span>';
209 }
210 // If the current page was the last in the tree:
211 $prev_dat = end($pageTree->tree);
212 if ($prev_dat['row']['uid'] == $id) {
213 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($id)) {
214 $lines[] = '<ul class="list-tree" style="margin-left: 25px"><li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($id, $id, 4)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span></li></ul>';
215 }
216 }
217 for ($a = $latestInvDepth; $a <= $this->depth; $a++) {
218 $dat = $saveLatestUid[$a];
219 $prevPid = -$dat['row']['uid'];
220 if (!$this->dontPrintPageInsertIcons && $this->checkNewPageInPid($dat['row']['pid'])) {
221 if ($latestInvDepth < $dat['invertedDepth']) {
222 $lines[] = '</ul>';
223 }
224 $lines[] = '<span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->onClickEvent($prevPid, $dat['row']['pid'], 5)) . '"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->insertlabel() . '"></i></a></span>';
225 }
226 }
227
228 $code = '<ul class="list-tree">';
229
230 foreach ($lines as $line) {
231 if ((substr($line, 0, 3) === '<ul') || (substr($line, 0, 4) === '</ul')) {
232 $code .= $line;
233 } else {
234 $code .= '<li>' . $line . '</li>';
235 }
236 }
237
238 $code .= '</ul>';
239 return $code;
240 }
241
242 /**
243 * Wrap $t_code in bold IF the $dat uid matches $id
244 *
245 * @param string $t_code Title string
246 * @param array $dat Infomation array with record array inside.
247 * @param int $id The current id.
248 * @return string The title string.
249 */
250 public function boldTitle($t_code, $dat, $id)
251 {
252 if ($dat['row']['uid'] == $id) {
253 $t_code = '<strong>' . $t_code . '</strong>';
254 }
255 return $t_code;
256 }
257
258 /**
259 * Creates the onclick event for the insert-icons.
260 *
261 * TSconfig mod.web_list.newPageWiz.overrideWithExtension may contain an extension which provides a module
262 * to be used instead of the normal create new page wizard.
263 *
264 * @param int $pid The pid.
265 * @param int $newPagePID New page id.
266 * @return string Onclick attribute content
267 */
268 public function onClickEvent($pid, $newPagePID)
269 {
270 $TSconfigProp = $this->getModConfig($newPagePID);
271 if ($TSconfigProp['overrideWithExtension']) {
272 if (ExtensionManagementUtility::isLoaded($TSconfigProp['overrideWithExtension'])) {
273 $onclick = 'window.location.href=' . GeneralUtility::quoteJSvalue(ExtensionManagementUtility::extRelPath($TSconfigProp['overrideWithExtension']) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid) . ';';
274 return $onclick;
275 }
276 }
277 $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
278 return BackendUtility::editOnClick($params, '', $this->R_URI);
279 }
280
281 /**
282 * Get label, htmlspecialchars()'ed
283 *
284 * @return string The localized label for "insert new page here
285 */
286 public function insertlabel()
287 {
288 return $this->getLanguageService()->getLL($this->l_insertNewPageHere, 1);
289 }
290
291 /**
292 * Wrapping page title.
293 *
294 * @param string $str Page title.
295 * @param array $rec Page record (?)
296 * @return string Wrapped title.
297 */
298 public function linkPageTitle($str, $rec)
299 {
300 return $str;
301 }
302
303 /**
304 * Checks if the user has permission to created pages inside of the $pid page.
305 * Uses caching so only one regular lookup is made - hence you can call the function multiple times without worrying about performance.
306 *
307 * @param int $pid Page id for which to test.
308 * @return bool
309 */
310 public function checkNewPageInPid($pid)
311 {
312 if (!isset($this->checkNewPageCache[$pid])) {
313 $pidInfo = BackendUtility::getRecord('pages', $pid);
314 $this->checkNewPageCache[$pid] = $this->getBackendUser()->isAdmin() || $this->getBackendUser()->doesUserHaveAccess($pidInfo, 8);
315 }
316 return $this->checkNewPageCache[$pid];
317 }
318
319 /**
320 * Returns module configuration for a pid.
321 *
322 * @param int $pid Page id for which to get the module configuration.
323 * @return array The properties of teh module configuration for the page id.
324 * @see onClickEvent()
325 */
326 public function getModConfig($pid)
327 {
328 if (!isset($this->getModConfigCache[$pid])) {
329 // Acquiring TSconfig for this PID:
330 $this->getModConfigCache[$pid] = BackendUtility::getModTSconfig($pid, $this->modConfigStr);
331 }
332 return $this->getModConfigCache[$pid]['properties'];
333 }
334
335 /*************************************
336 *
337 * Content element positioning:
338 *
339 **************************************/
340 /**
341 * Creates HTML for inserting/moving content elements.
342 *
343 * @param int $pid page id onto which to insert content element.
344 * @param int $moveUid Move-uid (tt_content element uid?)
345 * @param string $colPosList List of columns to show
346 * @param bool $showHidden If not set, then hidden/starttime/endtime records are filtered out.
347 * @param string $R_URI Request URI
348 * @return string HTML
349 */
350 public function printContentElementColumns($pid, $moveUid, $colPosList, $showHidden, $R_URI)
351 {
352 $this->R_URI = $R_URI;
353 $this->moveUid = $moveUid;
354 $colPosArray = GeneralUtility::trimExplode(',', $colPosList, true);
355 $lines = [];
356 foreach ($colPosArray as $kk => $vv) {
357 $res = $this->getDatabase()->exec_SELECTquery('*', 'tt_content', 'pid=' . (int)$pid . ($showHidden ? '' : BackendUtility::BEenableFields('tt_content')) . ' AND colPos=' . (int)$vv . ((string)$this->cur_sys_language !== '' ? ' AND sys_language_uid=' . (int)$this->cur_sys_language : '') . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
358 $lines[$vv] = [];
359 $lines[$vv][] = $this->insertPositionIcon('', $vv, $kk, $moveUid, $pid);
360 while ($row = $this->getDatabase()->sql_fetch_assoc($res)) {
361 BackendUtility::workspaceOL('tt_content', $row);
362 if (is_array($row)) {
363 $lines[$vv][] = $this->wrapRecordHeader($this->getRecordHeader($row), $row);
364 $lines[$vv][] = $this->insertPositionIcon($row, $vv, $kk, $moveUid, $pid);
365 }
366 }
367 $this->getDatabase()->sql_free_result($res);
368 }
369 return $this->printRecordMap($lines, $colPosArray, $pid);
370 }
371
372 /**
373 * Creates the table with the content columns
374 *
375 * @param array $lines Array with arrays of lines for each column
376 * @param array $colPosArray Column position array
377 * @param int $pid The id of the page
378 * @return string HTML
379 */
380 public function printRecordMap($lines, $colPosArray, $pid = 0)
381 {
382 $count = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(count($colPosArray), 1);
383 $backendLayout = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getSelectedBackendLayout', $pid, $this);
384 if (isset($backendLayout['__config']['backend_layout.'])) {
385 $this->getLanguageService()->includeLLFile('EXT:backend/Resources/Private/Language/locallang_layout.xlf');
386 $table = '<div class="table-fit"><table class="table table-condensed table-bordered table-vertical-top">';
387 $colCount = (int)$backendLayout['__config']['backend_layout.']['colCount'];
388 $rowCount = (int)$backendLayout['__config']['backend_layout.']['rowCount'];
389 $table .= '<colgroup>';
390 for ($i = 0; $i < $colCount; $i++) {
391 $table .= '<col style="width:' . 100 / $colCount . '%"></col>';
392 }
393 $table .= '</colgroup>';
394 $table .= '<tbody>';
395 $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $pid, $this);
396 // Cycle through rows
397 for ($row = 1; $row <= $rowCount; $row++) {
398 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
399 if (!isset($rowConfig)) {
400 continue;
401 }
402 $table .= '<tr>';
403 for ($col = 1; $col <= $colCount; $col++) {
404 $columnConfig = $rowConfig['columns.'][$col . '.'];
405 if (!isset($columnConfig)) {
406 continue;
407 }
408 // Which tt_content colPos should be displayed inside this cell
409 $columnKey = (int)$columnConfig['colPos'];
410 $head = '';
411 foreach ($tcaItems as $item) {
412 if ($item[1] == $columnKey) {
413 $head = $this->getLanguageService()->sL($item[0], true);
414 }
415 }
416 // Render the grid cell
417 $table .= '<td'
418 . (isset($columnConfig['colspan']) ? ' colspan="' . $columnConfig['colspan'] . '"' : '')
419 . (isset($columnConfig['rowspan']) ? ' rowspan="' . $columnConfig['rowspan'] . '"' : '')
420 . ' class="col-nowrap col-min'
421 . (!isset($columnConfig['colPos']) ? ' warning' : '')
422 . (isset($columnConfig['colPos']) && !$head ? ' danger' : '') . '">';
423 // Render header
424 $table .= '<p>';
425 if (isset($columnConfig['colPos']) && $head) {
426 $table .= '<strong>' . $this->wrapColumnHeader($head, '', '') . '</strong>';
427 } elseif ($columnConfig['colPos']) {
428 $table .= '<em>' . $this->wrapColumnHeader($this->getLanguageService()->getLL('noAccess'), '', '') . '</em>';
429 } else {
430 $table .= '<em>' . $this->wrapColumnHeader(($columnConfig['name']?: '') . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', '') . '</em>';
431 }
432 $table .= '</p>';
433 // Render lines
434 if (isset($columnConfig['colPos']) && $head && !empty($lines[$columnKey])) {
435 $table .= '<ul class="list-unstyled">';
436 foreach ($lines[$columnKey] as $line) {
437 $table .= '<li>' . $line . '</li>';
438 }
439 $table .= '</ul>';
440 }
441 $table .= '</td>';
442 }
443 $table .= '</tr>';
444 }
445 $table .= '</tbody>';
446 $table .= '</table></div>';
447 } else {
448 // Traverse the columns here:
449 $row = '';
450 foreach ($colPosArray as $kk => $vv) {
451 $row .= '<td class="col-nowrap col-min" width="' . round(100 / $count) . '%">';
452 $row .= '<p><strong>' . $this->wrapColumnHeader($this->getLanguageService()->sL(BackendUtility::getLabelFromItemlist('tt_content', 'colPos', $vv), true), $vv) . '</strong></p>';
453 if (!empty($lines[$vv])) {
454 $row .= '<ul class="list-unstyled">';
455 foreach ($lines[$vv] as $line) {
456 $row .= '<li>' . $line . '</li>';
457 }
458 $row .= '</ul>';
459 }
460 $row .= '</td>';
461 }
462 $table = '
463
464 <!--
465 Map of records in columns:
466 -->
467 <div class="table-fit">
468 <table class="table table-condensed table-bordered table-vertical-top">
469 <tr>' . $row . '</tr>
470 </table>
471 </div>
472
473 ';
474 }
475 return $table;
476 }
477
478 /**
479 * Wrapping the column header
480 *
481 * @param string $str Header value
482 * @param string $vv Column info.
483 * @return string
484 * @see printRecordMap()
485 */
486 public function wrapColumnHeader($str, $vv)
487 {
488 return $str;
489 }
490
491 /**
492 * Creates a linked position icon.
493 *
494 * @param mixed $row Element row. If this is an array the link will cause an insert after this content element, otherwise
495 * the link will insert at the first position in the column
496 * @param string $vv Column position value.
497 * @param int $kk Column key.
498 * @param int $moveUid Move uid
499 * @param int $pid PID value.
500 * @return string
501 */
502 public function insertPositionIcon($row, $vv, $kk, $moveUid, $pid)
503 {
504 if (is_array($row) && !empty($row['uid'])) {
505 // Use record uid for the hash when inserting after this content element
506 $uid = $row['uid'];
507 } else {
508 // No uid means insert at first position in the column
509 $uid = '';
510 }
511 $cc = hexdec(substr(md5($uid . '-' . $vv . '-' . $kk), 0, 4));
512 return '<a href="#" onclick="' . htmlspecialchars($this->onClickInsertRecord($row, $vv, $moveUid, $pid, $this->cur_sys_language)) . '">' . '<i class="t3-icon fa fa-long-arrow-left" name="mImgEnd' . $cc . '" title="' . $this->getLanguageService()->getLL($this->l_insertNewRecordHere, 1) . '"></i></a>';
513 }
514
515 /**
516 * Create on-click event value.
517 *
518 * @param mixed $row The record. If this is not an array with the record data the insert will be for the first position
519 * in the column
520 * @param string $vv Column position value.
521 * @param int $moveUid Move uid
522 * @param int $pid PID value.
523 * @param int $sys_lang System language (not used currently)
524 * @return string
525 */
526 public function onClickInsertRecord($row, $vv, $moveUid, $pid, $sys_lang = 0)
527 {
528 $table = 'tt_content';
529 if (is_array($row)) {
530 $location = BackendUtility::getModuleUrl('tce_db') . '&cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=-' . $row['uid'] . '&prErr=1&uPT=1&vC=' . $this->getBackendUser()->veriCode();
531 } else {
532 $location = BackendUtility::getModuleUrl('tce_db') . '&cmd[' . $table . '][' . $moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&data[' . $table . '][' . $moveUid . '][colPos]=' . $vv . '&prErr=1&vC=' . $this->getBackendUser()->veriCode();
533 }
534 $location .= '&redirect=' . rawurlencode($this->R_URI);
535 // returns to prev. page
536 return 'window.location.href=' . GeneralUtility::quoteJSvalue($location) . ';return false;';
537 }
538
539 /**
540 * Wrapping the record header (from getRecordHeader())
541 *
542 * @param string $str HTML content
543 * @param string $row Record array.
544 * @return string HTML content
545 */
546 public function wrapRecordHeader($str, $row)
547 {
548 return $str;
549 }
550
551 /**
552 * Create record header (includes teh record icon, record title etc.)
553 *
554 * @param array $row Record row.
555 * @return string HTML
556 */
557 public function getRecordHeader($row)
558 {
559 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
560 $toolTip = BackendUtility::getRecordToolTip($row, 'tt_content');
561 $line = '<span ' . $toolTip . ' title="' . BackendUtility::getRecordIconAltText($row, 'tt_content') . '">' . $iconFactory->getIconForRecord('tt_content', $row, Icon::SIZE_SMALL)->render() . '</span>';
562 $line .= BackendUtility::getRecordTitle('tt_content', $row, true);
563 return $this->wrapRecordTitle($line, $row);
564 }
565
566 /**
567 * Wrapping the title of the record.
568 *
569 * @param string $str The title value.
570 * @param array $row The record row.
571 * @return string Wrapped title string.
572 */
573 public function wrapRecordTitle($str, $row)
574 {
575 return '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(['uid' => (int)$row['uid'], 'moveUid' => ''])) . '">' . $str . '</a>';
576 }
577
578 /**
579 * Returns the BackendUser
580 *
581 * @return BackendUserAuthentication
582 */
583 protected function getBackendUser()
584 {
585 return $GLOBALS['BE_USER'];
586 }
587
588 /**
589 * Returns the LanguageService
590 *
591 * @return LanguageService
592 */
593 protected function getLanguageService()
594 {
595 return $GLOBALS['LANG'];
596 }
597
598 /**
599 * @return DatabaseConnection
600 */
601 protected function getDatabase()
602 {
603 return $GLOBALS['TYPO3_DB'];
604 }
605 }