"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/cms/layout/class.tx_cms_layout.php Source File", "datetime" => "Sat Dec 2 19:22:27 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

class.tx_cms_layout.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00115 class tx_cms_layout extends recordList {
00116 
00117                 // External, static: For page statistics:
00118         var $stat_select_field='page_id';               // fieldname from sys_stat to select on.
00119         var $stat_codes=array();                                // eg.  "HITS_days:-1"
00120 
00121                 // External, static: Flags of various kinds:
00122         var $pI_showUser=0;                                             // If true, users/groups are shown in the page info box.
00123         var $pI_showStat=1;                                             // If true, hit statistics are shown in the page info box.
00124         var $nextThree = 3;                                             // The number of successive records to edit when showing content elements.
00125         var $pages_noEditColumns=0;                             // If true, disables the edit-column icon for tt_content elements
00126         var $option_showBigButtons=1;                   // If true, shows big buttons for editing page properties, moving, creating elements etc. in the columns view.
00127         var $option_newWizard=1;                                // If true, new-wizards are linked to rather than the regular new-element list.
00128         var $ext_function=0;                                    // If set to "1", will link a big button to content element wizard.
00129         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.
00130         var $agePrefixes = ' min| hrs| days| yrs';      // Age prefixes for displaying times. May be set externally to localized values.
00131         var $externalTables = array();                  // Array of tables which is configured to be listed by the Web > Page module in addition to the default tables.
00132         var $descrTable;                                                // "Pseudo" Description -table name
00133         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!
00134 
00135                 // External, static: Configuration of tt_content element display:
00136         var $tt_contentConfig = Array (
00137                 'showInfo' => 1,                                        // Boolean: Display info-marks or not
00138                 'showCommands' => 1,                            // Boolean: Display up/down arrows and edit icons for tt_content records
00139                 'showCommands_info' => 1,                       // Boolean: Displays infoGif with the command buttons
00140                 'single' => 1,                                          // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page
00141                 'showSingleCol' => 0,                           // The column(s) to show if single mode (under each other)
00142                 'languageCols' => 0,
00143                 'languageMode' => 0,
00144                 'languageColsPointer' => 0,
00145                 'showHidden' => 1,                                      // Displays hidden records as well
00146                 'sys_language_uid' => 0,                        // Which language
00147                 'cols' => '1,0,2,3'                                     // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
00148         );
00149 
00150                 // Internal, dynamic:
00151         var $allowedTableNames=array();                 // Will contain a list of tables which can be listed by the user.
00152         var $activeTables = array();                    // Contains icon/title of pages which are listed in the tables menu (see getTableMenu() function )
00153         var $tt_contentData = Array(
00154                 'nextThree' => Array(),
00155                 'prev' => Array(),
00156                 'next' => Array()
00157         );
00158         var $CType_labels=array();                              // Used to store labels for CTypes for tt_content elements
00159         var $itemLabels=array();                                // Used to store labels for the various fields in tt_content elements
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167         /*****************************************
00168          *
00169          * Renderings
00170          *
00171          *****************************************/
00172 
00180         function getTable($table,$id)   {
00181 
00182                         // Load full table definition:
00183                 t3lib_div::loadTCA($table);
00184 
00185                 if (isset($this->externalTables[$table]))       {
00186                         $fList = $this->externalTables[$table][0]['fList'];     // eg. "name;title;email;company,image"
00187                         $icon = $this->externalTables[$table][0]['icon'];       // Boolean,
00188 
00189                                 // Create listing
00190                         $out = $this->makeOrdinaryList($table, $id, $fList, $icon);
00191                         return $out;
00192                 } else {
00193                                 // Branch out based on table name:
00194                                 // 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.
00195                         switch($table)  {
00196                                 case 'pages':
00197                                         return $this->getTable_pages($id);
00198                                 break;
00199                                 case 'tt_content':
00200                                         return $this->getTable_tt_content($id);
00201                                 break;
00202                                 case 'fe_users':
00203                                         return $this->getTable_fe_users($id);
00204                                 break;
00205                                 case 'sys_note':
00206                                         return $this->getTable_sys_note($id);
00207                                 break;
00208                                 case 'tt_board':
00209                                         return $this->getTable_tt_board($id);
00210                                 break;
00211                                 case 'tt_address':
00212                                         return $this->getTable_tt_address($id);
00213                                 break;
00214                                 case 'tt_links':
00215                                         return $this->getTable_tt_links($id);
00216                                 break;
00217                                 case 'tt_guest':
00218                                         return $this->getTable_tt_guest($id);
00219                                 break;
00220                                 case 'tt_news':
00221                                         return $this->getTable_tt_news($id);
00222                                 break;
00223                                 case 'tt_calender':
00224                                         return $this->getTable_tt_calender($id);
00225                                 break;
00226                                 case 'tt_products':
00227                                         return $this->getTable_tt_products($id);
00228                                 break;
00229                         }
00230                 }
00231         }
00232 
00240         function getTable_pages($id)    {
00241                 global $TCA;
00242 
00243                         // Initializing:
00244                 $out='';
00245                 $delClause = t3lib_BEfunc::deleteClause('pages').' AND '.$GLOBALS['BE_USER']->getPagePermsClause(1);            // Select clause for pages:
00246 
00247                         // Select current page:
00248                 if (!$id)       {
00249                         $row = $GLOBALS['SOBE']->pageinfo;              // The root has a pseudo record in pageinfo...
00250                 } else {
00251                         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid='.intval($id).$delClause);
00252                         $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
00253                         t3lib_BEfunc::workspaceOL('pages', $row);
00254                 }
00255 
00256                         // If there was found a page:
00257                 if (is_array($row))     {
00258 
00259                                 // Select which fields to show:
00260                         $pKey = $GLOBALS['SOBE']->MOD_SETTINGS['function']=='tx_cms_webinfo_hits' ? 'hits' : $GLOBALS['SOBE']->MOD_SETTINGS['pages'];
00261                         switch($pKey)   {
00262                                 case 'hits':
00263                                         $this->fieldArray = explode(',','title,'.implode(',',$this->stat_codes));
00264                                 break;
00265                                 case 1:
00266                                         $this->cleanTableNames();
00267                                         $tableNames=$this->allowedTableNames;
00268                                         $this->fieldArray = explode(',','title,uid,'.implode(',',array_keys($tableNames)));
00269                                 break;
00270                                 case 2:
00271                                         $this->fieldArray = explode(',','title,uid,lastUpdated,newUntil,no_cache,cache_timeout,php_tree_stop,TSconfig,storage_pid,is_siteroot,fe_login_mode');
00272                                 break;
00273                                 default:
00274                                         $this->fieldArray = explode(',','title,uid,alias,starttime,endtime,fe_group,target,url,shortcut,shortcut_mode');
00275                                 break;
00276                         }
00277 
00278                                 // Getting select-depth:
00279                         $depth=intval($GLOBALS['SOBE']->MOD_SETTINGS['pages_levels']);
00280 
00281                                 // Half line is drawn
00282                         $theData = Array();
00283                         $theData['subject'] = $this->widthGif;
00284                         $out.=$this->addelement(0,'',$theData);
00285 
00286                                 // Overriding a few things:
00287                         $this->no_noWrap=0;
00288                         $this->oddColumnsTDParams=' class="bgColor3-20"';
00289 
00290                                 // Items
00291                         $this->eCounter=$this->firstElementNumber;
00292 
00293                                 // Creating elements:
00294                         list($flag,$code) = $this->fwd_rwd_nav();
00295                         $out.=$code;
00296                         $editUids=array();
00297                         if ($flag)      {
00298 
00299                                         // Getting children:
00300                                 $theRows = Array();
00301                                 $theRows = $this->pages_getTree($theRows,$row['uid'],$delClause.t3lib_BEfunc::versioningPlaceholderClause('pages'),'',$depth);
00302                                 if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2))    $editUids[]=$row['uid'];
00303                                 $out.=$this->pages_drawItem($row,$this->fieldArray);
00304 
00305                                         // Traverse all pages selected:
00306                                 foreach($theRows as $n => $sRow)        {
00307                                         if ($GLOBALS['BE_USER']->doesUserHaveAccess($sRow,2))   $editUids[]=$sRow['uid'];
00308                                         $out.=$this->pages_drawItem($sRow,$this->fieldArray);
00309                                 }
00310                                 $this->eCounter++;
00311                         }
00312 
00313                                 // Header line is drawn
00314                         $theData = Array();
00315                         $editIdList = implode(',', $editUids);
00316 
00317                                 // Traverse fields (as set above) in order to create header values:
00318                         foreach($this->fieldArray as $field)    {
00319                                 if ($editIdList && isset($TCA['pages']['columns'][$field]) && $field!='uid' && !$this->pages_noEditColumns)     {
00320                                         $params='&edit[pages]['.$editIdList.']=edit&columnsOnly='.$field.'&disHelp=1';
00321                                         $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'),ereg_replace(':$','',trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$field)))));
00322                                         $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'.
00323                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
00324                                                         '</a>';
00325                                 } else $eI='';
00326                                 switch($field)  {
00327                                         case 'title':
00328                                                 $theData[$field] = '&nbsp;<b>'.$GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label']).'</b>'.$eI;
00329                                         break;
00330                                         case 'uid':
00331                                                 $theData[$field] = '&nbsp;<b>ID:</b>';
00332                                         break;
00333                                         default:
00334                                                 if (substr($field,0,6)=='table_')       {
00335                                                         $f2 = substr($field,6);
00336                                                         if ($TCA[$f2])  {
00337                                                                 $theData[$field] = '&nbsp;'.t3lib_iconWorks::getIconImage($f2,array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$f2]['ctrl']['title'],1).'"');
00338                                                         }
00339                                                 } elseif (substr($field,0,5)=='HITS_')  {
00340                                                         $fParts = explode(':',substr($field,5));
00341                                                         switch($fParts[0])      {
00342                                                                 case 'days':
00343                                                                         $timespan = mktime (0,0,0)+intval($fParts[1])*3600*24;
00344                                                                         $theData[$field]='&nbsp;'.date('d',$timespan);
00345                                                                 break;
00346                                                                 default:
00347                                                                         $theData[$field] = '';
00348                                                                 break;
00349                                                         }
00350                                                 } else {
00351                                                         $theData[$field] = '&nbsp;&nbsp;<b>'.$GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label'],1).'</b>'.$eI;
00352                                                 }
00353                                         break;
00354                                 }
00355                         }
00356 
00357                                 // Start table:
00358                         $this->oddColumnsTDParams = '';
00359 
00360                                 // CSH:
00361                         $out = t3lib_BEfunc::cshItem($this->descrTable,'func_'.$pKey,$GLOBALS['BACK_PATH']).
00362                                 '
00363                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-pages">
00364                                         '.$this->addelement(1,'',$theData,' class="c-headLine"',20).
00365                                         $out.'
00366                                 </table>';
00367                 }
00368                 $this->oddColumnsTDParams = '';
00369                 return $out;
00370         }
00371 
00378         function getTable_tt_content($id)       {
00379                 global $TCA;
00380 
00381                 $this->initializeLanguages();
00382 
00383                         // Initialize:
00384                 $RTE = $GLOBALS['BE_USER']->isRTE();
00385                 $lMarg=1;
00386                 $showHidden = $this->tt_contentConfig['showHidden']?'':t3lib_BEfunc::BEenableFields('tt_content');
00387                 $pageTitleParamForAltDoc='&recTitle='.rawurlencode(t3lib_BEfunc::getRecordTitle('pages',t3lib_BEfunc::getRecordWSOL('pages',$id),1));
00388 
00389                         // Get labels for CTypes and tt_content element fields in general:
00390                 $this->CType_labels =array();
00391                 foreach($TCA['tt_content']['columns']['CType']['config']['items'] as $val)              {
00392                         $this->CType_labels[$val[1]]=$GLOBALS['LANG']->sL($val[0]);
00393                 }
00394                 $this->itemLabels =array();
00395                 foreach($TCA['tt_content']['columns'] as $name => $val) {
00396                         $this->itemLabels[$name]=$GLOBALS['LANG']->sL($val['label']);
00397                 }
00398 
00399 
00400                         // Select display mode:
00401                 if (!$this->tt_contentConfig['single']) {               // MULTIPLE column display mode, side by side:
00402 
00403                                 // Setting language list:
00404                         $langList = $this->tt_contentConfig['sys_language_uid'];
00405                         if ($this->tt_contentConfig['languageMode'])    {
00406                                 if ($this->tt_contentConfig['languageColsPointer'])     {
00407                                         $langList='0,'.$this->tt_contentConfig['languageColsPointer'];
00408                                 } else {
00409                                         $langList=implode(',',array_keys($this->tt_contentConfig['languageCols']));
00410                                 }
00411                                 $languageColumn = array();
00412                         }
00413                         $langListArr = explode(',',$langList);
00414                         $defLanguageCount = array();
00415                         $defLangBinding = array();
00416 
00417                                 // For EACH languages... :
00418                         foreach($langListArr as $lP)    {       // If NOT languageMode, then we'll only be through this once.
00419                                 $showLanguage = $this->defLangBinding && $lP==0 ? ' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid='.$lP;
00420                                 $cList = explode(',',$this->tt_contentConfig['cols']);
00421                                 $content = array();
00422                                 $head = array();
00423 
00424                                         // For EACH column, render the content into a variable:
00425                                 foreach($cList as $key) {
00426                                         if (!$lP) $defLanguageCount[$key] = array();
00427 
00428                                                 // Select content elements from this column/language:
00429                                         $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos='.intval($key).$showHidden.$showLanguage);
00430                                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00431 
00432                                                 // 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:
00433                                         if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result))     {
00434                                                 $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'))."';";
00435                                                 $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent'));
00436                                                 $content[$key].= '<img src="clear.gif" width="1" height="5" alt="" /><br />'.$theNewButton;
00437                                         }
00438 
00439                                                 // Traverse any selected elements and render their display code:
00440                                         $rowArr = $this->getResult($result);
00441 
00442                                         foreach($rowArr as $rKey => $row)       {
00443                                                 t3lib_BEfunc::workspaceOL('tt_content', $row);
00444 
00445                                                 if ((int)$row['t3ver_state']!=2)        {
00446                                                         $singleElementHTML = '';
00447                                                         if (!$lP) $defLanguageCount[$key][] = $row['uid'];
00448 
00449                                                         $editUidList.= $row['uid'].',';
00450                                                         $singleElementHTML.= $this->tt_content_drawHeader($row,$this->tt_contentConfig['showInfo']?15:5, $this->defLangBinding && $lP>0, TRUE);
00451 
00452                                                         $isRTE = $RTE && $this->isRTEforField('tt_content',$row,'bodytext');
00453                                                         $singleElementHTML.= '<div '.($row['_ORIG_uid'] ? ' class="ver-element"' :'').'>'.$this->tt_content_drawItem($row,$isRTE).'</div>';
00454 
00455                                                         if ($this->defLangBinding && $this->tt_contentConfig['languageMode'])   {
00456                                                                 $defLangBinding[$key][$lP][$row[($lP ? 'l18n_parent' : 'uid')]] = $singleElementHTML;
00457                                                         } else {
00458                                                                 $content[$key].= $singleElementHTML;
00459                                                         }
00460                                                 } else { unset($rowArr[$rKey]); }
00461                                         }
00462 
00463                                                 // Add new-icon link, header:
00464                                         $newP = $this->newContentElementOnClick($id,$key,$lP);
00465                                         $head[$key].= $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content','colPos',$key), ($this->doEdit&&count($rowArr)?'&edit[tt_content]['.$editUidList.']=edit'.$pageTitleParamForAltDoc:''), $newP);
00466                                         $editUidList = '';
00467                                 }
00468 
00469                                         // For EACH column, fit the rendered content into a table cell:
00470                                 $out='';
00471                                 foreach($cList as $k => $key)   {
00472                                         if (!$k)        {
00473                                                 $out.= '
00474                                                         <td><img src="clear.gif" width="'.$lMarg.'" height="1" alt="" /></td>';
00475                                         } else {
00476                                                 $out.= '
00477                                                         <td><img src="clear.gif" width="4" height="1" alt="" /></td>
00478                                                         <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td>
00479                                                         <td><img src="clear.gif" width="4" height="1" alt="" /></td>';
00480                                         }
00481                                         $out.= '
00482                                                         <td valign="top">'.$head[$key].$content[$key].'</td>';
00483 
00484                                                 // Storing content for use if languageMode is set:
00485                                         if ($this->tt_contentConfig['languageMode'])    {
00486                                                 $languageColumn[$key][$lP] = $head[$key].$content[$key];
00487                                                 if (!$this->defLangBinding)     {
00488                                                         $languageColumn[$key][$lP].='<br /><br />'.$this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key],$id,$lP),$lP);
00489                                                 }
00490                                         }
00491                                 }
00492 
00493                                         // Wrap the cells into a table row:
00494                                 $out = '
00495                                         <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-cols">
00496                                                 <tr>'.$out.'
00497                                                 </tr>
00498                                         </table>';
00499 
00500                                         // CSH:
00501                                 $out.= t3lib_BEfunc::cshItem($this->descrTable,'columns_multi',$GLOBALS['BACK_PATH']);
00502                         }
00503 
00504                                 // If language mode, then make another presentation:
00505                                 // 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!
00506                         if ($this->tt_contentConfig['languageMode'])    {
00507 
00508                                         // Get language selector:
00509                                 $languageSelector = $this->languageSelector($id);
00510 
00511                                         // Reset out - we will make new content here:
00512                                 $out='';
00513                                         // Separator between language columns (black thin line)
00514                                 $midSep = '
00515                                                 <td><img src="clear.gif" width="4" height="1" alt="" /></td>
00516                                                 <td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td>
00517                                                 <td><img src="clear.gif" width="4" height="1" alt="" /></td>';
00518 
00519                                         // Traverse languages found on the page and build up the table displaying them side by side:
00520                                 $cCont=array();
00521                                 $sCont=array();
00522                                 foreach($langListArr as $lP)    {
00523 
00524                                                 // Header:
00525                                         $cCont[$lP]='
00526                                                 <td valign="top" align="center" class="bgColor6"><strong>'.htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]).'</strong></td>';
00527 
00528                                                 // "View page" icon is added:
00529                                         $viewLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id,$this->backPath,t3lib_BEfunc::BEgetRootLine($this->id),'','','&L='.$lP)).'">'.
00530                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' class="absmiddle" title="" alt="" />'.
00531                                                 '</a>';
00532 
00533                                                 // Language overlay page header:
00534                                         if ($lP)        {
00535 
00536                                                 list($lpRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$id,'AND sys_language_uid='.intval($lP));
00537                                                 t3lib_BEfunc::workspaceOL('pages_language_overlay',$lpRecord);
00538                                                 $params='&edit[pages_language_overlay]['.$lpRecord['uid'].']=edit&overrideVals[pages_language_overlay][sys_language_uid]='.$lP;
00539                                                 $lPLabel = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getIconImage('pages_language_overlay',$lpRecord,$this->backPath,'  class="absmiddle"'),'pages_language_overlay',$lpRecord['uid']).
00540                                                         $viewLink.
00541                                                         ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay') ? '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
00542                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" class="absmiddle" alt="" />'.
00543                                                         '</a>' : '').
00544                                                         htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'],20));
00545                                         } else {
00546                                                 $lPLabel = $viewLink;
00547                                         }
00548                                         $sCont[$lP]='
00549                                                 <td nowrap="nowrap">'.$lPLabel.'</td>';
00550                                 }
00551                                         // Add headers:
00552                                 $out.='
00553                                         <tr>'.implode($midSep,$cCont).'
00554                                         </tr>';
00555                                 $out.='
00556                                         <tr>'.implode($midSep,$sCont).'
00557                                         </tr>';
00558 
00559                                         // Traverse previously built content for the columns:
00560                                 foreach($languageColumn as $cKey => $cCont)     {
00561                                         $out.='
00562                                         <tr>
00563                                                 <td valign="top">'.implode('</td>'.$midSep.'
00564                                                 <td valign="top">',$cCont).'</td>
00565                                         </tr>';
00566 
00567                                         if ($this->defLangBinding)      {
00568                                                         // "defLangBinding" mode
00569                                                 foreach($defLanguageCount[$cKey] as $defUid)    {
00570                                                         $cCont=array();
00571                                                         foreach($langListArr as $lP)    {
00572                                                                 $cCont[] = $defLangBinding[$cKey][$lP][$defUid].
00573                                                                                 '<br/>'.$this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid),$id,$lP),$lP);
00574                                                         }
00575                                                         $out.='
00576                                                         <tr>
00577                                                                 <td valign="top">'.implode('</td>'.$midSep.'
00578                                                                 <td valign="top">',$cCont).'</td>
00579                                                         </tr>';
00580                                                 }
00581 
00582                                                         // Create spacer:
00583                                                 $cCont=array();
00584                                                 foreach($langListArr as $lP)    {
00585                                                         $cCont[] = '&nbsp;';
00586                                                 }
00587                                                 $out.='
00588                                                 <tr>
00589                                                         <td valign="top">'.implode('</td>'.$midSep.'
00590                                                         <td valign="top">',$cCont).'</td>
00591                                                 </tr>';
00592                                         }
00593                                 }
00594 
00595                                         // Finally, wrap it all in a table and add the language selector on top of it:
00596                                 $out = $languageSelector.'
00597                                         <table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-langMode">
00598                                                 '.$out.'
00599                                         </table>';
00600 
00601                                         // CSH:
00602                                 $out.= t3lib_BEfunc::cshItem($this->descrTable,'language_list',$GLOBALS['BACK_PATH']);
00603                         }
00604                 } else {                // SINGLE column mode (columns shown beneath each other):
00605 #debug('single column');
00606                         if ($this->tt_contentConfig['sys_language_uid']==0 || !$this->defLangBinding)   {
00607 
00608                                         // Initialize:
00609                                 if ($this->defLangBinding && $this->tt_contentConfig['sys_language_uid']==0)    {
00610                                         $showLanguage = ' AND sys_language_uid IN (0,-1)';
00611                                         $lP = 0;
00612                                 } else {
00613                                         $showLanguage = ' AND sys_language_uid='.$this->tt_contentConfig['sys_language_uid'];
00614                                         $lP = $this->tt_contentConfig['sys_language_uid'];
00615                                 }
00616 
00617                                 $cList = explode(',',$this->tt_contentConfig['showSingleCol']);
00618                                 $content=array();
00619                                 $out='';
00620 
00621                                         // Expand the table to some preset dimensions:
00622                                 $out.='
00623                                         <tr>
00624                                                 <td><img src="clear.gif" width="'.$lMarg.'" height="1" alt="" /></td>
00625                                                 <td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td>
00626                                                 <td><img src="clear.gif" width="10" height="1" alt="" /></td>
00627                                                 <td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td>
00628                                         </tr>';
00629 
00630                                         // Traverse columns to display top-on-top
00631                                 while(list($counter,$key)=each($cList)) {
00632 
00633                                                 // Select content elements:
00634                                         $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos='.intval($key).$showHidden.$showLanguage);
00635                                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00636                                         $c = 0;
00637                                         $rowArr = $this->getResult($result);
00638                                         $rowOut = '';
00639 
00640                                                 // 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:
00641                                         if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result))     {
00642                                                 $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'))."';";
00643                                                 $theNewButton=$GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent'));
00644                                                 $theNewButton='<img src="clear.gif" width="1" height="5" alt="" /><br />'.$theNewButton;
00645                                         } else $theNewButton='';
00646 
00647                                                 // Traverse any selected elements:
00648                                         foreach($rowArr as $rKey => $row)       {
00649                                                 t3lib_BEfunc::workspaceOL('tt_content', $row);
00650 
00651                                                 if ((int)$row['t3ver_state']!=2)        {
00652 
00653                                                         $c++;
00654                                                         $editUidList.=$row['uid'].',';
00655                                                         $isRTE=$RTE && $this->isRTEforField('tt_content',$row,'bodytext');
00656 
00657                                                                 // Create row output:
00658                                                         $rowOut.='
00659                                                                 <tr>
00660                                                                         <td></td>
00661                                                                         <td valign="top">'.$this->tt_content_drawHeader($row).'</td>
00662                                                                         <td>&nbsp;</td>
00663                                                                         <td'.($row['_ORIG_uid'] ? ' class="ver-element"' :'').' valign="top">'.$this->tt_content_drawItem($row,$isRTE).'</td>
00664                                                                 </tr>';
00665 
00666                                                                 // If the element was not the last element, add a divider line:
00667                                                         if ($c != $GLOBALS['TYPO3_DB']->sql_num_rows($result))  {
00668                                                                 $rowOut.='
00669                                                                 <tr>
00670                                                                         <td></td>
00671                                                                         <td colspan="3"><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/stiblet_medium2.gif','width="468" height="1"').' class="c-divider" alt="" /></td>
00672                                                                 </tr>';
00673                                                         }
00674                                                 } else { unset($rowArr[$rKey]); }
00675                                         }
00676 
00677                                                 // Add spacer between sections in the vertical list
00678                                         if ($counter)   {
00679                                                 $out.='
00680                                                         <tr>
00681                                                                 <td></td>
00682                                                                 <td colspan="3"><br /><br /><br /><br /></td>
00683                                                         </tr>';
00684                                         }
00685 
00686                                                 // Add section header:
00687                                         $newP = $this->newContentElementOnClick($id,$key,$this->tt_contentConfig['sys_language_uid']);
00688                                         $out.='
00689 
00690                                                 <!-- Column header: -->
00691                                                 <tr>
00692                                                         <td></td>
00693                                                         <td valign="top" colspan="3">'.
00694                                                                 $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content','colPos',$key), ($this->doEdit&&count($rowArr)?'&edit[tt_content]['.$editUidList.']=edit'.$pageTitleParamForAltDoc:''), $newP).
00695                                                                 $theNewButton.
00696                                                                 '<br /></td>
00697                                                 </tr>';
00698 
00699                                                 // Finally, add the content from the records in this column:
00700                                         $out.=$rowOut;
00701                                 }
00702 
00703                                         // Finally, wrap all table rows in one, big table:
00704                                 $out = '
00705                                         <table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode">
00706                                                 '.$out.'
00707                                         </table>';
00708 
00709                                         // CSH:
00710                                 $out.= t3lib_BEfunc::cshItem($this->descrTable,'columns_single',$GLOBALS['BACK_PATH']);
00711                         } else {
00712                                 $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/>';
00713                         }
00714                 }
00715 
00716 
00717                         // Add the big buttons to page:
00718                 if ($this->option_showBigButtons)       {
00719                         $bArray=array();
00720 
00721                         if (!$GLOBALS['SOBE']->current_sys_language)    {
00722                                 if ($this->ext_CALC_PERMS&2)    $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages]['.$id."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageProperties'));
00723                         } else {
00724                                 if ($this->doEdit && $GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay'))      {
00725                                         list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay','pid',$id,'AND sys_language_uid='.intval($GLOBALS['SOBE']->current_sys_language));
00726                                         $bArray[0]=$GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay]['.$languageOverlayRecord['uid']."]=edit",$this->backPath,''),$GLOBALS['LANG']->getLL('editPageProperties_curLang'));
00727                                 }
00728                         }
00729                         if ($this->ext_CALC_PERMS&4 || $this->ext_CALC_PERMS&2) $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'));
00730                         if ($this->ext_CALC_PERMS&8)    $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'));
00731                         if ($this->doEdit && $this->ext_function==1) $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'));
00732                         $out = '
00733                                 <table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons">
00734                                         <tr>
00735                                                 <td>'.implode('</td>
00736                                                 <td>',$bArray).'</td>
00737                                         </tr>
00738                                 </table>
00739                                 <img src="clear.gif" width="1" height="5" alt="" /><br />
00740                                 '.t3lib_BEfunc::cshItem($this->descrTable,'button_panel',$GLOBALS['BACK_PATH']).        // CSH
00741                                 $out;
00742                 }
00743 
00744                         // Return content:
00745                 return $out;
00746         }
00747 
00754         function getTable_fe_users($id) {
00755 
00756                 $this->addElement_tdParams=array(
00757                         'username'=>' nowrap="nowrap"',
00758                         'password'=>' nowrap="nowrap"',
00759                         'usergroup'=>' nowrap="nowrap"',
00760                         'name'=>' nowrap="nowrap"',
00761                         'address'=>' nowrap="nowrap"',
00762                         'zip'=>' nowrap="nowrap"',
00763                         'city'=>' nowrap="nowrap"',
00764                         'email'=>' nowrap="nowrap"',
00765                         'telephone'=>' nowrap="nowrap"'
00766                 );
00767                 $fList = 'username,password,usergroup,name,email,telephone,address,zip,city';
00768                 $out = $this->makeOrdinaryList('fe_users',$id, $fList, 1);
00769                 $this->addElement_tdParams=array();
00770                 return $out;
00771         }
00772 
00780         function getTable_sys_note($id) {
00781                 global $TCA;
00782 
00783                 if (!t3lib_extMgm::isLoaded('sys_note'))        return '';
00784 
00785                         // INIT:
00786                 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
00787                 $tree = $this->getTreeObject($id,intval($GLOBALS['SOBE']->MOD_SETTINGS['pages_levels']),$perms_clause);
00788 
00789                 $this->itemLabels =array();
00790                 foreach($TCA['sys_note']['columns'] as $name => $val)   {
00791                         $this->itemLabels[$name]=$GLOBALS['LANG']->sL($val['label']);
00792                 }
00793 
00794                         // If page ids were found, select all sys_notes from the page ids:
00795                 $out='';
00796                 if (count($tree->ids))          {
00797                         $delClause = t3lib_BEfunc::deleteClause('sys_note').t3lib_BEfunc::versioningPlaceholderClause('sys_note');
00798                         $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);
00799                         $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00800 
00801                                 // If sys_notes were found, render them:
00802                         if ($dbCount)   {
00803                                 $this->fieldArray = explode(',','__cmds__,info,note');
00804 
00805                                         // header line is drawn
00806                                 $theData = Array();
00807                                 $theData['__cmds__'] ='';
00808                                 $theData['info'] = '<b>Info</b><br /><img src="clear.gif" height="1" width="220" alt="" />';
00809                                 $theData['note'] = '<b>Note</b>';
00810                                 $out.=$this->addelement(1,'',$theData,' class="c-headLine"',20);
00811 
00812                                         // half line is drawn
00813                                 $theData = Array();
00814                                 $theData['info'] = $this->widthGif;
00815                                 $out.=$this->addelement(0,'',$theData);
00816 
00817                                 $this->no_noWrap=1;
00818 
00819                                         // Items
00820                                 $this->eCounter=$this->firstElementNumber;
00821                                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))   {
00822                                         t3lib_BEfunc::workspaceOL('sys_note', $row);
00823 
00824                                         list($flag,$code) = $this->fwd_rwd_nav();
00825                                         $out.=$code;
00826                                         if ($flag)      {
00827                                                 $color = Array (
00828                                                         0 => '',                // No category
00829                                                         1 => ' class="bgColor4"',               // Instructions
00830                                                         2 => ' class="bgColor2"',               // Template
00831                                                         3 => '',                // Notes
00832                                                         4 => ' class="bgColor5"'                // To-do
00833                                                 );
00834                                                 $tdparams = $color[$row['category']];
00835                                                 $info = Array();;
00836                                                 $theData = Array();
00837                                                 $this->getProcessedValue('sys_note','subject,category,author,email,personal',$row,$info);
00838                                                 $cont=implode('<br />',$info);
00839                                                 $head = '<b>Page:</b> '.t3lib_BEfunc::getRecordPath($row['pid'],$perms_clause,10).'<br />';
00840 
00841                                                 $theData['__cmds__']= $this->getIcon('sys_note',$row);
00842                                                 $theData['info'] = $head.$cont;
00843                                                 $theData['note'] = nl2br($row['message']);
00844 
00845                                                 $out.=$this->addelement(1,'',$theData,$tdparams,20);
00846 
00847 
00848                                                         // half line is drawn
00849                                                 $theData = Array();
00850                                                 $theData['info'] = $this->widthGif;
00851                                                 $out.=$this->addelement(0,'',$theData);
00852                                         }
00853                                         $this->eCounter++;
00854                                 }
00855 
00856                                         // Wrap it all in a table:
00857                                 $out='
00858                                         <table border="0" cellpadding="1" cellspacing="2" width="480" class="typo3-page-sysnote">
00859                                                 '.$out.'
00860                                         </table>';
00861                         }
00862                 }
00863                 return $out;
00864         }
00865 
00873         function getTable_tt_board($id) {
00874 
00875                         // Initialize:
00876                 $delClause = t3lib_BEfunc::deleteClause('tt_board').t3lib_BEfunc::versioningPlaceholderClause('tt_board');
00877                 $queryParts = $this->makeQueryArray('tt_board', $id, 'AND parent=0');
00878                 $this->setTotalItems($queryParts);
00879                 $dbCount = 0;
00880 
00881                         // If items were selected, make query:
00882                 if ($this->totalItems)  {
00883                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00884                         $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00885                 }
00886 
00887                         // If results came out of that, render the list:
00888                 $out='';
00889                 if ($dbCount)   {
00890 
00891                                 // Setting fields to display first:
00892                         if ($GLOBALS['SOBE']->MOD_SETTINGS['tt_board']=='expand')       {
00893                                 $this->fieldArray = explode(',','subject,author,date,age');
00894                         } else {
00895                                 $this->fieldArray = explode(',','subject,author,date,age,replys');
00896                         }
00897 
00898                                 // Header line is drawn
00899                         $theData = Array();
00900                         $theData['subject'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_subject',1).'</b>';
00901                         $theData['author'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_author',1).'</b>';
00902                         $theData['date'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_date',1).'</b>';
00903                         $theData['age'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_age',1).'</b>';
00904                         if ($GLOBALS['SOBE']->MOD_SETTINGS['tt_board']!='expand') {
00905                                 $theData['replys'] = '<b>'.$GLOBALS['LANG']->getLL('tt_board_RE',1).'</b>';
00906                         }
00907                         $out.=$this->addelement(1,'',$theData,' class="c-headLine"',20);
00908 
00909                                 // half line is drawn
00910                         $theData = Array();
00911                         $theData['subject'] = $this->widthGif;
00912                         $out.=$this->addelement(0,'',$theData);
00913 
00914                                 // Items
00915                         $this->eCounter=$this->firstElementNumber;
00916                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))   {
00917                                 t3lib_BEfunc::workspaceOL('tt_board', $row);
00918 
00919                                 list($flag,$code) = $this->fwd_rwd_nav();
00920                                 $out.=$code;
00921 
00922                                 if ($flag)      {
00923 
00924                                         $theRows = Array();
00925                                         $theRows = $this->tt_board_getTree ($theRows,$row['uid'],$id,$delClause,'');
00926                                         $out.=$this->tt_board_drawItem('tt_board',$row,count($theRows));
00927 
00928                                         if ($GLOBALS['SOBE']->MOD_SETTINGS['tt_board']=='expand')       {
00929                                                 reset($theRows);
00930                                                 while(list($n,$sRow)=each($theRows))    {
00931                                                         $out.=$this->tt_board_drawItem('tt_board',$sRow,0);
00932                                                 }
00933                                         }
00934                                 }
00935                                 $this->eCounter++;
00936                         }
00937 
00938                                 // Wrap it all in a table:
00939                         $out='
00940                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-listTTboard">
00941                                         '.$out.'
00942                                 </table>';
00943                 }
00944 
00945                 return $out;
00946         }
00947 
00955         function getTable_tt_address($id)       {
00956 
00957                         // Define fieldlist to show:
00958                 switch($GLOBALS['SOBE']->MOD_SETTINGS['tt_address'])    {
00959                         case 1:
00960                                 $icon = 0;
00961                                 $fList = 'name,address,zip,city,country';
00962                         break;
00963                         case 2:
00964                                 $icon = 1;
00965                                 $fList = 'name;title;email;company,image';
00966                         break;
00967                         default:
00968                                 $icon = 0;
00969                                 $fList = 'name,email,www,phone,fax,mobile';
00970                         break;
00971                 }
00972 
00973                         // Create listing
00974                 $out = $this->makeOrdinaryList('tt_address',$id, $fList, $icon);
00975                 return $out;
00976         }
00977 
00985         function getTable_tt_links($id) {
00986 
00987                         // Define fieldlist to show:
00988                 switch($GLOBALS['SOBE']->MOD_SETTINGS['tt_links'])      {
00989                         case 1:
00990                                 $fList = 'title,hidden,url';
00991                         break;
00992                         case 2:
00993                                 $fList = 'title;url,note2';
00994                         break;
00995                         default:
00996                                 $fList = 'title;url,note';
00997                         break;
00998                 }
00999 
01000                 $out = $this->makeOrdinaryList('tt_links',$id, $fList,1);
01001                 return $out;
01002         }
01003 
01011         function getTable_tt_guest($id) {
01012 
01013                         // Define fieldlist to show:
01014                 $fList = 'title;cr_name;cr_email,note';
01015                 $out = $this->makeOrdinaryList('tt_guest',$id, $fList, 1);
01016                 return $out;
01017         }
01018 
01026         function getTable_tt_news($id)  {
01027 
01028                 $this->addElement_tdParams=array(
01029                         'title'=>' nowrap="nowrap"',
01030                         'datetime'=>' nowrap="nowrap"',
01031                         'starttime'=>' nowrap="nowrap"',
01032                         'author'=>' nowrap="nowrap"'
01033                 );
01034                 $fList = 'title,author,author_email,datetime,starttime,category,image';
01035                 $out = $this->makeOrdinaryList('tt_news',$id, $fList, 1);
01036                 $this->addElement_tdParams=array();
01037                 return $out;
01038         }
01039 
01047         function getTable_tt_calender($id)      {
01048 
01049                 $type=$GLOBALS['SOBE']->MOD_SETTINGS['tt_calender'];
01050                 switch($type)   {
01051                         case 'date':
01052                                         // Date default
01053                                 $fList = 'date,title';
01054                                 $icon=0;
01055                                 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');
01056                                 return $out;
01057                         break;
01058                         case 'date_ext':
01059                                         // Date extended
01060                                 $fList = 'title;date;time;datetext;link,note';
01061                                 $icon=1;
01062                                 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');
01063                                 return $out;
01064                         break;
01065                         case 'todo':
01066                                         // Todo default
01067                                 $fList = 'title,complete,priority,date';
01068                                 $icon=0;
01069                                 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');
01070                                 return $out;
01071                         break;
01072                         case 'todo_ext':
01073                                         // Todo extended
01074                                 $fList = 'title;complete;priority;date;workgroup;responsible;category,note';
01075                                 $icon=1;
01076                                 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');
01077                                 return $out;
01078                         break;
01079                         default:
01080                                         // Overview, both todo and calender
01081                                 $fList = 'title,date,time,week';
01082                                 $icon=1;
01083                                 $out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');
01084                                 $out.= $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');
01085                                 return $out;
01086                         break;
01087                 }
01088         }
01089 
01097         function getTable_tt_products($id)      {
01098 
01099                 $type = $GLOBALS['SOBE']->MOD_SETTINGS['tt_products'];
01100                 switch($type)   {
01101                         case 'ext':
01102                                 $fList = 'title;itemnumber;price;price2;inStock;category,image,note';
01103                                 $icon=1;
01104                                 $out = $this->makeOrdinaryList('tt_products',$id, $fList, $icon);
01105                         break;
01106                         default:
01107                                 $fList = 'title,itemnumber,price,category,image';
01108                                 $icon=1;
01109                                 $out = $this->makeOrdinaryList('tt_products',$id, $fList, $icon);
01110                         break;
01111                 }
01112 
01113                 return $out;
01114         }
01115 
01116 
01117 
01118 
01119 
01120 
01121 
01122 
01123 
01124 
01125 
01126 
01127         /**********************************
01128          *
01129          * Generic listing of items
01130          *
01131          **********************************/
01132 
01143         function makeOrdinaryList($table, $id, $fList, $icon=0, $addWhere='')   {
01144                 global $TCA;
01145 
01146                         // Initialize:
01147                 $out = '';
01148                 $queryParts = $this->makeQueryArray($table, $id, $addWhere);
01149                 $this->setTotalItems($queryParts);
01150                 $dbCount = 0;
01151 
01152                         // Make query for records if there were any records found in the count operation:
01153                 if ($this->totalItems)  {
01154                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
01155                         $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
01156                 }
01157 
01158                         // If records were found, render the list:
01159                 $out = '';
01160                 if ($dbCount)   {
01161 
01162                                 // Set fields
01163                         $this->fieldArray = explode(',','__cmds__,'.$fList);
01164 
01165                                 // Header line is drawn
01166                         $theData = array();
01167                         $theData = $this->headerFields($this->fieldArray,$table,$theData);
01168                         $out.= $this->addelement(1,'',$theData,' class="c-headLine"',15);
01169 
01170                                 // Render Items
01171                         $this->eCounter = $this->firstElementNumber;
01172                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))   {
01173                                 t3lib_BEfunc::workspaceOL($table, $row);
01174 
01175                                 list($flag,$code) = $this->fwd_rwd_nav();
01176                                 $out.= $code;
01177                                 if ($flag)      {
01178                                         $params = '&edit['.$table.']['.$row['uid'].']=edit';
01179                                         $Nrow = array();
01180 
01181                                                 // Setting icons/edit links:
01182                                         if ($icon)      {
01183                                                 $Nrow['__cmds__']= $this->getIcon($table,$row);
01184                                         }
01185                                         if ($this->doEdit)      {
01186                                                 $Nrow['__cmds__'].= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
01187                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.
01188                                                                                 '</a>';
01189                                         } else {
01190                                                 $Nrow['__cmds__'].= $this->noEditIcon();
01191                                         }
01192 
01193                                                 // Get values:
01194                                         $Nrow = $this->dataFields($this->fieldArray,$table,$row,$Nrow);
01195                                         $tdparams = $this->eCounter%2 ? ' class="bgColor4"' : ' class="bgColor4-20"';
01196                                         $out.= $this->addelement(1,'',$Nrow,$tdparams);
01197                                 }
01198                                 $this->eCounter++;
01199                         }
01200 
01201                                 // Wrap it all in a table:
01202                         $out='
01203 
01204                                 <!--
01205                                         STANDARD LIST OF "'.$table.'"
01206                                 -->
01207                                 <table border="0" cellpadding="1" cellspacing="2" width="480" id="typo3-page-stdlist">
01208                                         '.$out.'
01209                                 </table>';
01210                 }
01211                 return $out;
01212         }
01213 
01224         function dataFields($fieldArr,$table,$row,$out=array()) {
01225                 global $TCA;
01226 
01227                         // Check table validity:
01228                 if ($TCA[$table])       {
01229                         t3lib_div::loadTCA($table);
01230                         $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
01231 
01232                                 // Traverse fields:
01233                         foreach($fieldArr as $fieldName)        {
01234 
01235                                 if ($TCA[$table]['columns'][$fieldName])        {       // Each field has its own cell (if configured in TCA)
01236                                         if ($fieldName==$thumbsCol)     {       // If the column is a thumbnail column:
01237                                                 $out[$fieldName] = $this->thumbCode($row,$table,$fieldName);
01238                                         } else {        // ... otherwise just render the output:
01239                                                 $out[$fieldName] = nl2br(htmlspecialchars(trim(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fieldName,$row[$fieldName],0,0,0,$row['uid']),250))));
01240                                         }
01241                                 } 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)
01242                                         $theFields = explode(';',$fieldName);
01243 
01244                                                 // Traverse fields, separated by ";" (displayed in a single cell).
01245                                         foreach($theFields as $fName2)  {
01246                                                 if ($TCA[$table]['columns'][$fName2])   {
01247                                                          $out[$fieldName].= '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'],1).'</b>'.
01248                                                                                                 '&nbsp;&nbsp;'.
01249                                                                                                 htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fName2,$row[$fName2],0,0,0,$row['uid']),25)).
01250                                                                                                 '<br />';
01251                                                 }
01252                                         }
01253                                 }
01254                                         // If no value, add a nbsp.
01255                                 if (!$out[$fieldName])  $out[$fieldName]='&nbsp;';
01256 
01257                                         // Wrap in dimmed-span tags if record is "disabled"
01258                                 if ($this->isDisabled($table,$row))     {
01259                                         $out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
01260                                 }
01261                         }
01262                 }
01263                 return $out;
01264         }
01265 
01275         function headerFields($fieldArr,$table,$out=array())    {
01276                 global $TCA;
01277 
01278                 t3lib_div::loadTCA($table);
01279 
01280                 foreach($fieldArr as $fieldName)        {
01281                         $ll = $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fieldName]['label'],1);
01282                         $out[$fieldName] = '<b>'.($ll?$ll:'&nbsp;').'</b>';
01283                 }
01284                 return $out;
01285         }
01286 
01287 
01288 
01289 
01290 
01291 
01292 
01293 
01294 
01295 
01296 
01297 
01298 
01299 
01300 
01301         /**********************************
01302          *
01303          * Additional functions; Pages
01304          *
01305          **********************************/
01306 
01317         function pages_getTree($theRows,$pid,$qWhere,$treeIcons,$depth) {
01318                 $depth--;
01319                 if ($depth>=0)  {
01320                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($pid).$qWhere, '', 'sorting');
01321                         $c=0;
01322                         $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01323                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01324                                 t3lib_BEfunc::workspaceOL('pages', $row);
01325                                 $c++;
01326                                 $row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/join'.($rc==$c?'bottom':'').'.gif','width="18" height="16"').' alt="" />';
01327                                 $theRows[]=$row;
01328 
01329                                         // Get the branch
01330                                 $spaceOutIcons = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c?'blank.gif':'line.gif'),'width="18" height="16"').' alt="" />';
01331                                 $theRows = $this->pages_getTree($theRows,$row['uid'],$qWhere,$treeIcons.$spaceOutIcons,$row['php_tree_stop']?0:$depth);
01332                         }
01333                 } else {
01334                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'pages', 'pid='.intval($pid).$qWhere);
01335                         $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
01336                         if ($row[0])    {
01337                                 $this->plusPages[$pid]=$row[0];
01338                         }
01339                 }
01340                 return $theRows;
01341         }
01342 
01350         function pages_drawItem($row,$fieldArr) {
01351                 global $TCA;
01352 
01353                         // Initialization
01354                 $theIcon=$this->getIcon('pages',$row);
01355 
01356                         //      Preparing and getting the data-array
01357                 $theData = Array();
01358                 foreach($fieldArr as $field)    {
01359                         switch($field)  {
01360                                 case 'title':
01361                                         $red = $this->plusPages[$row['uid']] ? '<font color="red"><b>+&nbsp;</b></font>' : '';
01362                                         $pTitle = htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field],20));
01363                                         if ($red)       {
01364                                                 $pTitle = '<a href="'.htmlspecialchars($this->script.'?id='.$row['uid']).'">'.$pTitle.'</a>';
01365                                         }
01366                                         $theData[$field]=$row['treeIcons'].$theIcon.$red.$pTitle.'&nbsp;&nbsp;';
01367                                 break;
01368                                 case 'php_tree_stop':
01369                                 case 'TSconfig':
01370                                         $theData[$field] = $row[$field]?'&nbsp;<b>x</b>':'&nbsp;';
01371                                 break;
01372                                 case 'uid':
01373                                         if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2))    {
01374                                                 $params='&edit[pages]['.$row['uid'].']=edit';
01375                                                 $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'.
01376                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('editThisPage',1).'" alt="" />'.
01377                                                                 '</a>';
01378                                         } else $eI='';
01379                                         $theData[$field] = '<span align="right">'.$row['uid'].$eI.'</span>';
01380                                 break;
01381                                 default:
01382                                         if (substr($field,0,6)=='table_')       {
01383                                                 $f2 = substr($field,6);
01384                                                 if ($TCA[$f2])  {
01385                                                         $c = $this->numberOfRecords($f2,$row['uid']);
01386                                                         $theData[$field] = '&nbsp;&nbsp;'.($c?$c:'');
01387                                                 }
01388                                         } elseif (substr($field,0,5)=='HITS_')  {
01389                                                 if (t3lib_extMgm::isLoaded('sys_stat')) {
01390                                                         $fParts = explode(':',substr($field,5));
01391                                                         switch($fParts[0])      {
01392                                                                 case 'days':
01393                                                                         $timespan = mktime (0,0,0)+intval($fParts[1])*3600*24;
01394                                                                                 // Page hits
01395                                                                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01396                                                                                                         'count(*)',
01397                                                                                                         'sys_stat',
01398                                                                                                         $this->stat_select_field.'='.intval($row['uid']).'
01399                                                                                                                 AND tstamp>='.intval($timespan).'
01400                                                                                                                 AND tstamp<'.intval($timespan+3600*24)
01401                                                                                                 );
01402                                                                         list($number) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
01403                                                                         if ($number)    {
01404                                                                                         // Sessions
01405                                                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01406                                                                                                                 'count(*)',
01407                                                                                                                 'sys_stat',
01408                                                                                                                 $this->stat_select_field.'='.intval($row['uid']).'
01409                                                                                                                         AND tstamp>='.intval($timespan).'
01410                                                                                                                         AND tstamp<'.intval($timespan+3600*24).'
01411                                                                                                                         AND surecookie!=""',
01412                                                                                                                 'surecookie'
01413                                                                                                         );
01414                                                                                 $scnumber = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01415 
01416                                                                                 $number.= '/'.$scnumber;
01417                                                                         } else {
01418                                                                                 $number='';
01419                                                                         }
01420                                                                 break;
01421                                                         }
01422                                                         $theData[$field]= '&nbsp;'.$number;
01423                                                 } else {
01424                                                         $theData[$field]= '&nbsp;';
01425                                                 }
01426                                         } else {
01427                                                 $theData[$field]= '&nbsp;&nbsp;'.htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field]));
01428                                         }
01429                                 break;
01430                         }
01431                 }
01432                 $this->addElement_tdParams['title'] = ($row['_CSSCLASS'] ? ' class="'.$row['_CSSCLASS'].'"' : '');
01433                 return $this->addelement(1,'',$theData);
01434         }
01435 
01436 
01437 
01438 
01439 
01440 
01441 
01442 
01443 
01444 
01445 
01446 
01447         /**********************************
01448          *
01449          * Additional functions; Content Elements
01450          *
01451          **********************************/
01452 
01461         function tt_content_drawColHeader($colName,$editParams,$newParams)      {
01462 
01463                         // Create header row:
01464                 $out = '
01465                                 <tr>
01466                                         <td class="bgColor2" nowrap="nowrap"><img src="clear.gif" width="1" height="2" alt="" /><br /><div align="center"><b>'.htmlspecialchars(strtoupper($colName)).'</b></div><img src="clear.gif" width="1" height="2" alt="" /></td>
01467                                 </tr>';
01468 
01469                         // Create command links:
01470                 if ($this->tt_contentConfig['showCommands'])    {
01471                                 // Start cell:
01472                         $out.= '
01473                                 <tr>
01474                                         <td class="bgColor5">';
01475 
01476                                 // Edit whole of column:
01477                         if ($editParams)        {
01478                                 $out.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($editParams,$this->backPath)).'">'.
01479                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('editColumn',1).'" alt="" />'.
01480                                                 '</a>';
01481                         }
01482                                 // New record:
01483                         if ($newParams) {
01484                                 $out.='<a href="#" onclick="'.htmlspecialchars($newParams).'">'.
01485                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_record.gif','width="16" height="12"').' title="'.$GLOBALS['LANG']->getLL('newInColumn',1).'" alt="" />'.
01486                                                 '</a>';
01487                         }
01488                                 // End cell:
01489                         $out.= '
01490                                         </td>
01491                                 </tr>';
01492                 }
01493 
01494                         // Wrap and return:
01495                 return '
01496                         <table border="0" cellpadding="0" cellspacing="0" width="100%" class="typo3-page-colHeader">'.($space?'
01497                                 <tr>
01498                                         <td><img src="clear.gif" height="'.$space.'" alt="" /></td>
01499                                 </tr>':'').
01500                                 $out.'
01501                         </table>';
01502         }
01503 
01513         function tt_content_drawHeader($row,$space=0,$disableMoveAndNewButtons=FALSE,$langMode=FALSE)   {
01514                 global $TCA;
01515 
01516                         // Load full table description:
01517                 t3lib_div::loadTCA('tt_content');
01518 
01519                         // Get record locking status:
01520                 if ($lockInfo=t3lib_BEfunc::isRecordLocked('tt_content',$row['uid']))   {
01521                         $lockIcon='<a href="#" onclick="'.htmlspecialchars('alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;').'">'.
01522                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
01523                                                 '</a>';
01524                 } else $lockIcon='';
01525 
01526                         // Create header with icon/lock-icon/title:
01527                 $header = $this->getIcon('tt_content',$row).
01528                                 $lockIcon.
01529                                 ($langMode ? $this->languageFlag($row['sys_language_uid']) : '').
01530                                 '&nbsp;<b>'.htmlspecialchars($this->CType_labels[$row['CType']]).'</b>';
01531                 $out = '
01532                                         <tr>
01533                                                 <td class="bgColor4">'.$header.'</td>
01534                                         </tr>';
01535 
01536                         // If show info is set...;
01537                 if ($this->tt_contentConfig['showInfo'])        {
01538 
01539                                 // Get processed values:
01540                         $info = Array();
01541                         $this->getProcessedValue('tt_content','hidden,starttime,endtime,fe_group,spaceBefore,spaceAfter,section_frame,sectionIndex,linkToTop',$row,$info);
01542 
01543                                 // Render control panel for the element:
01544                         if ($this->tt_contentConfig['showCommands'] && $this->doEdit)   {
01545 
01546                                         // Start control cell:
01547                                 $out.= '
01548                                         <!-- Control Panel -->
01549                                         <tr>
01550                                                 <td class="bgColor5">';
01551 
01552                                         // Edit content element:
01553                                 $params='&edit[tt_content]['.$this->tt_contentData['nextThree'][$row['uid']].']=edit';
01554                                 $out.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
01555                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($this->nextThree>1?sprintf($GLOBALS['LANG']->getLL('nextThree'),$this->nextThree):$GLOBALS['LANG']->getLL('edit')).'" alt="" />'.
01556                                                 '</a>';
01557 
01558                                 if (!$disableMoveAndNewButtons) {
01559                                                 // New content element:
01560                                         if ($this->option_newWizard)    {
01561                                                 $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'))."';";
01562                                         } else {
01563                                                 $params='&edit[tt_content]['.(-$row['uid']).']=new';
01564                                                 $onClick = t3lib_BEfunc::editOnClick($params,$this->backPath);
01565                                         }
01566                                         $out.='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
01567                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_record.gif','width="16" height="12"').' title="'.$GLOBALS['LANG']->getLL('newAfter',1).'" alt="" />'.
01568                                                         '</a>';
01569 
01570                                                 // Move element up:
01571                                         if ($this->tt_contentData['prev'][$row['uid']]) {
01572                                                 $params='&cmd[tt_content]['.$row['uid'].'][move]='.$this->tt_contentData['prev'][$row['uid']];
01573                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01574                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('moveUp',1).'" alt="" />'.
01575                                                                 '</a>';
01576                                         } else {
01577                                                 $out.='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"',2).' alt="" />';
01578                                         }
01579                                                 // Move element down:
01580                                         if ($this->tt_contentData['next'][$row['uid']]) {
01581                                                 $params='&cmd[tt_content]['.$row['uid'].'][move]='.$this->tt_contentData['next'][$row['uid']];
01582                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01583                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('moveDown',1).'" alt="" />'.
01584                                                                 '</a>';
01585                                         } else {
01586                                                 $out.='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"',2).' alt="" />';
01587                                         }
01588                                 }
01589 
01590                                         // Hide element:
01591                                 $hiddenField = $TCA['tt_content']['ctrl']['enablecolumns']['disabled'];
01592                                 if ($hiddenField && $TCA['tt_content']['columns'][$hiddenField] && (!$TCA['tt_content']['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields','tt_content:'.$hiddenField)))    {
01593                                         if ($row[$hiddenField]) {
01594                                                 $params='&data[tt_content]['.($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid']).']['.$hiddenField.']=0';
01595                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01596                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('unHide',1).'" alt="" />'.
01597                                                                 '</a>';
01598                                         } else {
01599                                                 $params='&data[tt_content]['.($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid']).']['.$hiddenField.']=1';
01600                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01601                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('hide',1).'" alt="" />'.
01602                                                                 '</a>';
01603                                         }
01604                                 }
01605 
01606                                         // Delete
01607                                 $params='&cmd[tt_content]['.$row['uid'].'][delete]=1';
01608                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'" onclick="'.htmlspecialchars('return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')).');').'">'.
01609                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('deleteItem',1).'" alt="" />'.
01610                                                 '</a>';
01611 
01612                                         // End cell:
01613                                 $out.= '
01614                                                 </td>
01615                                         </tr>';
01616                         }
01617 
01618                                 // Display info from records fields:
01619                         if (count($info))       {
01620                                 $out.= '
01621                                         <tr>
01622                                                 <td class="bgColor4-20">'.implode('<br />',$info).'</td>
01623                                         </tr>';
01624                         }
01625                 }
01626                         // Wrap the whole header in a table:
01627                 return '
01628                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-ceHeader">'.($space?'
01629                                         <tr>
01630                                                 <td><img src="clear.gif" height="'.$space.'" alt="" /></td>
01631                                         </tr>':'').
01632                                         $out.'
01633                                 </table>';
01634         }
01635 
01643         function tt_content_drawItem($row, $isRTE=FALSE)        {
01644                 global $TCA;
01645 
01646                 $out='';
01647                 $outHeader='';
01648 
01649                         // Make header:
01650                 if ($row['header'] && $row['header_layout']!=100)       {
01651                         $infoArr = Array();
01652                         $this->getProcessedValue('tt_content','header_position,header_layout,header_link',$row,$infoArr);
01653 
01654                         $outHeader=  ($row['date'] ? htmlspecialchars($this->itemLabels['date'].' '.t3lib_BEfunc::date($row['date'])).'<br />':'').
01655                                         $this->infoGif($infoArr).
01656                                         '<b>'.$this->linkEditContent($this->renderText($row['header']),$row).'</b><br />';
01657                 }
01658 
01659                         // Make content:
01660                 $infoArr=Array();
01661                 switch($row['CType'])   {
01662                         case 'header':
01663                                 if ($row['subheader'])  {
01664                                         $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01665                                         $out.=  $this->infoGif($infoArr).
01666                                                         $this->linkEditContent($this->renderText($row['subheader']),$row).'<br />';
01667                                 }
01668                         break;
01669                         case 'text':
01670                         case 'textpic':
01671                         case 'image':
01672                                 if ($row['CType']=='text' || $row['CType']=='textpic')  {
01673                                         if ($row['bodytext'])   {
01674                                                 $this->getProcessedValue('tt_content','text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01675                                                 $out.= $this->infoGif($infoArr).
01676                                                                 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01677                                         }
01678                                 }
01679                                 if ($row['CType']=='textpic' || $row['CType']=='image') {
01680                                         if ($row['image'])      {
01681                                                 $infoArr=Array();
01682                                                 $this->getProcessedValue('tt_content','imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames',$row,$infoArr);
01683                                                 $out.=  $this->infoGif($infoArr).
01684                                                                 $this->thumbCode($row,'tt_content','image').'<br />';
01685 
01686                                                 if ($row['imagecaption'])       {
01687                                                         $infoArr=Array();
01688                                                         $this->getProcessedValue('tt_content','imagecaption_position',$row,$infoArr);
01689                                                         $out.=  $this->infoGif($infoArr).
01690                                                                         $this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
01691                                                 }
01692                                         }
01693                                 }
01694                         break;
01695                         case 'bullets':
01696                                 if ($row['bodytext'])   {
01697                                         $this->getProcessedValue('tt_content','layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01698                                         $out.=  $this->infoGif($infoArr).
01699                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01700                                 }
01701                         break;
01702                         case 'table':
01703                                 if ($row['bodytext'])   {
01704                                         $this->getProcessedValue('tt_content','table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01705                                         $out.=  $this->infoGif($infoArr).
01706                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01707                                 }
01708                         break;
01709                         case 'uploads':
01710                                 if ($row['media'])      {
01711                                         $this->getProcessedValue('tt_content','media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing',$row,$infoArr);
01712                                         $out.=  $this->infoGif($infoArr).
01713                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01714                                 }
01715                         break;
01716                         case 'multimedia':
01717                                 if ($row['multimedia']) {
01718                                         $out.=  $this->renderText($row['multimedia']).'<br />';
01719                                         $out.=  $this->renderText($row['parameters']).'<br />';
01720                                 }
01721                         break;
01722                         case 'mailform':
01723                                 if ($row['bodytext'])   {
01724                                         $this->getProcessedValue('tt_content','pages,subheader',$row,$infoArr);
01725                                         $out.=  $this->infoGif($infoArr).
01726                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01727                                 }
01728                         break;
01729                         case 'splash':
01730                                 if ($row['bodytext'])   {
01731                                         $out.=  $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01732                                 }
01733                                 if ($row['image'])      {
01734                                         $infoArr=Array();
01735                                         $this->getProcessedValue('tt_content','imagewidth',$row,$infoArr);
01736                                         $out.=  $this->infoGif($infoArr).
01737                                                         $this->thumbCode($row,'tt_content','image').'<br />';
01738                                 }
01739                         break;
01740                         case 'menu':
01741                                 if ($row['pages'])      {
01742                                         $this->getProcessedValue('tt_content','menu_type',$row,$infoArr);
01743                                         $out.=  $this->infoGif($infoArr).
01744                                                         $this->linkEditContent($row['pages'],$row).'<br />';
01745                                 }
01746                         break;
01747                         case 'shortcut':
01748                                 if ($row['records'])    {
01749                                         $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01750                                         $out.=  $this->infoGif($infoArr).
01751                                                         $this->linkEditContent($row['shortcut'],$row).'<br />';
01752                                 }
01753                         break;
01754                         case 'list':
01755                                 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01756                                 $out.=  $this->infoGif($infoArr).
01757                                                 $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','list_type'),1).' '.
01758                                                 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','list_type',$row['list_type']),1).'<br />';
01759 
01760                                 $out.=  $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
01761 
01762                                 $infoArr=Array();
01763                                 $this->getProcessedValue('tt_content','recursive',$row,$infoArr);
01764                                 $out.=  $this->infoGif($infoArr).
01765                                                 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','pages',$row['pages']),1).'<br />';
01766                         break;
01767                         case 'script':
01768                                 $out.=  $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
01769                                 $out.=  '<br />'.$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01770                                 $out.=  '<br />'.$this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
01771                         break;
01772                         default:
01773                                 if ($row['bodytext'])   {
01774                                         $out.=$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01775                                 }
01776                         break;
01777                 }
01778 
01779                         // Wrap span-tags:
01780                 $out = '
01781                         <span class="exampleContent">'.$out.'</span>';
01782                         // Add header:
01783                 $out = $outHeader.$out;
01784                         // Add RTE button:
01785                 if ($isRTE) {
01786                         $out.= $this->linkRTEbutton($row);
01787                 }
01788 
01789                         // Return values:
01790                 if ($this->isDisabled('tt_content',$row))       {
01791                         return $GLOBALS['TBE_TEMPLATE']->dfw($out);
01792                 } else {
01793                         return $out;
01794                 }
01795         }
01796 
01806         function getNonTranslatedTTcontentUids($defLanguageCount,$id,$lP)       {
01807                 if ($lP && count($defLanguageCount))    {
01808 
01809                                 // Select all translations here:
01810                         $queryParts = $this->makeQueryArray('tt_content', $id, 'AND sys_language_uid='.intval($lP).' AND l18n_parent IN ('.implode(',',$defLanguageCount).')');
01811                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
01812 
01813                                 // Flip uids:
01814                         $defLanguageCount = array_flip($defLanguageCount);
01815 
01816                                 // Traverse any selected elements and unset original UID if any:
01817                         $rowArr = $this->getResult($result);
01818                         foreach($rowArr as $row)        {
01819                                 unset($defLanguageCount[$row['l18n_parent']]);
01820                         }
01821 
01822                                 // Flip again:
01823                         $defLanguageCount = array_keys($defLanguageCount);
01824                 }
01825 
01826                 return $defLanguageCount;
01827         }
01828 
01836         function newLanguageButton($defLanguageCount,$lP)       {
01837                 if ($this->doEdit && count($defLanguageCount) && $lP)   {
01838 
01839                         $params = '';
01840                         foreach($defLanguageCount as $uidVal)   {
01841                                 $params.='&cmd[tt_content]['.$uidVal.'][localize]='.$lP;
01842                         }
01843 
01844                                 // Copy for language:
01845                         $onClick = "window.location.href='".$GLOBALS['SOBE']->doc->issueCommand($params)."'; return false;";
01846                         $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent_copyForLang').' ['.count($defLanguageCount).']');
01847                         return $theNewButton;
01848                 }
01849         }
01850 
01857         function infoGif($infoArr)      {
01858                 if (count($infoArr) && $this->tt_contentConfig['showInfo'])     {
01859                         $out='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.htmlspecialchars(implode(chr(10),$infoArr)).'" alt="" /> ';
01860                         return $out;
01861                 }
01862         }
01863 
01873         function newContentElementOnClick($id,$colPos,$sys_language)    {
01874                 if ($this->option_newWizard)    {
01875                         $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'))."';";
01876                 } else {
01877                         $onClick=t3lib_BEfunc::editOnClick('&edit[tt_content]['.$id.']=new&defVals[tt_content][colPos]='.$colPos.'&defVals[tt_content][sys_language_uid]='.$sys_language,$this->backPath);
01878                 }
01879                 return $onClick;
01880         }
01881 
01891         function linkEditContent($str,$row)     {
01892                 $addButton='';
01893                 $onClick = '';
01894 
01895                 if ($this->doEdit)      {
01896                                 // Setting onclick action for content link:
01897                         $onClick=t3lib_BEfunc::editOnClick('&edit[tt_content]['.$row['uid'].']=edit',$this->backPath);
01898                 }
01899                         // Return link
01900                 return $onClick ? '<a href="#" onclick="'.htmlspecialchars($onClick).'" title="'.$GLOBALS['LANG']->getLL('edit',1).'">'.$str.'</a>'.$addButton : $str;
01901         }
01902 
01909         function linkRTEbutton($row)    {
01910                 $params = array();
01911                 $params['table'] = 'tt_content';
01912                 $params['uid'] = $row['uid'];
01913                 $params['pid'] = $row['pid'];
01914                 $params['field'] = 'bodytext';
01915                 $params['returnUrl'] = t3lib_div::linkThisScript();
01916                 $RTEonClick = "window.location.href='".$this->backPath."wizard_rte.php?".t3lib_div::implodeArrayForUrl('',array('P'=>$params))."';return false;";
01917                 $addButton = $this->option_showBigButtons && $this->doEdit ? $GLOBALS['SOBE']->doc->t3Button($RTEonClick,$GLOBALS['LANG']->getLL('editInRTE')) : '';
01918 
01919                 return $addButton;
01920         }
01921 
01930         function languageSelector($id)  {
01931                 if ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay'))       {
01932 
01933                                 // First, select all
01934                         $res = $GLOBALS['SOBE']->exec_languageQuery(0);
01935                         $langSelItems=array();
01936                         $langSelItems[0]='
01937                                                 <option value="0"></option>';
01938                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01939                                 if ($GLOBALS['BE_USER']->checkLanguageAccess($row['uid']))      {
01940                                         $langSelItems[$row['uid']]='
01941                                                         <option value="'.$row['uid'].'">'.htmlspecialchars($row['title']).'</option>';
01942                                 }
01943                         }
01944 
01945                                 // Then, subtract the languages which are already on the page:
01946                         $res = $GLOBALS['SOBE']->exec_languageQuery($id);
01947                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01948                                 unset($langSelItems[$row['uid']]);
01949                         }
01950 
01951                                 // If any languages are left, make selector:
01952                         if (count($langSelItems)>1)             {
01953                                 $onChangeContent = 'window.location.href=\''.$this->backPath.'alt_doc.php?&edit[pages_language_overlay]['.$id.']=new&overrideVals[pages_language_overlay][sys_language_uid]=\'+this.options[this.selectedIndex].value+\'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')).'\'';
01954                                 return $GLOBALS['LANG']->getLL('new_language',1).': <select name="createNewLanguage" onchange="'.htmlspecialchars($onChangeContent).'">
01955                                                 '.implode('',$langSelItems).'
01956                                         </select><br /><br />';
01957                         }
01958                 }
01959         }
01960 
01967         function getResult($result)     {
01968 
01969                         // Initialize:
01970                 $editUidList='';
01971                 $recs=Array();
01972                 $nextTree = $this->nextThree;
01973                 $c=0;
01974                 $output=Array();
01975 
01976                         // Traverse the result:
01977                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))   {
01978 
01979                                 // Add the row to the array:
01980                         $output[]=$row;
01981 
01982                                 // Set an internal register:
01983                         $recs[$c]=$row['uid'];
01984 
01985                                 // Create the list of the next three ids (for editing links...)
01986                         for($a=0;$a<$nextTree;$a++)     {
01987                                 if(isset($recs[$c-$a])) {
01988                                         $this->tt_contentData['nextThree'][$recs[$c-$a]].=$row['uid'].',';
01989                                 }
01990                         }
01991 
01992                                 // Set next/previous ids:
01993                         if (isset($recs[$c-1])) {
01994                                 if (isset($recs[$c-2])) {
01995                                         $this->tt_contentData['prev'][$row['uid']]=-$recs[$c-2];
01996                                 } else {
01997                                         $this->tt_contentData['prev'][$row['uid']]=$row['pid'];
01998                                 }
01999                                 $this->tt_contentData['next'][$recs[$c-1]]=-$row['uid'];
02000                         }
02001                         $c++;
02002                 }
02003 
02004                         // Return selected records
02005                 return $output;
02006         }
02007 
02008 
02009 
02010 
02011 
02012 
02013 
02014 
02015 
02016 
02017 
02018 
02019 
02020         /**********************************
02021          *
02022          * Additional functions; Message board items (tt_board)
02023          *
02024          **********************************/
02025 
02036         function tt_board_getTree($theRows,$parent,$pid,$qWhere,$treeIcons) {
02037 
02038                         // Select tt_board elements:
02039                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_board', 'pid='.intval($pid).' AND parent='.intval($parent).$qWhere, '', 'crdate');
02040 
02041                         // Traverse the results:
02042                 $c=0;
02043                 $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
02044                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
02045                         $c++;
02046                         $row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c ? 'joinbottom.gif' : 'join.gif'),'width="18" height="16"').' alt="" />';
02047                         $theRows[]=$row;
02048 
02049                                 // Get the branch
02050                         $theRows = $this->tt_board_getTree(
02051                                                 $theRows,
02052                                                 $row['uid'],
02053                                                 $row['pid'],
02054                                                 $qWhere,
02055                                                 $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c ? 'blank.gif' : 'line.gif'),'width="18" height="16"').' alt="" />'
02056                                         );
02057                 }
02058 
02059                         // Return modified rows:
02060                 return $theRows;
02061         }
02062 
02071         function tt_board_drawItem($table,$row,$re)     {
02072 
02073                         // Building data-arary with content:
02074                 $theData = Array();
02075                 $theData['subject'] = t3lib_div::fixed_lgd_cs(htmlspecialchars($row['subject']),25).'&nbsp; &nbsp;';
02076                 $theData['author'] = t3lib_div::fixed_lgd_cs(htmlspecialchars($row['author']),15).'&nbsp; &nbsp;';
02077                 $theData['date'] = t3lib_div::fixed_lgd_cs(t3lib_BEfunc::datetime($row['crdate']),20).'&nbsp; &nbsp;';
02078                 $theData['age'] = t3lib_BEfunc::calcAge(time()-$row['crdate'], $this->agePrefixes).'&nbsp; &nbsp;';
02079                 if ($re)        {
02080                         $theData['replys'] = $re;
02081                 }
02082 
02083                         // Subject is built:
02084                 $theData['subject']     =
02085                                         $row['treeIcons'].
02086                                         $this->getIcon($table,$row).
02087                                         $theData['subject'];
02088 
02089                         // Adding element:
02090                 return $this->addelement(1,'',$theData);
02091         }
02092 
02093 
02094 
02095 
02096 
02097 
02098 
02099 
02100 
02101 
02102 
02103 
02104 
02105         /********************************
02106          *
02107          * Various helper functions
02108          *
02109          ********************************/
02110 
02118         function numberOfRecords($table,$pid)   {
02119                 global $TCA;
02120 
02121                 $c=0;
02122                 if ($TCA[$table])       {
02123                         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, 'pid='.intval($pid).t3lib_BEfunc::deleteClause($table).t3lib_BEfunc::versioningPlaceholderClause($table));
02124                         if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($result))        {
02125                                 $c=$row[0];
02126                         }
02127                 }
02128                 return $c;
02129         }
02130 
02137         function renderText($input)     {
02138                 $input = $this->strip_tags($input, true);
02139                 $input = t3lib_div::fixed_lgd_cs($input,1500);
02140                 return nl2br(htmlspecialchars(trim($this->wordWrapper($input))));
02141         }
02142 
02151         function getIcon($table,$row)   {
02152 
02153                         // Initialization
02154                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
02155                 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.$alttext.'"');
02156                 $this->counter++;
02157 
02158                         // The icon with link
02159                 $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']);
02160 
02161                 return $theIcon;
02162         }
02163 
02174         function getProcessedValue($table,$fieldList,$row,&$info)       {
02175 
02176                         // Splitting values from $fieldList:
02177                 $fieldArr = explode(',',$fieldList);
02178 
02179                         // Traverse fields from $fieldList:
02180                 foreach($fieldArr as $field)    {
02181                         if ($row[$field])       {
02182                                 $info[]= htmlspecialchars($this->itemLabels[$field]).' '.htmlspecialchars(t3lib_BEfunc::getProcessedValue($table,$field,$row[$field]));
02183                         }
02184                 }
02185         }
02186 
02194         function isDisabled($table,$row)        {
02195                 global $TCA;
02196                 if (
02197                         ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) ||
02198                         ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']]>time() ) ||
02199                         ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']]<time())
02200                 )       return true;
02201         }
02202 
02212         function wordWrapper($content,$max=50,$char=' -')       {
02213                 $array = split(' |'.chr(10),$content);
02214                 foreach($array as $val) {
02215                         if (strlen($val)>$max)  {
02216                                 $content=str_replace($val,substr(chunk_split($val,$max,$char),0,-1),$content);
02217                         }
02218                 }
02219                 return $content;
02220         }
02221 
02229         function noEditIcon($label='noEditItems')       {
02230                 return '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2_d.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL($label,1).'" alt="" />';
02231         }
02232 
02238         function cleanTableNames()      {
02239                 global $TCA;
02240 
02241                         // Get all table names:
02242                 $tableNames=array_flip(array_keys($TCA));
02243 
02244                         // Unset common names:
02245                 unset($tableNames['pages']);
02246                 unset($tableNames['static_template']);
02247                 unset($tableNames['sys_filemounts']);
02248                 unset($tableNames['sys_action']);
02249                 unset($tableNames['sys_workflows']);
02250                 unset($tableNames['be_users']);
02251                 unset($tableNames['be_groups']);
02252 
02253                 $this->allowedTableNames=array();
02254 
02255                         // Traverse table names and set them in allowedTableNames array IF they can be read-accessed by the user.
02256                 if (is_array($tableNames))      {
02257                         foreach($tableNames as $k => $v)        {
02258                                 if ($GLOBALS['BE_USER']->check('tables_select',$k))             {
02259                                         $this->allowedTableNames['table_'.$k]=$k;
02260                                 }
02261                         }
02262                 }
02263         }
02264 
02274         function isRTEforField($table,$row,$field){
02275                 $specConf = $this->getSpecConfForField($table,$row,$field);
02276                 $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
02277                 if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
02278                         t3lib_BEfunc::fixVersioningPid($table,$row);
02279                         list($tscPID,$thePidValue) = t3lib_BEfunc::getTSCpid($table,$row['uid'],$row['pid']);
02280                         if ($thePidValue>=0)    {       // If the pid-value is not negative (that is, a pid could NOT be fetched)
02281                                 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($tscPID));
02282                                 $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table,$row);
02283                                 $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$table,$field,$RTEtypeVal);
02284                                 if (!$thisConfig['disabled'])   {
02285                                         return TRUE;
02286                                 }
02287                         }
02288                 }
02289 
02290                 return FALSE;
02291         }
02292 
02304         function getSpecConfForField($table,$row,$field)        {
02305 
02306                         // Get types-configuration for the record:
02307                 $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row);
02308 
02309                         // Find the given field and return the spec key value if found:
02310                 if (is_array($types_fieldConfig))       {
02311                         foreach($types_fieldConfig as $vconf)   {
02312                                 if ($vconf['field']==$field)    return $vconf['spec'];
02313                         }
02314                 }
02315         }
02316 
02317 
02318 
02319 
02320 
02321 
02322 
02323 
02324 
02325 
02326 
02327 
02328         /*****************************************
02329          *
02330          * External renderings
02331          *
02332          *****************************************/
02333 
02341         function getPageInfoBox($rec,$edit=0)   {
02342                 global $LANG;
02343 
02344                         // If editing of the page properties is allowed:
02345                 if ($edit)      {
02346                         $params='&edit[pages]['.$rec['uid'].']=edit';
02347                         $editIcon='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
02348                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.
02349                                                 '</a>';
02350                 } else {
02351                         $editIcon=$this->noEditIcon('noEditPage');
02352                 }
02353 
02354                         // Setting page icon, link, title:
02355                 $outPutContent = t3lib_iconWorks::getIconImage('pages',$rec,$this->backPath,'title="'.htmlspecialchars(t3lib_BEfunc::titleAttribForPages($rec)).'"').
02356                                 $editIcon.
02357                                 '&nbsp;'.
02358                                 htmlspecialchars($rec['title']);
02359 
02360 
02361                         // Init array where infomation is accumulated as label/value pairs.
02362                 $lines=array();
02363 
02364                         // Owner user/group:
02365                 if ($this->pI_showUser) {
02366                                 // User:
02367                         $users= t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
02368                         $groupArray = explode(',',$GLOBALS['BE_USER']->user['usergroup_cached_list']);
02369                         $users=t3lib_BEfunc::blindUserNames($users,$groupArray);
02370                         $lines[]=array($LANG->getLL('pI_crUser').':',htmlspecialchars($users[$rec['cruser_id']]['username']).' ('.$users[$rec['cruser_id']]['realName'].')');
02371                 }
02372 
02373                         // Created:
02374                 $lines[]=array($LANG->getLL('pI_crDate').':', t3lib_BEfunc::datetime($rec['crdate']).' ('.t3lib_BEfunc::calcAge(time()-$rec['crdate'],$this->agePrefixes).')');
02375 
02376                         // Last change:
02377                 $lines[]=array($LANG->getLL('pI_lastChange').':', t3lib_BEfunc::datetime($rec['tstamp']).' ('.t3lib_BEfunc::calcAge(time()-$rec['tstamp'],$this->agePrefixes).')');
02378 
02379                         // Last change of content:
02380                 if ($rec['SYS_LASTCHANGED'])    {
02381                         $lines[]=array($LANG->getLL('pI_lastChangeContent').':', t3lib_BEfunc::datetime($rec['SYS_LASTCHANGED']).' ('.t3lib_BEfunc::calcAge(time()-$rec['SYS_LASTCHANGED'],$this->agePrefixes).')');
02382                 }
02383 
02384                         // Spacer:
02385                 $lines[]='';
02386 
02387                         // Display contents of certain page fields, if any value:
02388                 $dfields = explode(',','alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
02389                 foreach($dfields as $fV)        {
02390                         if ($rec[$fV])  {
02391                                 $lines[]=array($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$fV)), t3lib_BEfunc::getProcessedValue('pages',$fV,$rec[$fV]));
02392                         }
02393                 }
02394 
02395                         // Page hits (depends on "sys_stat" extension)
02396                 if ($this->pI_showStat && t3lib_extMgm::isLoaded('sys_stat'))   {
02397 
02398                                 // Counting total hits:
02399                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'sys_stat', 'page_id='.intval($rec['uid']));
02400                         $rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
02401                         if ($rrow[0])   {
02402 
02403                                         // Get min/max
02404                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id='.intval($rec['uid']));
02405                                 $rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
02406 
02407                                 $lines[]='';
02408                                 $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).')');
02409                                 $lines[]=array($LANG->getLL('pI_hitsTotal').':',$rrow[0]);
02410 
02411 
02412                                         // Last 10 days
02413                                 $nextMidNight = mktime (0,0,0)+1*3600*24;
02414 
02415                                 $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');
02416                                 $days=array();
02417                                 while($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))        {
02418                                         $days[$rrow[1]] = $rrow[0];
02419                                 }
02420 
02421                                 $headerH=array();
02422                                 $contentH=array();
02423                                 for($a=9;$a>=0;$a--)    {
02424                                         $headerH[]='
02425                                                         <td class="bgColor5" nowrap="nowrap">&nbsp;'.date('d',$nextMidNight-($a+1)*24*3600).'&nbsp;</td>';
02426                                         $contentH[]='
02427                                                         <td align="center">'.($days[$a] ? intval($days[$a]) : '-').'</td>';
02428                                 }
02429 
02430                                         // Compile first hit-table (last 10 days)
02431                                 $hitTable='
02432                                         <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits">
02433                                                 <tr>'.implode('',$headerH).'</tr>
02434                                                 <tr>'.implode('',$contentH).'</tr>
02435                                         </table>';
02436                                 $lines[]=array($LANG->getLL('pI_hits10days').':',$hitTable,1);
02437 
02438 
02439                                         // Last 24 hours
02440                                 $nextHour = mktime (date('H'),0,0)+3600;
02441                                 $hours=16;
02442 
02443                                 $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');
02444                                 $days=array();
02445                                 while($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))        {
02446                                         $days[$rrow[1]]=$rrow[0];
02447                                 }
02448 
02449                                 $headerH=array();
02450                                 $contentH=array();
02451                                 for($a=($hours-1);$a>=0;$a--)   {
02452                                         $headerH[]='
02453                                                         <td class="bgColor5" nowrap="nowrap">&nbsp;'.intval(date('H',$nextHour-($a+1)*3600)).'&nbsp;</td>';
02454                                         $contentH[]='
02455                                                         <td align="center">'.($days[$a] ? intval($days[$a]) : '-').'</td>';
02456                                 }
02457 
02458                                         // Compile second hit-table (last 24 hours)
02459                                 $hitTable='
02460                                         <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat">
02461                                                 <tr>'.implode('',$headerH).'</tr>
02462                                                 <tr>'.implode('',$contentH).'</tr>
02463                                         </table>';
02464                                 $lines[]=array($LANG->getLL('pI_hits24hours').':',$hitTable,1);
02465                         }
02466                 }
02467 
02468 
02469                         // Finally, wrap the elements in the $lines array in table cells/rows
02470                 foreach($lines as $fV)  {
02471                         if (is_array($fV))      {
02472                                 if (!$fV[2])    $fV[1]=htmlspecialchars($fV[1]);
02473                                 $out.='
02474                                 <tr>
02475                                         <td class="bgColor4" nowrap="nowrap"><strong>'.htmlspecialchars($fV[0]).'&nbsp;&nbsp;</strong></td>
02476                                         <td class="bgColor4">'.$fV[1].'</td>
02477                                 </tr>';
02478                         } else {
02479                                 $out.='
02480                                 <tr>
02481                                         <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
02482                                 </tr>';
02483                         }
02484                 }
02485 
02486                         // Wrap table tags around...
02487                 $outPutContent.='
02488 
02489 
02490 
02491                         <!--
02492                                 Page info box:
02493                         -->
02494                         <table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
02495                                 '.$out.'
02496                         </table>';
02497 
02498                         // ... and return it.
02499                 return $outPutContent;
02500         }
02501 
02510         function getTableMenu($id)      {
02511                 global $TCA;
02512 
02513                         // Initialize:
02514                 $this->activeTables=array();
02515                 $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!
02516 
02517                         // External tables:
02518                 if (is_array($this->externalTables))    {
02519                         $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
02520                 }
02521 
02522                         // Traverse tables to check:
02523                 foreach($theTables as $tName)   {
02524 
02525                                 // Check access and whether the proper extensions are loaded:
02526                         if ($GLOBALS['BE_USER']->check('tables_select',$tName) && (t3lib_extMgm::isLoaded($tName)||t3lib_div::inList('fe_users,tt_content',$tName) || isset($this->externalTables[$tName])))    {
02527 
02528                                         // Make query to count records from page:
02529                                 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $tName, 'pid='.intval($id).t3lib_BEfunc::deleteClause($tName).t3lib_BEfunc::versioningPlaceholderClause($tName));
02530                                 list($c) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
02531 
02532                                         // If records were found (or if "tt_content" is the table...):
02533                                 if ($c || t3lib_div::inList('tt_content',$tName))       {
02534 
02535                                                 // Add row to menu:
02536                                         $out.='
02537                                         <td><a href="#'.$tName.'"></a>'.
02538                                                         t3lib_iconWorks::getIconImage($tName,Array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1).'"').
02539                                                         '</td>';
02540 
02541                                                 // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
02542                                         $this->activeTables[$tName]=
02543                                                         t3lib_iconWorks::getIconImage($tName,Array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1).': '.$c.' '.$GLOBALS['LANG']->getLL('records',1).'" class="absmiddle"').
02544                                                         '&nbsp;'.
02545                                                         $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1);
02546                                 }
02547                         }
02548                 }
02549 
02550                         // Wrap cells in table tags:
02551                 $out = '
02552 
02553 
02554 
02555                         <!--
02556                                 Menu of tables on the page (table menu)
02557                         -->
02558                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
02559                                 <tr>'.$out.'
02560                                 </tr>
02561                         </table>';
02562 
02563                         // Return the content:
02564                 return $out;
02565         }
02566 
02575         function strip_tags($content, $fillEmptyContent=false)  {
02576                 if($fillEmptyContent && strstr($content, '><')) {
02577                         $content = preg_replace('/(<[^ >]* )([^ >]*)([^>]*>)(<\/[^>]*>)/', '$1$2$3$2$4', $content);
02578                 }
02579                 $content = preg_replace('/<br.?\/?>/', chr(10), $content);
02580 
02581                 return strip_tags($content);
02582         }
02583 }
02584 
02585 
02586 
02587 
02588 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php'])  {
02589         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php']);
02590 }
02591 ?>