TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
PageLayoutView.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\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 Doctrine\DBAL\Driver\Statement;
39 
43 class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList
44 {
50  public $pI_showUser = 0;
51 
57  public $nextThree = 3;
58 
65 
71  public $option_newWizard = 1;
72 
78  public $ext_function = 0;
79 
85  public $doEdit = 1;
86 
92  public $agePrefixes = ' min| hrs| days| yrs| min| hour| day| year';
93 
99  public $externalTables = [];
100 
106  public $descrTable;
107 
114  public $defLangBinding = false;
115 
121  public $tt_contentConfig = [
122  // Boolean: Display info-marks or not
123  'showInfo' => 1,
124  // Boolean: Display up/down arrows and edit icons for tt_content records
125  'showCommands' => 1,
126  'languageCols' => 0,
127  'languageMode' => 0,
128  'languageColsPointer' => 0,
129  'showHidden' => 1,
130  // Displays hidden records as well
131  'sys_language_uid' => 0,
132  // Which language
133  'cols' => '1,0,2,3',
134  'activeCols' => '1,0,2,3'
135  // Which columns can be accessed by current BE user
136  ];
137 
143  public $activeTables = [];
144 
148  public $tt_contentData = [
149  'nextThree' => [],
150  'prev' => [],
151  'next' => []
152  ];
153 
159  public $CType_labels = [];
160 
166  public $itemLabels = [];
167 
171  protected $clipboard;
172 
176  protected $plusPages = [];
177 
184 
190  protected $pageinfo;
191 
197  protected $languagesInColumnCache = [];
198 
205  protected $contentElementCache = [];
206 
210  protected $iconFactory;
211 
218 
223 
227  public function __construct()
228  {
229  parent::__construct();
230  $this->localizationController = GeneralUtility::makeInstance(LocalizationController::class);
231  $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
232  $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
233  $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_layout.xlf');
234  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
235  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Localization');
236  }
237 
238  /*****************************************
239  *
240  * Renderings
241  *
242  *****************************************/
251  public function getTable($table, $id, $fields = '')
252  {
253  if (isset($this->externalTables[$table])) {
254  return $this->getExternalTables($id, $table);
255  } else {
256  // Branch out based on table name:
257  switch ($table) {
258  case 'pages':
259  return $this->getTable_pages($id);
260  break;
261  case 'tt_content':
262  return $this->getTable_tt_content($id);
263  break;
264  default:
265  return '';
266  }
267  }
268  }
269 
277  public function getExternalTables($id, $table)
278  {
279  $this->pageinfo = BackendUtility::readPageAccess($id, '');
280  $type = $this->getPageLayoutController()->MOD_SETTINGS[$table];
281  if (!isset($type)) {
282  $type = 0;
283  }
284  // eg. "name;title;email;company,image"
285  $fList = $this->externalTables[$table][$type]['fList'];
286  // The columns are separeted by comma ','.
287  // Values separated by semicolon ';' are shown in the same column.
288  $icon = $this->externalTables[$table][$type]['icon'];
289  $addWhere = $this->externalTables[$table][$type]['addWhere'];
290  // Create listing
291  $out = $this->makeOrdinaryList($table, $id, $fList, $icon, $addWhere);
292  return $out;
293  }
294 
302  public function getTable_pages($id)
303  {
304  // Initializing:
305  $out = '';
306  $lang = $this->getLanguageService();
307  // Select current page:
308  if (!$id) {
309  // The root has a pseudo record in pageinfo...
310  $row = $this->getPageLayoutController()->pageinfo;
311  } else {
312  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
313  ->getQueryBuilderForTable('pages');
314  $queryBuilder->getRestrictions()
315  ->removeAll()
316  ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
317  $row = $queryBuilder
318  ->select('*')
319  ->from('pages')
320  ->where(
321  $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)),
322  $this->getBackendUser()->getPagePermsClause(1)
323  )
324  ->execute()
325  ->fetch();
326  BackendUtility::workspaceOL('pages', $row);
327  }
328  // If there was found a page:
329  if (is_array($row)) {
330  // Getting select-depth:
331  $depth = (int)$this->getPageLayoutController()->MOD_SETTINGS['pages_levels'];
332  // Overriding a few things:
333  $this->no_noWrap = 0;
334  // Items
335  $this->eCounter = $this->firstElementNumber;
336  // Creating elements:
337  list($flag, $code) = $this->fwd_rwd_nav();
338  $out .= $code;
339  $editUids = [];
340  if ($flag) {
341  // Getting children:
342  $theRows = $this->getPageRecordsRecursive($row['uid'], $depth);
343  if ($this->getBackendUser()->doesUserHaveAccess($row, 2) && $row['uid'] > 0) {
344  $editUids[] = $row['uid'];
345  }
346  $out .= $this->pages_drawItem($row, $this->fieldArray);
347  // Traverse all pages selected:
348  foreach ($theRows as $sRow) {
349  if ($this->getBackendUser()->doesUserHaveAccess($sRow, 2)) {
350  $editUids[] = $sRow['uid'];
351  }
352  $out .= $this->pages_drawItem($sRow, $this->fieldArray);
353  }
354  $this->eCounter++;
355  }
356  // Header line is drawn
357  $theData = [];
358  $editIdList = implode(',', $editUids);
359  // Traverse fields (as set above) in order to create header values:
360  foreach ($this->fieldArray as $field) {
361  if ($editIdList
362  && isset($GLOBALS['TCA']['pages']['columns'][$field])
363  && $field != 'uid'
364  && !$this->pages_noEditColumns
365  ) {
366  $iTitle = sprintf(
367  $lang->getLL('editThisColumn'),
368  rtrim(trim($lang->sL(BackendUtility::getItemLabel('pages', $field))), ':')
369  );
370  $urlParameters = [
371  'edit' => [
372  'pages' => [
373  $editIdList => 'edit'
374  ]
375  ],
376  'columnsOnly' => $field,
377  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
378  ];
379  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
380  $eI = '<a class="btn btn-default" href="' . htmlspecialchars($url)
381  . '" title="' . htmlspecialchars($iTitle) . '">'
382  . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
383  } else {
384  $eI = '';
385  }
386  switch ($field) {
387  case 'title':
388  $theData[$field] = '&nbsp;' . $eI . '<strong>'
389  . $lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label'])
390  . '</strong>';
391  break;
392  case 'uid':
393  $theData[$field] = '&nbsp;<strong>ID:</strong>';
394  break;
395  default:
396  if (substr($field, 0, 6) == 'table_') {
397  $f2 = substr($field, 6);
398  if ($GLOBALS['TCA'][$f2]) {
399  $theData[$field] = '&nbsp;' .
400  '<span title="' .
401  htmlspecialchars($lang->sL($GLOBALS['TCA'][$f2]['ctrl']['title'])) .
402  '">' .
403  $this->iconFactory->getIconForRecord($f2, [], Icon::SIZE_SMALL)->render() .
404  '</span>';
405  }
406  } else {
407  $theData[$field] = '&nbsp;&nbsp;' . $eI . '<strong>'
408  . htmlspecialchars($lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label']))
409  . '</strong>';
410  }
411  }
412  }
413  // CSH:
414  $out = BackendUtility::cshItem($this->descrTable, ('func_' . $pKey), null, '<span class="btn btn-default btn-sm">|</span>') . '
415  <div class="table-fit">
416  <table class="table table-striped table-hover typo3-page-pages">' .
417  '<thead>' .
418  $this->addElement(1, '', $theData) .
419  '</thead>' .
420  '<tbody>' .
421  $out .
422  '</tbody>' .
423  '</table>
424  </div>';
425  }
426  return $out;
427  }
428 
435  public function getTable_tt_content($id)
436  {
437  $backendUser = $this->getBackendUser();
438  $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
439  ->getConnectionForTable('tt_content')
440  ->getExpressionBuilder();
441  $this->pageinfo = BackendUtility::readPageAccess($this->id, '');
442  $this->initializeLanguages();
443  $this->initializeClipboard();
444  $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), true));
446  $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
447  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/DragDrop');
448  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
449  $userCanEditPage = $this->ext_CALC_PERMS & Permission::PAGE_EDIT && !empty($this->id) && ($backendUser->isAdmin() || (int)$this->pageinfo['editlock'] === 0);
450  if ($this->tt_contentConfig['languageColsPointer'] > 0) {
451  $userCanEditPage = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay');
452  }
453  if ($userCanEditPage) {
454  $languageOverlayId = 0;
455  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
456  ->getConnectionForTable('pages_language_overlay')
457  ->createQueryBuilder();
458  $constraint = $queryBuilder->expr()->eq(
459  'sys_language_uid',
460  $queryBuilder->createNamedParameter($this->tt_contentConfig['sys_language_uid'], \PDO::PARAM_INT)
461  );
462  $pageOverlayRecord = BackendUtility::getRecordsByField(
463  'pages_language_overlay',
464  'pid',
465  (int)$this->id,
466  $constraint,
467  '',
468  '',
469  '',
470  true,
471  $queryBuilder
472  );
473  if (!empty($pageOverlayRecord[0]['uid'])) {
474  $languageOverlayId = $pageOverlayRecord[0]['uid'];
475  }
476  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
477  PageActions.setPageId(' . (int)$this->id . ');
478  PageActions.setLanguageOverlayId(' . $languageOverlayId . ');
479  PageActions.initializePageTitleRenaming();
480  }');
481  }
482  // Get labels for CTypes and tt_content element fields in general:
483  $this->CType_labels = [];
484  foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
485  $this->CType_labels[$val[1]] = $this->getLanguageService()->sL($val[0]);
486  }
487  $this->itemLabels = [];
488  foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) {
489  $this->itemLabels[$name] = $this->getLanguageService()->sL($val['label']);
490  }
491  $languageColumn = [];
492  $out = '';
493 
494  // Setting language list:
495  $langList = $this->tt_contentConfig['sys_language_uid'];
496  if ($this->tt_contentConfig['languageMode']) {
497  if ($this->tt_contentConfig['languageColsPointer']) {
498  $langList = '0,' . $this->tt_contentConfig['languageColsPointer'];
499  } else {
500  $langList = implode(',', array_keys($this->tt_contentConfig['languageCols']));
501  }
502  $languageColumn = [];
503  }
504  $langListArr = GeneralUtility::intExplode(',', $langList);
505  $defaultLanguageElementsByColumn = [];
506  $defLangBinding = [];
507  // For each languages... :
508  // If not languageMode, then we'll only be through this once.
509  foreach ($langListArr as $lP) {
510  $lP = (int)$lP;
511 
512  if (!isset($this->contentElementCache[$lP])) {
513  $this->contentElementCache[$lP] = [];
514  }
515 
516  if (count($langListArr) === 1 || $lP === 0) {
517  $showLanguage = $expressionBuilder->in('sys_language_uid', [$lP, -1]);
518  } else {
519  $showLanguage = $expressionBuilder->eq('sys_language_uid', $lP);
520  }
521  $cList = explode(',', $this->tt_contentConfig['cols']);
522  $content = [];
523  $head = [];
524 
525  // Select content records per column
526  $contentRecordsPerColumn = $this->getContentRecordsPerColumn('table', $id, array_values($cList), $showLanguage);
527  // For each column, render the content into a variable:
528  foreach ($cList as $columnId) {
529  if (!isset($this->contentElementCache[$lP][$columnId])) {
530  $this->contentElementCache[$lP][$columnId] = [];
531  }
532 
533  if (!$lP) {
534  $defaultLanguageElementsByColumn[$columnId] = [];
535  }
536  // Start wrapping div
537  $content[$columnId] .= '<div data-colpos="' . $columnId . '" data-language-uid="' . $lP . '" class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-' . $lP . ' t3-page-ce-wrapper';
538  if (empty($contentRecordsPerColumn[$columnId])) {
539  $content[$columnId] .= ' t3-page-ce-empty';
540  }
541  $content[$columnId] .= '">';
542  // Add new content at the top most position
543  $link = '';
544  if ($this->getPageLayoutController()->contentIsNotLockedForEditors()
545  && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
546  ) {
547  if ($this->option_newWizard) {
548  $urlParameters = [
549  'id' => $id,
550  'sys_language_uid' => $lP,
551  'colPos' => $columnId,
552  'uid_pid' => $id,
553  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
554  ];
555  $tsConfig = BackendUtility::getModTSconfig($id, 'mod');
556  $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
557  ? $tsConfig['properties']['newContentElementWizard.']['override']
558  : 'new_content_element';
559  $url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
560  } else {
561  $urlParameters = [
562  'edit' => [
563  'tt_content' => [
564  $id => 'new'
565  ]
566  ],
567  'defVals' => [
568  'tt_content' => [
569  'colPos' => $columnId,
570  'sys_language_uid' => $lP
571  ]
572  ],
573  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
574  ];
575  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
576  }
577 
578  $link = '<a href="' . htmlspecialchars($url) . '" title="'
579  . htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="btn btn-default btn-sm">'
580  . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render()
581  . ' '
582  . htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>';
583  }
584  if ($this->getBackendUser()->checkLanguageAccess($lP)) {
585  $content[$columnId] .= '
586  <div class="t3-page-ce t3js-page-ce" data-page="' . (int)$id . '" id="' . StringUtility::getUniqueId() . '">
587  <div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $columnId . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">'
588  . $link
589  . '</div>
590  <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
591  </div>
592  ';
593  }
594  $editUidList = '';
595  if (!isset($contentRecordsPerColumn[$columnId]) || !is_array($contentRecordsPerColumn[$columnId])) {
596  $message = GeneralUtility::makeInstance(
597  FlashMessage::class,
598  $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:error.invalidBackendLayout'),
599  '',
601  );
602  $service = GeneralUtility::makeInstance(FlashMessageService::class);
603  $queue = $service->getMessageQueueByIdentifier();
604  $queue->addMessage($message);
605  } else {
606  $rowArr = $contentRecordsPerColumn[$columnId];
607  $this->generateTtContentDataArray($rowArr);
608 
609  foreach ((array)$rowArr as $rKey => $row) {
610  $this->contentElementCache[$lP][$columnId][$row['uid']] = $row;
611  if ($this->tt_contentConfig['languageMode']) {
612  $languageColumn[$columnId][$lP] = $head[$columnId] . $content[$columnId];
613  if (!$this->defLangBinding) {
614  $languageColumn[$columnId][$lP] .= $this->newLanguageButton(
615  $this->getNonTranslatedTTcontentUids($defaultLanguageElementsByColumn[$columnId], $id, $lP),
616  $lP,
617  $columnId
618  );
619  }
620  }
621  if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
622  $singleElementHTML = '';
623  if (!$lP && ($this->defLangBinding || $row['sys_language_uid'] != -1)) {
624  $defaultLanguageElementsByColumn[$columnId][] = (isset($row['_ORIG_uid']) ? $row['_ORIG_uid'] : $row['uid']);
625  }
626  $editUidList .= $row['uid'] . ',';
627  $disableMoveAndNewButtons = $this->defLangBinding && $lP > 0;
628  if (!$this->tt_contentConfig['languageMode']) {
629  $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility::getUniqueId() . '">';
630  }
631  $singleElementHTML .= $this->tt_content_drawHeader(
632  $row,
633  $this->tt_contentConfig['showInfo'] ? 15 : 5,
634  $disableMoveAndNewButtons,
635  true,
636  $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)
637  );
638  $innerContent = '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>'
639  . $this->tt_content_drawItem($row) . '</div>';
640  $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>'
641  . $this->tt_content_drawFooter($row);
642  $isDisabled = $this->isDisabled('tt_content', $row);
643  $statusHidden = $isDisabled ? ' t3-page-ce-hidden t3js-hidden-record' : '';
644  $displayNone = !$this->tt_contentConfig['showHidden'] && $isDisabled ? ' style="display: none;"' : '';
645  $highlightHeader = false;
646  if ($this->checkIfTranslationsExistInLanguage([], (int)$row['sys_language_uid']) && (int)$row['l18n_parent'] === 0) {
647  $highlightHeader = true;
648  }
649  $singleElementHTML = '<div class="t3-page-ce ' . ($highlightHeader ? 't3-page-ce-danger' : '') . ' t3js-page-ce t3js-page-ce-sortable ' . $statusHidden . '" id="element-tt_content-'
650  . $row['uid'] . '" data-table="tt_content" data-uid="' . $row['uid'] . '"' . $displayNone . '>' . $singleElementHTML . '</div>';
651 
652  if ($this->tt_contentConfig['languageMode']) {
653  $singleElementHTML .= '<div class="t3-page-ce t3js-page-ce">';
654  }
655  $singleElementHTML .= '<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $columnId . '-' . 'page-' . $id .
656  '-' . StringUtility::getUniqueId() . '">';
657  // Add icon "new content element below"
658  if (!$disableMoveAndNewButtons
659  && $this->getPageLayoutController()->contentIsNotLockedForEditors()
660  && $this->getBackendUser()->checkLanguageAccess($lP)
661  && (!$this->checkIfTranslationsExistInLanguage($contentRecordsPerColumn, $lP))
662  ) {
663  // New content element:
664  if ($this->option_newWizard) {
665  $urlParameters = [
666  'id' => $row['pid'],
667  'sys_language_uid' => $row['sys_language_uid'],
668  'colPos' => $row['colPos'],
669  'uid_pid' => -$row['uid'],
670  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
671  ];
672  $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod');
673  $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
674  ? $tsConfig['properties']['newContentElementWizard.']['override']
675  : 'new_content_element';
676  $url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
677  } else {
678  $urlParameters = [
679  'edit' => [
680  'tt_content' => [
681  -$row['uid'] => 'new'
682  ]
683  ],
684  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
685  ];
686  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
687  }
688  $singleElementHTML .= '
689  <a href="' . htmlspecialchars($url) . '" title="'
690  . htmlspecialchars($this->getLanguageService()->getLL('newContentElement')) . '" class="btn btn-default btn-sm">'
691  . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render()
692  . ' '
693  . htmlspecialchars($this->getLanguageService()->getLL('content')) . '</a>
694  ';
695  }
696  $singleElementHTML .= '</div></div><div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div></div>';
697  if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
698  $defLangBinding[$columnId][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML;
699  } else {
700  $content[$columnId] .= $singleElementHTML;
701  }
702  } else {
703  unset($rowArr[$rKey]);
704  }
705  }
706  $content[$columnId] .= '</div>';
707  $colTitle = BackendUtility::getProcessedValue('tt_content', 'colPos', $columnId);
708  $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $id, $this);
709  foreach ($tcaItems as $item) {
710  if ($item[1] == $columnId) {
711  $colTitle = $this->getLanguageService()->sL($item[0]);
712  }
713  }
714 
715  $pasteP = ['colPos' => $columnId, 'sys_language_uid' => $lP];
716  $editParam = $this->doEdit && !empty($rowArr)
717  ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc
718  : '';
719  $head[$columnId] .= $this->tt_content_drawColHeader($colTitle, $editParam, '', $pasteP);
720  }
721  }
722  // For each column, fit the rendered content into a table cell:
723  $out = '';
724  if ($this->tt_contentConfig['languageMode']) {
725  // in language mode process the content elements, but only fill $languageColumn. output will be generated later
726  $sortedLanguageColumn = [];
727  foreach ($cList as $columnId) {
728  $languageColumn[$columnId][$lP] = $head[$columnId] . $content[$columnId];
729  if (!$this->defLangBinding) {
730  $languageColumn[$columnId][$lP] .= $this->newLanguageButton(
731  $this->getNonTranslatedTTcontentUids($defaultLanguageElementsByColumn[$columnId], $id, $lP),
732  $lP,
733  $columnId
734  );
735  }
736  // We sort $languageColumn again according to $cList as it may contain data already from above.
737  $sortedLanguageColumn[$columnId] = $languageColumn[$columnId];
738  }
739  $languageColumn = $sortedLanguageColumn;
740  } else {
741  $backendLayout = $this->getBackendLayoutView()->getSelectedBackendLayout($this->id);
742  // GRID VIEW:
743  $grid = '<div class="t3-grid-container"><table border="0" cellspacing="0" cellpadding="0" width="100%" class="t3-page-columns t3-grid-table t3js-page-columns">';
744  // Add colgroups
745  $colCount = (int)$backendLayout['__config']['backend_layout.']['colCount'];
746  $rowCount = (int)$backendLayout['__config']['backend_layout.']['rowCount'];
747  $grid .= '<colgroup>';
748  for ($i = 0; $i < $colCount; $i++) {
749  $grid .= '<col />';
750  }
751  $grid .= '</colgroup>';
752  // Cycle through rows
753  for ($row = 1; $row <= $rowCount; $row++) {
754  $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
755  if (!isset($rowConfig)) {
756  continue;
757  }
758  $grid .= '<tr>';
759  for ($col = 1; $col <= $colCount; $col++) {
760  $columnConfig = $rowConfig['columns.'][$col . '.'];
761  if (!isset($columnConfig)) {
762  continue;
763  }
764  // Which tt_content colPos should be displayed inside this cell
765  $columnKey = (int)$columnConfig['colPos'];
766  // Render the grid cell
767  $colSpan = (int)$columnConfig['colspan'];
768  $rowSpan = (int)$columnConfig['rowspan'];
769  $grid .= '<td valign="top"' .
770  ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') .
771  ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') .
772  ' data-colpos="' . (int)$columnConfig['colPos'] . '" data-language-uid="' . $lP . '" class="t3js-page-lang-column-' . $lP . ' t3js-page-column t3-grid-cell t3-page-column t3-page-column-' . $columnKey .
773  ((!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '') ? ' t3-grid-cell-unassigned' : '') .
774  ((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ' t3-grid-cell-restricted' : '') .
775  ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') .
776  ($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">';
777 
778  // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
779  // If not, a new header without any buttons will be generated.
780  if (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey]
781  && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
782  ) {
783  $grid .= $head[$columnKey] . $content[$columnKey];
784  } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
785  && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
786  ) {
787  $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'), '', '');
788  } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
789  && !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
790  ) {
791  $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
792  ' (' . $this->getLanguageService()->getLL('noAccess') . ')', '', '');
793  } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
794  $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name'])
795  . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', '');
796  } else {
797  $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('notAssigned'), '', '');
798  }
799 
800  $grid .= '</td>';
801  }
802  $grid .= '</tr>';
803  }
804  $out .= $grid . '</table></div>';
805  }
806  // CSH:
807  $out .= BackendUtility::cshItem($this->descrTable, 'columns_multi', null, '<span class="btn btn-default btn-sm">|</span>');
808  }
809  // If language mode, then make another presentation:
810  // Notice that THIS presentation will override the value of $out!
811  // But it needs the code above to execute since $languageColumn is filled with content we need!
812  if ($this->tt_contentConfig['languageMode']) {
813  // Get language selector:
814  $languageSelector = $this->languageSelector($id);
815  // Reset out - we will make new content here:
816  $out = '';
817  // Traverse languages found on the page and build up the table displaying them side by side:
818  $cCont = [];
819  $sCont = [];
820  foreach ($langListArr as $lP) {
821  // Header:
822  $lP = (int)$lP;
823  $cCont[$lP] = '
824  <td valign="top" class="t3-page-column" data-language-uid="' . $lP . '">
825  <h2>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</h2>
826  </td>';
827 
828  // "View page" icon is added:
829  $viewLink = '';
830  if (!VersionState::cast($this->getPageLayoutController()->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
831  $onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id), '', '', ('&L=' . $lP));
832  $viewLink = '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars($onClick) . '" title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.showPage')) . '">' . $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>';
833  }
834  // Language overlay page header:
835  if ($lP) {
836  list($lpRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . $lP);
837  BackendUtility::workspaceOL('pages_language_overlay', $lpRecord);
839  $this->iconFactory->getIconForRecord('pages_language_overlay', $lpRecord, Icon::SIZE_SMALL)->render(),
840  'pages_language_overlay',
841  $lpRecord['uid']
842  );
843  $urlParameters = [
844  'edit' => [
845  'pages_language_overlay' => [
846  $lpRecord['uid'] => 'edit'
847  ]
848  ],
849  'overrideVals' => [
850  'pages_language_overlay' => [
851  'sys_language_uid' => $lP
852  ]
853  ],
854  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
855  ];
856  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
857  $editLink = ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay')
858  ? '<a href="' . htmlspecialchars($url) . '" class="btn btn-default btn-sm"'
859  . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
860  . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>'
861  : ''
862  );
863 
864  $lPLabel =
865  '<div class="btn-group">'
866  . $viewLink
867  . $editLink
868  . '</div>'
869  . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($lpRecord['title'], 20));
870  } else {
871  $editLink = '';
872  $recordIcon = '';
873  if ($this->getBackendUser()->checkLanguageAccess(0)) {
875  $this->iconFactory->getIconForRecord('pages', $this->pageRecord, Icon::SIZE_SMALL)->render(), 'pages', $this->id);
876  $urlParameters = [
877  'edit' => [
878  'pages' => [
879  $this->id => 'edit'
880  ]
881  ],
882  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
883  ];
884  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
885  $editLink = ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay')
886  ? '<a href="' . htmlspecialchars($url) . '" class="btn btn-default btn-sm"'
887  . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
888  . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>'
889  : ''
890  );
891  }
892 
893  $lPLabel =
894  '<div class="btn-group">'
895  . $viewLink
896  . $editLink
897  . '</div>'
898  . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->pageRecord['title'], 20));
899  }
900  $sCont[$lP] = '
901  <td nowrap="nowrap" class="t3-page-column t3-page-lang-label">' . $lPLabel . '</td>';
902  }
903  // Add headers:
904  $out .= '<tr>' . implode($cCont) . '</tr>';
905  $out .= '<tr>' . implode($sCont) . '</tr>';
906  unset($cCont, $sCont);
907 
908  // Traverse previously built content for the columns:
909  foreach ($languageColumn as $cKey => $cCont) {
910  $out .= '<tr>';
911  foreach ($cCont as $languageId => $columnContent) {
912  $out .= '<td valign="top" class="t3-grid-cell t3-page-column t3js-page-column t3js-page-lang-column t3js-page-lang-column-' . $languageId . '">' . $columnContent . '</td>';
913  }
914  $out .= '</tr>';
915  if ($this->defLangBinding) {
916  // "defLangBinding" mode
917  foreach ($defaultLanguageElementsByColumn[$cKey] as $defUid) {
918  $cCont = [];
919  foreach ($langListArr as $lP) {
920  $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . $this->newLanguageButton(
921  $this->getNonTranslatedTTcontentUids([$defUid], $id, $lP),
922  $lP,
923  $cKey
924  );
925  }
926  $out .= '
927  <tr>
928  <td valign="top" class="t3-grid-cell">' . implode(('</td>' . '
929  <td valign="top" class="t3-grid-cell">'), $cCont) . '</td>
930  </tr>';
931  }
932  }
933  }
934  // Finally, wrap it all in a table and add the language selector on top of it:
935  $out = $languageSelector . '
936  <div class="t3-grid-container">
937  <table cellpadding="0" cellspacing="0" class="t3-page-columns t3-grid-table t3js-page-columns">
938  ' . $out . '
939  </table>
940  </div>';
941  // CSH:
942  $out .= BackendUtility::cshItem($this->descrTable, 'language_list', null, '<span class="btn btn-default btn-sm">|</span>');
943  }
944 
945  return $out;
946  }
947 
948  /**********************************
949  *
950  * Generic listing of items
951  *
952  **********************************/
963  public function makeOrdinaryList($table, $id, $fList, $icon = false, $addWhere = '')
964  {
965  // Initialize
966  $addWhere = empty($addWhere) ? [] : [QueryHelper::stripLogicalOperatorPrefix($addWhere)];
967  $queryBuilder = $this->getQueryBuilder($table, $id, $addWhere);
968  $this->setTotalItems($table, $id, $addWhere);
969  $dbCount = 0;
970  $result = false;
971  // Make query for records if there were any records found in the count operation
972  if ($this->totalItems) {
973  $result = $queryBuilder->execute();
974  // Will return FALSE, if $result is invalid
975  $dbCount = $result->rowCount();
976  }
977  // If records were found, render the list
978  if (!$dbCount) {
979  return '';
980  }
981  // Set fields
982  $out = '';
983  $this->fieldArray = GeneralUtility::trimExplode(',', '__cmds__,' . $fList . ',__editIconLink__', true);
984  $theData = [];
985  $theData = $this->headerFields($this->fieldArray, $table, $theData);
986  // Title row
987  $localizedTableTitle = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title']));
988  $out .= '<tr><th class="col-icon"></th>'
989  . '<th colspan="' . (count($theData) - 2) . '"><span class="c-table">'
990  . $localizedTableTitle . '</span> (' . $dbCount . ')</td>' . '<td class="col-icon"></td>'
991  . '</tr>';
992  // Column's titles
993  if ($this->doEdit) {
994  $urlParameters = [
995  'edit' => [
996  $table => [
997  $this->id => 'new'
998  ]
999  ],
1000  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1001  ];
1002  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1003  $theData['__cmds__'] = '<a href="' . htmlspecialchars($url) . '" '
1004  . 'title="' . htmlspecialchars($this->getLanguageService()->getLL('new')) . '">'
1005  . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . '</a>';
1006  }
1007  $out .= $this->addElement(1, '', $theData, ' class="c-headLine"', 15, '', 'th');
1008  // Render Items
1009  $this->eCounter = $this->firstElementNumber;
1010  while ($row = $result->fetch()) {
1011  BackendUtility::workspaceOL($table, $row);
1012  if (is_array($row)) {
1013  list($flag, $code) = $this->fwd_rwd_nav();
1014  $out .= $code;
1015  if ($flag) {
1016  $Nrow = [];
1017  // Setting icons links
1018  if ($icon) {
1019  $Nrow['__cmds__'] = $this->getIcon($table, $row);
1020  }
1021  // Get values:
1022  $Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow);
1023  // Attach edit icon
1024  if ($this->doEdit && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
1025  $urlParameters = [
1026  'edit' => [
1027  $table => [
1028  $row['uid'] => 'edit'
1029  ]
1030  ],
1031  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1032  ];
1033  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1034  $Nrow['__editIconLink__'] = '<a class="btn btn-default" href="' . htmlspecialchars($url)
1035  . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">'
1036  . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>';
1037  } else {
1038  $Nrow['__editIconLink__'] = $this->noEditIcon();
1039  }
1040  $out .= $this->addElement(1, '', $Nrow);
1041  }
1042  $this->eCounter++;
1043  }
1044  }
1045  // Wrap it all in a table:
1046  $out = '
1047  <!--
1048  Standard list of table "' . $table . '"
1049  -->
1050  <div class="table-fit"><table class="table table-hover table-striped">
1051  ' . $out . '
1052  </table></div>';
1053  return $out;
1054  }
1055 
1070  public function dataFields($fieldArr, $table, $row, $out = [])
1071  {
1072  // Check table validity
1073  if (!isset($GLOBALS['TCA'][$table])) {
1074  return $out;
1075  }
1076 
1077  $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
1078  // Traverse fields
1079  foreach ($fieldArr as $fieldName) {
1080  if ($GLOBALS['TCA'][$table]['columns'][$fieldName]) {
1081  // Each field has its own cell (if configured in TCA)
1082  // If the column is a thumbnail column:
1083  if ($fieldName == $thumbsCol) {
1084  $out[$fieldName] = $this->thumbCode($row, $table, $fieldName);
1085  } else {
1086  // ... otherwise just render the output:
1087  $out[$fieldName] = nl2br(htmlspecialchars(trim(GeneralUtility::fixed_lgd_cs(
1088  BackendUtility::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']),
1089  250
1090  ))));
1091  }
1092  } else {
1093  // Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode
1094  // the field name with ";" and check each value there as a TCA configured field)
1095  $theFields = explode(';', $fieldName);
1096  // Traverse fields, separated by ";" (displayed in a single cell).
1097  foreach ($theFields as $fName2) {
1098  if ($GLOBALS['TCA'][$table]['columns'][$fName2]) {
1099  $out[$fieldName] .= '<strong>' . htmlspecialchars($this->getLanguageService()->sL(
1100  $GLOBALS['TCA'][$table]['columns'][$fName2]['label']
1101  )) . '</strong>' . '&nbsp;&nbsp;' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(
1102  BackendUtility::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']),
1103  25
1104  )) . '<br />';
1105  }
1106  }
1107  }
1108  // If no value, add a nbsp.
1109  if (!$out[$fieldName]) {
1110  $out[$fieldName] = '&nbsp;';
1111  }
1112  // Wrap in dimmed-span tags if record is "disabled"
1113  if ($this->isDisabled($table, $row)) {
1114  $out[$fieldName] = '<span class="text-muted">' . $out[$fieldName] . '</span>';
1115  }
1116  }
1117  return $out;
1118  }
1119 
1129  public function headerFields($fieldArr, $table, $out = [])
1130  {
1131  foreach ($fieldArr as $fieldName) {
1132  $ll = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['columns'][$fieldName]['label']));
1133  $out[$fieldName] = $ll ? $ll : '&nbsp;';
1134  }
1135  return $out;
1136  }
1137 
1148  protected function getContentRecordsPerColumn($table, $id, array $columns, $additionalWhereClause = '')
1149  {
1150  $columns = array_map('intval', $columns);
1151  $contentRecordsPerColumn = array_fill_keys($columns, []);
1152 
1153  $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1154  ->getQueryBuilderForTable('tt_content')
1155  ->expr();
1156 
1157  $queryBuilder = $this->getQueryBuilder(
1158  'tt_content',
1159  $id,
1160  [
1161  $expressionBuilder->in('colPos', $columns),
1162  $additionalWhereClause
1163  ]
1164  );
1165 
1166  // Traverse any selected elements and render their display code:
1167  $results = $this->getResult($queryBuilder->execute());
1168 
1169  foreach ($results as $record) {
1170  $columnValue = $record['colPos'];
1171  $contentRecordsPerColumn[$columnValue][] = $record;
1172  }
1173 
1174  return $contentRecordsPerColumn;
1175  }
1176 
1177  /**********************************
1178  *
1179  * Additional functions; Pages
1180  *
1181  **********************************/
1182 
1192  protected function getPageRecordsRecursive(int $pid, int $depth, string $iconPrefix = '', array $rows = []): array
1193  {
1194  $depth--;
1195  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
1196  $queryBuilder->getRestrictions()
1197  ->removeAll()
1198  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
1199  ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
1200 
1201  $queryBuilder
1202  ->select('*')
1203  ->from('pages')
1204  ->where(
1205  $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)),
1206  $this->getBackendUser()->getPagePermsClause(1)
1207  );
1208 
1209  if (!empty($GLOBALS['TCA']['pages']['ctrl']['sortby'])) {
1210  $queryBuilder->orderBy($GLOBALS['TCA']['pages']['ctrl']['sortby']);
1211  }
1212 
1213  if ($depth >= 0) {
1214  $result = $queryBuilder->execute();
1215  $rowCount = $result->rowCount();
1216  $count = 0;
1217  while ($row = $result->fetch()) {
1218  BackendUtility::workspaceOL('pages', $row);
1219  if (is_array($row)) {
1220  $count++;
1221  $row['treeIcons'] = $iconPrefix
1222  . '<span class="treeline-icon treeline-icon-join'
1223  . ($rowCount === $count ? 'bottom' : '')
1224  . '"></span>';
1225  $rows[] = $row;
1226  // Get the branch
1227  $spaceOutIcons = '<span class="treeline-icon treeline-icon-'
1228  . ($rowCount === $count ? 'clear' : 'line')
1229  . '"></span>';
1230  $rows = $this->getPageRecordsRecursive(
1231  $row['uid'],
1232  $row['php_tree_stop'] ? 0 : $depth,
1233  $iconPrefix . $spaceOutIcons,
1234  $rows
1235  );
1236  }
1237  }
1238  } else {
1239  $count = (int)$queryBuilder->count('uid')->execute()->fetchColumn(0);
1240  if ($count) {
1241  $this->plusPages[$pid] = $count;
1242  }
1243  }
1244 
1245  return $rows;
1246  }
1247 
1259  public function pages_getTree($theRows, $pid, $qWhere, $treeIcons, $depth)
1260  {
1262  $depth--;
1263  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
1264  $queryBuilder->getRestrictions()
1265  ->removeAll();
1266  $queryBuilder
1267  ->select('*')
1268  ->from('pages')
1269  ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)));
1270 
1271  if (!empty($GLOBALS['TCA']['pages']['ctrl']['sortby'])) {
1272  $queryBuilder->orderBy($GLOBALS['TCA']['pages']['ctrl']['sortby']);
1273  }
1274 
1275  if (!empty($qWhere)) {
1276  $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($qWhere));
1277  }
1278 
1279  if ($depth >= 0) {
1280  $result = $queryBuilder->execute();
1281  $rc = $result->rowCount();
1282  $c = 0;
1283  while ($row = $result->fetch()) {
1284  BackendUtility::workspaceOL('pages', $row);
1285  if (is_array($row)) {
1286  $c++;
1287  $row['treeIcons'] = $treeIcons . '<span class="treeline-icon treeline-icon-join' . ($rc === $c ? 'bottom' : '') . '"></span>';
1288  $theRows[] = $row;
1289  // Get the branch
1290  $spaceOutIcons = '<span class="treeline-icon treeline-icon-' . ($rc === $c ? 'clear' : 'line') . '"></span>';
1291  $theRows = $this->pages_getTree($theRows, $row['uid'], $qWhere, $treeIcons . $spaceOutIcons,
1292  $row['php_tree_stop'] ? 0 : $depth);
1293  }
1294  }
1295  } else {
1296  $count = (int)$queryBuilder->count('uid')->execute()->fetchColumn(0);
1297  if ($count) {
1298  $this->plusPages[$pid] = $count;
1299  }
1300  }
1301  return $theRows;
1302  }
1303 
1311  public function pages_drawItem($row, $fieldArr)
1312  {
1313  // Initialization
1314  $theIcon = $this->getIcon('pages', $row);
1315  // Preparing and getting the data-array
1316  $theData = [];
1317  foreach ($fieldArr as $field) {
1318  switch ($field) {
1319  case 'title':
1320  $red = $this->plusPages[$row['uid']] ? '<span class="text-danger"><strong>+</strong></span>' : '';
1321  $pTitle = htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field], 20));
1322  if ($red) {
1323  $pTitle = '<a href="'
1324  . htmlspecialchars($this->script . ((strpos($this->script, '?') !== false) ? '&' : '?')
1325  . 'id=' . $row['uid']) . '">' . $pTitle . '</a>';
1326  }
1327  $theData[$field] = $row['treeIcons'] . $theIcon . $red . $pTitle . '&nbsp;&nbsp;';
1328  break;
1329  case 'php_tree_stop':
1330  // Intended fall through
1331  case 'TSconfig':
1332  $theData[$field] = $row[$field] ? '&nbsp;<strong>x</strong>' : '&nbsp;';
1333  break;
1334  case 'uid':
1335  if ($this->getBackendUser()->doesUserHaveAccess($row, 2) && $row['uid'] > 0) {
1336  $urlParameters = [
1337  'edit' => [
1338  'pages' => [
1339  $row['uid'] => 'edit'
1340  ]
1341  ],
1342  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
1343  ];
1344  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
1345  $eI = '<a class="btn btn-default" href="' . htmlspecialchars($url)
1346  . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('editThisPage')) . '">'
1347  . $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>';
1348  } else {
1349  $eI = '';
1350  }
1351  $theData[$field] = $eI . '<span align="right">' . $row['uid'] . '</span>';
1352  break;
1353  case 'shortcut':
1354  case 'shortcut_mode':
1355  if ((int)$row['doktype'] === \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT) {
1356  $theData[$field] = $this->getPagesTableFieldValue($field, $row);
1357  }
1358  break;
1359  default:
1360  if (substr($field, 0, 6) == 'table_') {
1361  $f2 = substr($field, 6);
1362  if ($GLOBALS['TCA'][$f2]) {
1363  $c = $this->numberOfRecords($f2, $row['uid']);
1364  $theData[$field] = '&nbsp;&nbsp;' . ($c ? $c : '');
1365  }
1366  } else {
1367  $theData[$field] = $this->getPagesTableFieldValue($field, $row);
1368  }
1369  }
1370  }
1371  $this->addElement_tdParams['title'] = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : '';
1372  return $this->addElement(1, '', $theData);
1373  }
1374 
1383  protected function getPagesTableFieldValue($field, array $row)
1384  {
1385  return '&nbsp;&nbsp;' . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
1386  }
1387 
1388  /**********************************
1389  *
1390  * Additional functions; Content Elements
1391  *
1392  **********************************/
1402  public function tt_content_drawColHeader($colName, $editParams, $newParams, array $pasteParams = null)
1403  {
1404  $iconsArr = [];
1405  // Create command links:
1406  if ($this->tt_contentConfig['showCommands']) {
1407  // Edit whole of column:
1408  if ($editParams && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT) && $this->getBackendUser()->checkLanguageAccess(0)) {
1409  $iconsArr['edit'] = '<a href="#" onclick="'
1410  . htmlspecialchars(BackendUtility::editOnClick($editParams)) . '" title="'
1411  . htmlspecialchars($this->getLanguageService()->getLL('editColumn')) . '">'
1412  . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
1413  }
1414  if ($pasteParams) {
1415  $elFromTable = $this->clipboard->elFromTable('tt_content');
1416  if (!empty($elFromTable) && $this->getPageLayoutController()->pageIsNotLockedForEditors()) {
1417  $iconsArr['paste'] =
1418  '<a href="' . htmlspecialchars($this->clipboard->pasteUrl('tt_content', $this->id, true, $pasteParams)) . '"'
1419  . ' class="t3js-modal-trigger"'
1420  . ' data-severity="warning"'
1421  . ' data-title="' . htmlspecialchars($this->getLanguageService()->getLL('pasteIntoColumn')) . '"'
1422  . ' data-content="' . htmlspecialchars($this->clipboard->confirmMsgText('pages', $this->pageRecord, 'into', $elFromTable, $colName)) . '"'
1423  . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('pasteIntoColumn')) . '">'
1424  . $this->iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL)->render()
1425  . '</a>';
1426  }
1427  }
1428  }
1429  $icons = '';
1430  if (!empty($iconsArr)) {
1431  $icons = '<div class="t3-page-column-header-icons">' . implode('', $iconsArr) . '</div>';
1432  }
1433  // Create header row:
1434  $out = '<div class="t3-page-column-header">
1435  ' . $icons . '
1436  <div class="t3-page-column-header-label">' . htmlspecialchars($colName) . '</div>
1437  </div>';
1438  return $out;
1439  }
1440 
1448  protected function tt_content_drawFooter(array $row)
1449  {
1450  $content = '';
1451  // Get processed values:
1452  $info = [];
1453  $this->getProcessedValue('tt_content', 'starttime,endtime,fe_group,spaceBefore,spaceAfter', $row, $info);
1454 
1455  // Content element annotation
1456  if (!empty($GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn'])) {
1457  $info[] = htmlspecialchars($row[$GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']]);
1458  }
1459 
1460  // Call drawFooter hooks
1461  $drawFooterHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'];
1462  if (is_array($drawFooterHooks)) {
1463  foreach ($drawFooterHooks as $hookClass) {
1464  $hookObject = GeneralUtility::getUserObj($hookClass);
1465  if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface) {
1466  throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class, 1404378171);
1467  }
1468  $hookObject->preProcess($this, $info, $row);
1469  }
1470  }
1471 
1472  // Display info from records fields:
1473  if (!empty($info)) {
1474  $content = '<div class="t3-page-ce-info">
1475  ' . implode('<br>', $info) . '
1476  </div>';
1477  }
1478  // Wrap it
1479  if (!empty($content)) {
1480  $content = '<div class="t3-page-ce-footer">' . $content . '</div>';
1481  }
1482  return $content;
1483  }
1484 
1495  public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = false, $langMode = false, $dragDropEnabled = false)
1496  {
1497  $out = '';
1498  // If show info is set...;
1499  if ($this->tt_contentConfig['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
1500  // Render control panel for the element:
1501  if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
1502  // Edit content element:
1503  $urlParameters = [
1504  'edit' => [
1505  'tt_content' => [
1506  $this->tt_contentData['nextThree'][$row['uid']] => 'edit'
1507  ]
1508  ],
1509  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'],
1510  ];
1511  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters) . '#element-tt_content-' . $row['uid'];
1512 
1513  $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url)
1514  . '" title="' . htmlspecialchars($this->nextThree > 1
1515  ? sprintf($this->getLanguageService()->getLL('nextThree'), $this->nextThree)
1516  : $this->getLanguageService()->getLL('edit'))
1517  . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>';
1518  // Hide element:
1519  $hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
1520  if ($hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField]
1521  && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude']
1522  || $this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))
1523  ) {
1524  if ($row[$hiddenField]) {
1525  $value = 0;
1526  $label = 'unHide';
1527  } else {
1528  $value = 1;
1529  $label = 'hide';
1530  }
1531  $params = '&data[tt_content][' . ($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid'])
1532  . '][' . $hiddenField . ']=' . $value;
1533  $out .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
1534  . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($label)) . '">'
1535  . $this->iconFactory->getIcon('actions-edit-' . strtolower($label), Icon::SIZE_SMALL)->render() . '</a>';
1536  }
1537  // Delete
1538  $disableDeleteTS = $this->getBackendUser()->getTSConfig('options.disableDelete');
1539  $disableDelete = (bool) trim(isset($disableDeleteTS['properties']['tt_content']) ? $disableDeleteTS['properties']['tt_content'] : $disableDeleteTS['value']);
1540  if (!$disableDelete) {
1541  $params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
1542  $confirm = $this->getLanguageService()->getLL('deleteWarning')
1543  . BackendUtility::translationCount('tt_content', $row['uid'], (' '
1544  . $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.translationsOfRecord')));
1545  $out .= '<a class="btn btn-default t3js-modal-trigger" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params)) . '"'
1546  . ' data-severity="warning"'
1547  . ' data-title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')) . '"'
1548  . ' data-content="' . htmlspecialchars($confirm) . '" '
1549  . ' data-button-close-text="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_common.xlf:cancel')) . '"'
1550  . ' title="' . htmlspecialchars($this->getLanguageService()->getLL('deleteItem')) . '">'
1551  . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
1552  if ($out && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
1553  $out = '<div class="btn-group btn-group-sm" role="group">' . $out . '</div>';
1554  } else {
1555  $out = '';
1556  }
1557  }
1558  if (!$disableMoveAndNewButtons) {
1559  $moveButtonContent = '';
1560  $displayMoveButtons = false;
1561  // Move element up:
1562  if ($this->tt_contentData['prev'][$row['uid']]) {
1563  $params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData['prev'][$row['uid']];
1564  $moveButtonContent .= '<a class="btn btn-default" href="'
1565  . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
1566  . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveUp')) . '">'
1567  . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render() . '</a>';
1568  if (!$dragDropEnabled) {
1569  $displayMoveButtons = true;
1570  }
1571  } else {
1572  $moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
1573  }
1574  // Move element down:
1575  if ($this->tt_contentData['next'][$row['uid']]) {
1576  $params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData['next'][$row['uid']];
1577  $moveButtonContent .= '<a class="btn btn-default" href="'
1578  . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction($params))
1579  . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('moveDown')) . '">'
1580  . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render() . '</a>';
1581  if (!$dragDropEnabled) {
1582  $displayMoveButtons = true;
1583  }
1584  } else {
1585  $moveButtonContent .= '<span class="btn btn-default disabled">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
1586  }
1587  if ($displayMoveButtons) {
1588  $out .= '<div class="btn-group btn-group-sm" role="group">' . $moveButtonContent . '</div>';
1589  }
1590  }
1591  }
1592  }
1593  $allowDragAndDrop = $this->isDragAndDropAllowed($row);
1594  $additionalIcons = [];
1595  if ($row['sys_language_uid'] > 0 && $this->checkIfTranslationsExistInLanguage([], (int)$row['sys_language_uid'])) {
1596  $disabledClickMenuItems = 'new,move';
1597  $allowDragAndDrop = false;
1598  }
1599  $additionalIcons[] = $this->getIcon('tt_content', $row, $disabledClickMenuItems) . ' ';
1600  $additionalIcons[] = $langMode ? $this->languageFlag($row['sys_language_uid'], false) : '';
1601  // Get record locking status:
1602  if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
1603  $additionalIcons[] = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg'])
1604  . ');return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">'
1605  . $this->iconFactory->getIcon('status-warning-in-use', Icon::SIZE_SMALL)->render() . '</a>';
1606  }
1607  // Call stats information hook
1608  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
1609  $_params = ['tt_content', $row['uid'], &$row];
1610  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
1611  $additionalIcons[] = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1612  }
1613  }
1614  // Wrap the whole header
1615  // NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
1616  return '<div class="t3-page-ce-header ' . ($allowDragAndDrop ? 't3-page-ce-header-draggable t3js-page-ce-draghandle' : '') . '">
1617  <div class="t3-page-ce-header-icons-left">' . implode('', $additionalIcons) . '</div>
1618  <div class="t3-page-ce-header-icons-right">' . ($out ? '<div class="btn-toolbar">' . $out . '</div>' : '') . '</div>
1619  </div>
1620  <div class="t3-page-ce-body">';
1621  }
1622 
1629  protected function isDragAndDropAllowed(array $row)
1630  {
1631  if ($this->getBackendUser()->user['admin']
1632  || ((int)$row['editlock'] === 0 && (int)$this->pageinfo['editlock'] === 0)
1633  && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)
1634  && $this->getBackendUser()->checkAuthMode('tt_content', 'CType', $row['CType'], $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode'])
1635  ) {
1636  return true;
1637  }
1638  return false;
1639  }
1640 
1648  public function tt_content_drawItem($row)
1649  {
1650  $out = '';
1651  $outHeader = '';
1652  // Make header:
1653 
1654  if ($row['header']) {
1655  $infoArr = [];
1656  $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
1657  $hiddenHeaderNote = '';
1658  // If header layout is set to 'hidden', display an accordant note:
1659  if ($row['header_layout'] == 100) {
1660  $hiddenHeaderNote = ' <em>[' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.hidden')) . ']</em>';
1661  }
1662  $outHeader = $row['date']
1663  ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />'
1664  : '';
1665  $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row)
1666  . $hiddenHeaderNote . '</strong><br />';
1667  }
1668  // Make content:
1669  $infoArr = [];
1670  $drawItem = true;
1671  // Hook: Render an own preview of a record
1672  $drawItemHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
1673  if (is_array($drawItemHooks)) {
1674  foreach ($drawItemHooks as $hookClass) {
1675  $hookObject = GeneralUtility::getUserObj($hookClass);
1676  if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
1677  throw new \UnexpectedValueException($hookClass . ' must implement interface ' . PageLayoutViewDrawItemHookInterface::class, 1218547409);
1678  }
1679  $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
1680  }
1681  }
1682 
1683  // If the previous hook did not render something,
1684  // then check if a Fluid-based preview template was defined for this CType
1685  // and render it via Fluid. Possible option:
1686  // mod.web_layout.tt_content.preview.media = EXT:site_mysite/Resources/Private/Templates/Preview/Media.html
1687  if ($drawItem) {
1688  $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod.web_layout.tt_content.preview');
1689  if (!empty($tsConfig['properties'][$row['CType']])) {
1690  $fluidTemplateFile = $tsConfig['properties'][$row['CType']];
1691  $fluidTemplateFile = GeneralUtility::getFileAbsFileName($fluidTemplateFile);
1692  if ($fluidTemplateFile) {
1693  try {
1695  $view = GeneralUtility::makeInstance(StandaloneView::class);
1696  $view->setTemplatePathAndFilename($fluidTemplateFile);
1697  $view->assignMultiple($row);
1698  if (!empty($row['pi_flexform'])) {
1700  $flexFormService = GeneralUtility::makeInstance(FlexFormService::class);
1701  $view->assign('pi_flexform_transformed', $flexFormService->convertFlexFormContentToArray($row['pi_flexform']));
1702  }
1703  $out = $view->render();
1704  $drawItem = false;
1705  } catch (\Exception $e) {
1706  // Catch any exception to avoid breaking the view
1707  }
1708  }
1709  }
1710  }
1711 
1712  // Draw preview of the item depending on its CType (if not disabled by previous hook):
1713  if ($drawItem) {
1714  switch ($row['CType']) {
1715  case 'header':
1716  if ($row['subheader']) {
1717  $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
1718  }
1719  break;
1720  case 'bullets':
1721  case 'table':
1722  if ($row['bodytext']) {
1723  $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1724  }
1725  break;
1726  case 'uploads':
1727  if ($row['media']) {
1728  $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'media'), $row) . '<br />';
1729  }
1730  break;
1731  case 'menu':
1732  $contentType = $this->CType_labels[$row['CType']];
1733  $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
1734  // Add Menu Type
1735  $menuTypeLabel = $this->getLanguageService()->sL(
1736  BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'menu_type', $row['menu_type'])
1737  );
1738  $menuTypeLabel = $menuTypeLabel ?: 'invalid menu type';
1739  $out .= $this->linkEditContent($menuTypeLabel, $row);
1740  if ($row['menu_type'] !== '2' && ($row['pages'] || $row['selected_categories'])) {
1741  // Show pages if menu type is not "Sitemap"
1742  $out .= ':' . $this->linkEditContent($this->generateListForCTypeMenu($row), $row) . '<br />';
1743  }
1744  break;
1745  case 'shortcut':
1746  if (!empty($row['records'])) {
1747  $shortcutContent = [];
1748  $recordList = explode(',', $row['records']);
1749  foreach ($recordList as $recordIdentifier) {
1750  $split = BackendUtility::splitTable_Uid($recordIdentifier);
1751  $tableName = empty($split[0]) ? 'tt_content' : $split[0];
1752  $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);
1753  if (is_array($shortcutRecord)) {
1754  $icon = $this->iconFactory->getIconForRecord($tableName, $shortcutRecord, Icon::SIZE_SMALL)->render();
1756  $icon,
1757  $tableName,
1758  $shortcutRecord['uid'],
1759  1,
1760  '',
1761  '+copy,info,edit,view'
1762  );
1763  $shortcutContent[] = $icon
1764  . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));
1765  }
1766  }
1767  $out .= implode('<br />', $shortcutContent) . '<br />';
1768  }
1769  break;
1770  case 'list':
1771  $hookArr = [];
1772  $hookOut = '';
1773  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) {
1774  $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']];
1775  } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) {
1776  $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'];
1777  }
1778  if (!empty($hookArr)) {
1779  $_params = ['pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr];
1780  foreach ($hookArr as $_funcRef) {
1781  $hookOut .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1782  }
1783  }
1784  if ((string)$hookOut !== '') {
1785  $out .= $hookOut;
1786  } elseif (!empty($row['list_type'])) {
1787  $label = BackendUtility::getLabelFromItemListMerged($row['pid'], 'tt_content', 'list_type', $row['list_type']);
1788  if (!empty($label)) {
1789  $out .= $this->linkEditContent('<strong>' . htmlspecialchars($this->getLanguageService()->sL($label)) . '</strong>', $row) . '<br />';
1790  } else {
1791  $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
1792  $out .= '<span class="label label-warning">' . htmlspecialchars($message) . '</span>';
1793  }
1794  } elseif (!empty($row['select_key'])) {
1795  $out .= htmlspecialchars($this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key')))
1796  . ' ' . htmlspecialchars($row['select_key']) . '<br />';
1797  } else {
1798  $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
1799  }
1800  $out .= htmlspecialchars($this->getLanguageService()->sL(
1801  BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages'])
1802  )) . '<br />';
1803  break;
1804  default:
1805  $contentType = $this->CType_labels[$row['CType']];
1806 
1807  if (isset($contentType)) {
1808  $out .= $this->linkEditContent('<strong>' . htmlspecialchars($contentType) . '</strong>', $row) . '<br />';
1809  if ($row['bodytext']) {
1810  $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1811  }
1812  if ($row['image']) {
1813  $out .= $this->linkEditContent($this->getThumbCodeUnlinked($row, 'tt_content', 'image'), $row) . '<br />';
1814  }
1815  } else {
1816  $message = sprintf(
1817  $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.noMatchingValue'),
1818  $row['CType']
1819  );
1820  $out .= '<span class="label label-warning">' . htmlspecialchars($message) . '</span>';
1821  }
1822  }
1823  }
1824  // Wrap span-tags:
1825  $out = '
1826  <span class="exampleContent">' . $out . '</span>';
1827  // Add header:
1828  $out = $outHeader . $out;
1829  // Return values:
1830  if ($this->isDisabled('tt_content', $row)) {
1831  return '<span class="text-muted">' . $out . '</span>';
1832  } else {
1833  return $out;
1834  }
1835  }
1836 
1843  protected function generateListForCTypeMenu(array $row)
1844  {
1845  $table = 'pages';
1846  $field = 'pages';
1847  // get categories instead of pages
1848  if (strpos($row['menu_type'], 'categorized_') !== false) {
1849  $table = 'sys_category';
1850  $field = 'selected_categories';
1851  }
1852  if (trim($row[$field]) === '') {
1853  return '';
1854  }
1855  $content = '';
1856  $uidList = explode(',', $row[$field]);
1857  foreach ($uidList as $uid) {
1858  $uid = (int)$uid;
1859  $record = BackendUtility::getRecord($table, $uid, 'title');
1860  $content .= '<br>' . $record['title'] . ' (' . $uid . ')';
1861  }
1862  return $content;
1863  }
1864 
1875  public function getNonTranslatedTTcontentUids($defaultLanguageUids, $id, $lP)
1876  {
1877  if ($lP && !empty($defaultLanguageUids)) {
1878  // Select all translations here:
1879  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1880  ->getQueryBuilderForTable('tt_content');
1881  $queryBuilder->getRestrictions()
1882  ->removeAll()
1883  ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
1884  $queryBuilder
1885  ->select('*')
1886  ->from('tt_content')
1887  ->where(
1888  $queryBuilder->expr()->eq(
1889  'sys_language_uid',
1890  $queryBuilder->createNamedParameter($lP, \PDO::PARAM_INT)
1891  ),
1892  $queryBuilder->expr()->in(
1893  'l18n_parent',
1894  $queryBuilder->createNamedParameter($defaultLanguageUids, Connection::PARAM_INT_ARRAY)
1895  )
1896  );
1897 
1898  $result = $queryBuilder->execute();
1899 
1900  // Flip uids:
1901  $defaultLanguageUids = array_flip($defaultLanguageUids);
1902  // Traverse any selected elements and unset original UID if any:
1903  while ($row = $result->fetch()) {
1904  BackendUtility::workspaceOL('tt_content', $row);
1905  unset($defaultLanguageUids[$row['l18n_parent']]);
1906  }
1907  // Flip again:
1908  $defaultLanguageUids = array_keys($defaultLanguageUids);
1909  }
1910  return $defaultLanguageUids;
1911  }
1912 
1921  public function newLanguageButton($defaultLanguageUids, $lP, $colPos = 0)
1922  {
1923  $lP = (int)$lP;
1924  if (!$this->doEdit || !$lP) {
1925  return '';
1926  }
1927  $theNewButton = '';
1928 
1929  $allowCopy = true;
1930  $allowTranslate = true;
1931  if (!empty($this->languageHasTranslationsCache[$lP])) {
1932  if (isset($this->languageHasTranslationsCache[$lP]['hasStandAloneContent'])) {
1933  $allowTranslate = false;
1934  }
1935  if (isset($this->languageHasTranslationsCache[$lP]['hasTranslations'])) {
1936  $allowCopy = false;
1937  }
1938  }
1939 
1940  if (isset($this->contentElementCache[$lP][$colPos]) && is_array($this->contentElementCache[$lP][$colPos])) {
1941  foreach ($this->contentElementCache[$lP][$colPos] as $record) {
1942  $key = array_search($record['t3_origuid'], $defaultLanguageUids);
1943  if ($key !== false) {
1944  unset($defaultLanguageUids[$key]);
1945  }
1946  }
1947  }
1948 
1949  if (!empty($defaultLanguageUids)) {
1950  $theNewButton =
1951  '<input'
1952  . ' class="btn btn-default t3js-localize"'
1953  . ' type="button"'
1954  . ' disabled'
1955  . ' value="' . htmlspecialchars($this->getLanguageService()->getLL('newPageContent_translate')) . '"'
1956  . ' data-has-elements="' . (int)!empty($this->contentElementCache[$lP][$colPos]) . '"'
1957  . ' data-allow-copy="' . (int)$allowCopy . '"'
1958  . ' data-allow-translate="' . (int)$allowTranslate . '"'
1959  . ' data-table="tt_content"'
1960  . ' data-page-id="' . (int)GeneralUtility::_GP('id') . '"'
1961  . ' data-language-id="' . $lP . '"'
1962  . ' data-language-name="' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '"'
1963  . ' data-colpos-id="' . $colPos . '"'
1964  . ' data-colpos-name="' . BackendUtility::getProcessedValue('tt_content', 'colPos', $colPos) . '"'
1965  . '/>';
1966  }
1967 
1968  return '<div class="t3-page-lang-copyce">' . $theNewButton . '</div>';
1969  }
1970 
1980  public function newContentElementOnClick($id, $colPos, $sys_language)
1981  {
1982  if ($this->option_newWizard) {
1983  $tsConfig = BackendUtility::getModTSconfig($id, 'mod');
1984  $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
1985  ? $tsConfig['properties']['newContentElementWizard.']['override']
1986  : 'new_content_element';
1987  $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($moduleName) . '&id=' . $id . '&colPos=' . $colPos
1988  . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id
1989  . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';';
1990  } else {
1991  $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]='
1992  . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language);
1993  }
1994  return $onClick;
1995  }
1996 
2006  public function linkEditContent($str, $row)
2007  {
2008  if ($this->doEdit && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
2009  $urlParameters = [
2010  'edit' => [
2011  'tt_content' => [
2012  $row['uid'] => 'edit'
2013  ]
2014  ],
2015  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
2016  ];
2017  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
2018  // Return link
2019  return '<a href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">' . $str . '</a>';
2020  } else {
2021  return $str;
2022  }
2023  }
2024 
2034  public function languageSelector($id)
2035  {
2036  if ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay')) {
2037  // First, select all
2038  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
2039  $queryBuilder->getRestrictions()->removeAll();
2040  $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(HiddenRestriction::class));
2041  $statement = $queryBuilder->select('uid', 'title')
2042  ->from('sys_language')
2043  ->orderBy('sorting')
2044  ->execute();
2045  $langSelItems = [];
2046  $langSelItems[0] = '
2047  <option value="0"></option>';
2048  while ($row = $statement->fetch()) {
2049  if ($this->getBackendUser()->checkLanguageAccess($row['uid'])) {
2050  $langSelItems[$row['uid']] = '
2051  <option value="' . $row['uid'] . '">' . htmlspecialchars($row['title']) . '</option>';
2052  }
2053  }
2054  // Then, subtract the languages which are already on the page:
2055  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
2056  $queryBuilder->getRestrictions()->removeAll();
2057  $queryBuilder->select('sys_language.uid AS uid', 'sys_language.title AS title')
2058  ->from('sys_language')
2059  ->join(
2060  'sys_language',
2061  'pages_language_overlay',
2062  'pages_language_overlay',
2063  $queryBuilder->expr()->eq('sys_language.uid', $queryBuilder->quoteIdentifier('pages_language_overlay.sys_language_uid'))
2064  )
2065  ->where(
2066  $queryBuilder->expr()->eq(
2067  'pages_language_overlay.deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
2068  ),
2069  $queryBuilder->expr()->eq(
2070  'pages_language_overlay.pid',
2071  $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
2072  ),
2073  $queryBuilder->expr()->orX(
2074  $queryBuilder->expr()->gte(
2075  'pages_language_overlay.t3ver_state',
2076  $queryBuilder->createNamedParameter(
2078  \PDO::PARAM_INT
2079  )
2080  ),
2081  $queryBuilder->expr()->eq(
2082  'pages_language_overlay.t3ver_wsid',
2083  $queryBuilder->createNamedParameter($this->getBackendUser()->workspace, \PDO::PARAM_INT)
2084  )
2085  )
2086  )
2087  ->groupBy('pages_language_overlay.sys_language_uid', 'sys_language.uid', 'sys_language.pid',
2088  'sys_language.tstamp', 'sys_language.hidden', 'sys_language.title',
2089  'sys_language.language_isocode', 'sys_language.static_lang_isocode', 'sys_language.flag')
2090  ->orderBy('sys_language.sorting');
2091  if (!$this->getBackendUser()->isAdmin()) {
2092  $queryBuilder->andWhere(
2093  $queryBuilder->expr()->eq(
2094  'sys_language.hidden',
2095  $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
2096  )
2097  );
2098  }
2099  $statement = $queryBuilder->execute();
2100  while ($row = $statement->fetch()) {
2101  unset($langSelItems[$row['uid']]);
2102  }
2103  // Remove disallowed languages
2104  if (count($langSelItems) > 1
2105  && !$this->getBackendUser()->user['admin']
2106  && $this->getBackendUser()->groupData['allowed_languages'] !== ''
2107  ) {
2108  $allowed_languages = array_flip(explode(',', $this->getBackendUser()->groupData['allowed_languages']));
2109  if (!empty($allowed_languages)) {
2110  foreach ($langSelItems as $key => $value) {
2111  if (!isset($allowed_languages[$key]) && $key != 0) {
2112  unset($langSelItems[$key]);
2113  }
2114  }
2115  }
2116  }
2117  // Remove disabled languages
2119  $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages'])
2120  ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], true)
2121  : [];
2122  if (!empty($langSelItems) && !empty($disableLanguages)) {
2123  foreach ($disableLanguages as $language) {
2124  if ($language != 0 && isset($langSelItems[$language])) {
2125  unset($langSelItems[$language]);
2126  }
2127  }
2128  }
2129  // If any languages are left, make selector:
2130  if (count($langSelItems) > 1) {
2131  $url = BackendUtility::getModuleUrl('record_edit', [
2132  'edit[pages_language_overlay][' . $id . ']' => 'new',
2133  'overrideVals[pages_language_overlay][doktype]' => (int)$this->pageRecord['doktype'],
2134  'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
2135  ]);
2136  $onChangeContent = 'window.location.href=' . GeneralUtility::quoteJSvalue($url . '&overrideVals[pages_language_overlay][sys_language_uid]=') . '+this.options[this.selectedIndex].value';
2137  return '<div class="form-inline form-inline-spaced">'
2138  . '<div class="form-group">'
2139  . '<label for="createNewLanguage">'
2140  . htmlspecialchars($this->getLanguageService()->getLL('new_language'))
2141  . '</label>'
2142  . '<select class="form-control input-sm" name="createNewLanguage" onchange="' . htmlspecialchars($onChangeContent) . '">'
2143  . implode('', $langSelItems)
2144  . '</select></div></div>';
2145  }
2146  }
2147  return '';
2148  }
2149 
2157  public function getResult($result, string $table = 'tt_content'): array
2158  {
2159  if ($result instanceof \mysqli_result) {
2160  GeneralUtility::deprecationLog('Using \TYPO3\CMS\Backend\View\PageLayoutView::getResult with a mysqli_result object is deprecated since TYPO3 CMS 8 and will be removed in TYPO3 CMS 9');
2161  }
2162  $output = [];
2163  // Traverse the result:
2164  while ($row = ($result instanceof Statement ? $result->fetch() : $result->fetch_assoc())) {
2165  BackendUtility::workspaceOL($table, $row, -99, true);
2166  if ($row) {
2167  // Add the row to the array:
2168  $output[] = $row;
2169  }
2170  }
2171  $this->generateTtContentDataArray($output);
2172  // Return selected records
2173  return $output;
2174  }
2175 
2176  /********************************
2177  *
2178  * Various helper functions
2179  *
2180  ********************************/
2181 
2191  protected function initializeClipboard()
2192  {
2193  // Start clipboard
2194  $this->clipboard = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Clipboard\Clipboard::class);
2195 
2196  // Initialize - reads the clipboard content from the user session
2197  $this->clipboard->initializeClipboard();
2198 
2199  // This locks the clipboard to the Normal for this request.
2200  $this->clipboard->lockToNormal();
2201 
2202  // Clean up pad
2203  $this->clipboard->cleanCurrent();
2204 
2205  // Save the clipboard content
2206  $this->clipboard->endClipboard();
2207  }
2208 
2215  protected function generateTtContentDataArray(array $rowArray)
2216  {
2217  if (empty($this->tt_contentData)) {
2218  $this->tt_contentData = [
2219  'nextThree' => [],
2220  'next' => [],
2221  'prev' => [],
2222  ];
2223  }
2224  foreach ($rowArray as $key => $value) {
2225  // Create the list of the next three ids (for editing links...)
2226  for ($i = 0; $i < $this->nextThree; $i++) {
2227  if (isset($rowArray[$key - $i])
2228  && !GeneralUtility::inList($this->tt_contentData['nextThree'][$rowArray[$key - $i]['uid']], $value['uid'])
2229  ) {
2230  $this->tt_contentData['nextThree'][$rowArray[$key - $i]['uid']] .= $value['uid'] . ',';
2231  }
2232  }
2233 
2234  // Create information for next and previous content elements
2235  if (isset($rowArray[$key - 1])) {
2236  if (isset($rowArray[$key - 2])) {
2237  $this->tt_contentData['prev'][$value['uid']] = -$rowArray[$key - 2]['uid'];
2238  } else {
2239  $this->tt_contentData['prev'][$value['uid']] = $value['pid'];
2240  }
2241  $this->tt_contentData['next'][$rowArray[$key - 1]['uid']] = -$value['uid'];
2242  }
2243  }
2244  }
2245 
2253  public function numberOfRecords($table, $pid)
2254  {
2255  $count = 0;
2256  if ($GLOBALS['TCA'][$table]) {
2257  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
2258  ->getQueryBuilderForTable($table);
2259  $queryBuilder->getRestrictions()
2260  ->removeAll()
2261  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
2262  ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
2263  $count = (int)$queryBuilder->count('uid')
2264  ->from($table)
2265  ->where(
2266  $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT))
2267  )
2268  ->execute()
2269  ->fetchColumn();
2270  }
2271 
2272  return $count;
2273  }
2274 
2281  public function renderText($input)
2282  {
2283  $input = strip_tags($input);
2284  $input = GeneralUtility::fixed_lgd_cs($input, 1500);
2285  return nl2br(htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8', false));
2286  }
2287 
2296  public function getIcon($table, $row, $enabledClickMenuItems = '')
2297  {
2298  // Initialization
2299  $toolTip = BackendUtility::getRecordToolTip($row, 'tt_content');
2300  $icon = '<span ' . $toolTip . '>' . $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render() . '</span>';
2301  $this->counter++;
2302  // The icon with link
2303  if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) {
2304  $icon = BackendUtility::wrapClickMenuOnIcon($icon, $table, $row['uid'], true, '', $enabledClickMenuItems);
2305  }
2306  return $icon;
2307  }
2308 
2319  public function getProcessedValue($table, $fieldList, array $row, array &$info)
2320  {
2321  // Splitting values from $fieldList
2322  $fieldArr = explode(',', $fieldList);
2323  // Traverse fields from $fieldList
2324  foreach ($fieldArr as $field) {
2325  if ($row[$field]) {
2326  $info[] = '<strong>' . htmlspecialchars($this->itemLabels[$field]) . '</strong> '
2327  . htmlspecialchars(BackendUtility::getProcessedValue($table, $field, $row[$field]));
2328  }
2329  }
2330  }
2331 
2339  public function isDisabled($table, $row)
2340  {
2341  $enableCols = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
2342  return $enableCols['disabled'] && $row[$enableCols['disabled']]
2343  || $enableCols['starttime'] && $row[$enableCols['starttime']] > $GLOBALS['EXEC_TIME']
2344  || $enableCols['endtime'] && $row[$enableCols['endtime']] && $row[$enableCols['endtime']] < $GLOBALS['EXEC_TIME'];
2345  }
2346 
2355  public function noEditIcon($label = 'noEditItems')
2356  {
2357  $title = htmlspecialchars($this->getLanguageService()->getLL($label));
2358  return '<span title="' . $title . '">' . $this->iconFactory->getIcon('status-status-edit-read-only', Icon::SIZE_SMALL)->render() . '</span>';
2359  }
2360 
2361  /*****************************************
2362  *
2363  * External renderings
2364  *
2365  *****************************************/
2366 
2375  public function getTableMenu($id)
2376  {
2377  // Initialize:
2378  $this->activeTables = [];
2379  $theTables = ['tt_content'];
2380  // External tables:
2381  if (is_array($this->externalTables)) {
2382  $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
2383  }
2384  $out = '';
2385  // Traverse tables to check:
2386  foreach ($theTables as $tName) {
2387  // Check access and whether the proper extensions are loaded:
2388  if ($this->getBackendUser()->check('tables_select', $tName)
2389  && (isset($this->externalTables[$tName])
2390  || $tName === 'fe_users' || $tName === 'tt_content'
2391  || \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($tName)
2392  )
2393  ) {
2394  // Make query to count records from page:
2395  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
2396  ->getQueryBuilderForTable($tName);
2397  $queryBuilder->getRestrictions()
2398  ->removeAll()
2399  ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
2400  ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
2401  $count = $queryBuilder->count('uid')
2402  ->from($tName)
2403  ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)))
2404  ->execute()
2405  ->fetchColumn();
2406  // If records were found (or if "tt_content" is the table...):
2407  if ($count || $tName === 'tt_content') {
2408  // Add row to menu:
2409  $out .= '
2410  <td><a href="#' . $tName . '" title="' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title'])) . '"></a>'
2411  . $this->iconFactory->getIconForRecord($tName, [], Icon::SIZE_SMALL)->render()
2412  . '</td>';
2413  // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
2414  $title = htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title']))
2415  . ': ' . $count . ' ' . htmlspecialchars($this->getLanguageService()->getLL('records'));
2416  $this->activeTables[$tName] = '<span title="' . $title . '">'
2417  . $this->iconFactory->getIconForRecord($tName, [], Icon::SIZE_SMALL)->render()
2418  . '</span>'
2419  . '&nbsp;' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title']));
2420  }
2421  }
2422  }
2423  // Wrap cells in table tags:
2424  $out = '
2425  <!--
2426  Menu of tables on the page (table menu)
2427  -->
2428  <table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
2429  <tr>' . $out . '
2430  </tr>
2431  </table>';
2432  // Return the content:
2433  return $out;
2434  }
2435 
2444  public function getThumbCodeUnlinked($row, $table, $field)
2445  {
2446  return BackendUtility::thumbCode($row, $table, $field, '', '', null, 0, '', '', false);
2447  }
2448 
2457  protected function checkIfTranslationsExistInLanguage(array $contentElements, $language)
2458  {
2459  // If in default language, you may always create new entries
2460  // Also, you may override this strict behavior via user TS Config
2461  // If you do so, you're on your own and cannot rely on any support by the TYPO3 core
2462  // We jump out here since we don't need to do the expensive loop operations
2463  $allowInconsistentLanguageHandling = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.allowInconsistentLanguageHandling');
2464  if ($language === 0 || $allowInconsistentLanguageHandling['value'] === '1') {
2465  return false;
2466  }
2470  if (!isset($this->languageHasTranslationsCache[$language])) {
2471  foreach ($contentElements as $columns) {
2472  foreach ($columns as $contentElement) {
2473  if ((int)$contentElement['l18n_parent'] === 0) {
2474  $this->languageHasTranslationsCache[$language]['hasStandAloneContent'] = true;
2475  }
2476  if ((int)$contentElement['l18n_parent'] > 0) {
2477  $this->languageHasTranslationsCache[$language]['hasTranslations'] = true;
2478  }
2479  }
2480  }
2481  // Check whether we have a mix of both
2482  if ($this->languageHasTranslationsCache[$language]['hasStandAloneContent']
2483  && $this->languageHasTranslationsCache[$language]['hasTranslations']
2484  ) {
2485  $message = GeneralUtility::makeInstance(
2486  FlashMessage::class,
2487  sprintf($this->getLanguageService()->getLL('staleTranslationWarning'), $this->languageIconTitles[$language]['title']),
2488  sprintf($this->getLanguageService()->getLL('staleTranslationWarningTitle'), $this->languageIconTitles[$language]['title']),
2490  );
2491  $service = GeneralUtility::makeInstance(FlashMessageService::class);
2492  $queue = $service->getMessageQueueByIdentifier();
2493  $queue->addMessage($message);
2494  }
2495  }
2496  if ($this->languageHasTranslationsCache[$language]['hasTranslations']) {
2497  return true;
2498  }
2499  return false;
2500  }
2501 
2505  protected function getBackendLayoutView()
2506  {
2507  return GeneralUtility::makeInstance(BackendLayoutView::class);
2508  }
2509 
2513  protected function getBackendUser()
2514  {
2515  return $GLOBALS['BE_USER'];
2516  }
2517 
2521  protected function getPageLayoutController()
2522  {
2523  return $GLOBALS['SOBE'];
2524  }
2525 }
makeOrdinaryList($table, $id, $fList, $icon=false, $addWhere= '')
getNonTranslatedTTcontentUids($defaultLanguageUids, $id, $lP)
static getRecordWSOL($table, $uid, $fields= '*', $where= '', $useDeleteClause=true, $unsetMovePointers=false)
static getLabelFromItemListMerged($pageId, $table, $column, $key)
getThumbCodeUnlinked($row, $table, $field)
static trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
addElement($h, $icon, $data, $rowParams= '', $_= '', $_2= '', $colType= 'td')
setTotalItems(string $table, int $pageId, array $constraints)
static getRecordTitle($table, $row, $prep=false, $forceResult=true)
static getLinkToDataHandlerAction($parameters, $redirectUrl= '')
getResult($result, string $table= 'tt_content')
static viewOnClick($pageUid, $backPath= '', $rootLine=null, $anchorSection= '', $alternativeUrl= '', $additionalGetVars= '', $switchFocus=true)
getQueryBuilder(string $table, int $pageId, array $additionalConstraints=[], array $fields=['*'])
static workspaceOL($table, &$row, $wsid=-99, $unsetMovePointers=false)
static BEgetRootLine($uid, $clause= '', $workspaceOL=false)
static getRecord($table, $uid, $fields= '*', $where= '', $useDeleteClause=true)
tt_content_drawColHeader($colName, $editParams, $newParams, array $pasteParams=null)
getTable($table, $id, $fields= '')
getProcessedValue($table, $fieldList, array $row, array &$info)
languageFlag($sys_language_uid, $addAsAdditionalText=true)
pages_getTree($theRows, $pid, $qWhere, $treeIcons, $depth)
static getRecordsByField($theTable, $theField, $theValue, $whereClause= '', $groupBy= '', $orderBy= '', $limit= '', $useDeleteClause=true, $queryBuilder=null)
tt_content_drawHeader($row, $space=0, $disableMoveAndNewButtons=false, $langMode=false, $dragDropEnabled=false)
getPageRecordsRecursive(int $pid, int $depth, string $iconPrefix= '', array $rows=[])
getIcon($table, $row, $enabledClickMenuItems= '')
newContentElementOnClick($id, $colPos, $sys_language)
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)
static stripLogicalOperatorPrefix(string $constraint)
static wrapClickMenuOnIcon($content, $table, $uid=0, $listFrame=true, $addParams= '', $enDisItems= '', $returnTagParameters=false)
static getFileAbsFileName($filename, $_=null, $_2=null)
dataFields($fieldArr, $table, $row, $out=[])
checkIfTranslationsExistInLanguage(array $contentElements, $language)
newLanguageButton($defaultLanguageUids, $lP, $colPos=0)
getContentRecordsPerColumn($table, $id, array $columns, $additionalWhereClause= '')
static intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
static callUserFunction($funcName, &$params, &$ref, $_= '', $errorMode=0)
headerFields($fieldArr, $table, $out=[])