2 /***************************************************************
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
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.
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.
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.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Include file extending db_list.inc for use with the web_layout module
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
34 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
38 * [CLASS/FUNCTION INDEX of SCRIPT]
42 * 115: class tx_cms_layout extends recordList
45 * 180: function getTable($table,$id)
46 * 240: function getTable_pages($id)
47 * 378: function getTable_tt_content($id)
48 * 754: function getTable_fe_users($id)
49 * 780: function getTable_sys_note($id)
50 * 873: function getTable_tt_board($id)
51 * 955: function getTable_tt_address($id)
52 * 985: function getTable_tt_links($id)
53 * 1011: function getTable_tt_guest($id)
54 * 1026: function getTable_tt_news($id)
55 * 1047: function getTable_tt_calender($id)
56 * 1097: function getTable_tt_products($id)
58 * SECTION: Generic listing of items
59 * 1143: function makeOrdinaryList($table, $id, $fList, $icon=0, $addWhere='')
60 * 1224: function dataFields($fieldArr,$table,$row,$out=array())
61 * 1275: function headerFields($fieldArr,$table,$out=array())
63 * SECTION: Additional functions; Pages
64 * 1317: function pages_getTree($theRows,$pid,$qWhere,$treeIcons,$depth)
65 * 1350: function pages_drawItem($row,$fieldArr)
67 * SECTION: Additional functions; Content Elements
68 * 1461: function tt_content_drawColHeader($colName,$editParams,$newParams)
69 * 1513: function tt_content_drawHeader($row,$space=0,$disableMoveAndNewButtons=FALSE,$langMode=FALSE)
70 * 1643: function tt_content_drawItem($row, $isRTE=FALSE)
71 * 1806: function getNonTranslatedTTcontentUids($defLanguageCount,$id,$lP)
72 * 1836: function newLanguageButton($defLanguageCount,$lP)
73 * 1857: function infoGif($infoArr)
74 * 1873: function newContentElementOnClick($id,$colPos,$sys_language)
75 * 1891: function linkEditContent($str,$row)
76 * 1909: function linkRTEbutton($row)
77 * 1930: function languageSelector($id)
78 * 1967: function getResult($result)
80 * SECTION: Additional functions; Message board items (tt_board)
81 * 2036: function tt_board_getTree($theRows,$parent,$pid,$qWhere,$treeIcons)
82 * 2071: function tt_board_drawItem($table,$row,$re)
84 * SECTION: Various helper functions
85 * 2118: function numberOfRecords($table,$pid)
86 * 2137: function renderText($input)
87 * 2151: function getIcon($table,$row)
88 * 2174: function getProcessedValue($table,$fieldList,$row,&$info)
89 * 2194: function isDisabled($table,$row)
90 * 2212: function wordWrapper($content,$max=50,$char=' -')
91 * 2229: function noEditIcon($label='noEditItems')
92 * 2238: function cleanTableNames()
93 * 2274: function isRTEforField($table,$row,$field)
94 * 2304: function getSpecConfForField($table,$row,$field)
96 * SECTION: External renderings
97 * 2341: function getPageInfoBox($rec,$edit=0)
98 * 2510: function getTableMenu($id)
99 * 2575: function strip_tags($content, $fillEmptyContent=false)
101 * TOTAL FUNCTIONS: 43
102 * (This index is automatically created/updated by the extension "extdeveval")
108 * Child class for the Web > Page module
110 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
114 class tx_cms_layout
extends recordList
{
116 // External, static: For page statistics:
117 var $stat_select_field = 'page_id'; // fieldname from sys_stat to select on.
118 var $stat_codes = array(); // eg. "HITS_days:-1"
120 // External, static: Flags of various kinds:
121 var $pI_showUser = 0; // If true, users/groups are shown in the page info box.
122 var $pI_showStat = 1; // If true, hit statistics are shown in the page info box.
123 var $nextThree = 3; // The number of successive records to edit when showing content elements.
124 var $pages_noEditColumns = 0; // If true, disables the edit-column icon for tt_content elements
125 var $option_showBigButtons = 1; // If true, shows big buttons for editing page properties, moving, creating elements etc. in the columns view.
126 var $option_newWizard = 1; // If true, new-wizards are linked to rather than the regular new-element list.
127 var $ext_function = 0; // If set to "1", will link a big button to content element wizard.
128 var $doEdit = 1; // If true, elements will have edit icons (probably this is whethere the user has permission to edit the page content). Set externally.
129 var $agePrefixes = ' min| hrs| days| yrs'; // Age prefixes for displaying times. May be set externally to localized values.
130 var $externalTables = array(); // Array of tables to be listed by the Web > Page module in addition to the default tables.
131 var $descrTable; // "Pseudo" Description -table name
132 var $defLangBinding = FALSE; // If set true, the language mode of tt_content elements will be rendered with hard binding between default language content elements and their translations!
134 // External, static: Configuration of tt_content element display:
135 var $tt_contentConfig = Array(
136 'showInfo' => 1, // Boolean: Display info-marks or not
137 'showCommands' => 1, // Boolean: Display up/down arrows and edit icons for tt_content records
138 'single' => 1, // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
139 'showAsGrid' => 0, // Boolean: If set, the content of columns is shown in grid
140 'showSingleCol' => 0, // The column(s) to show if single mode (under each other)
143 'languageColsPointer' => 0,
144 'showHidden' => 1, // Displays hidden records as well
145 'sys_language_uid' => 0, // Which language
146 'cols' => '1,0,2,3' // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
149 // Internal, dynamic:
150 var $allowedTableNames = array(); // Will contain a list of tables which can be listed by the user.
151 var $activeTables = array(); // Contains icon/title of pages which are listed in the tables menu (see getTableMenu() function )
152 var $tt_contentData = Array(
153 'nextThree' => Array(),
157 var $CType_labels = array(); // Used to store labels for CTypes for tt_content elements
158 var $itemLabels = array(); // Used to store labels for the various fields in tt_content elements
161 /*****************************************
165 *****************************************/
168 * Adds the code of a single table
170 * @param string Table name
171 * @param integer Current page id
172 * @return string HTML for listing.
174 function getTable($table, $id) {
176 // Load full table definition:
177 t3lib_div
::loadTCA($table);
179 if (isset($this->externalTables
[$table])) {
180 return $this->getExternalTables($id, $table);
182 // Branch out based on table name:
183 // Notice: Most of these tables belongs to other extensions than 'cms'. Each of these tables can be rendered only if the extensions they belong to is loaded.
186 return $this->getTable_pages($id);
189 return $this->getTable_tt_content($id);
192 return $this->getTable_fe_users($id);
195 return $this->getTable_sys_note($id);
198 return $this->getTable_tt_board($id);
201 return $this->getTable_tt_address($id);
204 return $this->getTable_tt_links($id);
207 return $this->getTable_tt_guest($id);
210 return $this->getTable_tt_news($id);
213 return $this->getTable_tt_calender($id);
216 return $this->getTable_tt_products($id);
224 * Renders an external table from page id
226 * @param integer Page id
227 * @param string name of the table
228 * @return string HTML for the listing
230 function getExternalTables($id, $table) {
232 $type = $GLOBALS['SOBE']->MOD_SETTINGS
[$table];
237 $fList = $this->externalTables
[$table][$type]['fList']; // eg. "name;title;email;company,image"
238 // The columns are separeted by comma ','.
239 // Values separated by semicolon ';' are shown in the same column.
240 $icon = $this->externalTables
[$table][$type]['icon'];
241 $addWhere = $this->externalTables
[$table][$type]['addWhere'];
244 $out = $this->makeOrdinaryList($table, $id, $fList, $icon, $addWhere);
250 * Renders records from the pages table from page id
251 * (Used to get information about the page tree content by "Web>Info"!)
253 * @param integer Page id
254 * @return string HTML for the listing
256 function getTable_pages($id) {
261 $delClause = t3lib_BEfunc
::deleteClause('pages') . ' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1); // Select clause for pages:
263 // Select current page:
265 $row = $GLOBALS['SOBE']->pageinfo
; // The root has a pseudo record in pageinfo...
267 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid=' . intval($id) . $delClause);
268 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
269 t3lib_BEfunc
::workspaceOL('pages', $row);
272 // If there was found a page:
273 if (is_array($row)) {
275 // Select which fields to show:
276 $pKey = $GLOBALS['SOBE']->MOD_SETTINGS
['function'] == 'tx_cms_webinfo_hits' ?
'hits' : $GLOBALS['SOBE']->MOD_SETTINGS
['pages'];
279 $this->fieldArray
= explode(',', 'title,' . implode(',', $this->stat_codes
));
282 $this->cleanTableNames();
283 $tableNames = $this->allowedTableNames
;
284 $this->fieldArray
= explode(',', 'title,uid,' . implode(',', array_keys($tableNames)));
287 $this->fieldArray
= explode(',', 'title,uid,lastUpdated,newUntil,no_cache,cache_timeout,php_tree_stop,TSconfig,storage_pid,is_siteroot,fe_login_mode');
290 $this->fieldArray
= explode(',', 'title,uid,alias,starttime,endtime,fe_group,target,url,shortcut,shortcut_mode');
294 // Getting select-depth:
295 $depth = intval($GLOBALS['SOBE']->MOD_SETTINGS
['pages_levels']);
297 // Half line is drawn
299 $theData['subject'] = $this->widthGif
;
300 $out .= $this->addelement(0, '', $theData);
302 // Overriding a few things:
303 $this->no_noWrap
= 0;
304 $this->oddColumnsCssClass
= 'bgColor3-20';
307 $this->eCounter
= $this->firstElementNumber
;
309 // Creating elements:
310 list($flag, $code) = $this->fwd_rwd_nav();
317 $theRows = $this->pages_getTree($theRows, $row['uid'], $delClause . t3lib_BEfunc
::versioningPlaceholderClause('pages'), '', $depth);
318 if ($GLOBALS['BE_USER']->doesUserHaveAccess($row, 2)) {
319 $editUids[] = $row['uid'];
321 $out .= $this->pages_drawItem($row, $this->fieldArray
);
323 // Traverse all pages selected:
324 foreach ($theRows as $n => $sRow) {
325 if ($GLOBALS['BE_USER']->doesUserHaveAccess($sRow, 2)) {
326 $editUids[] = $sRow['uid'];
328 $out .= $this->pages_drawItem($sRow, $this->fieldArray
);
333 // Header line is drawn
335 $editIdList = implode(',', $editUids);
337 // Traverse fields (as set above) in order to create header values:
338 foreach ($this->fieldArray
as $field) {
339 if ($editIdList && isset($TCA['pages']['columns'][$field]) && $field != 'uid' && !$this->pages_noEditColumns
) {
340 $params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=' . $field . '&disHelp=1';
341 $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'), rtrim(trim($GLOBALS['LANG']->sL(t3lib_BEfunc
::getItemLabel('pages', $field))), ':'));
342 $eI = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $this->backPath
, '')) . '" title="' . htmlspecialchars($iTitle) . '">' .
343 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
350 $theData[$field] = ' <strong>' . $GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label']) . '</strong>' . $eI;
353 $theData[$field] = ' <strong>ID:</strong>';
356 if (substr($field, 0, 6) == 'table_') {
357 $f2 = substr($field, 6);
359 $theData[$field] = ' ' . t3lib_iconWorks
::getSpriteIconForRecord($f2, array(), array('title' => $GLOBALS['LANG']->sL($TCA[$f2]['ctrl']['title'], 1)));
361 } elseif (substr($field, 0, 5) == 'HITS_') {
362 $fParts = explode(':', substr($field, 5));
363 switch ($fParts[0]) {
365 $timespan = mktime(0, 0, 0) +
intval($fParts[1]) * 3600 * 24;
366 $theData[$field] = ' ' . date('d', $timespan);
369 $theData[$field] = '';
373 $theData[$field] = ' <strong>' . $GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label'], 1) . '</strong>' . $eI;
380 $this->oddColumnsCssClass
= '';
383 $out = t3lib_BEfunc
::cshItem($this->descrTable
, 'func_' . $pKey, $GLOBALS['BACK_PATH']) .
385 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-pages">
386 ' . $this->addelement(1, '', $theData, ' class="t3-row-header"', 20) .
390 $this->oddColumnsCssClass
= '';
395 * Returns the backend layout which should be used for this page.
397 * @param integer $id: Uid of the current
398 * @return integer The Uid of the backend layout record
400 function getSelectedBackendLayoutUid($id) {
401 $rootline = t3lib_BEfunc
::BEgetRootLine($id);
402 $backendLayoutUid = null;
403 for ($i = count($rootline); $i > 0; $i--) {
404 $page = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, be_layout, be_layout_next_level', 'pages', 'uid=' . intval($rootline[$i]['uid']));
405 if (intval($page['be_layout_next_level']) > 0 && $page['uid'] != $id) {
406 $backendLayoutUid = intval($page['be_layout_next_level']);
409 if (intval($page['be_layout']) > 0) {
410 $backendLayoutUid = intval($page['be_layout']);
415 return $backendLayoutUid;
419 * Renders Content Elements from the tt_content table from page id
421 * @param integer Page id
422 * @return string HTML for the listing
424 function getTable_tt_content($id) {
427 $this->initializeLanguages();
430 $RTE = $GLOBALS['BE_USER']->isRTE();
432 $showHidden = $this->tt_contentConfig
['showHidden'] ?
'' : t3lib_BEfunc
::BEenableFields('tt_content');
433 $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(t3lib_BEfunc
::getRecordTitle('pages', t3lib_BEfunc
::getRecordWSOL('pages', $id), TRUE));
434 $GLOBALS['SOBE']->doc
->getPageRenderer()->loadExtJs();
435 $GLOBALS['SOBE']->doc
->getPageRenderer()->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js');
437 // Get labels for CTypes and tt_content element fields in general:
438 $this->CType_labels
= array();
439 foreach ($TCA['tt_content']['columns']['CType']['config']['items'] as $val) {
440 $this->CType_labels
[$val[1]] = $GLOBALS['LANG']->sL($val[0]);
442 $this->itemLabels
= array();
443 foreach ($TCA['tt_content']['columns'] as $name => $val) {
444 $this->itemLabels
[$name] = $GLOBALS['LANG']->sL($val['label']);
447 // Select display mode:
448 if (!$this->tt_contentConfig
['single']) { // MULTIPLE column display mode, side by side:
450 // Setting language list:
451 $langList = $this->tt_contentConfig
['sys_language_uid'];
452 if ($this->tt_contentConfig
['languageMode']) {
453 if ($this->tt_contentConfig
['languageColsPointer']) {
454 $langList = '0,' . $this->tt_contentConfig
['languageColsPointer'];
456 $langList = implode(',', array_keys($this->tt_contentConfig
['languageCols']));
458 $languageColumn = array();
460 $langListArr = explode(',', $langList);
461 $defLanguageCount = array();
462 $defLangBinding = array();
464 // For EACH languages... :
465 foreach ($langListArr as $lP) { // If NOT languageMode, then we'll only be through this once.
466 $showLanguage = $this->defLangBinding
&& $lP == 0 ?
' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid=' . $lP;
467 $cList = explode(',', $this->tt_contentConfig
['cols']);
471 // For EACH column, render the content into a variable:
472 foreach ($cList as $key) {
474 $defLanguageCount[$key] = array();
477 // Select content elements from this column/language:
478 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage);
479 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
481 // 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:
482 if ($this->doEdit
&& $this->option_showBigButtons
&& !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
483 $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')) . "';";
484 $theNewButton = $GLOBALS['SOBE']->doc
->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent'));
485 $content[$key] .= '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton;
488 // Traverse any selected elements and render their display code:
489 $rowArr = $this->getResult($result);
491 foreach ($rowArr as $rKey => $row) {
493 if (is_array($row) && (int) $row['t3ver_state'] != 2) {
494 $singleElementHTML = '';
496 $defLanguageCount[$key][] = $row['uid'];
499 $editUidList .= $row['uid'] . ',';
500 $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig
['showInfo'] ?
15 : 5, $this->defLangBinding
&& $lP > 0, TRUE);
502 $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
503 $singleElementHTML .= '<div ' . ($row['_ORIG_uid'] ?
' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row, $isRTE) . '</div>';
505 // NOTE: this is the end tag for <div class="t3-page-ce-body">
506 // because of bad (historic) conception, starting tag has to be placed inside tt_content_drawHeader()
507 $singleElementHTML .= '</div>';
510 $statusHidden = ($this->isDisabled('tt_content', $row) ?
' t3-page-ce-hidden' : '');
511 $singleElementHTML = '<div class="t3-page-ce' . $statusHidden . '">' . $singleElementHTML . '</div>';
513 if ($this->defLangBinding
&& $this->tt_contentConfig
['languageMode']) {
514 $defLangBinding[$key][$lP][$row[($lP ?
'l18n_parent' : 'uid')]] = $singleElementHTML;
516 $content[$key] .= $singleElementHTML;
519 unset($rowArr[$rKey]);
523 // Add new-icon link, header:
524 $newP = $this->newContentElementOnClick($id, $key, $lP);
525 $colTitle = t3lib_BEfunc
::getProcessedValue('tt_content', 'colPos', $key);
527 $tcaItems = t3lib_div
::callUserFunction('EXT:cms/classes/class.tx_cms_backendlayout.php:tx_cms_BackendLayout->getColPosListItemsParsed', $id, $this);
528 foreach ($tcaItems as $item) {
529 if ($item[1] == $key) {
530 $colTitle = $GLOBALS['LANG']->sL($item[0]);
533 $head[$key] .= $this->tt_content_drawColHeader($colTitle, ($this->doEdit
&& count($rowArr) ?
'&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : ''), $newP);
537 // For EACH column, fit the rendered content into a table cell:
540 if ($this->tt_contentConfig
['showAsGrid']) {
541 $backendLayoutUid = $this->getSelectedBackendLayoutUid($id);
542 $backendLayoutRecord = t3lib_BEfunc
::getRecord('be_layouts', intval($backendLayoutUid));
543 if (empty($backendLayoutRecord['config'])) {
544 // TODO: show a message that no layout was found
545 $this->tt_contentConfig
['showAsGrid'] = 0;
549 if (!$this->tt_contentConfig
['showAsGrid']) {
550 foreach ($cList as $k => $key) {
554 <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>';
557 <td><img src="clear.gif" width="4" height="1" alt="" /></td>
558 <td bgcolor="#cfcfcf"><img src="clear.gif" width="1" height="1" alt="" /></td>
559 <td><img src="clear.gif" width="4" height="1" alt="" /></td>';
562 <td class="t3-page-column t3-page-column-' . $key . '">' . $head[$key] . $content[$key] . '</td>';
564 // Storing content for use if languageMode is set:
565 if ($this->tt_contentConfig
['languageMode']) {
566 $languageColumn[$key][$lP] = $head[$key] . $content[$key];
567 if (!$this->defLangBinding
) {
568 $languageColumn[$key][$lP] .= '<br /><br />' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP);
573 // Wrap the cells into a table row:
575 <table border="0" cellpadding="0" cellspacing="0" class="t3-page-columns">
583 // initialize TS parser to parse config to array
584 $parser = t3lib_div
::makeInstance('t3lib_TSparser');
585 $parser->parse($backendLayoutRecord['config']);
587 $grid .= '<div class="t3-gridContainer"><table border="0" cellspacing="1" cellpadding="4" width="80%" height="100%" class="t3-page-columns t3-gridTable">';
590 $colCount = intval($parser->setup
['be_layout.']['colCount']);
591 $rowCount = intval($parser->setup
['be_layout.']['rowCount']);
593 $grid .= '<colgroup>';
594 for ($i = 0; $i < $colCount; $i++
) {
595 $grid .= '<col style="width:' . (100 / $colCount) . '%"></col>';
597 $grid .= '</colgroup>';
599 // cycle through rows
600 for ($row = 1; $row <= $rowCount; $row++
) {
601 $rowConfig = $parser->setup
['be_layout.']['rows.'][$row . '.'];
602 if (!isset($rowConfig)) {
608 for ($col = 1; $col <= $colCount; $col++
) {
609 $columnConfig = $rowConfig['columns.'][$col . '.'];
611 if (!isset($columnConfig)) {
615 // which tt_content colPos should be displayed inside this cell
616 $columnKey = intval($columnConfig['colPos']);
618 // render the grid cell
619 $grid .= '<td valign="top"' .
620 (isset($columnConfig['colspan']) ?
' colspan="' . $columnConfig['colspan'] . '"' : '') .
621 (isset($columnConfig['rowspan']) ?
' rowspan="' . $columnConfig['rowspan'] . '"' : '') .
622 ' class="t3-gridCell t3-page-column t3-page-column-' . $columnKey .
623 (!isset($columnConfig['colPos']) ?
' t3-gridCell-disabled' : '') .
624 (isset($columnConfig['colspan']) ?
' t3-gridCell-width' . $columnConfig['colspan'] : '') .
625 (isset($columnConfig['rowspan']) ?
' t3-gridCell-height' . $columnConfig['rowspan'] : '') . '">';
627 // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
628 // If not, a new header without any buttons will be generated.
629 if (isset($columnConfig['colPos'])) {
630 $grid .= $head[$columnKey] . $content[$columnKey];
632 $grid .= $this->tt_content_drawColHeader($columnConfig['name'], '', '');
639 $out .= $grid . '</table></div>';
643 $out .= t3lib_BEfunc
::cshItem($this->descrTable
, 'columns_multi', $GLOBALS['BACK_PATH']);
646 // If language mode, then make another presentation:
647 // 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!
648 if ($this->tt_contentConfig
['languageMode']) {
650 // Get language selector:
651 $languageSelector = $this->languageSelector($id);
653 // Reset out - we will make new content here:
655 // Separator between language columns (black thin line)
657 <td><img src="clear.gif" width="4" height="1" alt="" /></td>
658 <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td>
659 <td><img src="clear.gif" width="4" height="1" alt="" /></td>';
661 // Traverse languages found on the page and build up the table displaying them side by side:
664 foreach ($langListArr as $lP) {
668 <td valign="top" align="center" class="bgColor6"><strong>' . htmlspecialchars($this->tt_contentConfig
['languageCols'][$lP]) . '</strong></td>';
670 // "View page" icon is added:
671 $viewLink = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::viewOnClick($this->id
, $this->backPath
, t3lib_BEfunc
::BEgetRootLine($this->id
), '', '', '&L=' . $lP)) . '">' .
672 t3lib_iconWorks
::getSpriteIcon('actions-document-view') .
675 // Language overlay page header:
678 list($lpRecord) = t3lib_BEfunc
::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($lP));
679 t3lib_BEfunc
::workspaceOL('pages_language_overlay', $lpRecord);
680 $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP;
681 $lPLabel = $GLOBALS['SOBE']->doc
->wrapClickMenuOnIcon(t3lib_iconWorks
::getSpriteIconForRecord('pages_language_overlay', $lpRecord), $lpRecord['uid']) .
683 ($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) . '">' .
684 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
686 htmlspecialchars(t3lib_div
::fixed_lgd_cs($lpRecord['title'], 20));
688 $lPLabel = $viewLink;
691 <td nowrap="nowrap">' . $lPLabel . '</td>';
695 <tr class="bgColor5">' . implode($midSep, $cCont) . '
698 <tr class="bgColor5">' . implode($midSep, $sCont) . '
701 // Traverse previously built content for the columns:
702 foreach ($languageColumn as $cKey => $cCont) {
705 <td valign="top">' . implode('</td>' . $midSep . '
706 <td valign="top">', $cCont) . '</td>
709 if ($this->defLangBinding
) {
710 // "defLangBinding" mode
711 foreach ($defLanguageCount[$cKey] as $defUid) {
713 foreach ($langListArr as $lP) {
714 $cCont[] = $defLangBinding[$cKey][$lP][$defUid] .
715 '<br/>' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP), $lP);
719 <td valign="top">' . implode('</td>' . $midSep . '
720 <td valign="top">', $cCont) . '</td>
726 foreach ($langListArr as $lP) {
731 <td valign="top">' . implode('</td>' . $midSep . '
732 <td valign="top">', $cCont) . '</td>
737 // Finally, wrap it all in a table and add the language selector on top of it:
738 $out = $languageSelector . '
739 <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-langMode">
744 $out .= t3lib_BEfunc
::cshItem($this->descrTable
, 'language_list', $GLOBALS['BACK_PATH']);
746 } else { // SINGLE column mode (columns shown beneath each other):
747 #debug('single column');
748 if ($this->tt_contentConfig
['sys_language_uid'] == 0 ||
!$this->defLangBinding
) {
751 if ($this->defLangBinding
&& $this->tt_contentConfig
['sys_language_uid'] == 0) {
752 $showLanguage = ' AND sys_language_uid IN (0,-1)';
755 $showLanguage = ' AND sys_language_uid=' . $this->tt_contentConfig
['sys_language_uid'];
756 $lP = $this->tt_contentConfig
['sys_language_uid'];
759 $cList = explode(',', $this->tt_contentConfig
['showSingleCol']);
763 // Expand the table to some preset dimensions:
766 <td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>
767 <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td>
768 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
769 <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td>
772 // Traverse columns to display top-on-top
773 foreach ($cList as $counter => $key) {
775 // Select content elements:
776 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage);
777 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
779 $rowArr = $this->getResult($result);
782 // 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:
783 if ($this->doEdit
&& $this->option_showBigButtons
&& !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
784 $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')) . "';";
785 $theNewButton = $GLOBALS['SOBE']->doc
->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent'));
786 $theNewButton = '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton;
791 // Traverse any selected elements:
792 foreach ($rowArr as $rKey => $row) {
794 if (is_array($row) && (int) $row['t3ver_state'] != 2) {
797 $editUidList .= $row['uid'] . ',';
798 $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
800 // Create row output:
804 <td valign="top">' . $this->tt_content_drawHeader($row) . '</td>
806 <td' . ($row['_ORIG_uid'] ?
' class="ver-element"' : '') . ' valign="top">' . $this->tt_content_drawItem($row, $isRTE) . '</td>
809 // If the element was not the last element, add a divider line:
810 if ($c != $GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
814 <td colspan="3"><img' . t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/stiblet_medium2.gif', 'width="468" height="1"') . ' class="c-divider" alt="" /></td>
818 unset($rowArr[$rKey]);
822 // Add spacer between sections in the vertical list
827 <td colspan="3"><br /><br /><br /><br /></td>
831 // Add section header:
832 $newP = $this->newContentElementOnClick($id, $key, $this->tt_contentConfig
['sys_language_uid']);
835 <!-- Column header: -->
838 <td valign="top" colspan="3">' .
839 $this->tt_content_drawColHeader(t3lib_BEfunc
::getProcessedValue('tt_content', 'colPos', $key), ($this->doEdit
&& count($rowArr) ?
'&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : ''), $newP) .
844 // Finally, add the content from the records in this column:
848 // Finally, wrap all table rows in one, big table:
850 <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode">
855 $out .= t3lib_BEfunc
::cshItem($this->descrTable
, 'columns_single', $GLOBALS['BACK_PATH']);
857 $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/>';
862 // Add the big buttons to page:
863 if ($this->option_showBigButtons
) {
866 if (!$GLOBALS['SOBE']->current_sys_language
) {
867 if ($this->ext_CALC_PERMS
& 2) {
868 $bArray[0] = $GLOBALS['SOBE']->doc
->t3Button(t3lib_BEfunc
::editOnClick('&edit[pages][' . $id . "]=edit", $this->backPath
, ''), $GLOBALS['LANG']->getLL('editPageProperties'));
871 if ($this->doEdit
&& $GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay')) {
872 list($languageOverlayRecord) = t3lib_BEfunc
::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language
));
873 $bArray[0] = $GLOBALS['SOBE']->doc
->t3Button(t3lib_BEfunc
::editOnClick('&edit[pages_language_overlay][' . $languageOverlayRecord['uid'] . "]=edit", $this->backPath
, ''), $GLOBALS['LANG']->getLL('editPageProperties_curLang'));
876 if ($this->ext_CALC_PERMS
& 4 ||
$this->ext_CALC_PERMS
& 2) {
877 $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'));
879 if ($this->ext_CALC_PERMS
& 8) {
880 $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'));
882 if ($this->doEdit
&& $this->ext_function
== 1) {
883 $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'));
886 <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons">
888 <td>' . implode('</td>
889 <td>', $bArray) . '</td>
890 <td>' . t3lib_BEfunc
::cshItem($this->descrTable
, 'button_panel', $GLOBALS['BACK_PATH']) . '</td>
902 * Renders Frontend Users from the fe_users table from page id
904 * @param integer Page id
905 * @return string HTML for the listing
907 function getTable_fe_users($id) {
909 $this->addElement_tdParams
= array(
910 'username' => ' nowrap="nowrap"',
911 'usergroup' => ' nowrap="nowrap"',
912 'name' => ' nowrap="nowrap"',
913 'address' => ' nowrap="nowrap"',
914 'zip' => ' nowrap="nowrap"',
915 'city' => ' nowrap="nowrap"',
916 'email' => ' nowrap="nowrap"',
917 'telephone' => ' nowrap="nowrap"'
919 $fList = 'username,usergroup,name,email,telephone,address,zip,city';
920 $out = $this->makeOrdinaryList('fe_users', $id, $fList, 1);
921 $this->addElement_tdParams
= array();
926 * Renders records from the sys_notes table from page id
927 * NOTICE: Requires the sys_note extension to be loaded.
929 * @param integer Page id
930 * @return string HTML for the listing
932 function getTable_sys_note($id) {
935 if (!t3lib_extMgm
::isLoaded('sys_note')) {
940 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
941 $tree = $this->getTreeObject($id, intval($GLOBALS['SOBE']->MOD_SETTINGS
['pages_levels']), $perms_clause);
943 $this->itemLabels
= array();
944 foreach ($TCA['sys_note']['columns'] as $name => $val) {
945 $this->itemLabels
[$name] = $GLOBALS['LANG']->sL($val['label']);
948 // If page ids were found, select all sys_notes from the page ids:
950 if (count($tree->ids
)) {
951 $delClause = t3lib_BEfunc
::deleteClause('sys_note') . t3lib_BEfunc
::versioningPlaceholderClause('sys_note');
952 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_note', 'pid IN (' . implode(',', $tree->ids
) . ') AND (personal=0 OR cruser=' . intval($GLOBALS['BE_USER']->user
['uid']) . ')' . $delClause);
953 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
955 // If sys_notes were found, render them:
957 $this->fieldArray
= explode(',', '__cmds__,info,note');
959 // header line is drawn
961 $theData['__cmds__'] = '';
962 $theData['info'] = '<strong>Info</strong><br /><img src="clear.gif" height="1" width="220" alt="" />';
963 $theData['note'] = '<strong>Note</strong>';
964 $out .= $this->addelement(1, '', $theData, ' class="t3-row-header"', 20);
966 // half line is drawn
968 $theData['info'] = $this->widthGif
;
969 $out .= $this->addelement(0, '', $theData);
971 $this->no_noWrap
= 1;
974 $this->eCounter
= $this->firstElementNumber
;
975 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
976 t3lib_BEfunc
::workspaceOL('sys_note', $row);
978 if (is_array($row)) {
979 list($flag, $code) = $this->fwd_rwd_nav();
983 0 => '', // No category
984 1 => ' class="bgColor4"', // Instructions
985 2 => ' class="bgColor2"', // Template
987 4 => ' class="bgColor5"' // To-do
989 $tdparams = $color[$row['category']];
993 $this->getProcessedValue('sys_note', 'subject,category,author,email,personal', $row, $info);
994 $cont = implode('<br />', $info);
995 $head = '<strong>Page:</strong> ' . t3lib_BEfunc
::getRecordPath($row['pid'], $perms_clause, 10) . '<br />';
997 $theData['__cmds__'] = $this->getIcon('sys_note', $row);
998 $theData['info'] = $head . $cont;
999 $theData['note'] = nl2br($row['message']);
1001 $out .= $this->addelement(1, '', $theData, $tdparams, 20);
1004 // half line is drawn
1006 $theData['info'] = $this->widthGif
;
1007 $out .= $this->addelement(0, '', $theData);
1013 // Wrap it all in a table:
1015 <table border="0" cellpadding="1" cellspacing="2" width="480" class="typo3-page-sysnote">
1024 * Renders records from the tt_board table from page id
1025 * NOTICE: Requires the tt_board extension to be loaded.
1027 * @param integer Page id
1028 * @return string HTML for the listing
1030 function getTable_tt_board($id) {
1033 $delClause = t3lib_BEfunc
::deleteClause('tt_board') . t3lib_BEfunc
::versioningPlaceholderClause('tt_board');
1034 $queryParts = $this->makeQueryArray('tt_board', $id, 'AND parent=0');
1035 $this->setTotalItems($queryParts);
1038 // If items were selected, make query:
1039 if ($this->totalItems
) {
1040 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
1041 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
1044 // If results came out of that, render the list:
1048 // Setting fields to display first:
1049 if ($GLOBALS['SOBE']->MOD_SETTINGS
['tt_board'] == 'expand') {
1050 $this->fieldArray
= explode(',', 'subject,author,date,age');
1052 $this->fieldArray
= explode(',', 'subject,author,date,age,replys');
1055 // Header line is drawn
1057 $theData['subject'] = '<strong>' . $GLOBALS['LANG']->getLL('tt_board_subject', 1) . '</strong>';
1058 $theData['author'] = '<strong>' . $GLOBALS['LANG']->getLL('tt_board_author', 1) . '</strong>';
1059 $theData['date'] = '<strong>' . $GLOBALS['LANG']->getLL('tt_board_date', 1) . '</strong>';
1060 $theData['age'] = '<strong>' . $GLOBALS['LANG']->getLL('tt_board_age', 1) . '</strong>';
1061 if ($GLOBALS['SOBE']->MOD_SETTINGS
['tt_board'] != 'expand') {
1062 $theData['replys'] = '<strong>' . $GLOBALS['LANG']->getLL('tt_board_RE', 1) . '</strong>';
1064 $out .= $this->addelement(1, '', $theData, ' class="t3-row-header"', 20);
1066 // half line is drawn
1068 $theData['subject'] = $this->widthGif
;
1069 $out .= $this->addelement(0, '', $theData);
1072 $this->eCounter
= $this->firstElementNumber
;
1073 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1074 t3lib_BEfunc
::workspaceOL('tt_board', $row);
1076 if (is_array($row)) {
1077 list($flag, $code) = $this->fwd_rwd_nav();
1083 $theRows = $this->tt_board_getTree($theRows, $row['uid'], $id, $delClause, '');
1084 $out .= $this->tt_board_drawItem('tt_board', $row, count($theRows));
1086 if ($GLOBALS['SOBE']->MOD_SETTINGS
['tt_board'] == 'expand') {
1087 foreach ($theRows as $n => $sRow) {
1088 $out .= $this->tt_board_drawItem('tt_board', $sRow, 0);
1096 // Wrap it all in a table:
1098 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-listTTboard">
1107 * Renders address records from the tt_address table from page id
1108 * NOTICE: Requires the tt_address extension to be loaded.
1110 * @param integer Page id
1111 * @return string HTML for the listing
1113 function getTable_tt_address($id) {
1115 // Define fieldlist to show:
1116 switch ($GLOBALS['SOBE']->MOD_SETTINGS
['tt_address']) {
1119 $fList = 'name,address,zip,city,country';
1123 $fList = 'name;title;email;company,image';
1127 $fList = 'name,email,www,phone,fax,mobile';
1132 $out = $this->makeOrdinaryList('tt_address', $id, $fList, $icon);
1137 * Renders link records from the tt_links table from page id
1138 * NOTICE: Requires the tt_links extension to be loaded.
1140 * @param integer Page id
1141 * @return string HTML for the listing
1143 function getTable_tt_links($id) {
1145 // Define fieldlist to show:
1146 switch ($GLOBALS['SOBE']->MOD_SETTINGS
['tt_links']) {
1148 $fList = 'title,hidden,url';
1151 $fList = 'title;url,note2';
1154 $fList = 'title;url,note';
1158 $out = $this->makeOrdinaryList('tt_links', $id, $fList, 1);
1163 * Renders link records from the tt_links table from page id
1164 * NOTICE: Requires the tt_links extension to be loaded.
1166 * @param integer Page id
1167 * @return string HTML for the listing
1169 function getTable_tt_guest($id) {
1171 // Define fieldlist to show:
1172 $fList = 'title;cr_name;cr_email,note';
1173 $out = $this->makeOrdinaryList('tt_guest', $id, $fList, 1);
1178 * Renders news items from the tt_news table from page id
1179 * NOTICE: Requires the tt_news extension to be loaded.
1181 * @param integer Page id
1182 * @return string HTML for the listing
1184 function getTable_tt_news($id) {
1186 $this->addElement_tdParams
= array(
1187 'title' => ' nowrap="nowrap"',
1188 'datetime' => ' nowrap="nowrap"',
1189 'starttime' => ' nowrap="nowrap"',
1190 'author' => ' nowrap="nowrap"'
1192 $fList = 'title,author,author_email,datetime,starttime,category,image';
1193 $out = $this->makeOrdinaryList('tt_news', $id, $fList, 1);
1194 $this->addElement_tdParams
= array();
1199 * Renders calender elements link records from the tt_calender table from page id
1200 * NOTICE: Requires the tt_calender extension to be loaded.
1202 * @param integer Page id
1203 * @return string HTML for the listing
1205 function getTable_tt_calender($id) {
1207 $type = $GLOBALS['SOBE']->MOD_SETTINGS
['tt_calender'];
1211 $fList = 'date,title';
1213 $out = $this->makeOrdinaryList('tt_calender', $id, $fList, $icon, ' AND type=0');
1218 $fList = 'title;date;time;datetext;link,note';
1220 $out = $this->makeOrdinaryList('tt_calender', $id, $fList, $icon, ' AND type=0');
1225 $fList = 'title,complete,priority,date';
1227 $out = $this->makeOrdinaryList('tt_calender', $id, $fList, $icon, ' AND type=1');
1232 $fList = 'title;complete;priority;date;workgroup;responsible;category,note';
1234 $out = $this->makeOrdinaryList('tt_calender', $id, $fList, $icon, ' AND type=1');
1238 // Overview, both todo and calender
1239 $fList = 'title,date,time,week';
1241 $out = $this->makeOrdinaryList('tt_calender', $id, $fList, $icon, ' AND type=0');
1242 $out .= $this->makeOrdinaryList('tt_calender', $id, $fList, $icon, ' AND type=1');
1249 * Renders shopping elements from the tt_products table from page id
1250 * NOTICE: Requires the tt_products extension to be loaded.
1252 * @param integer Page id
1253 * @return string HTML for the listing
1255 function getTable_tt_products($id) {
1257 $type = $GLOBALS['SOBE']->MOD_SETTINGS
['tt_products'];
1260 $fList = 'title;itemnumber;price;price2;inStock;category,image,note';
1262 $out = $this->makeOrdinaryList('tt_products', $id, $fList, $icon);
1265 $fList = 'title,itemnumber,price,category,image';
1267 $out = $this->makeOrdinaryList('tt_products', $id, $fList, $icon);
1275 /**********************************
1277 * Generic listing of items
1279 **********************************/
1282 * Creates a standard list of elements from a table.
1284 * @param string Table name
1285 * @param integer Page id.
1286 * @param string Comma list of fields to display
1287 * @param boolean If true, icon is shown
1288 * @param string Additional WHERE-clauses.
1289 * @return string HTML table
1291 function makeOrdinaryList($table, $id, $fList, $icon = 0, $addWhere = '') {
1296 $queryParts = $this->makeQueryArray($table, $id, $addWhere);
1297 $this->setTotalItems($queryParts);
1300 // Make query for records if there were any records found in the count operation:
1301 if ($this->totalItems
) {
1302 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
1303 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
1306 // If records were found, render the list:
1311 $this->fieldArray
= t3lib_div
::trimExplode(',', '__cmds__,' . $fList, TRUE);
1313 // Header line is drawn
1315 $theData = $this->headerFields($this->fieldArray
, $table, $theData);
1316 if ($this->doEdit
) {
1317 $theData['__cmds__'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick('&edit[' . $table . '][' . $this->id
. ']=new', $this->backPath
)) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' .
1318 t3lib_iconWorks
::getSpriteIcon('actions-document-new') .
1321 $out .= $this->addelement(1, '', $theData, ' class="c-headLine"', 15);
1324 $this->eCounter
= $this->firstElementNumber
;
1325 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
1326 t3lib_BEfunc
::workspaceOL($table, $row);
1328 if (is_array($row)) {
1329 list($flag, $code) = $this->fwd_rwd_nav();
1332 $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
1335 // Setting icons/edit links:
1337 $Nrow['__cmds__'] = $this->getIcon($table, $row);
1339 if ($this->doEdit
) {
1340 $Nrow['__cmds__'] .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $this->backPath
)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' .
1341 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
1344 $Nrow['__cmds__'] .= $this->noEditIcon();
1348 $Nrow = $this->dataFields($this->fieldArray
, $table, $row, $Nrow);
1349 $tdparams = $this->eCounter %
2 ?
' class="bgColor4"' : ' class="bgColor4-20"';
1350 $out .= $this->addelement(1, '', $Nrow, $tdparams);
1356 // Wrap it all in a table:
1360 STANDARD LIST OF "' . $table . '"
1362 <table border="0" cellpadding="1" cellspacing="2" width="480" class="typo3-page-stdlist">
1370 * Adds content to all data fields in $out array
1372 * @param array 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.
1373 * @param string Table name
1374 * @param array Record array
1375 * @param array Array to which the data is added
1376 * @return array $out array returned after processing.
1377 * @see makeOrdinaryList()
1379 function dataFields($fieldArr, $table, $row, $out = array()) {
1382 // Check table validity:
1384 t3lib_div
::loadTCA($table);
1385 $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
1388 foreach ($fieldArr as $fieldName) {
1390 if ($TCA[$table]['columns'][$fieldName]) { // Each field has its own cell (if configured in TCA)
1391 if ($fieldName == $thumbsCol) { // If the column is a thumbnail column:
1392 $out[$fieldName] = $this->thumbCode($row, $table, $fieldName);
1393 } else { // ... otherwise just render the output:
1394 $out[$fieldName] = nl2br(htmlspecialchars(trim(t3lib_div
::fixed_lgd_cs(t3lib_BEfunc
::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']), 250))));
1396 } 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)
1397 $theFields = explode(';', $fieldName);
1399 // Traverse fields, separated by ";" (displayed in a single cell).
1400 foreach ($theFields as $fName2) {
1401 if ($TCA[$table]['columns'][$fName2]) {
1402 $out[$fieldName] .= '<strong>' . $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'], 1) . '</strong>' .
1404 htmlspecialchars(t3lib_div
::fixed_lgd_cs(t3lib_BEfunc
::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']), 25)) .
1409 // If no value, add a nbsp.
1410 if (!$out[$fieldName]) {
1411 $out[$fieldName] = ' ';
1414 // Wrap in dimmed-span tags if record is "disabled"
1415 if ($this->isDisabled($table, $row)) {
1416 $out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
1424 * Header fields made for the listing of records
1426 * @param array Field names
1427 * @param string The table name
1428 * @param array Array to which the headers are added.
1429 * @return array $out returned after addition of the header fields.
1430 * @see makeOrdinaryList()
1432 function headerFields($fieldArr, $table, $out = array()) {
1435 t3lib_div
::loadTCA($table);
1437 foreach ($fieldArr as $fieldName) {
1438 $ll = $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fieldName]['label'], 1);
1439 $out[$fieldName] = '<strong>' . ($ll ?
$ll : ' ') . '</strong>';
1445 /**********************************
1447 * Additional functions; Pages
1449 **********************************/
1452 * Adds pages-rows to an array, selecting recursively in the page tree.
1454 * @param array Array which will accumulate page rows
1455 * @param integer Pid to select from
1456 * @param string Query-where clause
1457 * @param string Prefixed icon code.
1458 * @param integer Depth (decreasing)
1459 * @return array $theRows, but with added rows.
1461 function pages_getTree($theRows, $pid, $qWhere, $treeIcons, $depth) {
1464 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid=' . intval($pid) . $qWhere, '', 'sorting');
1466 $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1467 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1468 t3lib_BEfunc
::workspaceOL('pages', $row);
1469 if (is_array($row)) {
1471 $row['treeIcons'] = $treeIcons . '<img' . t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/ol/join' . ($rc == $c ?
'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />';
1475 $spaceOutIcons = '<img' . t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/ol/' . ($rc == $c ?
'blank.gif' : 'line.gif'), 'width="18" height="16"') . ' alt="" />';
1476 $theRows = $this->pages_getTree($theRows, $row['uid'], $qWhere, $treeIcons . $spaceOutIcons, $row['php_tree_stop'] ?
0 : $depth);
1480 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'pages', 'pid=' . intval($pid) . $qWhere);
1482 $this->plusPages
[$pid] = $count;
1489 * Adds a list item for the pages-rendering
1491 * @param array Record array
1492 * @param array Field list
1493 * @return string HTML for the item
1495 function pages_drawItem($row, $fieldArr) {
1499 $theIcon = $this->getIcon('pages', $row);
1501 // Preparing and getting the data-array
1503 foreach ($fieldArr as $field) {
1506 $red = $this->plusPages
[$row['uid']] ?
'<font color="red"><strong>+ </strong></font>' : '';
1507 $pTitle = htmlspecialchars(t3lib_BEfunc
::getProcessedValue('pages', $field, $row[$field], 20));
1509 $pTitle = '<a href="' . htmlspecialchars($this->script
. '?id=' . $row['uid']) . '">' . $pTitle . '</a>';
1511 $theData[$field] = $row['treeIcons'] . $theIcon . $red . $pTitle . ' ';
1513 case 'php_tree_stop':
1515 $theData[$field] = $row[$field] ?
' <strong>x</strong>' : ' ';
1518 if ($GLOBALS['BE_USER']->doesUserHaveAccess($row, 2)) {
1519 $params = '&edit[pages][' . $row['uid'] . ']=edit';
1520 $eI = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $this->backPath
, '')) . '" title="' . $GLOBALS['LANG']->getLL('editThisPage', TRUE) . '">' .
1521 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
1526 $theData[$field] = '<span align="right">' . $row['uid'] . $eI . '</span>';
1529 if (substr($field, 0, 6) == 'table_') {
1530 $f2 = substr($field, 6);
1532 $c = $this->numberOfRecords($f2, $row['uid']);
1533 $theData[$field] = ' ' . ($c ?
$c : '');
1535 } elseif (substr($field, 0, 5) == 'HITS_') {
1536 if (t3lib_extMgm
::isLoaded('sys_stat')) {
1537 $fParts = explode(':', substr($field, 5));
1538 switch ($fParts[0]) {
1540 $timespan = mktime(0, 0, 0) +
intval($fParts[1]) * 3600 * 24;
1542 $number = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
1545 $this->stat_select_field
. '=' . intval($row['uid']) .
1546 ' AND tstamp >=' . intval($timespan) .
1547 ' AND tstamp <' . intval($timespan +
3600 * 24)
1551 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1554 $this->stat_select_field
. '=' . intval($row['uid']) . '
1555 AND tstamp>=' . intval($timespan) . '
1556 AND tstamp<' . intval($timespan +
3600 * 24) . '
1557 AND surecookie!=""',
1560 $scnumber = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1562 $number .= '/' . $scnumber;
1568 $theData[$field] = ' ' . $number;
1570 $theData[$field] = ' ';
1573 $theData[$field] = ' ' . htmlspecialchars(t3lib_BEfunc
::getProcessedValue('pages', $field, $row[$field]));
1578 $this->addElement_tdParams
['title'] = ($row['_CSSCLASS'] ?
' class="' . $row['_CSSCLASS'] . '"' : '');
1579 return $this->addelement(1, '', $theData);
1583 /**********************************
1585 * Additional functions; Content Elements
1587 **********************************/
1590 * Draw header for a content element column:
1592 * @param string Column name
1593 * @param string Edit params (Syntax: &edit[...] for alt_doc.php)
1594 * @param string New element params (Syntax: &edit[...] for alt_doc.php)
1595 * @return string HTML table
1597 function tt_content_drawColHeader($colName, $editParams, $newParams) {
1600 // Create command links:
1601 if ($this->tt_contentConfig
['showCommands']) {
1604 $icons .= '<a href="#" onclick="' . htmlspecialchars($newParams) . '" title="' . $GLOBALS['LANG']->getLL('newInColumn', TRUE) . '">' .
1605 t3lib_iconWorks
::getSpriteIcon('actions-document-new') .
1608 // Edit whole of column:
1610 $icons .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($editParams, $this->backPath
)) . '" title="' . $GLOBALS['LANG']->getLL('editColumn', TRUE) . '">' .
1611 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
1615 if (strlen($icons)) {
1616 $icons = '<div class="t3-page-colHeader-icons">' . $icons . '</div>';
1619 // Create header row:
1620 $out = '<div class="t3-page-colHeader t3-row-header">
1622 <div class="t3-page-colHeader-label">' . htmlspecialchars($colName) . '</div>
1628 * Draw the header for a single tt_content element
1630 * @param array Record array
1631 * @param integer Amount of pixel space above the header.
1632 * @param boolean If set the buttons for creating new elements and moving up and down are not shown.
1633 * @param boolean If set, we are in language mode and flags will be shown for languages
1634 * @return string HTML table with the record header.
1636 function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButtons = FALSE, $langMode = FALSE) {
1639 // Load full table description:
1640 t3lib_div
::loadTCA('tt_content');
1642 // Get record locking status:
1643 if ($lockInfo = t3lib_BEfunc
::isRecordLocked('tt_content', $row['uid'])) {
1644 $lockIcon = '<a href="#" onclick="' . htmlspecialchars('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . ');return false;') . '" title="' . htmlspecialchars($lockInfo['msg']) . '">' .
1645 t3lib_iconWorks
::getSpriteIcon('status-warning-in-use') .
1651 // Call stats information hook
1653 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
1654 $_params = array('tt_content', $row['uid'], &$row);
1655 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
1656 $stat .= t3lib_div
::callUserFunction($_funcRef, $_params, $this);
1660 // Create line with type of content element and icon/lock-icon/title:
1661 $ceType = $this->getIcon('tt_content', $row) . ' ' .
1664 ($langMode ?
$this->languageFlag($row['sys_language_uid']) : '') . ' ' .
1665 ' <strong>' . htmlspecialchars($this->CType_labels
[$row['CType']]) . '</strong>';
1667 // If show info is set...;
1668 if ($this->tt_contentConfig
['showInfo']) {
1670 // Get processed values:
1672 $this->getProcessedValue('tt_content', 'hidden,starttime,endtime,fe_group,spaceBefore,spaceAfter', $row, $info);
1674 // Render control panel for the element:
1675 if ($this->tt_contentConfig
['showCommands'] && $this->doEdit
) {
1677 if (!$disableMoveAndNewButtons) {
1678 // New content element:
1679 if ($this->option_newWizard
) {
1680 $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')) . "';";
1682 $params = '&edit[tt_content][' . (-$row['uid']) . ']=new';
1683 $onClick = t3lib_BEfunc
::editOnClick($params, $this->backPath
);
1685 $out .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $GLOBALS['LANG']->getLL('newAfter', 1) . '">' .
1686 t3lib_iconWorks
::getSpriteIcon('actions-document-new') .
1690 // Edit content element:
1691 $params = '&edit[tt_content][' . $this->tt_contentData
['nextThree'][$row['uid']] . ']=edit';
1692 $out .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $this->backPath
)) . '" title="' .
1693 htmlspecialchars($this->nextThree
> 1 ?
sprintf($GLOBALS['LANG']->getLL('nextThree'), $this->nextThree
) : $GLOBALS['LANG']->getLL('edit')) . '">' .
1694 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
1698 $hiddenField = $TCA['tt_content']['ctrl']['enablecolumns']['disabled'];
1699 if ($hiddenField && $TCA['tt_content']['columns'][$hiddenField] && (!$TCA['tt_content']['columns'][$hiddenField]['exclude'] ||
$GLOBALS['BE_USER']->check('non_exclude_fields', 'tt_content:' . $hiddenField))) {
1700 if ($row[$hiddenField]) {
1701 $params = '&data[tt_content][' . ($row['_ORIG_uid'] ?
$row['_ORIG_uid'] : $row['uid']) . '][' . $hiddenField . ']=0';
1702 $out .= '<a href="' . htmlspecialchars($GLOBALS['SOBE']->doc
->issueCommand($params)) . '" title="' . $GLOBALS['LANG']->getLL('unHide', TRUE) . '">' .
1703 t3lib_iconWorks
::getSpriteIcon('actions-edit-unhide') .
1706 $params = '&data[tt_content][' . ($row['_ORIG_uid'] ?
$row['_ORIG_uid'] : $row['uid']) . '][' . $hiddenField . ']=1';
1707 $out .= '<a href="' . htmlspecialchars($GLOBALS['SOBE']->doc
->issueCommand($params)) . '" title="' . $GLOBALS['LANG']->getLL('hide', TRUE) . '">' .
1708 t3lib_iconWorks
::getSpriteIcon('actions-edit-hide') .
1714 $params = '&cmd[tt_content][' . $row['uid'] . '][delete]=1';
1715 $confirm = $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning') .
1716 t3lib_BEfunc
::translationCount('tt_content', $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord')));
1717 $out .= '<a href="' . htmlspecialchars($GLOBALS['SOBE']->doc
->issueCommand($params)) . '" onclick="' . htmlspecialchars('return confirm(' . $confirm . ');') . '" title="' . $GLOBALS['LANG']->getLL('deleteItem', TRUE) . '">' .
1718 t3lib_iconWorks
::getSpriteIcon('actions-edit-delete') .
1721 if (!$disableMoveAndNewButtons) {
1722 $out .= '<span class="t3-page-ce-icons-move">';
1724 if ($this->tt_contentData
['prev'][$row['uid']]) {
1725 $params = '&cmd[tt_content][' . $row['uid'] . '][move]=' . $this->tt_contentData
['prev'][$row['uid']];
1726 $out .= '<a href="' . htmlspecialchars($GLOBALS['SOBE']->doc
->issueCommand($params)) . '" title="' . $GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' .
1727 t3lib_iconWorks
::getSpriteIcon('actions-move-up') .
1730 $out .= t3lib_iconWorks
::getSpriteIcon('empty-empty');
1732 // Move element down:
1733 if ($this->tt_contentData
['next'][$row['uid']]) {
1734 $params = '&cmd[tt_content][' . $row['uid'] . '][move]= ' . $this->tt_contentData
['next'][$row['uid']];
1735 $out .= '<a href="' . htmlspecialchars($GLOBALS['SOBE']->doc
->issueCommand($params)) . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' .
1736 t3lib_iconWorks
::getSpriteIcon('actions-move-down') .
1739 $out .= t3lib_iconWorks
::getSpriteIcon('empty-empty');
1745 // Display info from records fields:
1748 $infoOutput = '<div class="t3-page-ce-info">
1749 ' . implode('<br />', $info) . '
1753 // Wrap the whole header
1754 // NOTE: end-tag for <div class="t3-page-ce-body"> is in getTable_tt_content()
1755 return '<h4 class="t3-page-ce-header">
1756 <div class="t3-row-header">
1760 <div class="t3-page-ce-body">
1761 <div class="t3-page-ce-type">
1768 * Draws the preview content for a content element
1770 * @param string Content element
1771 * @param boolean Set if the RTE link can be created.
1772 * @return string HTML
1774 function tt_content_drawItem($row, $isRTE = FALSE) {
1781 if ($row['header']) {
1783 $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
1785 // If header layout is set to 'hidden', display an accordant note:
1786 if ($row['header_layout'] == 100) {
1787 $hiddenHeaderNote = ' <em>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.hidden', true) . ']</em>';
1789 $outHeader = ($row['date'] ?
htmlspecialchars($this->itemLabels
['date'] . ' ' . t3lib_BEfunc
::date($row['date'])) . '<br />' : '') .
1790 '<strong>' . $this->linkEditContent($this->renderText($row['header']), $row) . $hiddenHeaderNote . '</strong><br />';
1797 // Hook: Render an own preview of a record
1798 $drawItemHooks =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'];
1800 if (is_array($drawItemHooks)) {
1801 foreach ($drawItemHooks as $hookClass) {
1802 $hookObject = t3lib_div
::getUserObj($hookClass);
1804 if (!($hookObject instanceof tx_cms_layout_tt_content_drawItemHook
)) {
1805 throw new UnexpectedValueException('$hookObject must implement interface tx_cms_layout_tt_content_drawItemHook', 1218547409);
1808 $hookObject->preProcess($this, $drawItem, $outHeader, $out, $row);
1812 // Draw preview of the item depending on its CType (if not disabled by previous hook):
1814 switch ($row['CType']) {
1816 if ($row['subheader']) {
1817 $out .= $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
1823 if ($row['CType'] == 'text' ||
$row['CType'] == 'textpic') {
1824 if ($row['bodytext']) {
1825 $this->getProcessedValue('tt_content', 'text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
1826 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1829 if ($row['CType'] == 'textpic' ||
$row['CType'] == 'image') {
1830 if ($row['image']) {
1831 $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
1832 if ($row['imagecaption']) {
1833 $out .= $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
1841 if ($row['bodytext']) {
1842 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1846 if ($row['media']) {
1847 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1851 if ($row['multimedia']) {
1852 $out .= $this->renderText($row['multimedia']) . '<br />';
1853 $out .= $this->renderText($row['parameters']) . '<br />';
1857 if ($row['bodytext']) {
1858 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1860 if ($row['image']) {
1861 $out .= $this->thumbCode($row, 'tt_content', 'image') . '<br />';
1865 if ($row['pages']) {
1866 $out .= $this->linkEditContent($row['pages'], $row) . '<br />';
1870 if ($row['records']) {
1871 $out .= $this->linkEditContent($row['shortcut'], $row) . '<br />';
1875 $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc
::getItemLabel('tt_content', 'list_type'), 1) . ' ' .
1876 $GLOBALS['LANG']->sL(t3lib_BEfunc
::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']), 1) . '<br />';
1879 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) {
1880 $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']];
1881 } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) {
1882 $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'];
1884 if (count($hookArr) > 0) {
1885 $_params = array('pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr);
1886 foreach ($hookArr as $_funcRef) {
1887 $hookOut .= t3lib_div
::callUserFunction($_funcRef, $_params, $this);
1890 if (strcmp($hookOut, '')) {
1893 $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc
::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />';
1896 $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc
::getLabelFromItemlist('tt_content', 'pages', $row['pages']), 1) . '<br />';
1899 $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc
::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />';
1900 $out .= '<br />' . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1901 $out .= '<br />' . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
1904 if ($row['bodytext']) {
1905 $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
1913 <span class="exampleContent">' . $out . '</span>';
1915 $out = $outHeader . $out;
1918 $out .= $this->linkRTEbutton($row);
1922 if ($this->isDisabled('tt_content', $row)) {
1923 return $GLOBALS['TBE_TEMPLATE']->dfw($out);
1930 * Filters out all tt_content uids which are already translated so only non-translated uids is left.
1931 * 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 (?)
1933 * @param array Numeric array with uids of tt_content elements in the default language
1934 * @param integer Page pid
1935 * @param integer Sys language UID
1936 * @return array Modified $defLanguageCount
1938 function getNonTranslatedTTcontentUids($defLanguageCount, $id, $lP) {
1939 if ($lP && count($defLanguageCount)) {
1941 // Select all translations here:
1942 $queryParts = $this->makeQueryArray('tt_content', $id, 'AND sys_language_uid=' . intval($lP) . ' AND l18n_parent IN (' . implode(',', $defLanguageCount) . ')');
1943 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
1946 $defLanguageCount = array_flip($defLanguageCount);
1948 // Traverse any selected elements and unset original UID if any:
1949 $rowArr = $this->getResult($result);
1950 foreach ($rowArr as $row) {
1951 unset($defLanguageCount[$row['l18n_parent']]);
1955 $defLanguageCount = array_keys($defLanguageCount);
1958 return $defLanguageCount;
1962 * Creates button which is used to create copies of records..
1964 * @param array Numeric array with uids of tt_content elements in the default language
1965 * @param integer Sys language UID
1966 * @return string "Copy languages" button, if available.
1968 function newLanguageButton($defLanguageCount, $lP) {
1969 if ($this->doEdit
&& count($defLanguageCount) && $lP) {
1972 foreach ($defLanguageCount as $uidVal) {
1973 $params .= '&cmd[tt_content][' . $uidVal . '][localize]=' . $lP;
1976 // Copy for language:
1977 $onClick = "window.location.href='" . $GLOBALS['SOBE']->doc
->issueCommand($params) . "'; return false;";
1978 $theNewButton = $GLOBALS['SOBE']->doc
->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent_copyForLang') . ' [' . count($defLanguageCount) . ']');
1979 return $theNewButton;
1984 * Returns an icon, which has its title attribute set to a massive amount of information about the element.
1986 * @param array Array where values are human readable output of field values (not htmlspecialchars()'ed though). The values are imploded by a linebreak.
1987 * @return string HTML img tag if applicable.
1988 * @deprecated since TYPO3 4.4, this function will be removed in TYPO3 4.6
1990 function infoGif($infoArr) {
1991 t3lib_div
::logDeprecatedFunction();
1993 if (count($infoArr) && $this->tt_contentConfig
['showInfo']) {
1994 return t3lib_iconWorks
::getSpriteIcon('actions-document-info', array('title' => htmlspecialchars(implode(LF
, $infoArr))));
1999 * Creates onclick-attribute content for a new content element
2001 * @param integer Page id where to create the element.
2002 * @param integer Preset: Column position value
2003 * @param integer Preset: Sys langauge value
2004 * @return string String for onclick attribute.
2005 * @see getTable_tt_content()
2007 function newContentElementOnClick($id, $colPos, $sys_language) {
2008 if ($this->option_newWizard
) {
2009 $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')) . "';";
2011 $onClick = t3lib_BEfunc
::editOnClick('&edit[tt_content][' . $id . ']=new&defVals[tt_content][colPos]=' . $colPos . '&defVals[tt_content][sys_language_uid]=' . $sys_language, $this->backPath
);
2017 * Will create a link on the input string and possible a big button after the string which links to editing in the RTE
2018 * Used for content element content displayed so the user can click the content / "Edit in Rich Text Editor" button
2020 * @param string String to link. Must be prepared for HTML output.
2021 * @param array The row.
2022 * @return string If the whole thing was editable ($this->doEdit) $str is return with link around. Otherwise just $str.
2023 * @see getTable_tt_content()
2025 function linkEditContent($str, $row) {
2029 if ($this->doEdit
) {
2030 // Setting onclick action for content link:
2031 $onClick = t3lib_BEfunc
::editOnClick('&edit[tt_content][' . $row['uid'] . ']=edit', $this->backPath
);
2034 return $onClick ?
'<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $GLOBALS['LANG']->getLL('edit', 1) . '">' . $str . '</a>' . $addButton : $str;
2038 * Adds a button to edit the row in RTE wizard
2040 * @param array The row of tt_content element
2041 * @return string Button to click if you want to edit in RTE wizard.
2043 function linkRTEbutton($row) {
2045 $params['table'] = 'tt_content';
2046 $params['uid'] = $row['uid'];
2047 $params['pid'] = $row['pid'];
2048 $params['field'] = 'bodytext';
2049 $params['returnUrl'] = t3lib_div
::linkThisScript();
2050 $RTEonClick = "window.location.href='" . $this->backPath
. "wizard_rte.php?" . t3lib_div
::implodeArrayForUrl('', array('P' => $params)) . "';return false;";
2051 $addButton = $this->option_showBigButtons
&& $this->doEdit ?
$GLOBALS['SOBE']->doc
->t3Button($RTEonClick, $GLOBALS['LANG']->getLL('editInRTE')) : '';
2057 * Make selector box for creating new translation in a language
2058 * Displays only languages which are not yet present for the current page and
2059 * that are not disabled with page TS.
2061 * @param integer Page id for which to create a new language (pages_language_overlay record)
2062 * @return string <select> HTML element (if there were items for the box anyways...)
2063 * @see getTable_tt_content()
2065 function languageSelector($id) {
2066 if ($GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay')) {
2068 // First, select all
2069 $res = $GLOBALS['SOBE']->exec_languageQuery(0);
2070 $langSelItems = array();
2071 $langSelItems[0] = '
2072 <option value="0"></option>';
2073 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
2074 if ($GLOBALS['BE_USER']->checkLanguageAccess($row['uid'])) {
2075 $langSelItems[$row['uid']] = '
2076 <option value="' . $row['uid'] . '">' . htmlspecialchars($row['title']) . '</option>';
2080 // Then, subtract the languages which are already on the page:
2081 $res = $GLOBALS['SOBE']->exec_languageQuery($id);
2082 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
2083 unset($langSelItems[$row['uid']]);
2085 // Remove disallowed languages
2086 if (count($langSelItems) > 1 &&
2087 !$GLOBALS['BE_USER']->user
['admin'] &&
2088 strlen($GLOBALS['BE_USER']->groupData
['allowed_languages'])) {
2090 $allowed_languages = array_flip(explode(',', $GLOBALS['BE_USER']->groupData
['allowed_languages']));
2092 if (count($allowed_languages)) {
2093 foreach ($langSelItems as $key => $value) {
2094 if (!isset($allowed_languages[$key]) && $key != 0) {
2095 unset($langSelItems[$key]);
2100 // Remove disabled languages
2101 $modSharedTSconfig = t3lib_BEfunc
::getModTSconfig($id, 'mod.SHARED');
2102 $disableLanguages = isset($modSharedTSconfig['properties']['disableLanguages']) ? t3lib_div
::trimExplode(',', $modSharedTSconfig['properties']['disableLanguages'], 1) : array();
2103 if (count($langSelItems) && count($disableLanguages)) {
2104 foreach ($disableLanguages as $language) {
2105 if ($language != 0 && isset($langSelItems[$language])) {
2106 unset($langSelItems[$language]);
2111 // If any languages are left, make selector:
2112 if (count($langSelItems) > 1) {
2113 $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')) . '\'';
2114 return $GLOBALS['LANG']->getLL('new_language', 1) . ': <select name="createNewLanguage" onchange="' . htmlspecialchars($onChangeContent) . '">
2115 ' . implode('', $langSelItems) . '
2116 </select><br /><br />';
2122 * Traverse the result pointer given, adding each record to array and setting some internal values at the same time.
2124 * @param pointer SQL result pointer for select query.
2125 * @param string Table name defaulting to tt_content
2126 * @return array The selected rows returned in this array.
2128 function getResult($result, $table = 'tt_content') {
2133 $nextTree = $this->nextThree
;
2137 // Traverse the result:
2138 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
2140 t3lib_BEfunc
::workspaceOL($table, $row, -99, TRUE);
2143 // Add the row to the array:
2146 // Set an internal register:
2147 $recs[$c] = $row['uid'];
2149 // Create the list of the next three ids (for editing links...)
2150 for ($a = 0; $a < $nextTree; $a++
) {
2151 if (isset($recs[$c - $a])) {
2152 $this->tt_contentData
['nextThree'][$recs[$c - $a]] .= $row['uid'] . ',';
2156 // Set next/previous ids:
2157 if (isset($recs[$c - 1])) {
2158 if (isset($recs[$c - 2])) {
2159 $this->tt_contentData
['prev'][$row['uid']] = -$recs[$c - 2];
2161 $this->tt_contentData
['prev'][$row['uid']] = $row['pid'];
2163 $this->tt_contentData
['next'][$recs[$c - 1]] = -$row['uid'];
2169 // Return selected records
2174 /**********************************
2176 * Additional functions; Message board items (tt_board)
2178 **********************************/
2181 * Traverses recursively a branch in a message board.
2183 * @param array Array of rows (build up recursively)
2184 * @param integer tt_content parent uid
2185 * @param integer Page id
2186 * @param string Additional query part.
2187 * @param string HTML content to prefix items with (to draw the proper tree-graphics)
2188 * @return array $theRows, but with added content
2190 function tt_board_getTree($theRows, $parent, $pid, $qWhere, $treeIcons) {
2192 // Select tt_board elements:
2193 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_board', 'pid=' . intval($pid) . ' AND parent=' . intval($parent) . $qWhere, '', 'crdate');
2195 // Traverse the results:
2197 $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
2198 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
2200 $row['treeIcons'] = $treeIcons . '<img' . t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/ol/' . ($rc == $c ?
'joinbottom.gif' : 'join.gif'), 'width="18" height="16"') . ' alt="" />';
2204 $theRows = $this->tt_board_getTree(
2209 $treeIcons . '<img' . t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/ol/' . ($rc == $c ?
'blank.gif' : 'line.gif'), 'width="18" height="16"') . ' alt="" />'
2213 // Return modified rows:
2218 * Adds an element to the tt_board listing:
2220 * @param string Table name
2221 * @param array The record row
2222 * @param string Reply count, if applicable.
2223 * @return string Return content of element (table row)
2225 function tt_board_drawItem($table, $row, $re) {
2227 // Building data-arary with content:
2229 $theData['subject'] = t3lib_div
::fixed_lgd_cs(htmlspecialchars($row['subject']), 25) . ' ';
2230 $theData['author'] = t3lib_div
::fixed_lgd_cs(htmlspecialchars($row['author']), 15) . ' ';
2231 $theData['date'] = t3lib_div
::fixed_lgd_cs(t3lib_BEfunc
::datetime($row['crdate']), 20) . ' ';
2232 $theData['age'] = t3lib_BEfunc
::calcAge($GLOBALS['EXEC_TIME'] - $row['crdate'], $this->agePrefixes
) . ' ';
2234 $theData['replys'] = $re;
2237 // Subject is built:
2238 $theData['subject'] =
2240 $this->getIcon($table, $row) .
2241 $theData['subject'];
2244 return $this->addelement(1, '', $theData);
2248 /********************************
2250 * Various helper functions
2252 ********************************/
2255 * Counts and returns the number of records on the page with $pid
2257 * @param string Table name
2258 * @param integer Page id
2259 * @return integer Number of records.
2261 function numberOfRecords($table, $pid) {
2262 if ($GLOBALS['TCA'][$table]) {
2263 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
2266 'pid=' . intval($pid) .
2267 t3lib_BEfunc
::deleteClause($table) .
2268 t3lib_BEfunc
::versioningPlaceholderClause($table)
2271 return intval($count);
2275 * Processing of larger amounts of text (usually from RTE/bodytext fields) with word wrapping etc.
2277 * @param string Input string
2278 * @return string Output string
2280 function renderText($input) {
2281 $input = $this->strip_tags($input, true);
2282 $input = t3lib_div
::fixed_lgd_cs($input, 1500);
2283 return nl2br(htmlspecialchars(trim($this->wordWrapper($input))));
2287 * Creates the icon image tag for record from table and wraps it in a link which will trigger the click menu.
2289 * @param string Table name
2290 * @param array Record array
2291 * @param string Record title (NOT USED)
2292 * @return string HTML for the icon
2294 function getIcon($table, $row) {
2297 $alttext = t3lib_BEfunc
::getRecordIconAltText($row, $table);
2298 $iconImg = t3lib_iconWorks
::getSpriteIconForRecord($table, $row, array('title' => $alttext));
2301 // The icon with link
2302 $theIcon = $GLOBALS['SOBE']->doc
->wrapClickMenuOnIcon($iconImg, $table, $row['uid']);
2308 * Creates processed values for all fieldnames in $fieldList based on values from $row array.
2309 * The result is 'returned' through $info which is passed as a reference
2311 * @param string Table name
2312 * @param string Commalist of fields.
2313 * @param array Record from which to take values for processing.
2314 * @param array Array to which the processed values are added.
2317 function getProcessedValue($table, $fieldList, $row, &$info) {
2319 // Splitting values from $fieldList:
2320 $fieldArr = explode(',', $fieldList);
2322 // Traverse fields from $fieldList:
2323 foreach ($fieldArr as $field) {
2325 $info[] = htmlspecialchars($this->itemLabels
[$field]) . ' ' . htmlspecialchars(t3lib_BEfunc
::getProcessedValue($table, $field, $row[$field]));
2331 * Returns true, if the record given as parameters is NOT visible based on hidden/starttime/endtime (if available)
2333 * @param string Tablename of table to test
2334 * @param array Record row.
2335 * @return boolean Returns true, if disabled.
2337 function isDisabled($table, $row) {
2340 ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) ||
2341 ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME']) ||
2342 ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME'])
2349 * 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.
2350 * Works well on normal texts, little less well when HTML is involved (since much HTML will have long strings that will be broken).
2352 * @param string Content to word-wrap.
2353 * @param integer Max number of chars in a word before it will be wrapped.
2354 * @param string Character to insert when wrapping.
2355 * @return string Processed output.
2357 function wordWrapper($content, $max = 50, $char = ' -') {
2358 $array = preg_split('/[ ' . LF
. ']/', $content);
2359 foreach ($array as $val) {
2360 if (strlen($val) > $max) {
2361 $content = str_replace($val, substr(chunk_split($val, $max, $char), 0, -1), $content);
2368 * Returns icon for "no-edit" of a record.
2369 * 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...
2371 * @param string Label key from LOCAL_LANG
2372 * @return string IMG tag for icon.
2374 function noEditIcon($label = 'noEditItems') {
2375 return t3lib_iconWorks
::getSpriteIcon('status-edit-read-only', array('title' => $GLOBALS['LANG']->getLL($label, TRUE)));
2379 * 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.
2383 function cleanTableNames() {
2386 // Get all table names:
2387 $tableNames = array_flip(array_keys($TCA));
2389 // Unset common names:
2390 unset($tableNames['pages']);
2391 unset($tableNames['static_template']);
2392 unset($tableNames['sys_filemounts']);
2393 unset($tableNames['sys_action']);
2394 unset($tableNames['sys_workflows']);
2395 unset($tableNames['be_users']);
2396 unset($tableNames['be_groups']);
2398 $this->allowedTableNames
= array();
2400 // Traverse table names and set them in allowedTableNames array IF they can be read-accessed by the user.
2401 if (is_array($tableNames)) {
2402 foreach ($tableNames as $k => $v) {
2403 if ($GLOBALS['BE_USER']->check('tables_select', $k)) {
2404 $this->allowedTableNames
['table_' . $k] = $k;
2411 * Checking if the RTE is available/enabled for a certain table/field and if so, it returns true.
2412 * Used to determine if the RTE button should be displayed.
2414 * @param string Table name
2415 * @param array Record row (needed, if there are RTE dependencies based on other fields in the record)
2416 * @param string Field name
2417 * @return boolean Returns true if the rich text editor would be enabled/available for the field name specified.
2419 function isRTEforField($table, $row, $field) {
2420 $specConf = $this->getSpecConfForField($table, $row, $field);
2421 $p = t3lib_BEfunc
::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
2422 if (isset($specConf['richtext']) && (!$p['flag'] ||
!$row[$p['flag']])) {
2423 t3lib_BEfunc
::fixVersioningPid($table, $row);
2424 list($tscPID, $thePidValue) = t3lib_BEfunc
::getTSCpid($table, $row['uid'], $row['pid']);
2425 if ($thePidValue >= 0) { // If the pid-value is not negative (that is, a pid could NOT be fetched)
2426 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc
::getPagesTSconfig($tscPID));
2427 $RTEtypeVal = t3lib_BEfunc
::getTCAtypeValue($table, $row);
2428 $thisConfig = t3lib_BEfunc
::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal);
2429 if (!$thisConfig['disabled']) {
2439 * Returns "special" configuration from the "types" configuration in TCA for the record given by tablename/fieldname.
2440 * Used by isRTEforField() in the process of finding whether a field has RTE enabled or not.
2442 * @param string Table name
2443 * @param array Record array
2444 * @param string Field name
2445 * @return array Spec. conf (if available)
2447 * @see isRTEforField()
2449 function getSpecConfForField($table, $row, $field) {
2451 // Get types-configuration for the record:
2452 $types_fieldConfig = t3lib_BEfunc
::getTCAtypes($table, $row);
2454 // Find the given field and return the spec key value if found:
2455 if (is_array($types_fieldConfig)) {
2456 foreach ($types_fieldConfig as $vconf) {
2457 if ($vconf['field'] == $field) {
2458 return $vconf['spec'];
2465 /*****************************************
2467 * External renderings
2469 *****************************************/
2472 * Creates an info-box for the current page (identified by input record).
2474 * @param array Page record
2475 * @param boolean If set, there will be shown an edit icon, linking to editing of the page properties.
2476 * @return string HTML for the box.
2478 function getPageInfoBox($rec, $edit = 0) {
2481 // If editing of the page properties is allowed:
2483 $params = '&edit[pages][' . $rec['uid'] . ']=edit';
2484 $editIcon = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc
::editOnClick($params, $this->backPath
)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' .
2485 t3lib_iconWorks
::getSpriteIcon('actions-document-open') .
2488 $editIcon = $this->noEditIcon('noEditPage');
2491 // Setting page icon, link, title:
2492 $outPutContent = t3lib_iconWorks
::getSpriteIconForRecord('pages', $rec, array('title' => t3lib_BEfunc
::titleAttribForPages($rec))) .
2495 htmlspecialchars($rec['title']);
2498 // Init array where infomation is accumulated as label/value pairs.
2501 // Owner user/group:
2502 if ($this->pI_showUser
) {
2504 $users = t3lib_BEfunc
::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
2505 $groupArray = explode(',', $GLOBALS['BE_USER']->user
['usergroup_cached_list']);
2506 $users = t3lib_BEfunc
::blindUserNames($users, $groupArray);
2507 $lines[] = array($LANG->getLL('pI_crUser') . ':', htmlspecialchars($users[$rec['cruser_id']]['username']) . ' (' . $users[$rec['cruser_id']]['realName'] . ')');
2512 $LANG->getLL('pI_crDate') . ':',
2513 t3lib_BEfunc
::datetime($rec['crdate']) . ' (' . t3lib_BEfunc
::calcAge($GLOBALS['EXEC_TIME'] - $rec['crdate'], $this->agePrefixes
) . ')',
2518 $LANG->getLL('pI_lastChange') . ':',
2519 t3lib_BEfunc
::datetime($rec['tstamp']) . ' (' . t3lib_BEfunc
::calcAge($GLOBALS['EXEC_TIME'] - $rec['tstamp'], $this->agePrefixes
) . ')',
2522 // Last change of content:
2523 if ($rec['SYS_LASTCHANGED']) {
2525 $LANG->getLL('pI_lastChangeContent') . ':',
2526 t3lib_BEfunc
::datetime($rec['SYS_LASTCHANGED']) . ' (' . t3lib_BEfunc
::calcAge($GLOBALS['EXEC_TIME'] - $rec['SYS_LASTCHANGED'], $this->agePrefixes
) . ')',
2533 // Display contents of certain page fields, if any value:
2534 $dfields = explode(',', 'alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
2535 foreach ($dfields as $fV) {
2537 $lines[] = array($GLOBALS['LANG']->sL(t3lib_BEfunc
::getItemLabel('pages', $fV)), t3lib_BEfunc
::getProcessedValue('pages', $fV, $rec[$fV]));
2541 // Page hits (depends on "sys_stat" extension)
2542 if ($this->pI_showStat
&& t3lib_extMgm
::isLoaded('sys_stat')) {
2544 // Counting total hits:
2545 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_stat', 'page_id=' . intval($rec['uid']));
2549 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id=' . intval($rec['uid']));
2550 $rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
2553 $lines[] = array($LANG->getLL('pI_hitsPeriod') . ':', t3lib_BEfunc
::date($rrow2[0]) . ' - ' . t3lib_BEfunc
::date($rrow2[1]) . ' (' . t3lib_BEfunc
::calcAge($rrow2[1] - $rrow2[0], $this->agePrefixes
) . ')');
2554 $lines[] = array($LANG->getLL('pI_hitsTotal') . ':', $rrow2[0]);
2558 $nextMidNight = mktime(0, 0, 0) +
1 * 3600 * 24;
2560 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextMidNight . '-tstamp)/(24*3600)) AS day', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextMidNight - 10 * 24 * 3600), 'day');
2562 while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
2563 $days[$rrow[1]] = $rrow[0];
2567 $contentH = array();
2568 for ($a = 9; $a >= 0; $a--) {
2570 <td class="bgColor5" nowrap="nowrap"> ' . date('d', $nextMidNight - ($a +
1) * 24 * 3600) . ' </td>';
2572 <td align="center">' . ($days[$a] ?
intval($days[$a]) : '-') . '</td>';
2575 // Compile first hit-table (last 10 days)
2577 <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits">
2578 <tr>' . implode('', $headerH) . '</tr>
2579 <tr>' . implode('', $contentH) . '</tr>
2581 $lines[] = array($LANG->getLL('pI_hits10days') . ':', $hitTable, 1);
2585 $nextHour = mktime(date('H'), 0, 0) +
3600;
2588 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*), FLOOR((' . $nextHour . '-tstamp)/3600) AS hours', 'sys_stat', 'page_id=' . intval($rec['uid']) . ' AND tstamp>' . ($nextHour - $hours * 3600), 'hours');
2590 while ($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
2591 $days[$rrow[1]] = $rrow[0];
2595 $contentH = array();
2596 for ($a = ($hours - 1); $a >= 0; $a--) {
2598 <td class="bgColor5" nowrap="nowrap"> ' . intval(date('H', $nextHour - ($a +
1) * 3600)) . ' </td>';
2600 <td align="center">' . ($days[$a] ?
intval($days[$a]) : '-') . '</td>';
2603 // Compile second hit-table (last 24 hours)
2605 <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat">
2606 <tr>' . implode('', $headerH) . '</tr>
2607 <tr>' . implode('', $contentH) . '</tr>
2609 $lines[] = array($LANG->getLL('pI_hits24hours') . ':', $hitTable, 1);
2614 // Finally, wrap the elements in the $lines array in table cells/rows
2615 foreach ($lines as $fV) {
2616 if (is_array($fV)) {
2618 $fV[1] = htmlspecialchars($fV[1]);
2622 <td class="bgColor4" nowrap="nowrap"><strong>' . htmlspecialchars($fV[0]) . ' </strong></td>
2623 <td class="bgColor4">' . $fV[1] . '</td>
2628 <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
2633 // Wrap table tags around...
2641 <table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
2645 // ... and return it.
2646 return $outPutContent;
2650 * Creates a menu of the tables that can be listed by this function
2651 * Only tables which has records on the page will be included.
2652 * Notice: The function also fills in the internal variable $this->activeTables with icon/titles.
2654 * @param integer Page id from which we are listing records (the function will look up if there are records on the page)
2655 * @return string HTML output.
2657 function getTableMenu($id) {
2661 $this->activeTables
= array();
2662 $theTables = explode(',', 'tt_content,fe_users,tt_address,tt_links,tt_board,tt_guest,tt_calender,tt_products,tt_news'); // NOTICE: This serves double function: Both being tables names (all) and for most others also being extension keys for the extensions they are related to!
2665 if (is_array($this->externalTables
)) {
2666 $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables
)));
2669 // Traverse tables to check:
2670 foreach ($theTables as $tName) {
2672 // Check access and whether the proper extensions are loaded:
2673 if ($GLOBALS['BE_USER']->check('tables_select', $tName) && (t3lib_extMgm
::isLoaded($tName) || t3lib_div
::inList('fe_users,tt_content', $tName) ||
isset($this->externalTables
[$tName]))) {
2675 // Make query to count records from page:
2676 $c = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
2679 'pid=' . intval($id) .
2680 t3lib_BEfunc
::deleteClause($tName) .
2681 t3lib_BEfunc
::versioningPlaceholderClause($tName)
2684 // If records were found (or if "tt_content" is the table...):
2685 if ($c || t3lib_div
::inList('tt_content', $tName)) {
2689 <td><a href="#' . $tName . '"></a>' .
2690 t3lib_iconWorks
::getSpriteIconForRecord($tName, Array(), array('title' => $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'], 1))) .
2693 // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
2694 $this->activeTables
[$tName] =
2695 t3lib_iconWorks
::getSpriteIconForRecord($tName, Array(), array('title' => $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'], 1) . ': ' . $c . ' ' . $GLOBALS['LANG']->getLL('records',