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