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