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