Documentation TYPO3 par Ameos

class.tx_cms_layout.php

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


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