Documentation TYPO3 par Ameos

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),TRUE));
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                         if ($this->doEdit)      {
01169                                 $theData['__cmds__'] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit['.$table.']['.$this->id.']=new',$this->backPath)).'">'.
01170                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_el.gif').' title="'.$GLOBALS['LANG']->getLL('new',1).'" alt="" />'.
01171                                         '</a>';
01172                         }
01173                         $out.= $this->addelement(1,'',$theData,' class="c-headLine"',15);
01174 
01175                                 // Render Items
01176                         $this->eCounter = $this->firstElementNumber;
01177                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))   {
01178                                 t3lib_BEfunc::workspaceOL($table, $row);
01179 
01180                                 list($flag,$code) = $this->fwd_rwd_nav();
01181                                 $out.= $code;
01182                                 if ($flag)      {
01183                                         $params = '&edit['.$table.']['.$row['uid'].']=edit';
01184                                         $Nrow = array();
01185 
01186                                                 // Setting icons/edit links:
01187                                         if ($icon)      {
01188                                                 $Nrow['__cmds__']= $this->getIcon($table,$row);
01189                                         }
01190                                         if ($this->doEdit)      {
01191                                                 $Nrow['__cmds__'].= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
01192                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.
01193                                                                                 '</a>';
01194                                         } else {
01195                                                 $Nrow['__cmds__'].= $this->noEditIcon();
01196                                         }
01197 
01198                                                 // Get values:
01199                                         $Nrow = $this->dataFields($this->fieldArray,$table,$row,$Nrow);
01200                                         $tdparams = $this->eCounter%2 ? ' class="bgColor4"' : ' class="bgColor4-20"';
01201                                         $out.= $this->addelement(1,'',$Nrow,$tdparams);
01202                                 }
01203                                 $this->eCounter++;
01204                         }
01205 
01206                                 // Wrap it all in a table:
01207                         $out='
01208 
01209                                 <!--
01210                                         STANDARD LIST OF "'.$table.'"
01211                                 -->
01212                                 <table border="0" cellpadding="1" cellspacing="2" width="480" id="typo3-page-stdlist">
01213                                         '.$out.'
01214                                 </table>';
01215                 }
01216                 return $out;
01217         }
01218 
01229         function dataFields($fieldArr,$table,$row,$out=array()) {
01230                 global $TCA;
01231 
01232                         // Check table validity:
01233                 if ($TCA[$table])       {
01234                         t3lib_div::loadTCA($table);
01235                         $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
01236 
01237                                 // Traverse fields:
01238                         foreach($fieldArr as $fieldName)        {
01239 
01240                                 if ($TCA[$table]['columns'][$fieldName])        {       // Each field has its own cell (if configured in TCA)
01241                                         if ($fieldName==$thumbsCol)     {       // If the column is a thumbnail column:
01242                                                 $out[$fieldName] = $this->thumbCode($row,$table,$fieldName);
01243                                         } else {        // ... otherwise just render the output:
01244                                                 $out[$fieldName] = nl2br(htmlspecialchars(trim(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fieldName,$row[$fieldName],0,0,0,$row['uid']),250))));
01245                                         }
01246                                 } 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)
01247                                         $theFields = explode(';',$fieldName);
01248 
01249                                                 // Traverse fields, separated by ";" (displayed in a single cell).
01250                                         foreach($theFields as $fName2)  {
01251                                                 if ($TCA[$table]['columns'][$fName2])   {
01252                                                          $out[$fieldName].= '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'],1).'</b>'.
01253                                                                                                 '&nbsp;&nbsp;'.
01254                                                                                                 htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fName2,$row[$fName2],0,0,0,$row['uid']),25)).
01255                                                                                                 '<br />';
01256                                                 }
01257                                         }
01258                                 }
01259                                         // If no value, add a nbsp.
01260                                 if (!$out[$fieldName])  $out[$fieldName]='&nbsp;';
01261 
01262                                         // Wrap in dimmed-span tags if record is "disabled"
01263                                 if ($this->isDisabled($table,$row))     {
01264                                         $out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
01265                                 }
01266                         }
01267                 }
01268                 return $out;
01269         }
01270 
01280         function headerFields($fieldArr,$table,$out=array())    {
01281                 global $TCA;
01282 
01283                 t3lib_div::loadTCA($table);
01284 
01285                 foreach($fieldArr as $fieldName)        {
01286                         $ll = $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fieldName]['label'],1);
01287                         $out[$fieldName] = '<b>'.($ll?$ll:'&nbsp;').'</b>';
01288                 }
01289                 return $out;
01290         }
01291 
01292 
01293 
01294 
01295 
01296 
01297 
01298 
01299 
01300 
01301 
01302 
01303 
01304 
01305 
01306         /**********************************
01307          *
01308          * Additional functions; Pages
01309          *
01310          **********************************/
01311 
01322         function pages_getTree($theRows,$pid,$qWhere,$treeIcons,$depth) {
01323                 $depth--;
01324                 if ($depth>=0)  {
01325                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($pid).$qWhere, '', 'sorting');
01326                         $c=0;
01327                         $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01328                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01329                                 t3lib_BEfunc::workspaceOL('pages', $row);
01330                                 $c++;
01331                                 $row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/join'.($rc==$c?'bottom':'').'.gif','width="18" height="16"').' alt="" />';
01332                                 $theRows[]=$row;
01333 
01334                                         // Get the branch
01335                                 $spaceOutIcons = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c?'blank.gif':'line.gif'),'width="18" height="16"').' alt="" />';
01336                                 $theRows = $this->pages_getTree($theRows,$row['uid'],$qWhere,$treeIcons.$spaceOutIcons,$row['php_tree_stop']?0:$depth);
01337                         }
01338                 } else {
01339                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'pages', 'pid='.intval($pid).$qWhere);
01340                         $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
01341                         if ($row[0])    {
01342                                 $this->plusPages[$pid]=$row[0];
01343                         }
01344                 }
01345                 return $theRows;
01346         }
01347 
01355         function pages_drawItem($row,$fieldArr) {
01356                 global $TCA;
01357 
01358                         // Initialization
01359                 $theIcon=$this->getIcon('pages',$row);
01360 
01361                         //      Preparing and getting the data-array
01362                 $theData = Array();
01363                 foreach($fieldArr as $field)    {
01364                         switch($field)  {
01365                                 case 'title':
01366                                         $red = $this->plusPages[$row['uid']] ? '<font color="red"><b>+&nbsp;</b></font>' : '';
01367                                         $pTitle = htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field],20));
01368                                         if ($red)       {
01369                                                 $pTitle = '<a href="'.htmlspecialchars($this->script.'?id='.$row['uid']).'">'.$pTitle.'</a>';
01370                                         }
01371                                         $theData[$field]=$row['treeIcons'].$theIcon.$red.$pTitle.'&nbsp;&nbsp;';
01372                                 break;
01373                                 case 'php_tree_stop':
01374                                 case 'TSconfig':
01375                                         $theData[$field] = $row[$field]?'&nbsp;<b>x</b>':'&nbsp;';
01376                                 break;
01377                                 case 'uid':
01378                                         if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2))    {
01379                                                 $params='&edit[pages]['.$row['uid'].']=edit';
01380                                                 $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'.
01381                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('editThisPage',1).'" alt="" />'.
01382                                                                 '</a>';
01383                                         } else $eI='';
01384                                         $theData[$field] = '<span align="right">'.$row['uid'].$eI.'</span>';
01385                                 break;
01386                                 default:
01387                                         if (substr($field,0,6)=='table_')       {
01388                                                 $f2 = substr($field,6);
01389                                                 if ($TCA[$f2])  {
01390                                                         $c = $this->numberOfRecords($f2,$row['uid']);
01391                                                         $theData[$field] = '&nbsp;&nbsp;'.($c?$c:'');
01392                                                 }
01393                                         } elseif (substr($field,0,5)=='HITS_')  {
01394                                                 if (t3lib_extMgm::isLoaded('sys_stat')) {
01395                                                         $fParts = explode(':',substr($field,5));
01396                                                         switch($fParts[0])      {
01397                                                                 case 'days':
01398                                                                         $timespan = mktime (0,0,0)+intval($fParts[1])*3600*24;
01399                                                                                 // Page hits
01400                                                                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01401                                                                                                         'count(*)',
01402                                                                                                         'sys_stat',
01403                                                                                                         $this->stat_select_field.'='.intval($row['uid']).'
01404                                                                                                                 AND tstamp>='.intval($timespan).'
01405                                                                                                                 AND tstamp<'.intval($timespan+3600*24)
01406                                                                                                 );
01407                                                                         list($number) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
01408                                                                         if ($number)    {
01409                                                                                         // Sessions
01410                                                                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01411                                                                                                                 'count(*)',
01412                                                                                                                 'sys_stat',
01413                                                                                                                 $this->stat_select_field.'='.intval($row['uid']).'
01414                                                                                                                         AND tstamp>='.intval($timespan).'
01415                                                                                                                         AND tstamp<'.intval($timespan+3600*24).'
01416                                                                                                                         AND surecookie!=""',
01417                                                                                                                 'surecookie'
01418                                                                                                         );
01419                                                                                 $scnumber = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01420 
01421                                                                                 $number.= '/'.$scnumber;
01422                                                                         } else {
01423                                                                                 $number='';
01424                                                                         }
01425                                                                 break;
01426                                                         }
01427                                                         $theData[$field]= '&nbsp;'.$number;
01428                                                 } else {
01429                                                         $theData[$field]= '&nbsp;';
01430                                                 }
01431                                         } else {
01432                                                 $theData[$field]= '&nbsp;&nbsp;'.htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field]));
01433                                         }
01434                                 break;
01435                         }
01436                 }
01437                 $this->addElement_tdParams['title'] = ($row['_CSSCLASS'] ? ' class="'.$row['_CSSCLASS'].'"' : '');
01438                 return $this->addelement(1,'',$theData);
01439         }
01440 
01441 
01442 
01443 
01444 
01445 
01446 
01447 
01448 
01449 
01450 
01451 
01452         /**********************************
01453          *
01454          * Additional functions; Content Elements
01455          *
01456          **********************************/
01457 
01466         function tt_content_drawColHeader($colName,$editParams,$newParams)      {
01467 
01468                         // Create header row:
01469                 $out = '
01470                                 <tr>
01471                                         <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>
01472                                 </tr>';
01473 
01474                         // Create command links:
01475                 if ($this->tt_contentConfig['showCommands'])    {
01476                                 // Start cell:
01477                         $out.= '
01478                                 <tr>
01479                                         <td class="bgColor5">';
01480 
01481                                 // Edit whole of column:
01482                         if ($editParams)        {
01483                                 $out.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($editParams,$this->backPath)).'">'.
01484                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('editColumn',1).'" alt="" />'.
01485                                                 '</a>';
01486                         }
01487                                 // New record:
01488                         if ($newParams) {
01489                                 $out.='<a href="#" onclick="'.htmlspecialchars($newParams).'">'.
01490                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_record.gif','width="16" height="12"').' title="'.$GLOBALS['LANG']->getLL('newInColumn',1).'" alt="" />'.
01491                                                 '</a>';
01492                         }
01493                                 // End cell:
01494                         $out.= '
01495                                         </td>
01496                                 </tr>';
01497                 }
01498 
01499                         // Wrap and return:
01500                 return '
01501                         <table border="0" cellpadding="0" cellspacing="0" width="100%" class="typo3-page-colHeader">'.($space?'
01502                                 <tr>
01503                                         <td><img src="clear.gif" height="'.$space.'" alt="" /></td>
01504                                 </tr>':'').
01505                                 $out.'
01506                         </table>';
01507         }
01508 
01518         function tt_content_drawHeader($row,$space=0,$disableMoveAndNewButtons=FALSE,$langMode=FALSE)   {
01519                 global $TCA;
01520 
01521                         // Load full table description:
01522                 t3lib_div::loadTCA('tt_content');
01523 
01524                         // Get record locking status:
01525                 if ($lockInfo=t3lib_BEfunc::isRecordLocked('tt_content',$row['uid']))   {
01526                         $lockIcon='<a href="#" onclick="'.htmlspecialchars('alert('.$GLOBALS['LANG']->JScharCode($lockInfo['msg']).');return false;').'">'.
01527                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
01528                                                 '</a>';
01529                 } else $lockIcon='';
01530 
01531                         // Create header with icon/lock-icon/title:
01532                 $header = $this->getIcon('tt_content',$row).
01533                                 $lockIcon.
01534                                 ($langMode ? $this->languageFlag($row['sys_language_uid']) : '').
01535                                 '&nbsp;<b>'.htmlspecialchars($this->CType_labels[$row['CType']]).'</b>';
01536                 $out = '
01537                                         <tr>
01538                                                 <td class="bgColor4">'.$header.'</td>
01539                                         </tr>';
01540 
01541                         // If show info is set...;
01542                 if ($this->tt_contentConfig['showInfo'])        {
01543 
01544                                 // Get processed values:
01545                         $info = Array();
01546                         $this->getProcessedValue('tt_content','hidden,starttime,endtime,fe_group,spaceBefore,spaceAfter,section_frame,sectionIndex,linkToTop',$row,$info);
01547 
01548                                 // Render control panel for the element:
01549                         if ($this->tt_contentConfig['showCommands'] && $this->doEdit)   {
01550 
01551                                         // Start control cell:
01552                                 $out.= '
01553                                         <!-- Control Panel -->
01554                                         <tr>
01555                                                 <td class="bgColor5">';
01556 
01557                                         // Edit content element:
01558                                 $params='&edit[tt_content]['.$this->tt_contentData['nextThree'][$row['uid']].']=edit';
01559                                 $out.='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
01560                                                 '<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="" />'.
01561                                                 '</a>';
01562 
01563                                 if (!$disableMoveAndNewButtons) {
01564                                                 // New content element:
01565                                         if ($this->option_newWizard)    {
01566                                                 $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'))."';";
01567                                         } else {
01568                                                 $params='&edit[tt_content]['.(-$row['uid']).']=new';
01569                                                 $onClick = t3lib_BEfunc::editOnClick($params,$this->backPath);
01570                                         }
01571                                         $out.='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
01572                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_record.gif','width="16" height="12"').' title="'.$GLOBALS['LANG']->getLL('newAfter',1).'" alt="" />'.
01573                                                         '</a>';
01574 
01575                                                 // Move element up:
01576                                         if ($this->tt_contentData['prev'][$row['uid']]) {
01577                                                 $params='&cmd[tt_content]['.$row['uid'].'][move]='.$this->tt_contentData['prev'][$row['uid']];
01578                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01579                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('moveUp',1).'" alt="" />'.
01580                                                                 '</a>';
01581                                         } else {
01582                                                 $out.='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"',2).' alt="" />';
01583                                         }
01584                                                 // Move element down:
01585                                         if ($this->tt_contentData['next'][$row['uid']]) {
01586                                                 $params='&cmd[tt_content]['.$row['uid'].'][move]='.$this->tt_contentData['next'][$row['uid']];
01587                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01588                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('moveDown',1).'" alt="" />'.
01589                                                                 '</a>';
01590                                         } else {
01591                                                 $out.='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"',2).' alt="" />';
01592                                         }
01593                                 }
01594 
01595                                         // Hide element:
01596                                 $hiddenField = $TCA['tt_content']['ctrl']['enablecolumns']['disabled'];
01597                                 if ($hiddenField && $TCA['tt_content']['columns'][$hiddenField] && (!$TCA['tt_content']['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields','tt_content:'.$hiddenField)))    {
01598                                         if ($row[$hiddenField]) {
01599                                                 $params='&data[tt_content]['.($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid']).']['.$hiddenField.']=0';
01600                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01601                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('unHide',1).'" alt="" />'.
01602                                                                 '</a>';
01603                                         } else {
01604                                                 $params='&data[tt_content]['.($row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid']).']['.$hiddenField.']=1';
01605                                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'">'.
01606                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$GLOBALS['LANG']->getLL('hide',1).'" alt="" />'.
01607                                                                 '</a>';
01608                                         }
01609                                 }
01610 
01611                                         // Delete
01612                                 $params='&cmd[tt_content]['.$row['uid'].'][delete]=1';
01613                                 $out.='<a href="'.htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params)).'" onclick="'.htmlspecialchars('return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning')).');').'">'.
01614                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('deleteItem',1).'" alt="" />'.
01615                                                 '</a>';
01616 
01617                                         // End cell:
01618                                 $out.= '
01619                                                 </td>
01620                                         </tr>';
01621                         }
01622 
01623                                 // Display info from records fields:
01624                         if (count($info))       {
01625                                 $out.= '
01626                                         <tr>
01627                                                 <td class="bgColor4-20">'.implode('<br />',$info).'</td>
01628                                         </tr>';
01629                         }
01630                 }
01631                         // Wrap the whole header in a table:
01632                 return '
01633                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-page-ceHeader">'.($space?'
01634                                         <tr>
01635                                                 <td><img src="clear.gif" height="'.$space.'" alt="" /></td>
01636                                         </tr>':'').
01637                                         $out.'
01638                                 </table>';
01639         }
01640 
01648         function tt_content_drawItem($row, $isRTE=FALSE)        {
01649                 global $TCA;
01650 
01651                 $out='';
01652                 $outHeader='';
01653 
01654                         // Make header:
01655                 if ($row['header'] && $row['header_layout']!=100)       {
01656                         $infoArr = Array();
01657                         $this->getProcessedValue('tt_content','header_position,header_layout,header_link',$row,$infoArr);
01658 
01659                         $outHeader=  ($row['date'] ? htmlspecialchars($this->itemLabels['date'].' '.t3lib_BEfunc::date($row['date'])).'<br />':'').
01660                                         $this->infoGif($infoArr).
01661                                         '<b>'.$this->linkEditContent($this->renderText($row['header']),$row).'</b><br />';
01662                 }
01663 
01664                         // Make content:
01665                 $infoArr=Array();
01666                 switch($row['CType'])   {
01667                         case 'header':
01668                                 if ($row['subheader'])  {
01669                                         $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01670                                         $out.=  $this->infoGif($infoArr).
01671                                                         $this->linkEditContent($this->renderText($row['subheader']),$row).'<br />';
01672                                 }
01673                         break;
01674                         case 'text':
01675                         case 'textpic':
01676                         case 'image':
01677                                 if ($row['CType']=='text' || $row['CType']=='textpic')  {
01678                                         if ($row['bodytext'])   {
01679                                                 $this->getProcessedValue('tt_content','text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01680                                                 $out.= $this->infoGif($infoArr).
01681                                                                 $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01682                                         }
01683                                 }
01684                                 if ($row['CType']=='textpic' || $row['CType']=='image') {
01685                                         if ($row['image'])      {
01686                                                 $infoArr=Array();
01687                                                 $this->getProcessedValue('tt_content','imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames',$row,$infoArr);
01688                                                 $out.=  $this->infoGif($infoArr).
01689                                                                 $this->thumbCode($row,'tt_content','image').'<br />';
01690 
01691                                                 if ($row['imagecaption'])       {
01692                                                         $infoArr=Array();
01693                                                         $this->getProcessedValue('tt_content','imagecaption_position',$row,$infoArr);
01694                                                         $out.=  $this->infoGif($infoArr).
01695                                                                         $this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
01696                                                 }
01697                                         }
01698                                 }
01699                         break;
01700                         case 'bullets':
01701                                 if ($row['bodytext'])   {
01702                                         $this->getProcessedValue('tt_content','layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01703                                         $out.=  $this->infoGif($infoArr).
01704                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01705                                 }
01706                         break;
01707                         case 'table':
01708                                 if ($row['bodytext'])   {
01709                                         $this->getProcessedValue('tt_content','table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties',$row,$infoArr);
01710                                         $out.=  $this->infoGif($infoArr).
01711                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01712                                 }
01713                         break;
01714                         case 'uploads':
01715                                 if ($row['media'])      {
01716                                         $this->getProcessedValue('tt_content','media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing',$row,$infoArr);
01717                                         $out.=  $this->infoGif($infoArr).
01718                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01719                                 }
01720                         break;
01721                         case 'multimedia':
01722                                 if ($row['multimedia']) {
01723                                         $out.=  $this->renderText($row['multimedia']).'<br />';
01724                                         $out.=  $this->renderText($row['parameters']).'<br />';
01725                                 }
01726                         break;
01727                         case 'mailform':
01728                                 if ($row['bodytext'])   {
01729                                         $this->getProcessedValue('tt_content','pages,subheader',$row,$infoArr);
01730                                         $out.=  $this->infoGif($infoArr).
01731                                                         $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01732                                 }
01733                         break;
01734                         case 'splash':
01735                                 if ($row['bodytext'])   {
01736                                         $out.=  $this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01737                                 }
01738                                 if ($row['image'])      {
01739                                         $infoArr=Array();
01740                                         $this->getProcessedValue('tt_content','imagewidth',$row,$infoArr);
01741                                         $out.=  $this->infoGif($infoArr).
01742                                                         $this->thumbCode($row,'tt_content','image').'<br />';
01743                                 }
01744                         break;
01745                         case 'menu':
01746                                 if ($row['pages'])      {
01747                                         $this->getProcessedValue('tt_content','menu_type',$row,$infoArr);
01748                                         $out.=  $this->infoGif($infoArr).
01749                                                         $this->linkEditContent($row['pages'],$row).'<br />';
01750                                 }
01751                         break;
01752                         case 'shortcut':
01753                                 if ($row['records'])    {
01754                                         $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01755                                         $out.=  $this->infoGif($infoArr).
01756                                                         $this->linkEditContent($row['shortcut'],$row).'<br />';
01757                                 }
01758                         break;
01759                         case 'list':
01760                                 $this->getProcessedValue('tt_content','layout',$row,$infoArr);
01761                                 $out.=  $this->infoGif($infoArr).
01762                                                 $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','list_type'),1).' '.
01763                                                 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','list_type',$row['list_type']),1).'<br />';
01764 
01765                                 $out.=  $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
01766 
01767                                 $infoArr=Array();
01768                                 $this->getProcessedValue('tt_content','recursive',$row,$infoArr);
01769                                 $out.=  $this->infoGif($infoArr).
01770                                                 $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content','pages',$row['pages']),1).'<br />';
01771                         break;
01772                         case 'script':
01773                                 $out.=  $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','select_key'),1).' '.$row['select_key'].'<br />';
01774                                 $out.=  '<br />'.$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01775                                 $out.=  '<br />'.$this->linkEditContent($this->renderText($row['imagecaption']),$row).'<br />';
01776                         break;
01777                         default:
01778                                 if ($row['bodytext'])   {
01779                                         $out.=$this->linkEditContent($this->renderText($row['bodytext']),$row).'<br />';
01780                                 }
01781                         break;
01782                 }
01783 
01784                         // Wrap span-tags:
01785                 $out = '
01786                         <span class="exampleContent">'.$out.'</span>';
01787                         // Add header:
01788                 $out = $outHeader.$out;
01789                         // Add RTE button:
01790                 if ($isRTE) {
01791                         $out.= $this->linkRTEbutton($row);
01792                 }
01793 
01794                         // Return values:
01795                 if ($this->isDisabled('tt_content',$row))       {
01796                         return $GLOBALS['TBE_TEMPLATE']->dfw($out);
01797                 } else {
01798                         return $out;
01799                 }
01800         }
01801 
01811         function getNonTranslatedTTcontentUids($defLanguageCount,$id,$lP)       {
01812                 if ($lP && count($defLanguageCount))    {
01813 
01814                                 // Select all translations here:
01815                         $queryParts = $this->makeQueryArray('tt_content', $id, 'AND sys_language_uid='.intval($lP).' AND l18n_parent IN ('.implode(',',$defLanguageCount).')');
01816                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
01817 
01818                                 // Flip uids:
01819                         $defLanguageCount = array_flip($defLanguageCount);
01820 
01821                                 // Traverse any selected elements and unset original UID if any:
01822                         $rowArr = $this->getResult($result);
01823                         foreach($rowArr as $row)        {
01824                                 unset($defLanguageCount[$row['l18n_parent']]);
01825                         }
01826 
01827                                 // Flip again:
01828                         $defLanguageCount = array_keys($defLanguageCount);
01829                 }
01830 
01831                 return $defLanguageCount;
01832         }
01833 
01841         function newLanguageButton($defLanguageCount,$lP)       {
01842                 if ($this->doEdit && count($defLanguageCount) && $lP)   {
01843 
01844                         $params = '';
01845                         foreach($defLanguageCount as $uidVal)   {
01846                                 $params.='&cmd[tt_content]['.$uidVal.'][localize]='.$lP;
01847                         }
01848 
01849                                 // Copy for language:
01850                         $onClick = "window.location.href='".$GLOBALS['SOBE']->doc->issueCommand($params)."'; return false;";
01851                         $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick,$GLOBALS['LANG']->getLL('newPageContent_copyForLang').' ['.count($defLanguageCount).']');
01852                         return $theNewButton;
01853                 }
01854         }
01855 
01862         function infoGif($infoArr)      {
01863                 if (count($infoArr) && $this->tt_contentConfig['showInfo'])     {
01864                         $out='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.htmlspecialchars(implode(chr(10),$infoArr)).'" alt="" /> ';
01865                         return $out;
01866                 }
01867         }
01868 
01878         function newContentElementOnClick($id,$colPos,$sys_language)    {
01879                 if ($this->option_newWizard)    {
01880                         $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'))."';";
01881                 } else {
01882                         $onClick=t3lib_BEfunc::editOnClick('&edit[tt_content]['.$id.']=new&defVals[tt_content][colPos]='.$colPos.'&defVals[tt_content][sys_language_uid]='.$sys_language,$this->backPath);
01883                 }
01884                 return $onClick;
01885         }
01886 
01896         function linkEditContent($str,$row)     {
01897                 $addButton='';
01898                 $onClick = '';
01899 
01900                 if ($this->doEdit)      {
01901                                 // Setting onclick action for content link:
01902                         $onClick=t3lib_BEfunc::editOnClick('&edit[tt_content]['.$row['uid'].']=edit',$this->backPath);
01903                 }
01904                         // Return link
01905                 return $onClick ? '<a href="#" onclick="'.htmlspecialchars($onClick).'" title="'.$GLOBALS['LANG']->getLL('edit',1).'">'.$str.'</a>'.$addButton : $str;
01906         }
01907 
01914         function linkRTEbutton($row)    {
01915                 $params = array();
01916                 $params['table'] = 'tt_content';
01917                 $params['uid'] = $row['uid'];
01918                 $params['pid'] = $row['pid'];
01919                 $params['field'] = 'bodytext';
01920                 $params['returnUrl'] = t3lib_div::linkThisScript();
01921                 $RTEonClick = "window.location.href='".$this->backPath."wizard_rte.php?".t3lib_div::implodeArrayForUrl('',array('P'=>$params))."';return false;";
01922                 $addButton = $this->option_showBigButtons && $this->doEdit ? $GLOBALS['SOBE']->doc->t3Button($RTEonClick,$GLOBALS['LANG']->getLL('editInRTE')) : '';
01923 
01924                 return $addButton;
01925         }
01926 
01935         function languageSelector($id)  {
01936                 if ($GLOBALS['BE_USER']->check('tables_modify','pages_language_overlay'))       {
01937 
01938                                 // First, select all
01939                         $res = $GLOBALS['SOBE']->exec_languageQuery(0);
01940                         $langSelItems=array();
01941                         $langSelItems[0]='
01942                                                 <option value="0"></option>';
01943                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01944                                 if ($GLOBALS['BE_USER']->checkLanguageAccess($row['uid']))      {
01945                                         $langSelItems[$row['uid']]='
01946                                                         <option value="'.$row['uid'].'">'.htmlspecialchars($row['title']).'</option>';
01947                                 }
01948                         }
01949 
01950                                 // Then, subtract the languages which are already on the page:
01951                         $res = $GLOBALS['SOBE']->exec_languageQuery($id);
01952                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01953                                 unset($langSelItems[$row['uid']]);
01954                         }
01955 
01956                                 // If any languages are left, make selector:
01957                         if (count($langSelItems)>1)             {
01958                                 $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')).'\'';
01959                                 return $GLOBALS['LANG']->getLL('new_language',1).': <select name="createNewLanguage" onchange="'.htmlspecialchars($onChangeContent).'">
01960                                                 '.implode('',$langSelItems).'
01961                                         </select><br /><br />';
01962                         }
01963                 }
01964         }
01965 
01972         function getResult($result)     {
01973 
01974                         // Initialize:
01975                 $editUidList='';
01976                 $recs=Array();
01977                 $nextTree = $this->nextThree;
01978                 $c=0;
01979                 $output=Array();
01980 
01981                         // Traverse the result:
01982                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))   {
01983 
01984                                 // Add the row to the array:
01985                         $output[]=$row;
01986 
01987                                 // Set an internal register:
01988                         $recs[$c]=$row['uid'];
01989 
01990                                 // Create the list of the next three ids (for editing links...)
01991                         for($a=0;$a<$nextTree;$a++)     {
01992                                 if(isset($recs[$c-$a])) {
01993                                         $this->tt_contentData['nextThree'][$recs[$c-$a]].=$row['uid'].',';
01994                                 }
01995                         }
01996 
01997                                 // Set next/previous ids:
01998                         if (isset($recs[$c-1])) {
01999                                 if (isset($recs[$c-2])) {
02000                                         $this->tt_contentData['prev'][$row['uid']]=-$recs[$c-2];
02001                                 } else {
02002                                         $this->tt_contentData['prev'][$row['uid']]=$row['pid'];
02003                                 }
02004                                 $this->tt_contentData['next'][$recs[$c-1]]=-$row['uid'];
02005                         }
02006                         $c++;
02007                 }
02008 
02009                         // Return selected records
02010                 return $output;
02011         }
02012 
02013 
02014 
02015 
02016 
02017 
02018 
02019 
02020 
02021 
02022 
02023 
02024 
02025         /**********************************
02026          *
02027          * Additional functions; Message board items (tt_board)
02028          *
02029          **********************************/
02030 
02041         function tt_board_getTree($theRows,$parent,$pid,$qWhere,$treeIcons) {
02042 
02043                         // Select tt_board elements:
02044                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_board', 'pid='.intval($pid).' AND parent='.intval($parent).$qWhere, '', 'crdate');
02045 
02046                         // Traverse the results:
02047                 $c=0;
02048                 $rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
02049                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
02050                         $c++;
02051                         $row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c ? 'joinbottom.gif' : 'join.gif'),'width="18" height="16"').' alt="" />';
02052                         $theRows[]=$row;
02053 
02054                                 // Get the branch
02055                         $theRows = $this->tt_board_getTree(
02056                                                 $theRows,
02057                                                 $row['uid'],
02058                                                 $row['pid'],
02059                                                 $qWhere,
02060                                                 $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c ? 'blank.gif' : 'line.gif'),'width="18" height="16"').' alt="" />'
02061                                         );
02062                 }
02063 
02064                         // Return modified rows:
02065                 return $theRows;
02066         }
02067 
02076         function tt_board_drawItem($table,$row,$re)     {
02077 
02078                         // Building data-arary with content:
02079                 $theData = Array();
02080                 $theData['subject'] = t3lib_div::fixed_lgd_cs(htmlspecialchars($row['subject']),25).'&nbsp; &nbsp;';
02081                 $theData['author'] = t3lib_div::fixed_lgd_cs(htmlspecialchars($row['author']),15).'&nbsp; &nbsp;';
02082                 $theData['date'] = t3lib_div::fixed_lgd_cs(t3lib_BEfunc::datetime($row['crdate']),20).'&nbsp; &nbsp;';
02083                 $theData['age'] = t3lib_BEfunc::calcAge(time()-$row['crdate'], $this->agePrefixes).'&nbsp; &nbsp;';
02084                 if ($re)        {
02085                         $theData['replys'] = $re;
02086                 }
02087 
02088                         // Subject is built:
02089                 $theData['subject']     =
02090                                         $row['treeIcons'].
02091                                         $this->getIcon($table,$row).
02092                                         $theData['subject'];
02093 
02094                         // Adding element:
02095                 return $this->addelement(1,'',$theData);
02096         }
02097 
02098 
02099 
02100 
02101 
02102 
02103 
02104 
02105 
02106 
02107 
02108 
02109 
02110         /********************************
02111          *
02112          * Various helper functions
02113          *
02114          ********************************/
02115 
02123         function numberOfRecords($table,$pid)   {
02124                 global $TCA;
02125 
02126                 $c=0;
02127                 if ($TCA[$table])       {
02128                         $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, 'pid='.intval($pid).t3lib_BEfunc::deleteClause($table).t3lib_BEfunc::versioningPlaceholderClause($table));
02129                         if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($result))        {
02130                                 $c=$row[0];
02131                         }
02132                 }
02133                 return $c;
02134         }
02135 
02142         function renderText($input)     {
02143                 $input = $this->strip_tags($input, true);
02144                 $input = t3lib_div::fixed_lgd_cs($input,1500);
02145                 return nl2br(htmlspecialchars(trim($this->wordWrapper($input))));
02146         }
02147 
02156         function getIcon($table,$row)   {
02157 
02158                         // Initialization
02159                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
02160                 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.$alttext.'"');
02161                 $this->counter++;
02162 
02163                         // The icon with link
02164                 $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']);
02165 
02166                 return $theIcon;
02167         }
02168 
02179         function getProcessedValue($table,$fieldList,$row,&$info)       {
02180 
02181                         // Splitting values from $fieldList:
02182                 $fieldArr = explode(',',$fieldList);
02183 
02184                         // Traverse fields from $fieldList:
02185                 foreach($fieldArr as $field)    {
02186                         if ($row[$field])       {
02187                                 $info[]= htmlspecialchars($this->itemLabels[$field]).' '.htmlspecialchars(t3lib_BEfunc::getProcessedValue($table,$field,$row[$field]));
02188                         }
02189                 }
02190         }
02191 
02199         function isDisabled($table,$row)        {
02200                 global $TCA;
02201                 if (
02202                         ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) ||
02203                         ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']]>time() ) ||
02204                         ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']]<time())
02205                 )       return true;
02206         }
02207 
02217         function wordWrapper($content,$max=50,$char=' -')       {
02218                 $array = split(' |'.chr(10),$content);
02219                 foreach($array as $val) {
02220                         if (strlen($val)>$max)  {
02221                                 $content=str_replace($val,substr(chunk_split($val,$max,$char),0,-1),$content);
02222                         }
02223                 }
02224                 return $content;
02225         }
02226 
02234         function noEditIcon($label='noEditItems')       {
02235                 return '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2_d.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL($label,1).'" alt="" />';
02236         }
02237 
02243         function cleanTableNames()      {
02244                 global $TCA;
02245 
02246                         // Get all table names:
02247                 $tableNames=array_flip(array_keys($TCA));
02248 
02249                         // Unset common names:
02250                 unset($tableNames['pages']);
02251                 unset($tableNames['static_template']);
02252                 unset($tableNames['sys_filemounts']);
02253                 unset($tableNames['sys_action']);
02254                 unset($tableNames['sys_workflows']);
02255                 unset($tableNames['be_users']);
02256                 unset($tableNames['be_groups']);
02257 
02258                 $this->allowedTableNames=array();
02259 
02260                         // Traverse table names and set them in allowedTableNames array IF they can be read-accessed by the user.
02261                 if (is_array($tableNames))      {
02262                         foreach($tableNames as $k => $v)        {
02263                                 if ($GLOBALS['BE_USER']->check('tables_select',$k))             {
02264                                         $this->allowedTableNames['table_'.$k]=$k;
02265                                 }
02266                         }
02267                 }
02268         }
02269 
02279         function isRTEforField($table,$row,$field){
02280                 $specConf = $this->getSpecConfForField($table,$row,$field);
02281                 $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
02282                 if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
02283                         t3lib_BEfunc::fixVersioningPid($table,$row);
02284                         list($tscPID,$thePidValue) = t3lib_BEfunc::getTSCpid($table,$row['uid'],$row['pid']);
02285                         if ($thePidValue>=0)    {       // If the pid-value is not negative (that is, a pid could NOT be fetched)
02286                                 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($tscPID));
02287                                 $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table,$row);
02288                                 $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$table,$field,$RTEtypeVal);
02289                                 if (!$thisConfig['disabled'])   {
02290                                         return TRUE;
02291                                 }
02292                         }
02293                 }
02294 
02295                 return FALSE;
02296         }
02297 
02309         function getSpecConfForField($table,$row,$field)        {
02310 
02311                         // Get types-configuration for the record:
02312                 $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row);
02313 
02314                         // Find the given field and return the spec key value if found:
02315                 if (is_array($types_fieldConfig))       {
02316                         foreach($types_fieldConfig as $vconf)   {
02317                                 if ($vconf['field']==$field)    return $vconf['spec'];
02318                         }
02319                 }
02320         }
02321 
02322 
02323 
02324 
02325 
02326 
02327 
02328 
02329 
02330 
02331 
02332 
02333         /*****************************************
02334          *
02335          * External renderings
02336          *
02337          *****************************************/
02338 
02346         function getPageInfoBox($rec,$edit=0)   {
02347                 global $LANG;
02348 
02349                         // If editing of the page properties is allowed:
02350                 if ($edit)      {
02351                         $params='&edit[pages]['.$rec['uid'].']=edit';
02352                         $editIcon='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.
02353                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.
02354                                                 '</a>';
02355                 } else {
02356                         $editIcon=$this->noEditIcon('noEditPage');
02357                 }
02358 
02359                         // Setting page icon, link, title:
02360                 $outPutContent = t3lib_iconWorks::getIconImage('pages',$rec,$this->backPath,'title="'.htmlspecialchars(t3lib_BEfunc::titleAttribForPages($rec)).'"').
02361                                 $editIcon.
02362                                 '&nbsp;'.
02363                                 htmlspecialchars($rec['title']);
02364 
02365 
02366                         // Init array where infomation is accumulated as label/value pairs.
02367                 $lines=array();
02368 
02369                         // Owner user/group:
02370                 if ($this->pI_showUser) {
02371                                 // User:
02372                         $users= t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
02373                         $groupArray = explode(',',$GLOBALS['BE_USER']->user['usergroup_cached_list']);
02374                         $users=t3lib_BEfunc::blindUserNames($users,$groupArray);
02375                         $lines[]=array($LANG->getLL('pI_crUser').':',htmlspecialchars($users[$rec['cruser_id']]['username']).' ('.$users[$rec['cruser_id']]['realName'].')');
02376                 }
02377 
02378                         // Created:
02379                 $lines[]=array($LANG->getLL('pI_crDate').':', t3lib_BEfunc::datetime($rec['crdate']).' ('.t3lib_BEfunc::calcAge(time()-$rec['crdate'],$this->agePrefixes).')');
02380 
02381                         // Last change:
02382                 $lines[]=array($LANG->getLL('pI_lastChange').':', t3lib_BEfunc::datetime($rec['tstamp']).' ('.t3lib_BEfunc::calcAge(time()-$rec['tstamp'],$this->agePrefixes).')');
02383 
02384                         // Last change of content:
02385                 if ($rec['SYS_LASTCHANGED'])    {
02386                         $lines[]=array($LANG->getLL('pI_lastChangeContent').':', t3lib_BEfunc::datetime($rec['SYS_LASTCHANGED']).' ('.t3lib_BEfunc::calcAge(time()-$rec['SYS_LASTCHANGED'],$this->agePrefixes).')');
02387                 }
02388 
02389                         // Spacer:
02390                 $lines[]='';
02391 
02392                         // Display contents of certain page fields, if any value:
02393                 $dfields = explode(',','alias,target,hidden,starttime,endtime,fe_group,no_cache,cache_timeout,newUntil,lastUpdated,subtitle,keywords,description,abstract,author,author_email');
02394                 foreach($dfields as $fV)        {
02395                         if ($rec[$fV])  {
02396                                 $lines[]=array($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$fV)), t3lib_BEfunc::getProcessedValue('pages',$fV,$rec[$fV]));
02397                         }
02398                 }
02399 
02400                         // Page hits (depends on "sys_stat" extension)
02401                 if ($this->pI_showStat && t3lib_extMgm::isLoaded('sys_stat'))   {
02402 
02403                                 // Counting total hits:
02404                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'sys_stat', 'page_id='.intval($rec['uid']));
02405                         $rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
02406                         if ($rrow[0])   {
02407 
02408                                         // Get min/max
02409                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('min(tstamp) AS min,max(tstamp) AS max', 'sys_stat', 'page_id='.intval($rec['uid']));
02410                                 $rrow2 = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
02411 
02412                                 $lines[]='';
02413                                 $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).')');
02414                                 $lines[]=array($LANG->getLL('pI_hitsTotal').':',$rrow[0]);
02415 
02416 
02417                                         // Last 10 days
02418                                 $nextMidNight = mktime (0,0,0)+1*3600*24;
02419 
02420                                 $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');
02421                                 $days=array();
02422                                 while($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))        {
02423                                         $days[$rrow[1]] = $rrow[0];
02424                                 }
02425 
02426                                 $headerH=array();
02427                                 $contentH=array();
02428                                 for($a=9;$a>=0;$a--)    {
02429                                         $headerH[]='
02430                                                         <td class="bgColor5" nowrap="nowrap">&nbsp;'.date('d',$nextMidNight-($a+1)*24*3600).'&nbsp;</td>';
02431                                         $contentH[]='
02432                                                         <td align="center">'.($days[$a] ? intval($days[$a]) : '-').'</td>';
02433                                 }
02434 
02435                                         // Compile first hit-table (last 10 days)
02436                                 $hitTable='
02437                                         <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-hits">
02438                                                 <tr>'.implode('',$headerH).'</tr>
02439                                                 <tr>'.implode('',$contentH).'</tr>
02440                                         </table>';
02441                                 $lines[]=array($LANG->getLL('pI_hits10days').':',$hitTable,1);
02442 
02443 
02444                                         // Last 24 hours
02445                                 $nextHour = mktime (date('H'),0,0)+3600;
02446                                 $hours=16;
02447 
02448                                 $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');
02449                                 $days=array();
02450                                 while($rrow = $GLOBALS['TYPO3_DB']->sql_fetch_row($res))        {
02451                                         $days[$rrow[1]]=$rrow[0];
02452                                 }
02453 
02454                                 $headerH=array();
02455                                 $contentH=array();
02456                                 for($a=($hours-1);$a>=0;$a--)   {
02457                                         $headerH[]='
02458                                                         <td class="bgColor5" nowrap="nowrap">&nbsp;'.intval(date('H',$nextHour-($a+1)*3600)).'&nbsp;</td>';
02459                                         $contentH[]='
02460                                                         <td align="center">'.($days[$a] ? intval($days[$a]) : '-').'</td>';
02461                                 }
02462 
02463                                         // Compile second hit-table (last 24 hours)
02464                                 $hitTable='
02465                                         <table border="0" cellpadding="0" cellspacing="1" class="typo3-page-stat">
02466                                                 <tr>'.implode('',$headerH).'</tr>
02467                                                 <tr>'.implode('',$contentH).'</tr>
02468                                         </table>';
02469                                 $lines[]=array($LANG->getLL('pI_hits24hours').':',$hitTable,1);
02470                         }
02471                 }
02472 
02473 
02474                         // Finally, wrap the elements in the $lines array in table cells/rows
02475                 foreach($lines as $fV)  {
02476                         if (is_array($fV))      {
02477                                 if (!$fV[2])    $fV[1]=htmlspecialchars($fV[1]);
02478                                 $out.='
02479                                 <tr>
02480                                         <td class="bgColor4" nowrap="nowrap"><strong>'.htmlspecialchars($fV[0]).'&nbsp;&nbsp;</strong></td>
02481                                         <td class="bgColor4">'.$fV[1].'</td>
02482                                 </tr>';
02483                         } else {
02484                                 $out.='
02485                                 <tr>
02486                                         <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
02487                                 </tr>';
02488                         }
02489                 }
02490 
02491                         // Wrap table tags around...
02492                 $outPutContent.='
02493 
02494 
02495 
02496                         <!--
02497                                 Page info box:
02498                         -->
02499                         <table border="0" cellpadding="0" cellspacing="1" id="typo3-page-info">
02500                                 '.$out.'
02501                         </table>';
02502 
02503                         // ... and return it.
02504                 return $outPutContent;
02505         }
02506 
02515         function getTableMenu($id)      {
02516                 global $TCA;
02517 
02518                         // Initialize:
02519                 $this->activeTables=array();
02520                 $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!
02521 
02522                         // External tables:
02523                 if (is_array($this->externalTables))    {
02524                         $theTables = array_unique(array_merge($theTables, array_keys($this->externalTables)));
02525                 }
02526 
02527                         // Traverse tables to check:
02528                 foreach($theTables as $tName)   {
02529 
02530                                 // Check access and whether the proper extensions are loaded:
02531                         if ($GLOBALS['BE_USER']->check('tables_select',$tName) && (t3lib_extMgm::isLoaded($tName)||t3lib_div::inList('fe_users,tt_content',$tName) || isset($this->externalTables[$tName])))    {
02532 
02533                                         // Make query to count records from page:
02534                                 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $tName, 'pid='.intval($id).t3lib_BEfunc::deleteClause($tName).t3lib_BEfunc::versioningPlaceholderClause($tName));
02535                                 list($c) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
02536 
02537                                         // If records were found (or if "tt_content" is the table...):
02538                                 if ($c || t3lib_div::inList('tt_content',$tName))       {
02539 
02540                                                 // Add row to menu:
02541                                         $out.='
02542                                         <td><a href="#'.$tName.'"></a>'.
02543                                                         t3lib_iconWorks::getIconImage($tName,Array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1).'"').
02544                                                         '</td>';
02545 
02546                                                 // ... and to the internal array, activeTables we also add table icon and title (for use elsewhere)
02547                                         $this->activeTables[$tName]=
02548                                                         t3lib_iconWorks::getIconImage($tName,Array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1).': '.$c.' '.$GLOBALS['LANG']->getLL('records',1).'" class="absmiddle"').
02549                                                         '&nbsp;'.
02550                                                         $GLOBALS['LANG']->sL($TCA[$tName]['ctrl']['title'],1);
02551                                 }
02552                         }
02553                 }
02554 
02555                         // Wrap cells in table tags:
02556                 $out = '
02557 
02558 
02559 
02560                         <!--
02561                                 Menu of tables on the page (table menu)
02562                         -->
02563                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-page-tblMenu">
02564                                 <tr>'.$out.'
02565                                 </tr>
02566                         </table>';
02567 
02568                         // Return the content:
02569                 return $out;
02570         }
02571 
02580         function strip_tags($content, $fillEmptyContent=false)  {
02581                 if($fillEmptyContent && strstr($content, '><')) {
02582                         $content = preg_replace('/(<[^ >]* )([^ >]*)([^>]*>)(<\/[^>]*>)/', '$1$2$3$2$4', $content);
02583                 }
02584                 $content = preg_replace('/<br.?\/?>/', chr(10), $content);
02585 
02586                 return strip_tags($content);
02587         }
02588 }
02589 
02590 
02591 
02592 
02593 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php'])  {
02594         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php']);
02595 }
02596 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6