[CLEANUP] Add phpDoc to properties in ext:backend
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / View / PageLayoutView.php
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 TYPO3\CMS\Backend\Controller\PageLayoutController;
18 use TYPO3\CMS\Backend\Template\DocumentTemplate;
19 use TYPO3\CMS\Backend\Utility\BackendUtility;
20 use TYPO3\CMS\Backend\Utility\IconUtility;
21 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
22 use TYPO3\CMS\Core\Database\DatabaseConnection;
23 use TYPO3\CMS\Core\Messaging\FlashMessage;
24 use TYPO3\CMS\Core\Utility\GeneralUtility;
25 use TYPO3\CMS\Core\Versioning\VersionState;
26 use TYPO3\CMS\Lang\LanguageService;
27
28 /**
29 * Child class for the Web > Page module
30 *
31 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
32 */
33 class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList {
34
35 /**
36 * If TRUE, users/groups are shown in the page info box.
37 *
38 * @var int
39 */
40 public $pI_showUser = 0;
41
42 /**
43 * The number of successive records to edit when showing content elements.
44 *
45 * @var int
46 */
47 public $nextThree = 3;
48
49 /**
50 * If TRUE, disables the edit-column icon for tt_content elements
51 *
52 * @var int
53 */
54 public $pages_noEditColumns = 0;
55
56 /**
57 * If TRUE, shows big buttons for editing page properties, moving, creating elements etc. in the columns view.
58 *
59 * @var int
60 */
61 public $option_showBigButtons = 1;
62
63 /**
64 * If TRUE, new-wizards are linked to rather than the regular new-element list.
65 *
66 * @var int
67 */
68 public $option_newWizard = 1;
69
70 /**
71 * If set to "1", will link a big button to content element wizard.
72 *
73 * @var int
74 */
75 public $ext_function = 0;
76
77 /**
78 * If TRUE, elements will have edit icons (probably this is whether the user has permission to edit the page content). Set externally.
79 *
80 * @var int
81 */
82 public $doEdit = 1;
83
84 /**
85 * Age prefixes for displaying times. May be set externally to localized values.
86 *
87 * @var string
88 */
89 public $agePrefixes = ' min| hrs| days| yrs| min| hour| day| year';
90
91 /**
92 * Array of tables to be listed by the Web > Page module in addition to the default tables.
93 *
94 * @var array
95 */
96 public $externalTables = array();
97
98 /**
99 * "Pseudo" Description -table name
100 *
101 * @var string
102 */
103 public $descrTable;
104
105 /**
106 * If set TRUE, the language mode of tt_content elements will be rendered with hard binding between
107 * default language content elements and their translations!
108 *
109 * @var bool
110 */
111 public $defLangBinding = FALSE;
112
113 /**
114 * External, static: Configuration of tt_content element display:
115 *
116 * @var array
117 */
118 public $tt_contentConfig = array(
119 'showInfo' => 1,
120 // Boolean: Display info-marks or not
121 'showCommands' => 1,
122 // Boolean: Display up/down arrows and edit icons for tt_content records
123 'single' => 1,
124 // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
125 'showAsGrid' => 0,
126 // Boolean: If set, the content of columns is shown in grid
127 'showSingleCol' => 0,
128 // The column(s) to show if single mode (under each other)
129 'languageCols' => 0,
130 'languageMode' => 0,
131 'languageColsPointer' => 0,
132 'showHidden' => 1,
133 // Displays hidden records as well
134 'sys_language_uid' => 0,
135 // Which language
136 'cols' => '1,0,2,3',
137 'activeCols' => '1,0,2,3'
138 // Which columns can be accessed by current BE user
139 );
140
141 /**
142 * Contains icon/title of pages which are listed in the tables menu (see getTableMenu() function )
143 *
144 * @var array
145 */
146 public $activeTables = array();
147
148 /**
149 * @var array
150 */
151 public $tt_contentData = array(
152 'nextThree' => array(),
153 'prev' => array(),
154 'next' => array()
155 );
156
157 /**
158 * Used to store labels for CTypes for tt_content elements
159 *
160 * @var array
161 */
162 public $CType_labels = array();
163
164 /**
165 * Used to store labels for the various fields in tt_content elements
166 *
167 * @var array
168 */
169 public $itemLabels = array();
170
171 /**
172 * Used to store the RTE setup of a particular page
173 *
174 * @var array
175 */
176 protected $rteSetup = array();
177
178 /**
179 * @var \TYPO3\CMS\Backend\Clipboard\Clipboard
180 */
181 protected $clipboard;
182
183 /**
184 * @var array
185 */
186 protected $plusPages = array();
187
188 /**
189 * User permissions
190 *
191 * @var int
192 */
193 public $ext_CALC_PERMS;
194
195 /*****************************************
196 *
197 * Renderings
198 *
199 *****************************************/
200 /**
201 * Adds the code of a single table
202 *
203 * @param string $table Table name
204 * @param int $id Current page id
205 * @return string HTML for listing.
206 */
207 public function getTable($table, $id) {
208 if (isset($this->externalTables[$table])) {
209 return $this->getExternalTables($id, $table);
210 } else {
211 // Branch out based on table name:
212 switch ($table) {
213 case 'pages':
214 return $this->getTable_pages($id);
215 break;
216 case 'tt_content':
217 return $this->getTable_tt_content($id);
218 break;
219 default:
220 return '';
221 }
222 }
223 }
224
225 /**
226 * Renders an external table from page id
227 *
228 * @param int $id Page id
229 * @param string $table Name of the table
230 * @return string HTML for the listing
231 */
232 public function getExternalTables($id, $table) {
233 $type = $this->getPageLayoutController()->MOD_SETTINGS[$table];
234 if (!isset($type)) {
235 $type = 0;
236 }
237 // eg. "name;title;email;company,image"
238 $fList = $this->externalTables[$table][$type]['fList'];
239 // The columns are separeted by comma ','.
240 // Values separated by semicolon ';' are shown in the same column.
241 $icon = $this->externalTables[$table][$type]['icon'];
242 $addWhere = $this->externalTables[$table][$type]['addWhere'];
243 // Create listing
244 $out = $this->makeOrdinaryList($table, $id, $fList, $icon, $addWhere);
245 return $out;
246 }
247
248 /**
249 * Renders records from the pages table from page id
250 * (Used to get information about the page tree content by "Web>Info"!)
251 *
252 * @param int $id Page id
253 * @return string HTML for the listing
254 */
255 public function getTable_pages($id) {
256 // Initializing:
257 $out = '';
258 // Select clause for pages:
259 $delClause = BackendUtility::deleteClause('pages') . ' AND ' . $this->getBackendUser()->getPagePermsClause(1);
260 // Select current page:
261 if (!$id) {
262 // The root has a pseudo record in pageinfo...
263 $row = $this->getPageLayoutController()->pageinfo;
264 } else {
265 $result = $this->getDatabase()->exec_SELECTquery('*', 'pages', 'uid=' . (int)$id . $delClause);
266 $row = $this->getDatabase()->sql_fetch_assoc($result);
267 BackendUtility::workspaceOL('pages', $row);
268 }
269 // If there was found a page:
270 if (is_array($row)) {
271 // Select which fields to show:
272 $pKey = $this->getPageLayoutController()->MOD_SETTINGS['pages'];
273 switch ($pKey) {
274 case 1:
275 $this->fieldArray = array('title','uid') + array_keys($this->cleanTableNames());
276 break;
277 case 2:
278 $this->fieldArray = array(
279 'title',
280 'uid',
281 'lastUpdated',
282 'newUntil',
283 'no_cache',
284 'cache_timeout',
285 'php_tree_stop',
286 'TSconfig',
287 'storage_pid',
288 'is_siteroot',
289 'fe_login_mode'
290 );
291 break;
292 default:
293 $this->fieldArray = array(
294 'title',
295 'uid',
296 'alias',
297 'starttime',
298 'endtime',
299 'fe_group',
300 'target',
301 'url',
302 'shortcut',
303 'shortcut_mode'
304 );
305 }
306 // Getting select-depth:
307 $depth = (int)$this->getPageLayoutController()->MOD_SETTINGS['pages_levels'];
308 // Half line is drawn
309 $theData = array();
310 $theData['subject'] = $this->widthGif;
311 $out .= $this->addelement(0, '', $theData);
312 // Overriding a few things:
313 $this->no_noWrap = 0;
314 $this->oddColumnsCssClass = 'bgColor3-20';
315 // Items
316 $this->eCounter = $this->firstElementNumber;
317 // Creating elements:
318 list($flag, $code) = $this->fwd_rwd_nav();
319 $out .= $code;
320 $editUids = array();
321 if ($flag) {
322 // Getting children:
323 $theRows = array();
324 $theRows = $this->pages_getTree($theRows, $row['uid'], $delClause . BackendUtility::versioningPlaceholderClause('pages'), '', $depth);
325 if ($this->getBackendUser()->doesUserHaveAccess($row, 2)) {
326 $editUids[] = $row['uid'];
327 }
328 $out .= $this->pages_drawItem($row, $this->fieldArray);
329 // Traverse all pages selected:
330 foreach ($theRows as $sRow) {
331 if ($this->getBackendUser()->doesUserHaveAccess($sRow, 2)) {
332 $editUids[] = $sRow['uid'];
333 }
334 $out .= $this->pages_drawItem($sRow, $this->fieldArray);
335 }
336 $this->eCounter++;
337 }
338 // Header line is drawn
339 $theData = array();
340 $editIdList = implode(',', $editUids);
341 // Traverse fields (as set above) in order to create header values:
342 foreach ($this->fieldArray as $field) {
343 if ($editIdList && isset($GLOBALS['TCA']['pages']['columns'][$field]) && $field != 'uid' && !$this->pages_noEditColumns) {
344 $params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=' . $field . '&disHelp=1';
345 $iTitle = sprintf(
346 $this->getLanguageService()->getLL('editThisColumn'),
347 rtrim(trim($this->getLanguageService()->sL(BackendUtility::getItemLabel('pages', $field))), ':')
348 );
349 $eI = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, ''))
350 . '" title="' . htmlspecialchars($iTitle) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
351 } else {
352 $eI = '';
353 }
354 switch ($field) {
355 case 'title':
356 $theData[$field] = '&nbsp;<strong>'
357 . $this->getLanguageService()->sL($GLOBALS['TCA']['pages']['columns'][$field]['label'])
358 . '</strong>' . $eI;
359 break;
360 case 'uid':
361 $theData[$field] = '&nbsp;<strong>ID:</strong>';
362 break;
363 default:
364 if (substr($field, 0, 6) == 'table_') {
365 $f2 = substr($field, 6);
366 if ($GLOBALS['TCA'][$f2]) {
367 $theData[$field] = '&nbsp;' . IconUtility::getSpriteIconForRecord($f2, array(), array(
368 'title' => $this->getLanguageService()->sL($GLOBALS['TCA'][$f2]['ctrl']['title'], TRUE)
369 ));
370 }
371 } else {
372 $theData[$field] = '&nbsp;&nbsp;<strong>'
373 . $this->getLanguageService()->sL($GLOBALS['TCA']['pages']['columns'][$field]['label'], TRUE)
374 . '</strong>' . $eI;
375 }
376 }
377 }
378 // Start table:
379 $this->oddColumnsCssClass = '';
380 // CSH:
381 $out = BackendUtility::cshItem($this->descrTable, ('func_' . $pKey), $GLOBALS['BACK_PATH']) . '
382 <table class="t3-table typo3-page-pages">' .
383 '<thead>' .
384 $this->addelement(1, '', $theData) .
385 '</thead>' .
386 '<tbody>' .
387 $out .
388 '</tbody>' .
389 '</table>';
390 }
391 $this->oddColumnsCssClass = '';
392 return $out;
393 }
394
395 /**
396 * Returns the backend layout which should be used for this page.
397 *
398 * @param int $id Uid of the current page
399 * @return bool|string Identifier of the backend layout to be used, or FALSE if none
400 * @deprecated since TYPO3 CMS 6.2, will be removed two versions later
401 */
402 public function getSelectedBackendLayoutUid($id) {
403 GeneralUtility::logDeprecatedFunction();
404 return $this->getBackendLayoutView()->getSelectedCombinedIdentifier($id);
405 }
406
407 /**
408 * Renders Content Elements from the tt_content table from page id
409 *
410 * @param int $id Page id
411 * @return string HTML for the listing
412 */
413 public function getTable_tt_content($id) {
414 $this->initializeLanguages();
415 $this->initializeClipboard();
416 // Initialize:
417 $RTE = $this->getBackendUser()->isRTE();
418 $lMarg = 1;
419 $showHidden = $this->tt_contentConfig['showHidden'] ? '' : BackendUtility::BEenableFields('tt_content');
420 $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), TRUE));
421 /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */
422 $pageRenderer = $this->getPageLayoutController()->doc->getPageRenderer();
423 $pageRenderer->loadExtJs();
424 $pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js');
425 // Get labels for CTypes and tt_content element fields in general:
426 $this->CType_labels = array();
427 foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
428 $this->CType_labels[$val[1]] = $this->getLanguageService()->sL($val[0]);
429 }
430 $this->itemLabels = array();
431 foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) {
432 $this->itemLabels[$name] = $this->getLanguageService()->sL($val['label']);
433 }
434 $languageColumn = array();
435 $out = '';
436 // Select display mode:
437 // MULTIPLE column display mode, side by side:
438 if (!$this->tt_contentConfig['single']) {
439 // Setting language list:
440 $langList = $this->tt_contentConfig['sys_language_uid'];
441 if ($this->tt_contentConfig['languageMode']) {
442 if ($this->tt_contentConfig['languageColsPointer']) {
443 $langList = '0,' . $this->tt_contentConfig['languageColsPointer'];
444 } else {
445 $langList = implode(',', array_keys($this->tt_contentConfig['languageCols']));
446 }
447 $languageColumn = array();
448 }
449 $langListArr = GeneralUtility::intExplode(',', $langList);
450 $defLanguageCount = array();
451 $defLangBinding = array();
452 // For each languages... :
453 // If not languageMode, then we'll only be through this once.
454 foreach ($langListArr as $lP) {
455 $lP = (int)$lP;
456 if (count($langListArr) === 1 || $lP === 0) {
457 $showLanguage = ' AND sys_language_uid IN (' . $lP . ',-1)';
458 } else {
459 $showLanguage = ' AND sys_language_uid=' . $lP;
460 }
461 $cList = explode(',', $this->tt_contentConfig['cols']);
462 $content = array();
463 $head = array();
464
465 // Select content records per column
466 $contentRecordsPerColumn = $this->getContentRecordsPerColumn('table', $id, array_values($cList), $showHidden . $showLanguage);
467 // For each column, render the content into a variable:
468 foreach ($cList as $key) {
469 if (!$lP) {
470 $defLanguageCount[$key] = array();
471 }
472 // Start wrapping div
473 $content[$key] .= '<div class="t3-page-ce-wrapper';
474 if (count($contentRecordsPerColumn[$key]) === 0) {
475 $content[$key] .= ' t3-page-ce-empty';
476 }
477 $content[$key] .= '">';
478 // Add new content at the top most position
479 $content[$key] .= '
480 <div class="t3-page-ce" id="' . str_replace('.', '', uniqid('', TRUE)) . '">
481 <div class="t3-page-ce-dropzone" id="colpos-' . $key . '-' . 'page-' . $id . '-' . uniqid('', TRUE) . '">
482 <div class="t3-page-ce-wrapper-new-ce">
483 <a href="#" onclick="' . htmlspecialchars($this->newContentElementOnClick($id, $key, $lP))
484 . '" title="' . $this->getLanguageService()->getLL('newRecordHere', TRUE) . '">'
485 . IconUtility::getSpriteIcon('actions-document-new') . '</a>
486 </div>
487 </div>
488 </div>
489 ';
490 $editUidList = '';
491 $rowArr = $contentRecordsPerColumn[$key];
492 $this->generateTtContentDataArray($rowArr);
493 foreach ((array)$rowArr as $rKey => $row) {
494 if ($this->tt_contentConfig['languageMode']) {
495 $languageColumn[$key][$lP] = $head[$key] . $content[$key];
496 if (!$this->defLangBinding) {
497 $languageColumn[$key][$lP] .= $this->newLanguageButton(
498 $this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP),
499 $lP
500 );
501 }
502 }
503 if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
504 $singleElementHTML = '';
505 if (!$lP && ($this->defLangBinding || $row['sys_language_uid'] != -1)) {
506 $defLanguageCount[$key][] = $row['uid'];
507 }
508 $editUidList .= $row['uid'] . ',';
509 $disableMoveAndNewButtons = $this->defLangBinding && $lP > 0;
510 if (!$this->tt_contentConfig['languageMode']) {
511 $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . str_replace('.', '', uniqid('', TRUE)) . '">';
512 }
513 $singleElementHTML .= $this->tt_content_drawHeader(
514 $row,
515 $this->tt_contentConfig['showInfo'] ? 15 : 5,
516 $disableMoveAndNewButtons,
517 TRUE,
518 !$this->tt_contentConfig['languageMode']
519 );
520 $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
521 $innerContent = '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>'
522 . $this->tt_content_drawItem($row, $isRTE) . '</div>';
523 $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>'
524 . $this->tt_content_drawFooter($row);
525 // NOTE: this is the end tag for <div class="t3-page-ce-body">
526 // because of bad (historic) conception, starting tag has to be placed inside tt_content_drawHeader()
527 $singleElementHTML .= '</div>';
528 $statusHidden = $this->isDisabled('tt_content', $row) ? ' t3-page-ce-hidden' : '';
529 $singleElementHTML = '<div class="t3-page-ce' . $statusHidden . '" id="element-tt_content-'
530 . $row['uid'] . '">' . $singleElementHTML . '</div>';
531 if ($this->tt_contentConfig['languageMode']) {
532 $singleElementHTML .= '<div class="t3-page-ce">';
533 }
534 $singleElementHTML .= '<div class="t3-page-ce-dropzone" id="colpos-' . $key . '-' . 'page-' . $id .
535 '-' . str_replace('.', '', uniqid('', TRUE)) . '">';
536 // Add icon "new content element below"
537 if (!$disableMoveAndNewButtons) {
538 // New content element:
539 if ($this->option_newWizard) {
540 $onClick = 'window.location.href=\'db_new_content_el.php?id=' . $row['pid']
541 . '&sys_language_uid=' . $row['sys_language_uid'] . '&colPos=' . $row['colPos']
542 . '&uid_pid=' . -$row['uid'] .
543 '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';';
544 } else {
545 $params = '&edit[tt_content][' . -$row['uid'] . ']=new';
546 $onClick = BackendUtility::editOnClick($params, $this->backPath);
547 }
548 $singleElementHTML .= '
549 <div class="t3-page-ce-wrapper-new-ce">
550 <a href="#" onclick="' . htmlspecialchars($onClick) . '" title="'
551 . $this->getLanguageService()->getLL('newRecordHere', TRUE) . '">'
552 . IconUtility::getSpriteIcon('actions-document-new') . '</a>
553 </div>
554 ';
555 }
556 $singleElementHTML .= '</div></div>';
557 if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
558 $defLangBinding[$key][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML;
559 } else {
560 $content[$key] .= $singleElementHTML;
561 }
562 } else {
563 unset($rowArr[$rKey]);
564 }
565 }
566 $content[$key] .= '</div>';
567 // Add new-icon link, header:
568 $newP = $this->newContentElementOnClick($id, $key, $lP);
569 $colTitle = BackendUtility::getProcessedValue('tt_content', 'colPos', $key);
570 $tcaItems = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getColPosListItemsParsed', $id, $this);
571 foreach ($tcaItems as $item) {
572 if ($item[1] == $key) {
573 $colTitle = $this->getLanguageService()->sL($item[0]);
574 }
575 }
576
577 $pasteP = array('colPos' => $key, 'sys_language_uid' => $lP);
578 $editParam = $this->doEdit && count($rowArr)
579 ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc
580 : '';
581 $head[$key] .= $this->tt_content_drawColHeader($colTitle, $editParam, $newP, $pasteP);
582 }
583 // For each column, fit the rendered content into a table cell:
584 $out = '';
585 if ($this->tt_contentConfig['languageMode']) {
586 // in language mode process the content elements, but only fill $languageColumn. output will be generated later
587 foreach ($cList as $key) {
588 $languageColumn[$key][$lP] = $head[$key] . $content[$key];
589 if (!$this->defLangBinding) {
590 $languageColumn[$key][$lP] .= $this->newLanguageButton(
591 $this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP),
592 $lP
593 );
594 }
595 }
596 } else {
597 $backendLayout = $this->getBackendLayoutView()->getSelectedBackendLayout($this->id);
598 // GRID VIEW:
599 $grid = '<div class="t3-gridContainer"><table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%" class="t3-page-columns t3-gridTable">';
600 // Add colgroups
601 $colCount = (int)$backendLayout['__config']['backend_layout.']['colCount'];
602 $rowCount = (int)$backendLayout['__config']['backend_layout.']['rowCount'];
603 $grid .= '<colgroup>';
604 for ($i = 0; $i < $colCount; $i++) {
605 $grid .= '<col style="width:' . 100 / $colCount . '%"></col>';
606 }
607 $grid .= '</colgroup>';
608 // Cycle through rows
609 for ($row = 1; $row <= $rowCount; $row++) {
610 $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
611 if (!isset($rowConfig)) {
612 continue;
613 }
614 $grid .= '<tr>';
615 for ($col = 1; $col <= $colCount; $col++) {
616 $columnConfig = $rowConfig['columns.'][$col . '.'];
617 if (!isset($columnConfig)) {
618 continue;
619 }
620 // Which tt_content colPos should be displayed inside this cell
621 $columnKey = (int)$columnConfig['colPos'];
622 // Render the grid cell
623 $colSpan = (int)$columnConfig['colspan'];
624 $rowSpan = (int)$columnConfig['rowspan'];
625 $grid .= '<td valign="top"' .
626 ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') .
627 ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') .
628 ' class="t3-gridCell t3-page-column t3-page-column-' . $columnKey .
629 ((!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '') ? ' t3-gridCell-unassigned' : '') .
630 ((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ' t3-gridCell-restricted' : '') .
631 ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') .
632 ($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">';
633
634 // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
635 // If not, a new header without any buttons will be generated.
636 if (
637 isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey]
638 && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
639 ) {
640 $grid .= $head[$columnKey] . $content[$columnKey];
641 } elseif (
642 isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
643 && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
644 ) {
645 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'), '', '');
646 } elseif (
647 isset($columnConfig['colPos']) && $columnConfig['colPos'] !== ''
648 && !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])
649 ) {
650 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) .
651 ' (' . $this->getLanguageService()->getLL('noAccess') . ')', '', '');
652 } elseif (isset($columnConfig['name']) && strlen($columnConfig['name']) > 0) {
653 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name'])
654 . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', '');
655 } else {
656 $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('notAssigned'), '', '');
657 }
658
659 $grid .= '</td>';
660 }
661 $grid .= '</tr>';
662 }
663 $out .= $grid . '</table></div>';
664 }
665 // CSH:
666 $out .= BackendUtility::cshItem($this->descrTable, 'columns_multi', $GLOBALS['BACK_PATH']);
667 }
668 // If language mode, then make another presentation:
669 // Notice that THIS presentation will override the value of $out!
670 // But it needs the code above to execute since $languageColumn is filled with content we need!
671 if ($this->tt_contentConfig['languageMode']) {
672 // Get language selector:
673 $languageSelector = $this->languageSelector($id);
674 // Reset out - we will make new content here:
675 $out = '';
676 // Traverse languages found on the page and build up the table displaying them side by side:
677 $cCont = array();
678 $sCont = array();
679 foreach ($langListArr as $lP) {
680 // Header:
681 $lP = (int)$lP;
682 $cCont[$lP] = '
683 <td valign="top" class="t3-page-lang-column">
684 <h3>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</h3>
685 </td>';
686
687 // "View page" icon is added:
688 $onClick = BackendUtility::viewOnClick($this->id, $this->backPath, BackendUtility::BEgetRootLine($this->id), '', '', ('&L=' . $lP));
689 $viewLink = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
690 // Language overlay page header:
691 if ($lP) {
692 list($lpRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . $lP);
693 BackendUtility::workspaceOL('pages_language_overlay', $lpRecord);
694 $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP;
695 $lPLabel = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon(
696 IconUtility::getSpriteIconForRecord('pages_language_overlay', $lpRecord),
697 'pages_language_overlay',
698 $lpRecord['uid']
699 ) . $viewLink . ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay')
700 ? '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath))
701 . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '">'
702 . IconUtility::getSpriteIcon('actions-document-open') . '</a>'
703 : ''
704 ) . htmlspecialchars(GeneralUtility::fixed_lgd_cs($lpRecord['title'], 20));
705 } else {
706 $lPLabel = $viewLink;
707 }
708 $sCont[$lP] = '
709 <td nowrap="nowrap" class="t3-page-lang-column t3-page-lang-label">' . $lPLabel . '</td>';
710 }
711 // Add headers:
712 $out .= '<tr>' . implode($cCont) . '</tr>';
713 $out .= '<tr>' . implode($sCont) . '</tr>';
714 // Traverse previously built content for the columns:
715 foreach ($languageColumn as $cKey => $cCont) {
716 $out .= '
717 <tr>
718 <td valign="top" class="t3-gridCell t3-page-column t3-page-lang-column">' . implode(('</td>' . '
719 <td valign="top" class="t3-gridCell t3-page-column t3-page-lang-column">'), $cCont) . '</td>
720 </tr>';
721 if ($this->defLangBinding) {
722 // "defLangBinding" mode
723 foreach ($defLanguageCount[$cKey] as $defUid) {
724 $cCont = array();
725 foreach ($langListArr as $lP) {
726 $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . $this->newLanguageButton(
727 $this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP),
728 $lP
729 );
730 }
731 $out .= '
732 <tr>
733 <td valign="top" class="t3-page-lang-column">' . implode(('</td>' . '
734 <td valign="top" class="t3-page-lang-column">'), $cCont) . '</td>
735 </tr>';
736 }
737 // Create spacer:
738 $cCont = array_fill(0, count($langListArr), '&nbsp;');
739 $out .= '
740 <tr>
741 <td valign="top" class="t3-page-lang-column">' . implode(('</td>' . '
742 <td valign="top" class="t3-page-lang-column">'), $cCont) . '</td>
743 </tr>';
744 }
745 }
746 // Finally, wrap it all in a table and add the language selector on top of it:
747 $out = $languageSelector . '
748 <div class="t3-lang-gridContainer">
749 <table cellpadding="0" cellspacing="0" class="t3-page-langMode">
750 ' . $out . '
751 </table>
752 </div>';
753 // CSH:
754 $out .= BackendUtility::cshItem($this->descrTable, 'language_list', $GLOBALS['BACK_PATH']);
755 }
756 } else {
757 // SINGLE column mode (columns shown beneath each other):
758 if ($this->tt_contentConfig['sys_language_uid'] == 0 || !$this->defLangBinding) {
759 // Initialize:
760 if ($this->defLangBinding && $this->tt_contentConfig['sys_language_uid'] == 0) {
761 $showLanguage = ' AND sys_language_uid IN (0,-1)';
762 $lP = 0;
763 } else {
764 $showLanguage = ' AND sys_language_uid=' . $this->tt_contentConfig['sys_language_uid'];
765 $lP = $this->tt_contentConfig['sys_language_uid'];
766 }
767 $cList = explode(',', $this->tt_contentConfig['showSingleCol']);
768 $out = '';
769 // Expand the table to some preset dimensions:
770 $out .= '
771 <tr>
772 <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>
773 <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td>
774 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
775 <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td>
776 </tr>';
777
778 // Select content records per column
779 $contentRecordsPerColumn = $this->getContentRecordsPerColumn('tt_content', $id, array_values($cList), $showHidden . $showLanguage);
780 // Traverse columns to display top-on-top
781 foreach ($cList as $counter => $key) {
782 $c = 0;
783 $rowArr = $contentRecordsPerColumn[$key];
784 $this->generateTtContentDataArray($rowArr);
785 $numberOfContentElementsInColumn = count($rowArr);
786 $rowOut = '';
787 // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script:
788 if ($this->doEdit && $this->option_showBigButtons && !(int)$key && $numberOfContentElementsInColumn == 0) {
789 $onClick = 'window.location.href=\'db_new_content_el.php?id=' . $id . '&colPos=' . (int)$key
790 . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl='
791 . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';';
792 $theNewButton = $this->getPageLayoutController()->doc->t3Button($onClick, $this->getLanguageService()->getLL('newPageContent'));
793 $theNewButton = '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton;
794 } else {
795 $theNewButton = '';
796 }
797 $editUidList = '';
798 // Traverse any selected elements:
799 foreach ($rowArr as $rKey => $row) {
800 if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
801 $c++;
802 $editUidList .= $row['uid'] . ',';
803 $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
804 // Create row output:
805 $rowOut .= '
806 <tr>
807 <td></td>
808 <td valign="top">' . $this->tt_content_drawHeader($row) . '</td>
809 <td>&nbsp;</td>
810 <td' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . ' valign="top">'
811 . $this->tt_content_drawItem($row, $isRTE) . '</td>
812 </tr>';
813 // If the element was not the last element, add a divider line:
814 if ($c != $numberOfContentElementsInColumn) {
815 $rowOut .= '
816 <tr>
817 <td></td>
818 <td colspan="3"><img'
819 . IconUtility::skinImg($this->backPath, 'gfx/stiblet_medium2.gif', 'width="468" height="1"')
820 . ' class="c-divider" alt="" /></td>
821 </tr>';
822 }
823 } else {
824 unset($rowArr[$rKey]);
825 }
826 }
827 // Add spacer between sections in the vertical list
828 if ($counter) {
829 $out .= '
830 <tr>
831 <td></td>
832 <td colspan="3"><br /><br /><br /><br /></td>
833 </tr>';
834 }
835 // Add section header:
836 $newP = $this->newContentElementOnClick($id, $key, $this->tt_contentConfig['sys_language_uid']);
837 $pasteP = array('colPos' => $key, 'sys_language_uid' => $this->tt_contentConfig['sys_language_uid']);
838 $out .= '
839
840 <!-- Column header: -->
841 <tr>
842 <td></td>
843 <td valign="top" colspan="3">' . $this->tt_content_drawColHeader(
844 BackendUtility::getProcessedValue('tt_content', 'colPos', $key),
845 $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '',
846 $newP,
847 $pasteP
848 ) . $theNewButton . '<br /></td>
849 </tr>';
850 // Finally, add the content from the records in this column:
851 $out .= $rowOut;
852 }
853 // Finally, wrap all table rows in one, big table:
854 $out = '
855 <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode">
856 ' . $out . '
857 </table>';
858 // CSH:
859 $out .= BackendUtility::cshItem($this->descrTable, 'columns_single', $GLOBALS['BACK_PATH']);
860 } else {
861 $out = '<br/><br/>' . $this->getPageLayoutController()->doc->icons(1)
862 . 'Sorry, you cannot view a single language in this localization mode (Default Language Binding is enabled)<br/><br/>';
863 }
864 }
865 // Add the big buttons to page:
866 if ($this->option_showBigButtons) {
867 $bArray = array();
868 if (!$this->getPageLayoutController()->current_sys_language) {
869 if ($this->ext_CALC_PERMS & 2) {
870 $bArray[0] = $this->getPageLayoutController()->doc->t3Button(
871 BackendUtility::editOnClick('&edit[pages][' . $id . ']=edit', $this->backPath, ''),
872 $this->getLanguageService()->getLL('editPageProperties')
873 );
874 }
875 } else {
876 if ($this->doEdit && $this->getBackendUser()->check('tables_modify', 'pages_language_overlay')) {
877 list($languageOverlayRecord) = BackendUtility::getRecordsByField(
878 'pages_language_overlay',
879 'pid',
880 $id,
881 'AND sys_language_uid=' . (int)$this->getPageLayoutController()->current_sys_language
882 );
883 $bArray[0] = $this->getPageLayoutController()->doc->t3Button(
884 BackendUtility::editOnClick('&edit[pages_language_overlay][' . $languageOverlayRecord['uid'] . ']=edit',
885 $this->backPath, ''),
886 $this->getLanguageService()->getLL('editPageProperties_curLang')
887 );
888 }
889 }
890 if ($this->ext_CALC_PERMS & 4 || $this->ext_CALC_PERMS & 2) {
891 $bArray[1] = $this->getPageLayoutController()->doc->t3Button(
892 'window.location.href=\'' . $this->backPath . 'move_el.php?table=pages&uid=' . $id
893 . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';',
894 $this->getLanguageService()->getLL('move_page')
895 );
896 }
897 if ($this->ext_CALC_PERMS & 8) {
898 $bArray[2] = $this->getPageLayoutController()->doc->t3Button(
899 'window.location.href=\'' . $this->backPath . 'db_new.php?id=' . $id
900 . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';',
901 $this->getLanguageService()->getLL('newPage2')
902 );
903 }
904 if ($this->doEdit && $this->ext_function == 1) {
905 $bArray[3] = $this->getPageLayoutController()->doc->t3Button(
906 'window.location.href=\'db_new_content_el.php?id=' . $id
907 . '&sys_language_uid=' . $this->getPageLayoutController()->current_sys_language
908 . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';',
909 $this->getLanguageService()->getLL('newPageContent2')
910 );
911 }
912 $out = '
913 <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons">
914 <tr>
915 <td>' . implode('</td>
916 <td>', $bArray) . '</td>
917 <td>' . BackendUtility::cshItem($this->descrTable, 'button_panel', $GLOBALS['BACK_PATH']) . '</td>
918 </tr>
919 </table>
920 <br />
921 ' . $out;
922 }
923 // Return content:
924 return $out;
925 }
926
927 /**
928 * Get backend layout configuration
929 *
930 * @return array
931 * @deprecated since TYPO3 CMS 6.2, will be removed two versions later
932 */
933 public function getBackendLayoutConfiguration() {
934 GeneralUtility::logDeprecatedFunction();
935 return $this->getBackendLayoutView()->getSelectedBackendLayout($this->id);
936 }
937
938 /**********************************
939 *
940 * Generic listing of items
941 *
942 **********************************/
943 /**
944 * Creates a standard list of elements from a table.
945 *
946 * @param string $table Table name
947 * @param int $id Page id.
948 * @param string $fList Comma list of fields to display
949 * @param bool $icon If TRUE, icon is shown
950 * @param string $addWhere Additional WHERE-clauses.
951 * @return string HTML table
952 */
953 public function makeOrdinaryList($table, $id, $fList, $icon = FALSE, $addWhere = '') {
954 // Initialize
955 $queryParts = $this->makeQueryArray($table, $id, $addWhere);
956 $this->setTotalItems($queryParts);
957 $dbCount = 0;
958 $result = FALSE;
959 // Make query for records if there were any records found in the count operation
960 if ($this->totalItems) {
961 $result = $this->getDatabase()->exec_SELECT_queryArray($queryParts);
962 // Will return FALSE, if $result is invalid
963 $dbCount = $this->getDatabase()->sql_num_rows($result);
964 }
965 // If records were found, render the list
966 if (!$dbCount) {
967 return '';
968 }
969 // Set fields
970 $out = '';
971 $this->fieldArray = GeneralUtility::trimExplode(',', '__cmds__,' . $fList . ',__editIconLink__', TRUE);
972 $theData = array();
973 $theData = $this->headerFields($this->fieldArray, $table, $theData);
974 // Title row
975 $localizedTableTitle = $this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title'], TRUE);
976 $out .= '<tr class="t3-row-header">' . '<td nowrap="nowrap" class="col-icon"></td>'
977 . '<td nowrap="nowrap" colspan="' . (count($theData) - 2) . '"><span class="c-table">'
978 . $localizedTableTitle . '</span> (' . $dbCount . ')</td>' . '<td nowrap="nowrap" class="col-icon"></td>'
979 . '</tr>';
980 // Column's titles
981 if ($this->doEdit) {
982 $theData['__cmds__'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick(
983 '&edit[' . $table . '][' . $this->id . ']=new',
984 $this->backPath
985 )) . '" title="' . $this->getLanguageService()->getLL('new', TRUE) . '">'
986 . IconUtility::getSpriteIcon('actions-document-new') . '</a>';
987 }
988 $out .= $this->addelement(1, '', $theData, ' class="c-headLine"', 15);
989 // Render Items
990 $this->eCounter = $this->firstElementNumber;
991 while ($row = $this->getDatabase()->sql_fetch_assoc($result)) {
992 BackendUtility::workspaceOL($table, $row);
993 if (is_array($row)) {
994 list($flag, $code) = $this->fwd_rwd_nav();
995 $out .= $code;
996 if ($flag) {
997 $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
998 $Nrow = array();
999 // Setting icons links
1000 if ($icon) {
1001 $Nrow['__cmds__'] = $this->getIcon($table, $row);
1002 }
1003 // Get values:
1004 $Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow);
1005 // Attach edit icon
1006 if ($this->doEdit) {
1007 $Nrow['__editIconLink__'] = '<a href="#" onclick="' . htmlspecialchars(
1008 BackendUtility::editOnClick($params, $this->backPath))
1009 . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '">'
1010 . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
1011 } else {
1012 $Nrow['__editIconLink__'] = $this->noEditIcon();
1013 }
1014 $out .= $this->addelement(1, '', $Nrow, 'class="db_list_normal"');
1015 }
1016 $this->eCounter++;
1017 }
1018 }
1019 // Wrap it all in a table:
1020 $out = '
1021 <!--
1022 Standard list of table "' . $table . '"
1023 -->
1024 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
1025 ' . $out . '
1026 </table>';
1027 return $out;
1028 }
1029
1030 /**
1031 * Adds content to all data fields in $out array
1032 *
1033 * Each field name in $fieldArr has a special feature which is that the field name can be specified as more field names.
1034 * Eg. "field1,field2;field3".
1035 * Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.
1036 *
1037 * @param array $fieldArr Array of fields to display
1038 * @param string $table Table name
1039 * @param array $row Record array
1040 * @param array $out Array to which the data is added
1041 * @return array $out array returned after processing.
1042 * @see makeOrdinaryList()
1043 */
1044 public function dataFields($fieldArr, $table, $row, $out = array()) {
1045 // Check table validity
1046 if (!isset($GLOBALS['TCA'][$table])) {
1047 return $out;
1048 }
1049
1050 $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
1051 // Traverse fields
1052 foreach ($fieldArr as $fieldName) {
1053 if ($GLOBALS['TCA'][$table]['columns'][$fieldName]) {
1054 // Each field has its own cell (if configured in TCA)
1055 // If the column is a thumbnail column:
1056 if ($fieldName == $thumbsCol) {
1057 $out[$fieldName] = $this->thumbCode($row, $table, $fieldName);
1058 } else {
1059 // ... otherwise just render the output:
1060 $out[$fieldName] = nl2br(htmlspecialchars(trim(GeneralUtility::fixed_lgd_cs(
1061 BackendUtility::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']),
1062 250)
1063 )));
1064 }
1065 } else {
1066 // Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode
1067 // the field name with ";" and check each value there as a TCA configured field)
1068 $theFields = explode(';', $fieldName);
1069 // Traverse fields, separated by ";" (displayed in a single cell).
1070 foreach ($theFields as $fName2) {
1071 if ($GLOBALS['TCA'][$table]['columns'][$fName2]) {
1072 $out[$fieldName] .= '<strong>' . $this->getLanguageService()->sL(
1073 $GLOBALS['TCA'][$table]['columns'][$fName2]['label'],
1074 TRUE
1075 ) . '</strong>' . '&nbsp;&nbsp;' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(
1076 BackendUtility::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']),
1077 25
1078 )) . '<br />';
1079 }
1080 }
1081 }
1082 // If no value, add a nbsp.
1083 if (!$out[$fieldName]) {
1084 $out[$fieldName] = '&nbsp;';
1085 }
1086 // Wrap in dimmed-span tags if record is "disabled"
1087 if ($this->isDisabled($table, $row)) {
1088 $out[$fieldName] = $this->getDocumentTemplate()->dfw($out[$fieldName]);
1089 }
1090 }
1091 return $out;
1092 }
1093
1094 /**
1095 * Header fields made for the listing of records
1096 *
1097 * @param array $fieldArr Field names
1098 * @param string $table The table name
1099 * @param array $out Array to which the headers are added.
1100 * @return array $out returned after addition of the header fields.
1101 * @see makeOrdinaryList()
1102 */
1103 public function headerFields($fieldArr, $table, $out = array()) {
1104 foreach ($fieldArr as $fieldName) {
1105 $ll = $this->getLanguageService()->sL($GLOBALS['TCA'][$table]['columns'][$fieldName]['label'], TRUE);
1106 $out[$fieldName] = $ll ? $ll : '&nbsp;';
1107 }
1108 return $out;
1109 }
1110
1111 /**
1112 * Gets content records per column.
1113 * This is required for correct workspace overlays.
1114 *
1115 * @param string $table UNUSED (will always be queried from tt_content)
1116 * @param int $id Page Id to be used (not used at all, but part of the API, see $this->pidSelect)
1117 * @param array $columns colPos values to be considered to be shown
1118 * @param string $additionalWhereClause Additional where clause for database select
1119 * @return array Associative array for each column (colPos)
1120 */
1121 protected function getContentRecordsPerColumn($table, $id, array $columns, $additionalWhereClause = '') {
1122 $columns = array_map('intval', $columns);
1123 $contentRecordsPerColumn = array_fill_keys($columns, array());
1124
1125 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos IN (' . implode(',', $columns) . ')' . $additionalWhereClause);
1126 $result = $this->getDatabase()->exec_SELECT_queryArray($queryParts);
1127 // Traverse any selected elements and render their display code:
1128 $rowArr = $this->getResult($result);
1129
1130 foreach ($rowArr as $record) {
1131 $columnValue = $record['colPos'];
1132 $contentRecordsPerColumn[$columnValue][] = $record;
1133 }
1134
1135 return $contentRecordsPerColumn;
1136 }
1137
1138 /**********************************
1139 *
1140 * Additional functions; Pages
1141 *
1142 **********************************/
1143 /**
1144 * Adds pages-rows to an array, selecting recursively in the page tree.
1145 *
1146 * @param array $theRows Array which will accumulate page rows
1147 * @param int $pid Pid to select from
1148 * @param string $qWhere Query-where clause
1149 * @param string $treeIcons Prefixed icon code.
1150 * @param int $depth Depth (decreasing)
1151 * @return array $theRows, but with added rows.
1152 */
1153 public function pages_getTree($theRows, $pid, $qWhere, $treeIcons, $depth) {
1154 $depth--;
1155 if ($depth >= 0) {
1156 $res = $this->getDatabase()->exec_SELECTquery('*', 'pages', 'pid=' . (int)$pid . $qWhere, '', 'sorting');
1157 $c = 0;
1158 $rc = $this->getDatabase()->sql_num_rows($res);
1159 while ($row = $this->getDatabase()->sql_fetch_assoc($res)) {
1160 BackendUtility::workspaceOL('pages', $row);
1161 if (is_array($row)) {
1162 $c++;
1163 $row['treeIcons'] = $treeIcons . '<img' . IconUtility::skinImg(
1164 $this->backPath,
1165 'gfx/ol/join' . ($rc == $c ? 'bottom' : '') . '.gif',
1166 'width="18" height="16"'
1167 ) . ' alt="" />';
1168 $theRows[] = $row;
1169 // Get the branch
1170 $spaceOutIcons = '<img' . IconUtility::skinImg(
1171 $this->backPath,
1172 'gfx/ol/' . ($rc == $c ? 'blank.gif' : 'line.gif'),
1173 'width="18" height="16"'
1174 ) . ' alt="" />';
1175 $theRows = $this->pages_getTree($theRows, $row['uid'], $qWhere, $treeIcons . $spaceOutIcons, $row['php_tree_stop'] ? 0 : $depth);
1176 }
1177 }
1178 } else {
1179 $count = $this->getDatabase()->exec_SELECTcountRows('uid', 'pages', 'pid=' . (int)$pid . $qWhere);
1180 if ($count) {
1181 $this->plusPages[$pid] = $count;
1182 }
1183 }
1184 return $theRows;
1185 }
1186
1187 /**
1188 * Adds a list item for the pages-rendering
1189 *
1190 * @param array $row Record array
1191 * @param array $fieldArr Field list
1192 * @return string HTML for the item
1193 */
1194 public function pages_drawItem($row, $fieldArr) {
1195 // Initialization
1196 $theIcon = $this->getIcon('pages', $row);
1197 // Preparing and getting the data-array
1198 $theData = array();
1199 foreach ($fieldArr as $field) {
1200 switch ($field) {
1201 case 'title':
1202 $red = $this->plusPages[$row['uid']] ? '<font color="red"><strong>+&nbsp;</strong></font>' : '';
1203 $pTitle = htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field], 20));
1204 if ($red) {
1205 $pTitle = '<a href="'
1206 . htmlspecialchars($this->script . ((strpos($this->script, '?') !== FALSE) ? '&' : '?')
1207 . 'id=' . $row['uid']) . '">' . $pTitle . '</a>';
1208 }
1209 $theData[$field] = $row['treeIcons'] . $theIcon . $red . $pTitle . '&nbsp;&nbsp;';
1210 break;
1211 case 'php_tree_stop':
1212 // Intended fall through
1213 case 'TSconfig':
1214 $theData[$field] = $row[$field] ? '&nbsp;<strong>x</strong>' : '&nbsp;';
1215 break;
1216 case 'uid':
1217 if ($this->getBackendUser()->doesUserHaveAccess($row, 2)) {
1218 $params = '&edit[pages][' . $row['uid'] . ']=edit';
1219 $eI = '<a href="#" onclick="'
1220 . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, ''))
1221 . '" title="' . $this->getLanguageService()->getLL('editThisPage', TRUE) . '">'
1222 . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
1223 } else {
1224 $eI = '';
1225 }
1226 $theData[$field] = '<span align="right">' . $row['uid'] . $eI . '</span>';
1227 break;
1228 default:
1229 if (substr($field, 0, 6) == 'table_') {
1230 $f2 = substr($field, 6);
1231 if ($GLOBALS['TCA'][$f2]) {
1232 $c = $this->numberOfRecords($f2, $row['uid']);
1233 $theData[$field] = '&nbsp;&nbsp;' . ($c ? $c : '');
1234 }
1235 } else {
1236 $theData[$field] = '&nbsp;&nbsp;'
1237 . htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field]));
1238 }
1239 }
1240 }
1241 $this->addElement_tdParams['title'] = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : '';
1242 return $this->addelement(1, '', $theData);
1243 }
1244
1245 /**********************************
1246 *
1247 * Additional functions; Content Elements
1248 *
1249 **********************************/
1250 /**
1251 * Draw header for a content element column:
1252 *
1253 * @param string $colName Column name
1254 * @param string $editParams Edit params (Syntax: &edit[...] for alt_doc.php)
1255 * @param string $newParams New element params (Syntax: &edit[...] for alt_doc.php) OBSOLETE
1256 * @param array|NULL $pasteParams Paste element params (i.e. array(colPos => 1, sys_language_uid => 2))
1257 * @return string HTML table
1258 */
1259 public function tt_content_drawColHeader($colName, $editParams, $newParams, array $pasteParams = NULL) {
1260 $iconsArr = array();
1261 // Create command links:
1262 if ($this->tt_contentConfig['showCommands']) {
1263 // Edit whole of column:
1264 if ($editParams) {
1265 $iconsArr['edit'] = '<a href="#" onclick="'
1266 . htmlspecialchars(BackendUtility::editOnClick($editParams, $this->backPath)) . '" title="'
1267 . $this->getLanguageService()->getLL('editColumn', TRUE) . '">'
1268 . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
1269 }
1270 if ($pasteParams) {
1271 $elFromTable = $this->clipboard->elFromTable('tt_content');
1272 if (count($elFromTable)) {
1273 $iconsArr['paste'] = '<a href="'
1274 . htmlspecialchars($this->clipboard->pasteUrl('tt_content', $this->id, TRUE, $pasteParams))
1275 . '" onclick="' . htmlspecialchars(('return '
1276 . $this->clipboard->confirmMsg('pages', $this->pageRecord, 'into', $elFromTable, $colName)))
1277 . '" title="' . $this->getLanguageService()->getLL('clip_paste', TRUE) . '">'
1278 . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
1279 }
1280 }
1281 }
1282 $icons = '';
1283 if (count($iconsArr)) {
1284 $icons = '<div class="t3-page-colHeader-icons">' . implode('', $iconsArr) . '</div>';
1285 }
1286 // Create header row:
1287 $out = '<div class="t3-page-colHeader t3-row-header">
1288 ' . $icons . '
1289 <div class="t3-page-colHeader-label">' . htmlspecialchars($colName) . '</div>
1290 </div>';
1291 return $out;
1292 }
1293
1294 /**
1295 * Draw the footer for a single tt_content element
1296 *
1297 * @param array $row Record array
1298 * @return string HTML of the footer
1299 */
1300 protected function tt_content_drawFooter(array $row) {
1301 $content = '';
1302 // Get processed values:
1303 $info = array();
1304 $this->getProcessedValue('tt_content', 'starttime,endtime,fe_group,spaceBefore,spaceAfter', $row, $info);
1305 // Display info from records fields:
1306 if (count($info)) {
1307 $content = '<div class="t3-page-ce-info">
1308 ' . implode('<br />', $info) . '
1309 </div>';
1310 }
1311 // Wrap it
1312 if (!empty($content)) {
1313 $content = '<div class="t3-page-ce-footer">' . $content . '</div>';
1314 }
1315 return $content;
1316 }
1317
1318 /**
1319 * Draw the header for a single tt_content element
1320 *
1321 * @param array $row Record array
1322 * @param int $space Amount of pixel space above the header. UNUSED
1323 * @param bool $disableMoveAndNewButtons If set the buttons for creating new elements and moving up and down are not shown.
1324 * @param bool $langMode If set, we are in language mode and flags will be shown for languages
1325 * @param bool $dragDropEnabled If set the move button must be hidden
1326 * @return string HTML table with the record header.
1327 */
1328 public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = FALSE, $langMode = FALSE, $dragDropEnabled = FALSE) {
1329 $out = '';
1330 // If show info is set...;
1331 if ($this->tt_contentConfig['showInfo'] && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
1332 // Render control panel for the element:
1333 if ($this->tt_contentConfig['showCommands'] && $this->doEdit) {
1334 // Edit content element:
1335 $params = '&edit[tt_content][' . $this->tt_contentData['nextThree'][$row['uid']] . ']=edit';
1336 $out .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick(
1337 $params,
1338 $this->backPath,
1339 GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid']
1340 )) . '" title="' . htmlspecialchars($this->nextThree > 1
1341 ? sprintf($this->getLanguageService()->getLL('nextThree'), $this->nextThree)
1342 : $this->getLanguageService()->getLL('edit'))
1343 . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
1344 // Hide element:
1345 $hiddenField = $GLOBALS['TCA']['tt_content']['ctrl']['enablecolumns']['disabled'];
1346 if (
1347 $hiddenField && $GLOBALS['TCA']['tt_content']['columns'][$hiddenField]
1348 && (!$GLOBALS['TCA']['tt_content']['columns'][$hiddenField]['exclude']
1349 || $this->getBackendUser()->check('non_exclude_fields', 'tt_content:' . $hiddenField))
1350 ) {
1351 if ($row[$hiddenField]) {
1352 $value = 0;
1353 $label = 'unHide';
1354 } else {
1355 $value = 1;
1356 $label = 'hide';
1357 }
1358 $params = '&data[tt_content][' . ($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid'])
1359 . '][' . $hiddenField . ']=' . $value;
1360 $out .= '<a href="' . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params))
1361 . '" title="' . $this->getLanguageService()->getLL($label, TRUE) . '">'
1362 . IconUtility::getSpriteIcon('actions-edit-' . strtolower($label)) . '</a>';
1363 }
1364 // Delete
1365 $params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
1366 $confirm = GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('deleteWarning')
1367 . BackendUtility::translationCount('tt_content', $row['uid'], (' '
1368 . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord')))
1369 );
1370 $out .= '<a href="' . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params))
1371 . '" onclick="' . htmlspecialchars(('return confirm(' . $confirm . ');')) . '" title="'
1372 . $this->getLanguageService()->getLL('deleteItem', TRUE) . '">'
1373 . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
1374 if (!$disableMoveAndNewButtons) {
1375 $moveButtonContent = '';
1376 $displayMoveButtons = FALSE;
1377 // Move element up:
1378 if ($this->tt_contentData['prev'][$row['uid']]) {
1379 $params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData['prev'][$row['uid']];
1380 $moveButtonContent .= '<a href="'
1381 . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params))
1382 . '" title="' . $this->getLanguageService()->getLL('moveUp', TRUE) . '">'
1383 . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
1384 if (!$dragDropEnabled) {
1385 $displayMoveButtons = TRUE;
1386 }
1387 } else {
1388 $moveButtonContent .= IconUtility::getSpriteIcon('empty-empty');
1389 }
1390 // Move element down:
1391 if ($this->tt_contentData['next'][$row['uid']]) {
1392 $params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData['next'][$row['uid']];
1393 $moveButtonContent .= '<a href="'
1394 . htmlspecialchars($this->getPageLayoutController()->doc->issueCommand($params))
1395 . '" title="' . $this->getLanguageService()->getLL('moveDown', TRUE) . '">'
1396 . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
1397 if (!$dragDropEnabled) {
1398 $displayMoveButtons = TRUE;
1399 }
1400 } else {
1401 $moveButtonContent .= IconUtility::getSpriteIcon('empty-empty');
1402 }
1403 if ($displayMoveButtons) {
1404 $out .= '<span class="t3-page-ce-icons-move">' . $moveButtonContent . '</span>';
1405 }
1406 }
1407 }
1408 }
1409 $additionalIcons = array();
1410 $additionalIcons[] = $this->getIcon('tt_content', $row) . ' ';
1411 $additionalIcons[] = $langMode ? $this->languageFlag($row['sys_language_uid'], FALSE) : '';
1412 // Get record locking status:
1413 if ($lockInfo = BackendUtility::isRecordLocked('tt_content', $row['uid'])) {
1414 $additionalIcons[] = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg'])
1415 . ');return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">'
1416 . IconUtility::getSpriteIcon('status-warning-in-use') . '</a>';
1417 }
1418 // Call stats information hook
1419 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
1420 $_params = array('tt_content', $row['uid'], &$row);
1421 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
1422 $additionalIcons[] = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1423 }
1424 }
1425 // Wrap the whole header
1426 // NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
1427 return '<h4 class="t3-page-ce-header">
1428 <div class="t3-row-header">
1429 <span class="ce-icons-left">' . implode('', $additionalIcons) . '</span>
1430 <span class="ce-icons">
1431 ' . $out . '
1432 </span></div>
1433 </h4>
1434 <div class="t3-page-ce-body">';
1435 }
1436
1437 /**
1438 * Draws the preview content for a content element
1439 *
1440 * @param string $row Content element
1441 * @param bool $isRTE Set if the RTE link can be created.
1442 * @return string HTML
1443 * @throws \UnexpectedValueException
1444 */
1445 public function tt_content_drawItem($row, $isRTE = FALSE) {
1446 $out = '';
1447 $outHeader = '';
1448 // Make header:
1449 if ($row['header']) {
1450 $infoArr = array();
1451 $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
1452 $hiddenHeaderNote = '';
1453 // If header layout is set to 'hidden', display an accordant note:
1454 if ($row['header_layout'] == 100) {
1455 $hiddenHeaderNote = ' <em>[' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.hidden', TRUE) . ']</em>';
1456 }
1457 $outHeader = $row['date']
1458 ? htmlspecialchars($this->itemLabels['date'] . ' ' . BackendUtility::date($row['date'])) . '<br />'
1459 : '';
1460 $outHeader .= '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row)
1461 . $hiddenHeaderNote . '</strong><br />';
1462 }
1463 // Make content:
1464 $infoArr = array();
1465 $drawItem = TRUE;
1466 // Hook: Render an own preview of a record
1467 $drawItemHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
1468 if (is_array($drawItemHooks)) {
1469 foreach ($drawItemHooks as $hookClass) {
1470 $hookObject = GeneralUtility::getUserObj($hookClass);
1471 if (!$hookObject instanceof PageLayoutViewDrawItemHookInterface) {
1472 throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\View\\PageLayoutViewDrawItemHookInterface', 1218547409);
1473 }
1474 $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
1475 }
1476 }
1477 // Draw preview of the item depending on its CType (if not disabled by previous hook):
1478 if ($drawItem) {
1479 switch ($row['CType']) {
1480 case 'header':
1481 if ($row['subheader']) {
1482 $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
1483 }
1484 break;
1485 case 'text':
1486
1487 case 'textpic':
1488
1489 case 'image':
1490 if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
1491 if ($row['bodytext']) {
1492 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1493 }
1494 }
1495 if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
1496 if ($row['image']) {
1497 $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
1498 if ($row['imagecaption']) {
1499 $out .= $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
1500 }
1501 }
1502 }
1503 break;
1504 case 'bullets':
1505
1506 case 'table':
1507
1508 case 'mailform':
1509 if ($row['bodytext']) {
1510 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1511 }
1512 break;
1513 case 'uploads':
1514 if ($row['media']) {
1515 $out .= $this->thumbCode($row, 'tt_content', 'media') . '<br />';
1516 }
1517 break;
1518 case 'multimedia':
1519 if ($row['multimedia']) {
1520 $out .= $this->renderText($row['multimedia']) . '<br />';
1521 $out .= $this->renderText($row['parameters']) . '<br />';
1522 }
1523 break;
1524 case 'menu':
1525 if ($row['pages']) {
1526 $out .= $this->linkEditContent($row['pages'], $row) . '<br />';
1527 }
1528 break;
1529 case 'shortcut':
1530 if (!empty($row['records'])) {
1531 $shortcutContent = array();
1532 $recordList = explode(',', $row['records']);
1533 foreach ($recordList as $recordIdentifier) {
1534 $split = BackendUtility::splitTable_Uid($recordIdentifier);
1535 $tableName = empty($split[0]) ? 'tt_content' : $split[0];
1536 $shortcutRecord = BackendUtility::getRecord($tableName, $split[1]);
1537 if (is_array($shortcutRecord)) {
1538 $icon = IconUtility::getSpriteIconForRecord($tableName, $shortcutRecord);
1539 $onClick = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon($icon, $tableName,
1540 $shortcutRecord['uid'], 1, '', '+copy,info,edit,view', TRUE);
1541 $shortcutContent[] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $icon . '</a>'
1542 . htmlspecialchars(BackendUtility::getRecordTitle($tableName, $shortcutRecord));
1543 }
1544 }
1545 $out .= implode('<br />', $shortcutContent) . '<br />';
1546 }
1547 break;
1548 case 'list':
1549 $hookArr = array();
1550 $hookOut = '';
1551 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) {
1552 $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']];
1553 } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) {
1554 $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'];
1555 }
1556 if (count($hookArr) > 0) {
1557 $_params = array('pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr);
1558 foreach ($hookArr as $_funcRef) {
1559 $hookOut .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1560 }
1561 }
1562 if ((string)$hookOut !== '') {
1563 $out .= $hookOut;
1564 } elseif (!empty($row['list_type'])) {
1565 $label = BackendUtility::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']);
1566 if (!empty($label)) {
1567 $out .= '<strong>' . $this->getLanguageService()->sL($label, TRUE) . '</strong><br />';
1568 } else {
1569 $message = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'), $row['list_type']);
1570 $out .= GeneralUtility::makeInstance(
1571 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1572 htmlspecialchars($message),
1573 '',
1574 FlashMessage::WARNING
1575 )->render();
1576 }
1577 } elseif (!empty($row['select_key'])) {
1578 $out .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), TRUE)
1579 . ' ' . $row['select_key'] . '<br />';
1580 } else {
1581 $out .= '<strong>' . $this->getLanguageService()->getLL('noPluginSelected') . '</strong>';
1582 }
1583 $out .= $this->getLanguageService()->sL(
1584 BackendUtility::getLabelFromItemlist('tt_content', 'pages', $row['pages']),
1585 TRUE
1586 ) . '<br />';
1587 break;
1588 case 'script':
1589 $out .= $this->getLanguageService()->sL(BackendUtility::getItemLabel('tt_content', 'select_key'), TRUE)
1590 . ' ' . $row['select_key'] . '<br />';
1591 $out .= '<br />' . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1592 $out .= '<br />' . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
1593 break;
1594 default:
1595 $contentType = $this->CType_labels[$row['CType']];
1596
1597 if (isset($contentType)) {
1598 $out .= '<strong>' . htmlspecialchars($contentType) . '</strong><br />';
1599 if ($row['bodytext']) {
1600 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1601 }
1602 if ($row['image']) {
1603 $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
1604 }
1605 } else {
1606 $message = sprintf(
1607 $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noMatchingValue'),
1608 $row['CType']
1609 );
1610 $out .= GeneralUtility::makeInstance(
1611 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
1612 htmlspecialchars($message),
1613 '',
1614 FlashMessage::WARNING
1615 )->render();
1616 }
1617 }
1618 }
1619 // Wrap span-tags:
1620 $out = '
1621 <span class="exampleContent">' . $out . '</span>';
1622 // Add header:
1623 $out = $outHeader . $out;
1624 // Add RTE button:
1625 if ($isRTE) {
1626 $out .= $this->linkRTEbutton($row);
1627 }
1628 // Return values:
1629 if ($this->isDisabled('tt_content', $row)) {
1630 return $this->getDocumentTemplate()->dfw($out);
1631 } else {
1632 return $out;
1633 }
1634 }
1635
1636 /**
1637 * Filters out all tt_content uids which are already translated so only non-translated uids is left.
1638 * Selects across columns, but within in the same PID. Columns are expect to be the same
1639 * for translations and original but this may be a conceptual error (?)
1640 *
1641 * @param array $defLanguageCount Numeric array with uids of tt_content elements in the default language
1642 * @param int $id Page pid
1643 * @param int $lP Sys language UID
1644 * @return array Modified $defLanguageCount
1645 */
1646 public function getNonTranslatedTTcontentUids($defLanguageCount, $id, $lP) {
1647 if ($lP && count($defLanguageCount)) {
1648 // Select all translations here:
1649 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND sys_language_uid=' . (int)$lP
1650 . ' AND l18n_parent IN (' . implode(',', $defLanguageCount) . ')');
1651 $result = $this->getDatabase()->exec_SELECT_queryArray($queryParts);
1652 // Flip uids:
1653 $defLanguageCount = array_flip($defLanguageCount);
1654 // Traverse any selected elements and unset original UID if any:
1655 $rowArr = $this->getResult($result);
1656 foreach ($rowArr as $row) {
1657 unset($defLanguageCount[$row['l18n_parent']]);
1658 }
1659 // Flip again:
1660 $defLanguageCount = array_keys($defLanguageCount);
1661 }
1662 return $defLanguageCount;
1663 }
1664
1665 /**
1666 * Creates button which is used to create copies of records..
1667 *
1668 * @param array $defLanguageCount Numeric array with uids of tt_content elements in the default language
1669 * @param int $lP Sys language UID
1670 * @return string "Copy languages" button, if available.
1671 */
1672 public function newLanguageButton($defLanguageCount, $lP) {
1673 if (!$this->doEdit || count($defLanguageCount) === 0 || !$lP) {
1674 return '';
1675 }
1676 $params = '';
1677 foreach ($defLanguageCount as $uidVal) {
1678 $params .= '&cmd[tt_content][' . $uidVal . '][localize]=' . $lP;
1679 }
1680 // Copy for language:
1681 $onClick = 'window.location.href=\'' . $this->getPageLayoutController()->doc->issueCommand($params) . '\'; return false;';
1682 $theNewButton = '<div class="t3-page-lang-copyce">' .
1683 $this->getPageLayoutController()->doc->t3Button(
1684 $onClick,
1685 $this->getLanguageService()->getLL('newPageContent_copyForLang') . ' [' . count($defLanguageCount) . ']'
1686 ) . '</div>';
1687 return $theNewButton;
1688 }
1689
1690 /**
1691 * Creates onclick-attribute content for a new content element
1692 *
1693 * @param int $id Page id where to create the element.
1694 * @param int $colPos Preset: Column position value
1695 * @param int $sys_language Preset: Sys langauge value
1696 * @return string String for onclick attribute.
1697 * @see getTable_tt_content()
1698 */
1699 public function newContentElementOnClick($id, $colPos, $sys_language) {
1700 if ($this->option_newWizard) {
1701 $onClick = 'window.location.href=\'db_new_content_el.php?id=' . $id . '&colPos=' . $colPos
1702 . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id
1703 . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\';';
1704 } else {
1705 $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]='
1706 . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language, $this->backPath);
1707 }
1708 return $onClick;
1709 }
1710
1711 /**
1712 * Will create a link on the input string and possibly a big button after the string which links to editing in the RTE.
1713 * Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
1714 *
1715 * @param string $str String to link. Must be prepared for HTML output.
1716 * @param array $row The row.
1717 * @return string If the whole thing was editable ($this->doEdit) $str is return with link around. Otherwise just $str.
1718 * @see getTable_tt_content()
1719 */
1720 public function linkEditContent($str, $row) {
1721 $addButton = '';
1722 $onClick = '';
1723 if ($this->doEdit && $this->getBackendUser()->recordEditAccessInternals('tt_content', $row)) {
1724 // Setting onclick action for content link:
1725 $onClick = BackendUtility::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit', $this->backPath);
1726 }
1727 // Return link
1728 return $onClick ? '<a href="#" onclick="' . htmlspecialchars($onClick)
1729 . '" title="' . $this->getLanguageService()->getLL('edit', TRUE) . '">' . $str . '</a>' . $addButton : $str;
1730 }
1731
1732 /**
1733 * Adds a button to edit the row in RTE wizard
1734 *
1735 * @param array $row The row of tt_content element
1736 * @return string Button to click if you want to edit in RTE wizard.
1737 */
1738 public function linkRTEbutton($row) {
1739 $params = array();
1740 $params['table'] = 'tt_content';
1741 $params['uid'] = $row['uid'];
1742 $params['pid'] = $row['pid'];
1743 $params['field'] = 'bodytext';
1744 $params['returnUrl'] = GeneralUtility::linkThisScript();
1745 $RTEonClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('wizard_rte', array('P' => $params))) . ';return false;';
1746 $addButton = $this->option_showBigButtons && $this->doEdit
1747 ? $this->getPageLayoutController()->doc->t3Button($RTEonClick, $this->getLanguageService()->getLL('editInRTE'))
1748 : '';
1749 return $addButton;
1750 }
1751
1752 /**
1753 * Make selector box for creating new translation in a language
1754 * Displays only languages which are not yet present for the current page and
1755 * that are not disabled with page TS.
1756 *
1757 * @param int $id Page id for which to create a new language (pages_language_overlay record)
1758 * @return string <select> HTML element (if there were items for the box anyways...)
1759 * @see getTable_tt_content()
1760 */
1761 public function languageSelector($id) {
1762 if ($this->getBackendUser()->check('tables_modify', 'pages_language_overlay')) {
1763 // First, select all
1764 $res = $this->getPageLayoutController()->exec_languageQuery(0);
1765 $langSelItems = array();
1766 $langSelItems[0] = '
1767 <option value="0"></option>';
1768 while ($row = $this->getDatabase()->sql_fetch_assoc($res)) {
1769 if ($this->getBackendUser()->checkLanguageAccess($row['uid'])) {
1770 $langSelItems[$row['uid']] = '
1771 <option value="' . $row['uid'] . '">' . htmlspecialchars($row['title']) . '</option>';
1772 }
1773 }
1774 // Then, subtract the languages which are already on the page:
1775 $res = $this->getPageLayoutController()->exec_languageQuery($id);
1776 while ($row = $this->getDatabase()->sql_fetch_assoc($res)) {
1777 unset($langSelItems[$row['uid']]);
1778 }
1779 // Remove disallowed languages
1780 if (count($langSelItems) > 1
1781 && !$this->getBackendUser()->user['admin']
1782 && strlen($this->getBackendUser()->groupData['allowed_languages'])
1783 ) {
1784 $allowed_languages = array_flip(explode(',', $this->getBackendUser()->groupData['allowed_languages']));
1785 if (count($allowed_languages)) {
1786 foreach ($langSelItems as $key => $value) {
1787 if (!isset($allowed_languages[$key]) && $key != 0) {
1788 unset($langSelItems[$key]);
1789 }
1790 }
1791 }
1792 }
1793 // Remove disabled languages
1794 $modSharedTSconfig = BackendUtility::getModTSconfig($id, 'mod.SHARED');
1795 $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages'])
1796 ? GeneralUtility::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], TRUE)
1797 : array();
1798 if (count($langSelItems) && count($disableLanguages)) {
1799 foreach ($disableLanguages as $language) {
1800 if ($language != 0 && isset($langSelItems[$language])) {
1801 unset($langSelItems[$language]);
1802 }
1803 }
1804 }
1805 // If any languages are left, make selector:
1806 if (count($langSelItems) > 1) {
1807 $onChangeContent = 'window.location.href=\'' . $this->backPath . 'alt_doc.php?&edit[pages_language_overlay]['
1808 . $id . ']=new&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageRecord['doktype']
1809 . '&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value+\'&returnUrl='
1810 . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')) . '\'';
1811 return $this->getLanguageService()->getLL('new_language', TRUE)
1812 . ': <select name="createNewLanguage" onchange="' . htmlspecialchars($onChangeContent) . '">
1813 ' . implode('', $langSelItems) . '
1814 </select><br /><br />';
1815 }
1816 }
1817 return '';
1818 }
1819
1820 /**
1821 * Traverse the result pointer given, adding each record to array and setting some internal values at the same time.
1822 *
1823 * @param bool|\mysqli_result|object $result MySQLi result object / DBAL object
1824 * @param string $table Table name defaulting to tt_content
1825 * @return array The selected rows returned in this array.
1826 */
1827 public function getResult($result, $table = 'tt_content') {
1828 $output = array();
1829 // Traverse the result:
1830 while ($row = $this->getDatabase()->sql_fetch_assoc($result)) {
1831 BackendUtility::workspaceOL($table, $row, -99, TRUE);
1832 if ($row) {
1833 // Add the row to the array:
1834 $output[] = $row;
1835 }
1836 }
1837 $this->generateTtContentDataArray($output);
1838 // Return selected records
1839 return $output;
1840 }
1841
1842 /********************************
1843 *
1844 * Various helper functions
1845 *
1846 ********************************/
1847
1848 /**
1849 * Initializes the clipboard for generating paste links
1850 *
1851 * @return void
1852 *
1853 * @see \TYPO3\CMS\Recordlist\RecordList::main()
1854 * @see \TYPO3\CMS\Backend\Controller\ClickMenuController::main()
1855 * @see \TYPO3\CMS\Filelist\Controller\FileListController::main()
1856 */
1857 protected function initializeClipboard() {
1858 // Start clipboard
1859 $this->clipboard = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
1860
1861 // Initialize - reads the clipboard content from the user session
1862 $this->clipboard->initializeClipboard();
1863
1864 // This locks the clipboard to the Normal for this request.
1865 $this->clipboard->lockToNormal();
1866
1867 // Clean up pad
1868 $this->clipboard->cleanCurrent();
1869
1870 // Save the clipboard content
1871 $this->clipboard->endClipboard();
1872 }
1873
1874 /**
1875 * Generates the data for previous and next elements which is needed for movements.
1876 *
1877 * @param array $rowArray
1878 * @return void
1879 */
1880 protected function generateTtContentDataArray(array $rowArray) {
1881 if (empty($this->tt_contentData)) {
1882 $this->tt_contentData = array(
1883 'nextThree' => array(),
1884 'next' => array(),
1885 'prev' => array(),
1886 );
1887 }
1888 foreach ($rowArray as $key => $value) {
1889 // Create the list of the next three ids (for editing links...)
1890 for ($i = 0; $i < $this->nextThree; $i++) {
1891 if (isset($rowArray[$key - $i])
1892 && !GeneralUtility::inList($this->tt_contentData['nextThree'][$rowArray[$key - $i]['uid']], $value['uid'])
1893 ) {
1894 $this->tt_contentData['nextThree'][$rowArray[$key - $i]['uid']] .= $value['uid'] . ',';
1895 }
1896 }
1897
1898 // Create information for next and previous content elements
1899 if (isset($rowArray[$key - 1])) {
1900 if (isset($rowArray[$key - 2])) {
1901 $this->tt_contentData['prev'][$value['uid']] = -$rowArray[$key - 2]['uid'];
1902 } else {
1903 $this->tt_contentData['prev'][$value['uid']] = $value['pid'];
1904 }
1905 $this->tt_contentData['next'][$rowArray[$key - 1]['uid']] = -$value['uid'];
1906 }
1907 }
1908 }
1909
1910 /**
1911 * Counts and returns the number of records on the page with $pid
1912 *
1913 * @param string $table Table name
1914 * @param int $pid Page id
1915 * @return int Number of records.
1916 */
1917 public function numberOfRecords($table, $pid) {
1918 $count = 0;
1919 if ($GLOBALS['TCA'][$table]) {
1920 $where = 'pid=' . (int)$pid . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table);
1921 $count = $this->getDatabase()->exec_SELECTcountRows('uid', $table, $where);
1922 }
1923 return (int)$count;
1924 }
1925
1926 /**
1927 * Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping etc.
1928 *
1929 * @param string $input Input string
1930 * @return string Output string
1931 */
1932 public function renderText($input) {
1933 $input = strip_tags($input);
1934 $input = GeneralUtility::fixed_lgd_cs($input, 1500);
1935 return nl2br(htmlspecialchars(trim($input), ENT_QUOTES, 'UTF-8', FALSE));
1936 }
1937
1938 /**
1939 * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu.
1940 *
1941 * @param string $table Table name
1942 * @param array $row Record array
1943 * @return string HTML for the icon
1944 */
1945 public function getIcon($table, $row) {
1946 // Initialization
1947 $altText = BackendUtility::getRecordIconAltText($row, $table);
1948 $icon = IconUtility::getSpriteIconForRecord($table, $row, array('title' => $altText));
1949 $this->counter++;
1950 // The icon with link
1951 if ($this->getBackendUser()->recordEditAccessInternals($table, $row)) {
1952 $icon = $this->getPageLayoutController()->doc->wrapClickMenuOnIcon($icon, $table, $row['uid']);
1953 }
1954 return $icon;
1955 }
1956
1957 /**
1958 * Creates processed values for all field names in $fieldList based on values from $row array.
1959 * The result is 'returned' through $info which is passed as a reference
1960 *
1961 * @param string $table Table name
1962 * @param string $fieldList Comma separated list of fields.
1963 * @param array $row Record from which to take values for processing.
1964 * @param array $info Array to which the processed values are added.
1965 * @return void
1966 */
1967 public function getProcessedValue($table, $fieldList, array $row, array &$info) {
1968 // Splitting values from $fieldList
1969 $fieldArr = explode(',', $fieldList);
1970 // Traverse fields from $fieldList
1971 foreach ($fieldArr as $field) {
1972 if ($row[$field]) {
1973 $info[] = '<strong>' . htmlspecialchars($this->itemLabels[$field]) . '</strong> '
1974 . htmlspecialchars(BackendUtility::getProcessedValue($table, $field, $row[$field]));
1975 }
1976 }
1977 }
1978
1979 /**
1980 * Returns TRUE, if the record given as parameters is NOT visible based on hidden/starttime/endtime (if available)
1981 *
1982 * @param string $table Tablename of table to test
1983 * @param array $row Record row.
1984 * @return bool Returns TRUE, if disabled.
1985 */
1986 public function isDisabled($table, $row) {
1987 $enableCols = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
1988 return $enableCols['disabled'] && $row[$enableCols['disabled']]
1989 || $enableCols['starttime'] && $row[$enableCols['starttime']] > $GLOBALS['EXEC_TIME']
1990 || $enableCols['endtime'] && $row[$enableCols['endtime']] && $row[$enableCols['endtime']] < $GLOBALS['EXEC_TIME'];
1991 }
1992
1993 /**
1994 * Will perform "word-wrapping" on the input string. What it does is to split by space or line break,
1995 * then find any word longer than $max and if found, a hyphen is inserted.
1996 * Works well on normal texts, little less well when HTML is involved (since much HTML will have
1997 * long strings that will be broken).
1998 *
1999 * @param string $content Content to word-wrap.
2000 * @param int $max Max number of chars in a word before it will be wrapped.
2001 * @param string $char Character to insert when wrapping.
2002 * @return string Processed output.
2003 * @deprecated since 6.2 - will be removed two versions later; use CSS instead (word-break: break-all;)
2004 */
2005 public function wordWrapper($content, $max = 50, $char = ' -') {
2006 GeneralUtility::logDeprecatedFunction();
2007 $array = preg_split('/[ ' . LF . ']/', $content);
2008 foreach ($array as $val) {
2009 if (strlen($val) > $max) {
2010 $content = str_replace($val, substr(chunk_split($val, $max, $char), 0, -1), $content);
2011 }
2012 }
2013 return $content;
2014 }
2015
2016 /**
2017 * Returns icon for "no-edit" of a record.
2018 * Basically, the point is to signal that this record could have had an edit link if
2019 * the circumstances were right. A placeholder for the regular edit icon...
2020 *
2021 * @param string $label Label key from LOCAL_LANG
2022 * @return string IMG tag for icon.
2023 */
2024 public function noEditIcon($label = 'noEditItems') {
2025 return IconUtility::getSpriteIcon(
2026 'status-edit-read-only',
2027 array('title' => $this->getLanguageService()->getLL($label, TRUE))
2028 );
2029 }
2030
2031 /**
2032 * Function, which fills in the internal array, $this->allowedTableNames with all tables to
2033 * which the user has access. Also a set of standard tables (pages, static_template, sys_filemounts, etc...)
2034 * are filtered out. So what is left is basically all tables which makes sense to list content from.
2035 *
2036 * @return array
2037 */
2038 protected function cleanTableNames() {
2039 // Get all table names:
2040 $tableNames = array_flip(array_keys($GLOBALS['TCA']));
2041 // Unset common names:
2042 unset($tableNames['pages']);
2043 unset($tableNames['static_template']);
2044 unset($tableNames['sys_filemounts']);
2045 unset($tableNames['sys_action']);
2046 unset($tableNames['sys_workflows']);
2047 unset($tableNames['be_users']);
2048 unset($tableNames['be_groups']);
2049 $allowedTableNames = array();
2050 // Traverse table names and set them in allowedTableNames array IF they can be read-accessed by the user.
2051 if (is_array($tableNames)) {
2052 foreach ($tableNames as $k => $v) {
2053 if ($this->getBackendUser()->check('tables_select', $k)) {
2054 $allowedTableNames['table_' . $k] = $k;
2055 }
2056 }
2057 }
2058 return $allowedTableNames;
2059 }
2060
2061 /**
2062 * Checking if the RTE is available/enabled for a certain table/field and if so, it returns TRUE.
2063 * Used to determine if the RTE button should be displayed.
2064 *
2065 * @param string $table Table name
2066 * @param array $row Record row (needed, if there are RTE dependencies based on other fields in the record)
2067 * @param string $field Field name
2068 * @return bool Returns TRUE if the rich text editor would be enabled/available for the field name specified.
2069 */
2070 public function isRTEforField($table, $row, $field) {
2071 $specConf = $this->getSpecConfForField($table, $row, $field);
2072 if (!count($specConf)) {
2073 return FALSE;
2074 }
2075 $p = BackendUtility::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
2076 if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
2077 BackendUtility::fixVersioningPid($table, $row);
2078 list($tscPID, $thePidValue) = BackendUtility::getTSCpid($table, $row['uid'], $row['pid']);
2079 // If the pid-value is not negative (that is, a pid could NOT be fetched)
2080 if ($thePidValue >= 0) {
2081 if (!isset($this->rteSetup[$tscPID])) {
2082 $this->rteSetup[$tscPID] = $this->getBackendUser()->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
2083 }
2084 $RTEtypeVal = BackendUtility::getTCAtypeValue($table, $row);
2085 $thisConfig = BackendUtility::RTEsetup($this->rteSetup[$tscPID]['properties'], $table, $field, $RTEtypeVal);
2086 if (!$thisConfig['disabled']) {
2087 return TRUE;
2088 }
2089 }
2090 }
2091 return FALSE;
2092 }
2093
2094 /**
2095 * Returns "special" configuration from the "types" configuration in TCA for the record given by tablename/fieldname.
2096 * Used by isRTEforField() in the process of finding whether a field has RTE enabled or not.
2097 *
2098 * @param string $table Table name
2099 * @param array $row Record array
2100 * @param string $field Field name
2101 * @return array Spec. conf (if available)
2102 * @access private
2103 * @see isRTEforField()
2104 */
2105 public function getSpecConfForField($table, $row, $field) {
2106 // Get types-configuration for the record:
2107 $types_fieldConfig = BackendUtility::getTCAtypes($table, $row);
2108 // Find the given field and return the spec key value if found:
2109 if (is_array($types_fieldConfig)) {
2110 foreach ($types_fieldConfig as $vConf) {
2111 if ($vConf['field'] == $field) {
2112 return $vConf['spec'];
2113 }
2114 }
2115 }
2116 return array();
2117 }
2118
2119 /*****************************************
2120 *
2121 * External renderings
2122 *
2123 *****************************************/
2124
2125 /**
2126 * Creates a menu of the tables that can be listed by this function
2127 * Only tables which has records on the page will be included.
2128 * Notice: The function also fills in the internal variable $this->activeTables with icon/titles.
2129 *
2130 * @param int $id Page id from which we are listing records (the function will look up if there are records on the page)
2131 * @return string HTML output.
2132 */
2133 public function getTableMenu($id) {
2134 // Initialize:
2135 $this->activeTables = array();
2136 $theTables = array('tt_content');
2137 // External tables:
2138 if (is_array($this->externalTables)) {
2139 $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
2140 }
2141 $out = '';
2142 // Traverse tables to check:
2143 foreach ($theTables as $tName) {
2144 // Check access and whether the proper extensions are loaded:
2145 if ($this->getBackendUser()->check('tables_select', $tName)
2146 && (isset($this->externalTables[$tName])
2147 || GeneralUtility::inList('fe_users,tt_content', $tName)
2148 || \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($tName)
2149 )
2150 ) {
2151 // Make query to count records from page:
2152 $c = $this->getDatabase()->exec_SELECTcountRows('uid', $tName, 'pid=' . (int)$id
2153 . BackendUtility::deleteClause($tName) . BackendUtility::versioningPlaceholderClause($tName));
2154 // If records were found (or if "tt_content" is the table...):
2155 if ($c || GeneralUtility::inList('tt_content', $tName)) {
2156 // Add row to menu:
2157 $out .= '
2158 <td><a href="#' . $tName . '"></a>' . IconUtility::getSpriteIconForRecord(
2159 $tName,
2160 array(),
2161 array('title' => $this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title'], TRUE))
2162 ) . '</td>';
2163 // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
2164 $this->activeTables[$tName] = IconUtility::getSpriteIconForRecord(
2165 $tName,
2166 array(),
2167 array('title' => $this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title'], TRUE)
2168 . ': ' . $c . ' ' . $this->getLanguageService()->getLL('records', TRUE))
2169 ) . '&nbsp;' . $this->getLanguageService()->sL($GLOBALS['TCA'][$tName]['ctrl']['title'], TRUE);
2170 }
2171 }
2172 }
2173 // Wrap cells in table tags:
2174 $out = '
2175 <!--
2176 Menu of tables on the page (table menu)
2177 -->
2178 <table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
2179 <tr>' . $out . '
2180 </tr>
2181 </table>';
2182 // Return the content:
2183 return $out;
2184 }
2185
2186 /**
2187 * @return BackendLayoutView
2188 */
2189 protected function getBackendLayoutView() {
2190 return GeneralUtility::makeInstance(
2191 'TYPO3\\CMS\\Backend\\View\\BackendLayoutView'
2192 );
2193 }
2194
2195 /**
2196 * @return BackendUserAuthentication
2197 */
2198 protected function getBackendUser() {
2199 return $GLOBALS['BE_USER'];
2200 }
2201
2202 /**
2203 * @return DatabaseConnection
2204 */
2205 protected function getDatabase() {
2206 return $GLOBALS['TYPO3_DB'];
2207 }
2208
2209 /**
2210 * @return LanguageService
2211 */
2212 protected function getLanguageService() {
2213 return $GLOBALS['LANG'];
2214 }
2215
2216 /**
2217 * @return PageLayoutController
2218 */
2219 protected function getPageLayoutController() {
2220 return $GLOBALS['SOBE'];
2221 }
2222
2223 /**
2224 * @return DocumentTemplate
2225 */
2226 protected function getDocumentTemplate() {
2227 return $GLOBALS['TBE_TEMPLATE'];
2228 }
2229
2230 }