Documentation TYPO3 par Ameos

class.tx_cms_layout.php

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


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6