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