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