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