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