[BUGFIX] Respect editlock in the UI of list & page module
[Packages/TYPO3.CMS.git] / typo3 / sysext / recordlist / Classes / RecordList / DatabaseRecordList.php
1 <?php
2 namespace TYPO3\CMS\Recordlist\RecordList;
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\Module\BaseScriptClass;
18 use TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface;
19 use TYPO3\CMS\Backend\Template\DocumentTemplate;
20 use TYPO3\CMS\Core\Database\DatabaseConnection;
21 use TYPO3\CMS\Core\Messaging\FlashMessage;
22 use TYPO3\CMS\Core\Messaging\FlashMessageService;
23 use TYPO3\CMS\Core\Type\Bitmask\Permission;
24 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
25 use TYPO3\CMS\Core\Utility\GeneralUtility;
26 use TYPO3\CMS\Backend\Utility\BackendUtility;
27 use TYPO3\CMS\Backend\Utility\IconUtility;
28 use TYPO3\CMS\Core\Utility\MathUtility;
29 use TYPO3\CMS\Frontend\Page\PageRepository;
30
31 /**
32 * Class for rendering of Web>List module
33 */
34 class DatabaseRecordList extends AbstractDatabaseRecordList {
35
36 // *********
37 // External:
38 // *********
39
40 /**
41 * Used to indicate which tables (values in the array) that can have a
42 * create-new-record link. If the array is empty, all tables are allowed.
43 *
44 * @var string[]
45 */
46 public $allowedNewTables = array();
47
48 /**
49 * Used to indicate which tables (values in the array) that cannot have a
50 * create-new-record link. If the array is empty, all tables are allowed.
51 *
52 * @var string[]
53 */
54 public $deniedNewTables = array();
55
56 /**
57 * If TRUE, the control panel will contain links to the create-new wizards for
58 * pages and tt_content elements (normally, the link goes to just creatinga new
59 * element without the wizards!).
60 *
61 * @var bool
62 */
63 public $newWizards = FALSE;
64
65 /**
66 * If TRUE, will disable the rendering of clipboard + control panels.
67 *
68 * @var bool
69 */
70 public $dontShowClipControlPanels = FALSE;
71
72 /**
73 * If TRUE, will show the clipboard in the field list.
74 *
75 * @var bool
76 */
77 public $showClipboard = FALSE;
78
79 /**
80 * If TRUE, will DISABLE all control panels in lists. (Takes precedence)
81 *
82 * @var bool
83 */
84 public $noControlPanels = FALSE;
85
86 /**
87 * If TRUE, clickmenus will be rendered
88 *
89 * @var bool
90 */
91 public $clickMenuEnabled = TRUE;
92
93 /**
94 * Count of record rows in view
95 *
96 * @var int
97 */
98 public $totalRowCount;
99
100 /**
101 * Space icon used for alignment
102 *
103 * @var string
104 */
105 public $spaceIcon;
106
107 /**
108 * Disable single table view
109 *
110 * @var bool
111 */
112 public $disableSingleTableView = FALSE;
113
114 // *********
115 // Internal:
116 // *********
117
118 /**
119 * Set to the page record (see writeTop())
120 *
121 * @var string[]
122 */
123 public $pageRow = array();
124
125 /**
126 * Used to accumulate CSV lines for CSV export.
127 *
128 * @var string[]
129 */
130 protected $csvLines = array();
131
132 /**
133 * If set, the listing is returned as CSV instead.
134 *
135 * @var bool
136 */
137 public $csvOutput = FALSE;
138
139 /**
140 * Clipboard object
141 *
142 * @var \TYPO3\CMS\Backend\Clipboard\Clipboard
143 */
144 public $clipObj;
145
146 /**
147 * Tracking names of elements (for clipboard use)
148 *
149 * @var string[]
150 */
151 public $CBnames = array();
152
153 /**
154 * [$tablename][$uid] = number of references to this record
155 *
156 * @var int[][]
157 */
158 protected $referenceCount = array();
159
160 /**
161 * Translations of the current record
162 *
163 * @var string[]
164 */
165 public $translations;
166
167 /**
168 * select fields for the query which fetches the translations of the current
169 * record
170 *
171 * @var string
172 */
173 public $selFieldList;
174
175 /**
176 * @var mixed[]
177 */
178 public $pageinfo;
179
180 /**
181 * Injected by RecordList
182 *
183 * @var string[]
184 */
185 public $MOD_MENU;
186
187 /**
188 * If defined the records are editable
189 *
190 * @var bool
191 */
192 protected $editable = TRUE;
193
194 /**
195 * Create the panel of buttons for submitting the form or otherwise perform
196 * operations.
197 *
198 * @return string[] All available buttons as an assoc. array
199 */
200 public function getButtons() {
201 $module = $this->getModule();
202 $backendUser = $this->getBackendUserAuthentication();
203 $lang = $this->getLanguageService();
204 $buttons = array(
205 'csh' => '',
206 'view' => '',
207 'edit' => '',
208 'hide_unhide' => '',
209 'move' => '',
210 'new_record' => '',
211 'paste' => '',
212 'level_up' => '',
213 'cache' => '',
214 'reload' => '',
215 'shortcut' => '',
216 'back' => '',
217 'csv' => '',
218 'export' => ''
219 );
220 // Get users permissions for this page record:
221 $localCalcPerms = $backendUser->calcPerms($this->pageRow);
222 // CSH
223 if ((string)$this->id === '') {
224 $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_noId');
225 } elseif (!$this->id) {
226 $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_root');
227 } else {
228 $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module');
229 }
230 if (isset($this->id)) {
231 // View Exclude doktypes 254,255 Configuration:
232 // mod.web_list.noViewWithDokTypes = 254,255
233 if (isset($module->modTSconfig['properties']['noViewWithDokTypes'])) {
234 $noViewDokTypes = GeneralUtility::trimExplode(',', $module->modTSconfig['properties']['noViewWithDokTypes'], TRUE);
235 } else {
236 //default exclusion: doktype 254 (folder), 255 (recycler)
237 $noViewDokTypes = array(
238 PageRepository::DOKTYPE_SYSFOLDER,
239 PageRepository::DOKTYPE_RECYCLER
240 );
241 }
242 if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) {
243 $onClick = htmlspecialchars(BackendUtility::viewOnClick($this->id, $this->backPath, BackendUtility::BEgetRootLine($this->id)));
244 $buttons['view'] = '<a href="#" onclick="' . $onClick . '" title="'
245 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
246 . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
247 }
248 // New record
249 if (!$module->modTSconfig['properties']['noCreateRecordsLink']) {
250 $onClick = htmlspecialchars('return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', ['id' => $this->id])) . ');');
251 $buttons['new_record'] = '<a href="#" onclick="' . $onClick . '" title="'
252 . $lang->getLL('newRecordGeneral', TRUE) . '">'
253 . IconUtility::getSpriteIcon('actions-document-new') . '</a>';
254 }
255 // If edit permissions are set, see
256 // \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
257 if ($localCalcPerms & Permission::PAGE_EDIT && !empty($this->id)) {
258 // Edit
259 $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
260 $onClick = htmlspecialchars(BackendUtility::editOnClick($params, '', -1));
261 $buttons['edit'] = '<a href="#" onclick="' . $onClick . '" title="'
262 . $lang->getLL('editPage', TRUE) . '">'
263 . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
264 }
265 // Paste
266 if ($localCalcPerms & Permission::PAGE_NEW || $localCalcPerms & Permission::CONTENT_EDIT) {
267 $elFromTable = $this->clipObj->elFromTable('');
268 if (!empty($elFromTable)) {
269 $onClick = htmlspecialchars(('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable)));
270 $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id))
271 . '" onclick="' . $onClick . '" title="' . $lang->getLL('clip_paste', TRUE) . '">'
272 . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
273 }
274 }
275 // Cache
276 $buttons['cache'] = '<a href="' . htmlspecialchars(($this->listURL() . '&clear_cache=1')) . '" title="'
277 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', TRUE) . '">'
278 . IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>';
279 if (
280 $this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks'])
281 || (isset($module->modTSconfig['properties']['noExportRecordsLinks'])
282 && !$module->modTSconfig['properties']['noExportRecordsLinks']))
283 ) {
284 // CSV
285 $buttons['csv'] = '<a href="' . htmlspecialchars(($this->listURL() . '&csv=1')) . '" title="'
286 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.csv', TRUE) . '">'
287 . IconUtility::getSpriteIcon('mimetypes-text-csv') . '</a>';
288 // Export
289 if (ExtensionManagementUtility::isLoaded('impexp')) {
290 $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export'));
291 $buttons['export'] = '<a href="' . htmlspecialchars($url . '&tx_impexp[list][]='
292 . rawurlencode($this->table . ':' . $this->id)) . '" title="'
293 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.export', TRUE) . '">'
294 . IconUtility::getSpriteIcon('actions-document-export-t3d') . '</a>';
295 }
296 }
297 // Reload
298 $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="'
299 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">'
300 . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
301 // Shortcut
302 if ($backendUser->mayMakeShortcut()) {
303 $buttons['shortcut'] = $this->getDocumentTemplate()->makeShortcutIcon(
304 'id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev',
305 implode(',', array_keys($this->MOD_MENU)),
306 'web_list'
307 );
308 }
309 // Back
310 if ($this->returnUrl) {
311 $href = htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl, array('id' => $this->id)));
312 $buttons['back'] = '<a href="' . $href . '" class="typo3-goBack" title="'
313 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">'
314 . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
315 }
316 }
317 return $buttons;
318 }
319
320 /**
321 * Creates the listing of records from a single table
322 *
323 * @param string $table Table name
324 * @param int $id Page id
325 * @param string $rowList List of fields to show in the listing. Pseudo fields will be added including the record header.
326 * @throws \UnexpectedValueException
327 * @return string HTML table with the listing for the record.
328 */
329 public function getTable($table, $id, $rowList = '') {
330 $rowListArray = GeneralUtility::trimExplode(',', $rowList, TRUE);
331 // if no columns have been specified, show description (if configured)
332 if (!empty($GLOBALS['TCA'][$table]['ctrl']['descriptionColumn']) && empty($rowListArray)) {
333 array_push($rowListArray, $GLOBALS['TCA'][$table]['ctrl']['descriptionColumn']);
334 }
335 $backendUser = $this->getBackendUserAuthentication();
336 $lang = $this->getLanguageService();
337 $db = $this->getDatabaseConnection();
338 // Init
339 $addWhere = '';
340 $titleCol = $GLOBALS['TCA'][$table]['ctrl']['label'];
341 $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
342 $l10nEnabled = $GLOBALS['TCA'][$table]['ctrl']['languageField']
343 && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
344 && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'];
345 $tableCollapsed = (bool)$this->tablesCollapsed[$table];
346 // prepare space icon
347 $this->spaceIcon = '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>';
348 // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
349 $this->fieldArray = array();
350 // title Column
351 // Add title column
352 $this->fieldArray[] = $titleCol;
353 // Control-Panel
354 if (!GeneralUtility::inList($rowList, '_CONTROL_')) {
355 $this->fieldArray[] = '_CONTROL_';
356 }
357 // Clipboard
358 if ($this->showClipboard) {
359 $this->fieldArray[] = '_CLIPBOARD_';
360 }
361 // Ref
362 if (!$this->dontShowClipControlPanels) {
363 $this->fieldArray[] = '_REF_';
364 }
365 // Path
366 if ($this->searchLevels) {
367 $this->fieldArray[] = '_PATH_';
368 }
369 // Localization
370 if ($this->localizationView && $l10nEnabled) {
371 $this->fieldArray[] = '_LOCALIZATION_';
372 $this->fieldArray[] = '_LOCALIZATION_b';
373 $addWhere .= ' AND (
374 ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '<=0
375 OR
376 ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0
377 )';
378 }
379 // Cleaning up:
380 $this->fieldArray = array_unique(array_merge($this->fieldArray, $rowListArray));
381 if ($this->noControlPanels) {
382 $tempArray = array_flip($this->fieldArray);
383 unset($tempArray['_CONTROL_']);
384 unset($tempArray['_CLIPBOARD_']);
385 $this->fieldArray = array_keys($tempArray);
386 }
387 // Creating the list of fields to include in the SQL query:
388 $selectFields = $this->fieldArray;
389 $selectFields[] = 'uid';
390 $selectFields[] = 'pid';
391 // adding column for thumbnails
392 if ($thumbsCol) {
393 $selectFields[] = $thumbsCol;
394 }
395 if ($table == 'pages') {
396 $selectFields[] = 'module';
397 $selectFields[] = 'extendToSubpages';
398 $selectFields[] = 'nav_hide';
399 $selectFields[] = 'doktype';
400 $selectFields[] = 'shortcut';
401 $selectFields[] = 'shortcut_mode';
402 $selectFields[] = 'mount_pid';
403 }
404 if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
405 $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
406 }
407 foreach(array('type', 'typeicon_column', 'editlock') as $field) {
408 if ($GLOBALS['TCA'][$table]['ctrl'][$field]) {
409 $selectFields[] = $GLOBALS['TCA'][$table]['ctrl'][$field];
410 }
411 }
412 if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
413 $selectFields[] = 't3ver_id';
414 $selectFields[] = 't3ver_state';
415 $selectFields[] = 't3ver_wsid';
416 }
417 if ($l10nEnabled) {
418 $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
419 $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
420 }
421 if ($GLOBALS['TCA'][$table]['ctrl']['label_alt']) {
422 $selectFields = array_merge(
423 $selectFields,
424 GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], TRUE)
425 );
426 }
427 // Unique list!
428 $selectFields = array_unique($selectFields);
429 $fieldListFields = $this->makeFieldList($table, 1);
430 if (empty($fieldListFields) && $GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) {
431 $message = sprintf($lang->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:missingTcaColumnsMessage', TRUE), $table, $table);
432 $messageTitle = $lang->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:missingTcaColumnsMessageTitle', TRUE);
433 /** @var FlashMessage $flashMessage */
434 $flashMessage = GeneralUtility::makeInstance(
435 FlashMessage::class,
436 $message,
437 $messageTitle,
438 FlashMessage::WARNING,
439 TRUE
440 );
441 /** @var $flashMessageService FlashMessageService */
442 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
443 /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
444 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
445 $defaultFlashMessageQueue->enqueue($flashMessage);
446 }
447 // Making sure that the fields in the field-list ARE in the field-list from TCA!
448 $selectFields = array_intersect($selectFields, $fieldListFields);
449 // Implode it into a list of fields for the SQL-statement.
450 $selFieldList = implode(',', $selectFields);
451 $this->selFieldList = $selFieldList;
452 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
453 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
454 $hookObject = GeneralUtility::getUserObj($classData);
455 if (!$hookObject instanceof RecordListGetTableHookInterface) {
456 throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListGetTableHookInterface::class, 1195114460);
457 }
458 $hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
459 }
460 }
461 // Create the SQL query for selecting the elements in the listing:
462 // do not do paging when outputting as CSV
463 if ($this->csvOutput) {
464 $this->iLimit = 0;
465 }
466 if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
467 // Get the two previous rows for sorting if displaying page > 1
468 $this->firstElementNumber = $this->firstElementNumber - 2;
469 $this->iLimit = $this->iLimit + 2;
470 // (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
471 $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
472 $this->firstElementNumber = $this->firstElementNumber + 2;
473 $this->iLimit = $this->iLimit - 2;
474 } else {
475 // (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
476 $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
477 }
478
479 // Finding the total amount of records on the page
480 // (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
481 $this->setTotalItems($queryParts);
482
483 // Init:
484 $dbCount = 0;
485 $out = '';
486 $tableHeader = '';
487 $result = NULL;
488 $listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
489 // If the count query returned any number of records, we perform the real query,
490 // selecting records.
491 if ($this->totalItems) {
492 // Fetch records only if not in single table mode or if in multi table mode and
493 // not collapsed
494 if ($listOnlyInSingleTableMode || !$this->table && $tableCollapsed) {
495 $dbCount = $this->totalItems;
496 } else {
497 // Set the showLimit to the number of records when outputting as CSV
498 if ($this->csvOutput) {
499 $this->showLimit = $this->totalItems;
500 $this->iLimit = $this->totalItems;
501 }
502 $result = $db->exec_SELECT_queryArray($queryParts);
503 $dbCount = $db->sql_num_rows($result);
504 }
505 }
506 // If any records was selected, render the list:
507 if ($dbCount) {
508 $tableTitle = $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title'], TRUE);
509 if ($tableTitle === '') {
510 $tableTitle = $table;
511 }
512 // Header line is drawn
513 $theData = array();
514 if ($this->disableSingleTableView) {
515 $theData[$titleCol] = '<span class="c-table">' . BackendUtility::wrapInHelp($table, '', $tableTitle)
516 . '</span> (<span class="t3js-table-total-items">' . $this->totalItems . '</span>)';
517 } else {
518 $icon = $this->table
519 ? IconUtility::getSpriteIcon('actions-view-table-collapse', array('title' => $lang->getLL('contractView', TRUE)))
520 : IconUtility::getSpriteIcon('actions-view-table-expand', array('title' => $lang->getLL('expandView', TRUE)));
521 $theData[$titleCol] = $this->linkWrapTable($table, $tableTitle . ' (<span class="t3js-table-total-items">' . $this->totalItems . '</span>) ' . $icon);
522 }
523 if ($listOnlyInSingleTableMode) {
524 $tableHeader .= BackendUtility::wrapInHelp($table, '', $theData[$titleCol]);
525 } else {
526 // Render collapse button if in multi table mode
527 $collapseIcon = '';
528 if (!$this->table) {
529 $href = htmlspecialchars(($this->listURL() . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1')));
530 $title = $tableCollapsed
531 ? $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.expandTable', TRUE)
532 : $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.collapseTable', TRUE);
533 $icon = $tableCollapsed
534 ? IconUtility::getSpriteIcon('actions-view-list-expand', array('class' => 'collapseIcon'))
535 : IconUtility::getSpriteIcon('actions-view-list-collapse', array('class' => 'collapseIcon'));
536 $collapseIcon = '<a href="' . $href . '" title="' . $title . '" class="pull-right">' . $icon . '</a>';
537 }
538 $tableHeader .= $theData[$titleCol] . $collapseIcon;
539 }
540 // Render table rows only if in multi table view and not collapsed or if in
541 // single table view
542 $rowOutput = '';
543 if (!$listOnlyInSingleTableMode && (!$tableCollapsed || $this->table)) {
544 // Fixing an order table for sortby tables
545 $this->currentTable = array();
546 $currentIdList = array();
547 $doSort = $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField;
548 $prevUid = 0;
549 $prevPrevUid = 0;
550 // Get first two rows and initialize prevPrevUid and prevUid if on page > 1
551 if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
552 $row = $db->sql_fetch_assoc($result);
553 $prevPrevUid = -((int)$row['uid']);
554 $row = $db->sql_fetch_assoc($result);
555 $prevUid = $row['uid'];
556 }
557 $accRows = array();
558 // Accumulate rows here
559 while ($row = $db->sql_fetch_assoc($result)) {
560 if (!$this->isRowListingConditionFulfilled($table, $row)) {
561 continue;
562 }
563 // In offline workspace, look for alternative record:
564 BackendUtility::workspaceOL($table, $row, $backendUser->workspace, TRUE);
565 if (is_array($row)) {
566 $accRows[] = $row;
567 $currentIdList[] = $row['uid'];
568 if ($doSort) {
569 if ($prevUid) {
570 $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
571 $this->currentTable['next'][$prevUid] = '-' . $row['uid'];
572 $this->currentTable['prevUid'][$row['uid']] = $prevUid;
573 }
574 $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
575 $prevUid = $row['uid'];
576 }
577 }
578 }
579 $db->sql_free_result($result);
580 $this->totalRowCount = count($accRows);
581 // CSV initiated
582 if ($this->csvOutput) {
583 $this->initCSV();
584 }
585 // Render items:
586 $this->CBnames = array();
587 $this->duplicateStack = array();
588 $this->eCounter = $this->firstElementNumber;
589 $cc = 0;
590 foreach ($accRows as $row) {
591 // Render item row if counter < limit
592 if ($cc < $this->iLimit) {
593 $cc++;
594 $this->translations = FALSE;
595 $rowOutput .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
596 // If localization view is enabled it means that the selected records are
597 // either default or All language and here we will not select translations
598 // which point to the main record:
599 if ($this->localizationView && $l10nEnabled) {
600 // For each available translation, render the record:
601 if (is_array($this->translations)) {
602 foreach ($this->translations as $lRow) {
603 // $lRow isn't always what we want - if record was moved we've to work with the
604 // placeholder records otherwise the list is messed up a bit
605 if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
606 $where = 't3ver_move_id="' . (int)$lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid']
607 . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table);
608 $tmpRow = BackendUtility::getRecordRaw($table, $where, $selFieldList);
609 $lRow = is_array($tmpRow) ? $tmpRow : $lRow;
610 }
611 // In offline workspace, look for alternative record:
612 BackendUtility::workspaceOL($table, $lRow, $backendUser->workspace, TRUE);
613 if (is_array($lRow) && $backendUser->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) {
614 $currentIdList[] = $lRow['uid'];
615 $rowOutput .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 18);
616 }
617 }
618 }
619 }
620 }
621 // Counter of total rows incremented:
622 $this->eCounter++;
623 }
624 // Record navigation is added to the beginning and end of the table if in single
625 // table mode
626 if ($this->table) {
627 $rowOutput = $this->renderListNavigation('top') . $rowOutput . $this->renderListNavigation('bottom');
628 } else {
629 // Show that there are more records than shown
630 if ($this->totalItems > $this->itemsLimitPerTable) {
631 $countOnFirstPage = $this->totalItems > $this->itemsLimitSingleTable ? $this->itemsLimitSingleTable : $this->totalItems;
632 $hasMore = $this->totalItems > $this->itemsLimitSingleTable;
633 $colspan = $this->showIcon ? count($this->fieldArray) + 1 : count($this->fieldArray);
634 $rowOutput .= '<tr><td colspan="' . $colspan . '">
635 <a href="' . htmlspecialchars(($this->listURL() . '&table=' . rawurlencode($table))) . '" class="btn btn-default">'
636 . '<span class="t3-icon fa fa-chevron-down"></span> <i>[1 - ' . $countOnFirstPage . ($hasMore ? '+' : '') . ']</i></a>
637 </td></tr>';
638 }
639 }
640 // The header row for the table is now created:
641 $out .= $this->renderListHeader($table, $currentIdList);
642 }
643 // The list of records is added after the header:
644 $out .= $rowOutput;
645 // ... and it is all wrapped in a table:
646 $out = '
647
648
649
650 <!--
651 DB listing of elements: "' . htmlspecialchars($table) . '"
652 -->
653 <div class="panel panel-space panel-default">
654 <div class="panel-heading">
655 ' . $tableHeader . '
656 </div>
657 <div class="table-fit">
658 <table data-table="' . htmlspecialchars($table) . '" class="table table-striped table-hover' . ($listOnlyInSingleTableMode ? ' typo3-dblist-overview' : '') . '">
659 ' . $out . '
660 </table>
661 </div>
662 </div>
663 ';
664 // Output csv if...
665 // This ends the page with exit.
666 if ($this->csvOutput) {
667 $this->outputCSV($table);
668 }
669 }
670 // Return content:
671 return $out;
672 }
673
674 /**
675 * Check if all row listing conditions are fulfilled.
676 *
677 * This function serves as a dummy method to be overriden in extending classes.
678 *
679 * @param string $table Table name
680 * @param string[] $row Record
681 * @return bool True, if all conditions are fulfilled.
682 */
683 protected function isRowListingConditionFulfilled($table, $row) {
684 return TRUE;
685 }
686
687 /**
688 * Rendering a single row for the list
689 *
690 * @param string $table Table name
691 * @param mixed[] $row Current record
692 * @param int $cc Counter, counting for each time an element is rendered (used for alternating colors)
693 * @param string $titleCol Table field (column) where header value is found
694 * @param string $thumbsCol Table field (column) where (possible) thumbnails can be found
695 * @param int $indent Indent from left.
696 * @return string Table row for the element
697 * @access private
698 * @see getTable()
699 */
700 public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0) {
701 if (!is_array($row)) {
702 return '';
703 }
704 $rowOutput = '';
705 $id_orig = NULL;
706 // If in search mode, make sure the preview will show the correct page
707 if ((string)$this->searchString !== '') {
708 $id_orig = $this->id;
709 $this->id = $row['pid'];
710 }
711 // Add special classes for first and last row
712 $rowSpecial = '';
713 if ($cc == 1 && $indent == 0) {
714 $rowSpecial .= ' firstcol';
715 }
716 if ($cc == $this->totalRowCount || $cc == $this->iLimit) {
717 $rowSpecial .= ' lastcol';
718 }
719
720 $row_bgColor = ' class="' . $rowSpecial . '"';
721
722 // Overriding with versions background color if any:
723 $row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor;
724 // Incr. counter.
725 $this->counter++;
726 // The icon with link
727 $altText = htmlspecialchars(BackendUtility::getRecordIconAltText($row, $table));
728 $iconImg = IconUtility::getSpriteIconForRecord(
729 $table,
730 $row,
731 array('title' => $altText, 'style' => $indent ? ' margin-left: ' . $indent . 'px;' : '')
732 );
733 $theIcon = $this->clickMenuEnabled ? $this->getModule()->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
734 // Preparing and getting the data-array
735 $theData = array();
736 $localizationMarkerClass = '';
737 foreach ($this->fieldArray as $fCol) {
738 if ($fCol == $titleCol) {
739 $recTitle = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
740 $warning = '';
741 // If the record is edit-locked by another user, we will show a little warning sign:
742 $lockInfo = BackendUtility::isRecordLocked($table, $row['uid']);
743 if ($lockInfo) {
744 $warning = '<a href="#" onclick="alert('
745 . GeneralUtility::quoteJSvalue($lockInfo['msg']) . '); return false;" title="'
746 . htmlspecialchars($lockInfo['msg']) . '">'
747 . IconUtility::getSpriteIcon('status-warning-in-use') . '</a>';
748 }
749 $theData[$fCol] = $theData['__label'] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
750 // Render thumbnails, if:
751 // - a thumbnail column exists
752 // - there is content in it
753 // - the thumbnail column is visible for the current type
754 $type = 0;
755 if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) {
756 $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type'];
757 $type = $row[$typeColumn];
758 }
759 // If current type doesn't exist, set it to 0 (or to 1 for historical reasons,
760 // if 0 doesn't exist)
761 if (!isset($GLOBALS['TCA'][$table]['types'][$type])) {
762 $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1;
763 }
764 $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
765
766 if ($this->thumbs &&
767 trim($row[$thumbsCol]) &&
768 preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1
769 ) {
770 $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol);
771 }
772 if (
773 isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])
774 && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0
775 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0
776 ) {
777 // It's a translated record with a language parent
778 $localizationMarkerClass = ' localization';
779 }
780 } elseif ($fCol == 'pid') {
781 $theData[$fCol] = $row[$fCol];
782 } elseif ($fCol == '_PATH_') {
783 $theData[$fCol] = $this->recPath($row['pid']);
784 } elseif ($fCol == '_REF_') {
785 $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']);
786 } elseif ($fCol == '_CONTROL_') {
787 $theData[$fCol] = $this->makeControl($table, $row);
788 } elseif ($fCol == '_CLIPBOARD_') {
789 $theData[$fCol] = $this->makeClip($table, $row);
790 } elseif ($fCol == '_LOCALIZATION_') {
791 list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);
792 $theData[$fCol] = $lC1;
793 $theData[$fCol . 'b'] = $lC2;
794 } elseif ($fCol == '_LOCALIZATION_b') {
795 // deliberately empty
796 } else {
797 $pageId = $table === 'pages' ? $row['uid'] : $row['pid'];
798 $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid'], TRUE, $pageId);
799 $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
800 if ($this->csvOutput) {
801 $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']);
802 }
803 }
804 }
805 // Reset the ID if it was overwritten
806 if ((string)$this->searchString !== '') {
807 $this->id = $id_orig;
808 }
809 // Add row to CSV list:
810 if ($this->csvOutput) {
811 $this->addToCSV($row, $table);
812 }
813 // Add classes to table cells
814 $this->addElement_tdCssClass[$titleCol] = 'col-title' . $localizationMarkerClass;
815 $this->addElement_tdCssClass['_CONTROL_'] = 'col-control';
816 if ($this->getModule()->MOD_SETTINGS['clipBoard']) {
817 $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard';
818 }
819 $this->addElement_tdCssClass['_PATH_'] = 'col-path';
820 $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';
821 $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';
822 // Create element in table cells:
823 $theData['uid'] = $row['uid'];
824 $rowOutput .= $this->addelement(1, $theIcon, $theData, $row_bgColor);
825 // Finally, return table row element:
826 return $rowOutput;
827 }
828
829 /**
830 * Gets the number of records referencing the record with the UID $uid in
831 * the table $tableName.
832 *
833 * @param string $tableName
834 * @param int $uid
835 * @return int The number of references to record $uid in table
836 */
837 protected function getReferenceCount($tableName, $uid) {
838 $db = $this->getDatabaseConnection();
839 if (!isset($this->referenceCount[$tableName][$uid])) {
840 $where = 'ref_table = ' . $db->fullQuoteStr($tableName, 'sys_refindex')
841 . ' AND ref_uid = ' . $uid . ' AND deleted = 0';
842 $numberOfReferences = $db->exec_SELECTcountRows('*', 'sys_refindex', $where);
843 $this->referenceCount[$tableName][$uid] = $numberOfReferences;
844 }
845 return $this->referenceCount[$tableName][$uid];
846 }
847
848 /**
849 * Rendering the header row for a table
850 *
851 * @param string $table Table name
852 * @param int[] $currentIdList Array of the currently displayed uids of the table
853 * @throws \UnexpectedValueException
854 * @return string Header table row
855 * @access private
856 * @see getTable()
857 */
858 public function renderListHeader($table, $currentIdList) {
859 $lang = $this->getLanguageService();
860 // Init:
861 $theData = array();
862 $icon = '';
863 // Traverse the fields:
864 foreach ($this->fieldArray as $fCol) {
865 // Calculate users permissions to edit records in the table:
866 $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16);
867 switch ((string)$fCol) {
868 case '_PATH_':
869 // Path
870 $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels._PATH_', TRUE) . ']</i>';
871 break;
872 case '_REF_':
873 // References
874 $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:c__REF_', TRUE) . ']</i>';
875 break;
876 case '_LOCALIZATION_':
877 // Path
878 $theData[$fCol] = '<i>[' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels._LOCALIZATION_', TRUE) . ']</i>';
879 break;
880 case '_LOCALIZATION_b':
881 // Path
882 $theData[$fCol] = $lang->getLL('Localize', TRUE);
883 break;
884 case '_CLIPBOARD_':
885 if (!$this->getModule()->MOD_SETTINGS['clipBoard']) {
886 break;
887 }
888 // Clipboard:
889 $cells = array();
890 // If there are elements on the clipboard for this table, then display the
891 // "paste into" icon:
892 $elFromTable = $this->clipObj->elFromTable($table);
893 if (!empty($elFromTable)) {
894 $href = htmlspecialchars($this->clipObj->pasteUrl($table, $this->id));
895 $onClick = htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable));
896 $cells['pasteAfter'] = '<a class="btn btn-default" href="' . $href . '" onclick="' . $onClick
897 . '" title="' . $lang->getLL('clip_paste', TRUE) . '">'
898 . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
899 }
900 // If the numeric clipboard pads are enabled, display the control icons for that:
901 if ($this->clipObj->current != 'normal') {
902 // The "select" link:
903 $spriteIcon = IconUtility::getSpriteIcon('actions-edit-copy', array('title' => $lang->getLL('clip_selectMarked', TRUE)));
904 $cells['copyMarked'] = $this->linkClipboardHeaderIcon($spriteIcon, $table, 'setCB');
905 // The "edit marked" link:
906 $editIdList = implode(',', $currentIdList);
907 $editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
908 $params = '&edit[' . $table . '][' . $editIdList . ']=edit';
909 $onClick = htmlspecialchars(BackendUtility::editOnClick($params, '', -1));
910 $cells['edit'] = '<a class="btn btn-default" href="#" onclick="' . $onClick . '" title="'
911 . $lang->getLL('clip_editMarked', TRUE) . '">'
912 . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
913 // The "Delete marked" link:
914 $cells['delete'] = $this->linkClipboardHeaderIcon(
915 IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $lang->getLL('clip_deleteMarked', TRUE))),
916 $table,
917 'delete',
918 sprintf($lang->getLL('clip_deleteMarkedWarning'), $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']))
919 );
920 // The "Select all" link:
921 $onClick = htmlspecialchars(('checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;'));
922 $cells['markAll'] = '<a class="btn btn-default" rel="" href="#" onclick="' . $onClick . '" title="'
923 . $lang->getLL('clip_markRecords', TRUE) . '">'
924 . IconUtility::getSpriteIcon('actions-document-select') . '</a>';
925 } else {
926 $cells['empty'] = '';
927 }
928 /**
929 * @hook renderListHeaderActions: Allows to change the clipboard icons of the Web>List table headers
930 * @usage Above each listed table in Web>List a header row is shown.
931 * This hook allows to modify the icons responsible for the clipboard functions
932 * (shown above the clipboard checkboxes when a clipboard other than "Normal" is selected),
933 * or other "Action" functions which perform operations on the listed records.
934 */
935 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
936 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
937 $hookObject = GeneralUtility::getUserObj($classData);
938 if (!$hookObject instanceof RecordListHookInterface) {
939 throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567850);
940 }
941 $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
942 }
943 }
944 $theData[$fCol] = '<div class="btn-group" role="group">' . implode('', $cells) . '</div>';
945 break;
946 case '_CONTROL_':
947 // Control panel:
948 if ($this->isEditable($table)) {
949 // If new records can be created on this page, add links:
950 $permsAdditional = ($table === 'pages' ? 8 : 16);
951 if ($this->calcPerms & $permsAdditional && $this->showNewRecLink($table)) {
952 $spriteIcon = $table === 'pages'
953 ? IconUtility::getSpriteIcon('actions-page-new')
954 : IconUtility::getSpriteIcon('actions-document-new');
955 if ($table === 'tt_content' && $this->newWizards) {
956 // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
957 $tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
958 $tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension'];
959 $newContentWizScriptPath = ExtensionManagementUtility::isLoaded($tmpTSc)
960 ? $this->backPath . ExtensionManagementUtility::extRelPath($tmpTSc) . 'mod1/db_new_content_el.php?id=' . $this->id
961 : BackendUtility::getModuleUrl('new_content_element', array('id' => $this->id));
962
963 $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($newContentWizScriptPath) . ');';
964 $icon = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="'
965 . $lang->getLL('new', TRUE) . '">' . $spriteIcon . '</a>';
966 } elseif ($table == 'pages' && $this->newWizards) {
967 $parameters = ['id' => $this->id, 'pagesOnly' => 1, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
968 $href = BackendUtility::getModuleUrl('db_new', $parameters);
969 $icon = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="' . $lang->getLL('new', TRUE) . '">'
970 . $spriteIcon . '</a>';
971 } else {
972 $params = '&edit[' . $table . '][' . $this->id . ']=new';
973 if ($table == 'pages_language_overlay') {
974 $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageRow['doktype'];
975 }
976 $icon = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1))
977 . '" title="' . $lang->getLL('new', TRUE) . '">' . $spriteIcon . '</a>';
978 }
979 }
980 // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
981 if ($permsEdit && $this->table && is_array($currentIdList)) {
982 $editIdList = implode(',', $currentIdList);
983 if ($this->clipNumPane()) {
984 $editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
985 }
986 $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray);
987 $icon .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1))
988 . '" title="' . $lang->getLL('editShownColumns', TRUE) . '">'
989 . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
990 $icon = '<div class="btn-group" role="group">' . $icon . '</div>';
991 }
992 // Add an empty entry, so column count fits again after moving this into $icon
993 $theData[$fCol] = '&nbsp;';
994 }
995 break;
996 default:
997 // Regular fields header:
998 $theData[$fCol] = '';
999
1000 // Check if $fCol is really a field and get the label and remove the colons
1001 // at the end
1002 $sortLabel = BackendUtility::getItemLabel($table, $fCol);
1003 if ($sortLabel !== NULL) {
1004 $sortLabel = $lang->sL($sortLabel, TRUE);
1005 $sortLabel = rtrim(trim($sortLabel), ':');
1006 } else {
1007 // No TCA field, only output the $fCol variable with square brackets []
1008 $sortLabel = htmlspecialchars($fCol);
1009 $sortLabel = '<i>[' . rtrim(trim($sortLabel), ':') . ']</i>';
1010 }
1011
1012 if ($this->table && is_array($currentIdList)) {
1013 // If the numeric clipboard pads are selected, show duplicate sorting link:
1014 if ($this->clipNumPane()) {
1015 $theData[$fCol] .= '<a class="btn btn-default" href="' . htmlspecialchars($this->listURL('', -1) . '&duplicateField=' . $fCol)
1016 . '" title="' . $lang->getLL('clip_duplicates', TRUE) . '">'
1017 . IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>';
1018 }
1019 // If the table can be edited, add link for editing THIS field for all
1020 // listed records:
1021 if ($this->isEditable($table) && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) {
1022 $editIdList = implode(',', $currentIdList);
1023 if ($this->clipNumPane()) {
1024 $editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
1025 }
1026 $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol;
1027 $iTitle = sprintf($lang->getLL('editThisColumn'), $sortLabel);
1028 $theData[$fCol] .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1))
1029 . '" title="' . htmlspecialchars($iTitle) . '">'
1030 . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
1031 }
1032 if(strlen($theData[$fCol]) > 0){
1033 $theData[$fCol] = '<div class="btn-group" role="group">' . $theData[$fCol] . '</div> ';
1034 }
1035 }
1036 $theData[$fCol] .= $this->addSortLink($sortLabel, $fCol, $table);
1037 }
1038 }
1039 /**
1040 * @hook renderListHeader: Allows to change the contents of columns/cells of the Web>List table headers
1041 * @usage Above each listed table in Web>List a header row is shown.
1042 * Containing the labels of all shown fields and additional icons to create new records for this
1043 * table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc.
1044 */
1045 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1046 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1047 $hookObject = GeneralUtility::getUserObj($classData);
1048 if (!$hookObject instanceof RecordListHookInterface) {
1049 throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567855);
1050 }
1051 $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
1052 }
1053 }
1054
1055
1056 // Create and return header table row:
1057 return '<thead>' . $this->addelement(1, $icon, $theData, '', '', '', 'th') . '</thead>';
1058 }
1059
1060 /**
1061 * Get pointer for first element on the page
1062 *
1063 * @param int $page Page number starting with 1
1064 * @return int Pointer to first element on the page (starting with 0)
1065 */
1066 protected function getPointerForPage($page) {
1067 return ($page - 1) * $this->iLimit;
1068 }
1069
1070 /**
1071 * Creates a page browser for tables with many records
1072 *
1073 * @param string $renderPart Distinguish between 'top' and 'bottom' part of the navigation (above or below the records)
1074 * @return string Navigation HTML
1075 */
1076 protected function renderListNavigation($renderPart = 'top') {
1077 $totalPages = ceil($this->totalItems / $this->iLimit);
1078 // Show page selector if not all records fit into one page
1079 if ($totalPages <= 1) {
1080 return '';
1081 }
1082 $content = '';
1083 $listURL = $this->listURL('', $this->table);
1084 // 1 = first page
1085 // 0 = first element
1086 $currentPage = floor($this->firstElementNumber / $this->iLimit) + 1;
1087 // Compile first, previous, next, last and refresh buttons
1088 if ($currentPage > 1) {
1089 $labelFirst = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:first');
1090 $labelPrevious = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:previous');
1091 $first = '<li><a href="' . $listURL . '&pointer=' . $this->getPointerForPage(1) . '">'
1092 . IconUtility::getSpriteIcon('actions-view-paging-first', array('title' => $labelFirst)) . '</a></li>';
1093 $previous = '<li><a href="' . $listURL . '&pointer=' . $this->getPointerForPage($currentPage - 1) . '">'
1094 . IconUtility::getSpriteIcon('actions-view-paging-previous', array('title' => $labelPrevious)) . '</a></li>';
1095 } else {
1096 $first = '<li class="disabled"><span>' . IconUtility::getSpriteIcon('actions-view-paging-first') . '</span></li>';
1097 $previous = '<li class="disabled"><span>' . IconUtility::getSpriteIcon('actions-view-paging-previous') . '</span></li>';
1098 }
1099 if ($currentPage < $totalPages) {
1100 $labelNext = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:next');
1101 $labelLast = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:last');
1102 $next = '<li><a href="' . $listURL . '&pointer=' . $this->getPointerForPage($currentPage + 1) . '">'
1103 . IconUtility::getSpriteIcon('actions-view-paging-next', array('title' => $labelNext)) . '</a></li>';
1104 $last = '<li><a href="' . $listURL . '&pointer=' . $this->getPointerForPage($totalPages) . '">'
1105 . IconUtility::getSpriteIcon('actions-view-paging-last', array('title' => $labelLast)) . '</a></li>';
1106 } else {
1107 $next = '<li class="disabled"><span>' . IconUtility::getSpriteIcon('actions-view-paging-next') . '</span></li>';
1108 $last = '<li class="disabled"><span>' . IconUtility::getSpriteIcon('actions-view-paging-last') . '</span></li>';
1109 }
1110 $reload = '<li><a href="#" onclick="document.dblistForm.action=\'' . $listURL
1111 . '&pointer=\'+calculatePointer(document.getElementById(\'jumpPage-' . $renderPart
1112 . '\').value); document.dblistForm.submit(); return true;" title="'
1113 . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:reload', TRUE) . '">'
1114 . IconUtility::getSpriteIcon('actions-system-refresh') . '</a></li>';
1115 if ($renderPart === 'top') {
1116 // Add js to traverse a page select input to a pointer value
1117 $content = '
1118 <script type="text/javascript">
1119 /*<![CDATA[*/
1120 function calculatePointer(page) {
1121 if (page > ' . $totalPages . ') {
1122 page = ' . $totalPages . ';
1123 }
1124 if (page < 1) {
1125 page = 1;
1126 }
1127 return (page - 1) * ' . $this->iLimit . ';
1128 }
1129 /*]]>*/
1130 </script>
1131 ';
1132 }
1133 $pageNumberInput = '
1134 <input type="text" value="' . $currentPage . '" size="3" class="form-control input-sm paginator-input" id="jumpPage-' . $renderPart . '" name="jumpPage-'
1135 . $renderPart . '" onkeyup="if (event.keyCode == 13) { document.dblistForm.action=\'' . $listURL
1136 . '&pointer=\'+calculatePointer(this.value); document.dblistForm.submit(); } return true;" />
1137 ';
1138 $pageIndicatorText = sprintf(
1139 $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:pageIndicator'),
1140 $pageNumberInput,
1141 $totalPages
1142 );
1143 $pageIndicator = '<li><span>' . $pageIndicatorText . '</span></li>';
1144 if ($this->totalItems > $this->firstElementNumber + $this->iLimit) {
1145 $lastElementNumber = $this->firstElementNumber + $this->iLimit;
1146 } else {
1147 $lastElementNumber = $this->totalItems;
1148 }
1149 $rangeIndicator = '<li><span>' . sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:rangeIndicator'), ($this->firstElementNumber + 1), $lastElementNumber) . '</span></li>';
1150
1151 $titleColumn = $this->fieldArray[0];
1152 $data = array(
1153 $titleColumn => $content . '
1154 <nav class="pagination-wrap">
1155 <ul class="pagination pagination-block">
1156 ' . $first . '
1157 ' . $previous . '
1158 ' . $rangeIndicator . '
1159 ' . $pageIndicator . '
1160 ' . $next . '
1161 ' . $last . '
1162 ' . $reload . '
1163 </ul>
1164 </nav>
1165 '
1166 );
1167 return $this->addElement(1, '', $data);
1168 }
1169
1170 /*********************************
1171 *
1172 * Rendering of various elements
1173 *
1174 *********************************/
1175
1176 /**
1177 * Creates the control panel for a single record in the listing.
1178 *
1179 * @param string $table The table
1180 * @param mixed[] $row The record for which to make the control panel.
1181 * @throws \UnexpectedValueException
1182 * @return string HTML table with the control panel (unless disabled)
1183 */
1184 public function makeControl($table, $row) {
1185 $module = $this->getModule();
1186 $rowUid = $row['uid'];
1187 if (ExtensionManagementUtility::isLoaded('version') && isset($row['_ORIG_uid'])) {
1188 $rowUid = $row['_ORIG_uid'];
1189 }
1190 $cells = array(
1191 'primary' => array(),
1192 'secondary' => array()
1193 );
1194 // If the listed table is 'pages' we have to request the permission settings for each page:
1195 $localCalcPerms = 0;
1196 if ($table == 'pages') {
1197 $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
1198 }
1199 $permsEdit = $table === 'pages' && $localCalcPerms & Permission::PAGE_EDIT || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT;
1200 $permsEdit = $this->overlayEditLockPermissions($table, $row, $permsEdit);
1201 // "Show" link (only pages and tt_content elements)
1202 if ($table == 'pages' || $table == 'tt_content') {
1203 $viewAction = '<a class="btn btn-default" href="#" onclick="'
1204 . htmlspecialchars(
1205 BackendUtility::viewOnClick(
1206 ($table === 'tt_content' ? $this->id : $row['uid']),
1207 $this->backPath,
1208 '',
1209 ($table === 'tt_content' ? '#' . $row['uid'] : '')
1210 )
1211 ) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
1212 . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
1213 $this->addActionToCellGroup($cells, $viewAction, 'view');
1214 }
1215 // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
1216 if ($permsEdit) {
1217 $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
1218 $spriteIcon = (!$this->isEditable($table) ? 'actions-document-open-read-only' : 'actions-document-open');
1219 $editAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1))
1220 . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '">' . IconUtility::getSpriteIcon($spriteIcon) . '</a>';
1221 } else {
1222 $editAction = $this->spaceIcon;
1223 }
1224 $this->addActionToCellGroup($cells, $editAction, 'edit');
1225 // "Info": (All records)
1226 $onClick = 'top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;';
1227 $viewBigAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('showInfo', TRUE) . '">'
1228 . IconUtility::getSpriteIcon('actions-document-info') . '</a>';
1229 $this->addActionToCellGroup($cells, $viewBigAction, 'viewBig');
1230 // "Move" wizard link for pages/tt_content elements:
1231 if ($permsEdit && ($table === 'tt_content' || $table === 'pages')) {
1232 $onClick = 'return jumpExt(\'' . $this->backPath . BackendUtility::getModuleUrl('move_element') . '&table=' . $table . '&uid=' . $row['uid'] . '\');';
1233 $linkTitleLL = $this->getLanguageService()->getLL('move_' . ($table === 'tt_content' ? 'record' : 'page'), TRUE);
1234 $spriteIcon = $table === 'tt_content' ? 'actions-document-move' : 'actions-page-move';
1235 $moveAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $linkTitleLL . '">' . IconUtility::getSpriteIcon($spriteIcon) . '</a>';
1236 $this->addActionToCellGroup($cells, $moveAction, 'move');
1237 }
1238 // If the table is NOT a read-only table, then show these links:
1239 if ($this->isEditable($table)) {
1240 // "Revert" link (history/undo)
1241 $moduleUrl = BackendUtility::getModuleUrl('record_history', array('element' => $table . ':' . $row['uid']));
1242 $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($this->backPath . $moduleUrl) . ',\'#latest\');';
1243 $historyAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars($onClick) . '" title="'
1244 . $this->getLanguageService()->getLL('history', TRUE) . '">'
1245 . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
1246 $this->addActionToCellGroup($cells, $historyAction, 'history');
1247 // Versioning:
1248 if (ExtensionManagementUtility::isLoaded('version') && !ExtensionManagementUtility::isLoaded('workspaces')) {
1249 $vers = BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $this->getBackendUserAuthentication()->workspace, FALSE, $row);
1250 // If table can be versionized.
1251 if (is_array($vers)) {
1252 $versionIcon = 'no-version';
1253 if (count($vers) > 1) {
1254 $versionIcon = count($vers) - 1;
1255 }
1256 $href = $this->backPath . BackendUtility::getModuleUrl('web_txversionM1', array(
1257 'table' => $table, 'uid' => $row['uid']
1258 ));
1259 $versionAction = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="'
1260 . $this->getLanguageService()->getLL('displayVersions', TRUE) . '">'
1261 . IconUtility::getSpriteIcon(('status-version-' . $versionIcon)) . '</a>';
1262 $this->addActionToCellGroup($cells, $versionAction, 'version');
1263 }
1264 }
1265 // "Edit Perms" link:
1266 if ($table === 'pages' && $this->getBackendUserAuthentication()->check('modules', 'system_BeuserTxPermission') && ExtensionManagementUtility::isLoaded('beuser')) {
1267 $href = BackendUtility::getModuleUrl('system_BeuserTxPermission') . '&id=' . $row['uid'] . '&return_id=' . $row['uid'] . '&edit=1';
1268 $permsAction = '<a class="btn btn-default" href="' . htmlspecialchars($href) . '" title="'
1269 . $this->getLanguageService()->getLL('permissions', TRUE) . '">'
1270 . IconUtility::getSpriteIcon('status-status-locked') . '</a>';
1271 $this->addActionToCellGroup($cells, $permsAction, 'perms');
1272 }
1273 // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row
1274 // or if default values can depend on previous record):
1275 if ($GLOBALS['TCA'][$table]['ctrl']['sortby'] || $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
1276 if ($table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT || $table === 'pages' && $this->calcPerms & Permission::PAGE_NEW) {
1277 if ($this->showNewRecLink($table)) {
1278 $params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new';
1279 $newAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1))
1280 . '" title="' . $this->getLanguageService()->getLL('new' . ($table == 'pages ' ? 'Page' : 'Record'), TRUE) . '">'
1281 . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
1282 $this->addActionToCellGroup($cells, $newAction, 'new');
1283 }
1284 }
1285 }
1286 // "Up/Down" links
1287 if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
1288 if (isset($this->currentTable['prev'][$row['uid']])) {
1289 // Up
1290 $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
1291 $moveUpAction = '<a class="btn btn-default" href="#" onclick="'
1292 . htmlspecialchars('return jumpToUrl(' . $module->doc->issueCommand($params, -1) . ');')
1293 . '" title="' . $this->getLanguageService()->getLL('moveUp', TRUE) . '">'
1294 . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
1295 } else {
1296 $moveUpAction = $this->spaceIcon;
1297 }
1298 $this->addActionToCellGroup($cells, $moveUpAction, 'moveUp');
1299
1300 if ($this->currentTable['next'][$row['uid']]) {
1301 // Down
1302 $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
1303 $moveDownAction = '<a class="btn btn-default" href="#" onclick="'
1304 . htmlspecialchars('return jumpToUrl(' . $module->doc->issueCommand($params, -1) . ');')
1305 . '" title="' . $this->getLanguageService()->getLL('moveDown', TRUE) . '">'
1306 . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
1307 } else {
1308 $moveDownAction = $this->spaceIcon;
1309 }
1310 $this->addActionToCellGroup($cells, $moveDownAction, 'moveDown');
1311 }
1312 // "Hide/Unhide" links:
1313 $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
1314
1315 if (
1316 $permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField]
1317 && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude']
1318 || $this->getBackendUserAuthentication()->check('non_exclude_fields', $table . ':' . $hiddenField))
1319 ) {
1320 if ($this->isRecordCurrentBackendUser($table, $row)) {
1321 $hideAction = $this->spaceIcon;
1322 } else {
1323 if ($row[$hiddenField]) {
1324 $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
1325 $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="hidden" href="#"'
1326 . ' data-params="' . htmlspecialchars($params) . '"'
1327 . ' title="' . $this->getLanguageService()->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">'
1328 . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
1329 } else {
1330 $params = 'data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
1331 $hideAction = '<a class="btn btn-default t3js-record-hide" data-state="visible" href="#"'
1332 . ' data-params="' . htmlspecialchars($params) . '"'
1333 . ' title="' . $this->getLanguageService()->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">'
1334 . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
1335 }
1336 }
1337 $this->addActionToCellGroup($cells, $hideAction, 'hide');
1338 }
1339 // "Delete" link:
1340 if ($permsEdit && ($table === 'pages' && $localCalcPerms & Permission::PAGE_DELETE || $table !== 'pages' && $this->calcPerms & Permission::CONTENT_EDIT)) {
1341 // Check if the record version is in "deleted" state, because that will switch the action to "restore"
1342 if ($this->getBackendUserAuthentication()->workspace > 0 && isset($row['t3ver_state']) && (int)$row['t3ver_state'] === 2) {
1343 $actionName = 'restore';
1344 $refCountMsg = '';
1345 } else {
1346 $actionName = 'delete';
1347 $refCountMsg = BackendUtility::referenceCount(
1348 $table,
1349 $row['uid'],
1350 ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToRecord'),
1351 $this->getReferenceCount($table, $row['uid'])) . BackendUtility::translationCount($table, $row['uid'],
1352 ' ' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord')
1353 );
1354 }
1355
1356 if ($this->isRecordCurrentBackendUser($table, $row)) {
1357 $deleteAction = $this->spaceIcon;
1358 } else {
1359 $titleOrig = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
1360 $title = GeneralUtility::slashJS(GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL), TRUE);
1361 $warningText = $this->getLanguageService()->getLL($actionName . 'Warning') . ' "' . $title . '" ' . '[' . $table . ':' . $row['uid'] . ']' . $refCountMsg;
1362
1363 $params = 'cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
1364 $icon = IconUtility::getSpriteIcon('actions-edit-' . $actionName);
1365 $linkTitle = $this->getLanguageService()->getLL($actionName, TRUE);
1366 $deleteAction = '<a class="btn btn-default t3js-record-delete" href="#" '
1367 . ' data-l10parent="' . htmlspecialchars($row['l10n_parent']) . '"'
1368 . ' data-params="' . htmlspecialchars($params) . '" data-title="' . htmlspecialchars($titleOrig) . '"'
1369 . ' data-message="' . htmlspecialchars($warningText) . '" title="' . $linkTitle . '"'
1370 . '>' . $icon . '</a>';
1371 }
1372 } else {
1373 $deleteAction = $this->spaceIcon;
1374 }
1375 $this->addActionToCellGroup($cells, $deleteAction, 'delete');
1376 // "Levels" links: Moving pages into new levels...
1377 if ($permsEdit && $table == 'pages' && !$this->searchLevels) {
1378 // Up (Paste as the page right after the current parent page)
1379 if ($this->calcPerms & Permission::PAGE_NEW) {
1380 $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
1381 $moveLeftAction = '<a class="btn btn-default" href="#" onclick="'
1382 . htmlspecialchars('return jumpToUrl(' . $module->doc->issueCommand($params, -1) . ');')
1383 . '" title="' . $this->getLanguageService()->getLL('prevLevel', TRUE) . '">'
1384 . IconUtility::getSpriteIcon('actions-move-left') . '</a>';
1385 $this->addActionToCellGroup($cells, $moveLeftAction, 'moveLeft');
1386 }
1387 // Down (Paste as subpage to the page right above)
1388 if ($this->currentTable['prevUid'][$row['uid']]) {
1389 $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
1390 if ($localCalcPerms & Permission::PAGE_NEW) {
1391 $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
1392 $moveRightAction = '<a class="btn btn-default" href="#" onclick="'
1393 . htmlspecialchars('return jumpToUrl(' . $module->doc->issueCommand($params, -1) . ');')
1394 . '" title="' . $this->getLanguageService()->getLL('nextLevel', TRUE) . '">'
1395 . IconUtility::getSpriteIcon('actions-move-right') . '</a>';
1396 } else {
1397 $moveRightAction = $this->spaceIcon;
1398 }
1399 } else {
1400 $moveRightAction = $this->spaceIcon;
1401 }
1402 $this->addActionToCellGroup($cells, $moveRightAction, 'moveRight');
1403 }
1404 }
1405 /**
1406 * @hook recStatInfoHooks: Allows to insert HTML before record icons on various places
1407 */
1408 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
1409 $stat = '';
1410 $_params = array($table, $row['uid']);
1411 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
1412 $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1413 }
1414 $this->addActionToCellGroup($cells, $stat, 'stat');
1415 }
1416 /**
1417 * @hook makeControl: Allows to change control icons of records in list-module
1418 * @usage This hook method gets passed the current $cells array as third parameter.
1419 * This array contains values for the icons/actions generated for each record in Web>List.
1420 * Each array entry is accessible by an index-key.
1421 * The order of the icons is depending on the order of those array entries.
1422 */
1423 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1424 // for compatibility reason, we move all icons to the rootlevel
1425 // before calling the hooks
1426 foreach ($cells as $section => $actions) {
1427 foreach ($actions as $actionKey => $action) {
1428 $cells[$actionKey] = $action;
1429 }
1430 }
1431 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1432 $hookObject = GeneralUtility::getUserObj($classData);
1433 if (!$hookObject instanceof RecordListHookInterface) {
1434 throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567840);
1435 }
1436 $cells = $hookObject->makeControl($table, $row, $cells, $this);
1437 }
1438 // now sort icons again into primary and secondary sections
1439 // after all hooks are processed
1440 $hookCells = $cells;
1441 foreach ($hookCells as $key => $value) {
1442 if ($key === 'primary' || $key === 'secondary') {
1443 continue;
1444 }
1445 $this->addActionToCellGroup($cells, $value, $key);
1446 }
1447 }
1448 $output = '<!-- CONTROL PANEL: ' . $table . ':' . $row['uid'] . ' -->';
1449 foreach($cells as $classification => $actions) {
1450 $visibilityClass = ($classification !== 'primary' && !$module->MOD_SETTINGS['bigControlPanel'] ? 'collapsed' : 'expanded');
1451 if ($visibilityClass === 'collapsed') {
1452 $cellOutput = '';
1453 foreach ($actions as $action) {
1454 $cellOutput .= $action;
1455 }
1456 $output .= ' <div class="btn-group">' .
1457 '<span id="actions_' . $table . '_' . $row['uid'] . '" class="btn-group collapse collapse-horizontal width">' . $cellOutput . '</span>' .
1458 '<a href="#actions_' . $table . '_' . $row['uid'] . '" class="btn btn-default collapsed" data-toggle="collapse" aria-expanded="false"><span class="t3-icon fa fa-ellipsis-h"></span></a>' .
1459 '</div>';
1460 } else {
1461 $output .= ' <div class="btn-group" role="group">' . implode('', $actions) . '</div>';
1462 }
1463 }
1464 return $output;
1465 }
1466
1467 /**
1468 * Creates the clipboard panel for a single record in the listing.
1469 *
1470 * @param string $table The table
1471 * @param mixed[] $row The record for which to make the clipboard panel.
1472 * @throws \UnexpectedValueException
1473 * @return string HTML table with the clipboard panel (unless disabled)
1474 */
1475 public function makeClip($table, $row) {
1476 // Return blank, if disabled:
1477 if (!$this->getModule()->MOD_SETTINGS['clipBoard']) {
1478 return '';
1479 }
1480 $cells = array();
1481 $cells['pasteAfter'] = ($cells['pasteInto'] = $this->spaceIcon);
1482 //enables to hide the copy, cut and paste icons for localized records - doesn't make much sense to perform these options for them
1483 $isL10nOverlay = $this->localizationView && $table != 'pages_language_overlay' && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
1484 // Return blank, if disabled:
1485 // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
1486 // For the "Normal" pad:
1487 if ($this->clipObj->current == 'normal') {
1488 // Show copy/cut icons:
1489 $isSel = (string)$this->clipObj->isSelected($table, $row['uid']);
1490 if ($isL10nOverlay || !$this->overlayEditLockPermissions($table, $row)) {
1491 $cells['copy'] = $this->spaceIcon;
1492 $cells['cut'] = $this->spaceIcon;
1493 } else {
1494 $cells['copy'] = '<a class="btn btn-default" href="#" onclick="'
1495 . htmlspecialchars('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 1, ($isSel == 'copy'), array('returnUrl' => '')) . '\');')
1496 . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE) . '">'
1497 . (!$isSel == 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . '</a>';
1498 if (TRUE) {
1499 $cells['cut'] = '<a class="btn btn-default" href="#" onclick="'
1500 . htmlspecialchars('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 0, ($isSel == 'cut'), array('returnUrl' => '')) . '\');')
1501 . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE) . '">'
1502 . (!$isSel == 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . '</a>';
1503 } else {
1504 $cells['cut'] = $this->spaceIcon;
1505 }
1506 }
1507 } else {
1508 // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
1509 // Setting name of the element in ->CBnames array:
1510 $n = $table . '|' . $row['uid'];
1511 $this->CBnames[] = $n;
1512 // Check if the current element is selected and if so, prepare to set the checkbox as selected:
1513 $checked = $this->clipObj->isSelected($table, $row['uid']) ? 'checked="checked" ' : '';
1514 // If the "duplicateField" value is set then select all elements which are duplicates...
1515 if ($this->duplicateField && isset($row[$this->duplicateField])) {
1516 $checked = '';
1517 if (in_array($row[$this->duplicateField], $this->duplicateStack)) {
1518 $checked = 'checked="checked" ';
1519 }
1520 $this->duplicateStack[] = $row[$this->duplicateField];
1521 }
1522 // Adding the checkbox to the panel:
1523 $cells['select'] = $isL10nOverlay
1524 ? $this->spaceIcon
1525 : '<label class="btn btn-default btn-checkbox"><input type="hidden" name="CBH[' . $n . ']" value="0" /><input type="checkbox"'
1526 . ' name="CBC[' . $n . ']" value="1" ' . $checked . '/><span class="t3-icon fa"></span></label>';
1527 }
1528 // Now, looking for selected elements from the current table:
1529 $elFromTable = $this->clipObj->elFromTable($table);
1530 if (!empty($elFromTable) && $GLOBALS['TCA'][$table]['ctrl']['sortby']) {
1531 // IF elements are found and they can be individually ordered, then add a "paste after" icon:
1532 $cells['pasteAfter'] = $isL10nOverlay
1533 ? $this->spaceIcon
1534 : '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->pasteUrl($table, -$row['uid'])) . '" onclick="'
1535 . htmlspecialchars(('return ' . $this->clipObj->confirmMsg($table, $row, 'after', $elFromTable)))
1536 . '" title="' . $this->getLanguageService()->getLL('clip_pasteAfter', TRUE) . '">'
1537 . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
1538 }
1539 // Now, looking for elements in general:
1540 $elFromTable = $this->clipObj->elFromTable('');
1541 if ($table == 'pages' && !empty($elFromTable)) {
1542 $cells['pasteInto'] = '<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->pasteUrl('', $row['uid']))
1543 . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg($table, $row, 'into', $elFromTable))
1544 . '" title="' . $this->getLanguageService()->getLL('clip_pasteInto', TRUE) . '">'
1545 . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
1546 }
1547 /**
1548 * @hook makeClip: Allows to change clip-icons of records in list-module
1549 * @usage This hook method gets passed the current $cells array as third parameter.
1550 * This array contains values for the clipboard icons generated for each record in Web>List.
1551 * Each array entry is accessible by an index-key.
1552 * The order of the icons is depending on the order of those array entries.
1553 */
1554 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1555 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1556 $hookObject = GeneralUtility::getUserObj($classData);
1557 if (!$hookObject instanceof RecordListHookInterface) {
1558 throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567845);
1559 }
1560 $cells = $hookObject->makeClip($table, $row, $cells, $this);
1561 }
1562 }
1563 // Compile items into a DIV-element:
1564 return '<!-- CLIPBOARD PANEL: ' . $table . ':' . $row['uid'] . ' -->
1565 <div class="btn-group" role="group">' . implode('', $cells) . '</div>';
1566 }
1567
1568 /**
1569 * Creates the HTML for a reference count for the record with the UID $uid
1570 * in the table $tableName.
1571 *
1572 * @param string $tableName
1573 * @param int $uid
1574 * @return string HTML of reference a link, will be empty if there are no
1575 */
1576 protected function createReferenceHtml($tableName, $uid) {
1577 $db = $this->getDatabaseConnection();
1578 $referenceCount = $db->exec_SELECTcountRows(
1579 '*',
1580 'sys_refindex',
1581 'ref_table = ' . $db->fullQuoteStr($tableName, 'sys_refindex') .
1582 ' AND ref_uid = ' . $uid . ' AND deleted = 0'
1583 );
1584 return $this->generateReferenceToolTip($referenceCount, '\'' . $tableName . '\', \'' . $uid . '\'');
1585 }
1586
1587 /**
1588 * Creates the localization panel
1589 *
1590 * @param string $table The table
1591 * @param mixed[] $row The record for which to make the localization panel.
1592 * @return string[] Array with key 0/1 with content for column 1 and 2
1593 */
1594 public function makeLocalizationPanel($table, $row) {
1595 $out = array(
1596 0 => '',
1597 1 => ''
1598 );
1599 // Reset translations
1600 $this->translations = array();
1601
1602 // Language title and icon:
1603 $out[0] = $this->languageFlag($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]);
1604
1605 $translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row, $this->selFieldList);
1606 if (is_array($translations)) {
1607 $this->translations = $translations['translations'];
1608 // Traverse page translations and add icon for each language that does NOT yet exist:
1609 $lNew = '';
1610 foreach ($this->pageOverlays as $lUid_OnPage => $lsysRec) {
1611 if ($this->isEditable && !isset($translations['translations'][$lUid_OnPage]) && $this->getBackendUserAuthentication()->checkLanguageAccess($lUid_OnPage)) {
1612 $url = substr($this->listURL(), strlen($this->backPath));
1613 $href = $this->getModule()->doc->issueCommand(
1614 '&cmd[' . $table . '][' . $row['uid'] . '][localize]=' . $lUid_OnPage,
1615 $url . '&justLocalized=' . rawurlencode($table . ':' . $row['uid'] . ':' . $lUid_OnPage)
1616 );
1617 $language = BackendUtility::getRecord('sys_language', $lUid_OnPage, 'title');
1618 if ($this->languageIconTitles[$lUid_OnPage]['flagIcon']) {
1619 $lC = IconUtility::getSpriteIcon($this->languageIconTitles[$lUid_OnPage]['flagIcon']);
1620 } else {
1621 $lC = $this->languageIconTitles[$lUid_OnPage]['title'];
1622 }
1623 $lC = '<a href="' . htmlspecialchars($href) . '" title="'
1624 . htmlspecialchars($language['title']) . '">' . $lC . '</a> ';
1625 $lNew .= $lC;
1626 }
1627 }
1628 if ($lNew) {
1629 $out[1] .= $lNew;
1630 }
1631 } elseif ($row['l18n_parent']) {
1632 $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $out[0];
1633 }
1634 return $out;
1635 }
1636
1637 /**
1638 * Create the selector box for selecting fields to display from a table:
1639 *
1640 * @param string $table Table name
1641 * @param bool $formFields If TRUE, form-fields will be wrapped around the table.
1642 * @return string HTML table with the selector box (name: displayFields['.$table.'][])
1643 */
1644 public function fieldSelectBox($table, $formFields = TRUE) {
1645 $lang = $this->getLanguageService();
1646 // Init:
1647 $formElements = array('', '');
1648 if ($formFields) {
1649 $formElements = array('<form action="' . htmlspecialchars($this->listURL()) . '" method="post">', '</form>');
1650 }
1651 // Load already selected fields, if any:
1652 $setFields = is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
1653 // Request fields from table:
1654 $fields = $this->makeFieldList($table, FALSE, TRUE);
1655 // Add pseudo "control" fields
1656 $fields[] = '_PATH_';
1657 $fields[] = '_REF_';
1658 $fields[] = '_LOCALIZATION_';
1659 $fields[] = '_CONTROL_';
1660 $fields[] = '_CLIPBOARD_';
1661 // Create an option for each field:
1662 $opt = array();
1663 $opt[] = '<option value=""></option>';
1664 foreach ($fields as $fN) {
1665 // Field label
1666 $fL = is_array($GLOBALS['TCA'][$table]['columns'][$fN])
1667 ? rtrim($lang->sL($GLOBALS['TCA'][$table]['columns'][$fN]['label']), ':')
1668 : '[' . $fN . ']';
1669 $opt[] = '<option value="' . $fN . '"' . (in_array($fN, $setFields) ? ' selected="selected"' : '') . '>'
1670 . htmlspecialchars($fL) . '</option>';
1671 }
1672 // Compile the options into a multiple selector box:
1673 $lMenu = '<select size="' . MathUtility::forceIntegerInRange(count($fields) + 1, 3, 20)
1674 . '" multiple="multiple" name="displayFields[' . $table . '][]">' . implode('', $opt) . '</select>';
1675 // Table with the field selector::
1676 $content = $formElements[0] . '
1677 <!--
1678 Field selector for extended table view:
1679 -->
1680 <table border="0" cellpadding="0" cellspacing="0" id="typo3-dblist-fieldSelect">
1681 <tr>
1682 <td>
1683 ' . $lMenu . '
1684 </td>
1685 <td>
1686 <input class="btn btn-default" type="submit" name="search" value="'
1687 . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.setFields', TRUE) . '" />
1688 </td>
1689 </tr>
1690 </table>
1691 ' . $formElements[1];
1692 return '<div class="db_list-fieldSelect">' . $content . '</div>';
1693 }
1694
1695 /*********************************
1696 *
1697 * Helper functions
1698 *
1699 *********************************/
1700 /**
1701 * Creates a link around $string. The link contains an onclick action
1702 * which submits the script with some clipboard action.
1703 * Currently, this is used for setting elements / delete elements.
1704 *
1705 * @param string $string The HTML content to link (image/text)
1706 * @param string $table Table name
1707 * @param string $cmd Clipboard command (eg. "setCB" or "delete")
1708 * @param string $warning Warning text, if any ("delete" uses this for confirmation)
1709 * @return string <a> tag wrapped link.
1710 */
1711 public function linkClipboardHeaderIcon($string, $table, $cmd, $warning = '') {
1712 $onClickEvent = 'document.dblistForm.cmd.value=\'' . $cmd . '\';document.dblistForm.cmd_table.value=\''
1713 . $table . '\';document.dblistForm.submit();';
1714 if ($warning) {
1715 $onClickEvent = 'if (confirm(' . GeneralUtility::quoteJSvalue($warning) . ')){' . $onClickEvent . '}';
1716 }
1717 return '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(($onClickEvent . 'return false;')) . '">' . $string . '</a>';
1718 }
1719
1720 /**
1721 * Returns TRUE if a numeric clipboard pad is selected/active
1722 *
1723 * @return bool
1724 */
1725 public function clipNumPane() {
1726 return in_Array('_CLIPBOARD_', $this->fieldArray) && $this->clipObj->current != 'normal';
1727 }
1728
1729 /**
1730 * Creates a sort-by link on the input string ($code).
1731 * It will automatically detect if sorting should be ascending or descending depending on $this->sortRev.
1732 * Also some fields will not be possible to sort (including if single-table-view is disabled).
1733 *
1734 * @param string $code The string to link (text)
1735 * @param string $field The fieldname represented by the title ($code)
1736 * @param string $table Table name
1737 * @return string Linked $code variable
1738 */
1739 public function addSortLink($code, $field, $table) {
1740 // Certain circumstances just return string right away (no links):
1741 if ($field == '_CONTROL_' || $field == '_LOCALIZATION_' || $field == '_CLIPBOARD_' || $field == '_REF_' || $this->disableSingleTableView) {
1742 return $code;
1743 }
1744 // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
1745 if ($field == '_PATH_') {
1746 $field = 'pid';
1747 }
1748 // Create the sort link:
1749 $sortUrl = $this->listURL('', -1, 'sortField,sortRev,table,firstElementNumber') . '&table=' . $table
1750 . '&sortField=' . $field . '&sortRev=' . ($this->sortRev || $this->sortField != $field ? 0 : 1);
1751 $sortArrow = $this->sortField === $field
1752 ? IconUtility::getSpriteIcon('status-status-sorting-' . ($this->sortRev ? 'desc' : 'asc'))
1753 : '';
1754 // Return linked field:
1755 return '<a href="' . htmlspecialchars($sortUrl) . '">' . $code . $sortArrow . '</a>';
1756 }
1757
1758 /**
1759 * Returns the path for a certain pid
1760 * The result is cached internally for the session, thus you can call
1761 * this function as much as you like without performance problems.
1762 *
1763 * @param int $pid The page id for which to get the path
1764 * @return mixed[] The path.
1765 */
1766 public function recPath($pid) {
1767 if (!isset($this->recPath_cache[$pid])) {
1768 $this->recPath_cache[$pid] = BackendUtility::getRecordPath($pid, $this->perms_clause, 20);
1769 }
1770 return $this->recPath_cache[$pid];
1771 }
1772
1773 /**
1774 * Returns TRUE if a link for creating new records should be displayed for $table
1775 *
1776 * @param string $table Table name
1777 * @return bool Returns TRUE if a link for creating new records should be displayed for $table
1778 * @see \TYPO3\CMS\Backend\Controller\NewRecordController::showNewRecLink
1779 */
1780 public function showNewRecLink($table) {
1781 // No deny/allow tables are set:
1782 if (empty($this->allowedNewTables) && empty($this->deniedNewTables)) {
1783 return TRUE;
1784 }
1785 return !in_array($table, $this->deniedNewTables)
1786 && (empty($this->allowedNewTables) || in_array($table, $this->allowedNewTables));
1787 }
1788
1789 /**
1790 * Creates the "&returnUrl" parameter for links - this is used when the script links
1791 * to other scripts and passes its own URL with the link so other scripts can return to the listing again.
1792 * Uses REQUEST_URI as value.
1793 *
1794 * @return string
1795 */
1796 public function makeReturnUrl() {
1797 return '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'));
1798 }
1799
1800 /************************************
1801 *
1802 * CSV related functions
1803 *
1804 ************************************/
1805 /**
1806 * Initializes internal csvLines array with the header of field names
1807 *
1808 * @return void
1809 */
1810 protected function initCSV() {
1811 $this->addHeaderRowToCSV();
1812 }
1813
1814 /**
1815 * Add header line with field names as CSV line
1816 *
1817 * @return void
1818 */
1819 protected function addHeaderRowToCSV() {
1820 // Add header row, control fields will be reduced inside addToCSV()
1821 $this->addToCSV(array_combine($this->fieldArray, $this->fieldArray));
1822 }
1823
1824 /**
1825 * Adds selected columns of one table row as CSV line.
1826 *
1827 * @param mixed[] $row Record array, from which the values of fields found in $this->fieldArray will be listed in the CSV output.
1828 * @return void
1829 */
1830 protected function addToCSV(array $row = array()) {
1831 $rowReducedByControlFields = self::removeControlFieldsFromFieldRow($row);
1832 $rowReducedToSelectedColumns = array_intersect_key($rowReducedByControlFields, array_flip($this->fieldArray));
1833 $this->setCsvRow($rowReducedToSelectedColumns);
1834 }
1835
1836 /**
1837 * Remove control fields from row for CSV export
1838 *
1839 * @param mixed[] $row fieldNames => fieldValues
1840 * @return mixed[] Input array reduces by control fields
1841 */
1842 static protected function removeControlFieldsFromFieldRow(array $row = array()) {
1843 // Possible control fields in a list row
1844 $controlFields = array(
1845 '_PATH_',
1846 '_REF_',
1847 '_CONTROL_',
1848 '_CLIPBOARD_',
1849 '_LOCALIZATION_',
1850 '_LOCALIZATION_b'
1851 );
1852 return array_diff_key($row, array_flip($controlFields));
1853 }
1854
1855 /**
1856 * Adds input row of values to the internal csvLines array as a CSV formatted line
1857 *
1858 * @param mixed[] $csvRow Array with values to be listed.
1859 * @return void
1860 */
1861 public function setCsvRow($csvRow) {
1862 $this->csvLines[] = GeneralUtility::csvValues($csvRow);
1863 }
1864
1865 /**
1866 * Compiles the internal csvLines array to a csv-string and outputs it to the browser.
1867 * This function exits!
1868 *
1869 * @param string $prefix Filename prefix:
1870 * @return void EXITS php execution!
1871 */
1872 public function outputCSV($prefix) {
1873 // Setting filename:
1874 $filename = $prefix . '_' . date('dmy-Hi') . '.csv';
1875 // Creating output header:
1876 header('Content-Type: application/octet-stream');
1877 header('Content-Disposition: attachment; filename=' . $filename);
1878 // Cache-Control header is needed here to solve an issue with browser IE and
1879 // versions lower than 9. See for more information: http://support.microsoft.com/kb/323308
1880 header("Cache-Control: ''");
1881 // Printing the content of the CSV lines:
1882 echo implode(CRLF, $this->csvLines);
1883 // Exits:
1884 die;
1885 }
1886
1887 /**
1888 * add action into correct section
1889 *
1890 * @param array $cells
1891 * @param string $action
1892 * @param string $actionKey
1893 */
1894 public function addActionToCellGroup(&$cells, $action, $actionKey) {
1895 $cellsMap = array(
1896 'primary' => array(
1897 'view', 'edit', 'hide', 'delete', 'stat'
1898 ),
1899 'secondary' => array(
1900 'viewBig', 'history', 'perms', 'new', 'move', 'moveUp', 'moveDown', 'moveLeft', 'moveRight', 'version'
1901 )
1902 );
1903 $classification = in_array($actionKey, $cellsMap['primary']) ? 'primary' : 'secondary';
1904 $cells[$classification][$actionKey] = $action;
1905 unset($cells[$actionKey]);
1906 }
1907
1908 /**
1909 * Check if the record represents the current backend user
1910 *
1911 * @param string $table
1912 * @param array $row
1913 * @return bool
1914 */
1915 protected function isRecordCurrentBackendUser($table, $row) {
1916 return $table === 'be_users' && (int)$row['uid'] === $this->getBackendUserAuthentication()->user['uid'];
1917 }
1918
1919 /**
1920 * @param bool $isEditable
1921 */
1922 public function setIsEditable($isEditable) {
1923 $this->editable = $isEditable;
1924 }
1925
1926 /**
1927 * Check if the table is readonly or editable
1928 * @param string $table
1929 * @return bool
1930 */
1931 public function isEditable($table) {
1932 return $GLOBALS['TCA'][$table]['ctrl']['readOnly'] || $this->editable;
1933 }
1934
1935 /**
1936 * Check if the current record is locked by editlock
1937 *
1938 * @param string $table
1939 * @param array $row
1940 * @param bool $editPermission
1941 * @return bool
1942 */
1943 protected function overlayEditLockPermissions($table, $row, $editPermission = TRUE) {
1944 if ($editPermission) {
1945 if (($table === 'pages' && $row['editlock']) || ($table !== 'pages' && $this->pageRow['editlock'])) {
1946 $editPermission = FALSE;
1947 } elseif (isset($GLOBALS['TCA'][$table]['ctrl']['editlock']) && $row[$GLOBALS['TCA'][$table]['ctrl']['editlock']]) {
1948 $editPermission = FALSE;
1949 }
1950 }
1951 return $editPermission;
1952 }
1953
1954 /**
1955 * @return DatabaseConnection
1956 */
1957 protected function getDatabaseConnection() {
1958 return $GLOBALS['TYPO3_DB'];
1959 }
1960
1961 /**
1962 * @return BaseScriptClass
1963 */
1964 protected function getModule() {
1965 return $GLOBALS['SOBE'];
1966 }
1967
1968 /**
1969 * @return DocumentTemplate
1970 */
1971 protected function getDocumentTemplate() {
1972 return $GLOBALS['TBE_TEMPLATE'];
1973 }
1974
1975 }