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