Documentation TYPO3 par Ameos

class.db_list_extra.inc

00001 <?php
00002 /*************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2007 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 ***************************************************************/
00090 class localRecordList extends recordList {
00091 
00092                 // External:
00093         var $alternateBgColors=FALSE;                   // If true, table rows in the list will alternate in background colors (and have background colors at all!)
00094         var $allowedNewTables=array();                  // Used to indicate which tables (values in the array) that can have a create-new-record link. If the array is empty, all tables are allowed.
00095         var $newWizards=FALSE;                                  // If true, the control panel will contain links to the create-new wizards for pages and tt_content elements (normally, the link goes to just creating a new element without the wizards!).
00096 
00097         var $dontShowClipControlPanels=FALSE;   // If true, will disable the rendering of clipboard + control panels.
00098         var $showClipboard=FALSE;                               // If true, will show the clipboard in the field list.
00099         var $noControlPanels = FALSE;                   // If true, will DISABLE all control panels in lists. (Takes precedence)
00100         var $clickMenuEnabled = TRUE;                   // If true, clickmenus will be rendered
00101 
00102 
00103 
00104 
00105                 // Internal:
00106         var $pageRow=array();                                   // Set to the page record (see writeTop())
00107 
00108         var $csvLines=array();                                  // Used to accumulate CSV lines in for CSV export.
00109         var $csvOutput=FALSE;                                   // If set, the listing is returned as CSV instead.
00110 
00111         var $clipObj;                                                   // Clipboard object
00112         var $CBnames=array();                                   // Tracking names of elements (for clipboard use)
00113         var $duplicateStack=array();                    // Used to track which elements has duplicates and how many
00114 
00115 
00122         function writeTop($row) {
00123                 global $LANG;
00124 
00125                         // Makes the code for the pageicon in the top
00126                 $this->pageRow = $row;
00127                 $this->counter++;
00128                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,'pages');
00129                 $iconImg = t3lib_iconWorks::getIconImage('pages',$row,$this->backPath,'class="absmiddle" title="'.htmlspecialchars($alttext).'"');
00130                 $titleCol = 'test';     // pseudo title column name
00131                 $this->fieldArray = Array($titleCol,'up');              // Setting the fields to display in the list (this is of course "pseudo fields" since this is the top!)
00132 
00133 
00134                         // Filling in the pseudo data array:
00135                 $theData = Array();
00136                 $theData[$titleCol] = $this->widthGif;
00137 
00138                         // Get users permissions for this row:
00139                 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($row);
00140 
00141                 $theData['up']=array();
00142 
00143                         // Initialize control panel for currect page ($this->id):
00144                         // Some of the controls are added only if $this->id is set - since they make sense only on a real page, not root level.
00145                 $theCtrlPanel =array();
00146 
00147                         // "View page" icon is added:
00148                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id,$this->backPath,t3lib_BEfunc::BEgetRootLine($this->id))).'">'.
00149                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'" alt="" />'.
00150                                                 '</a>';
00151 
00152                         // If edit permissions are set (see class.t3lib_userauthgroup.php)
00153                 if ($localCalcPerms&2)  {
00154 
00155                                 // Adding "Edit page" icon:
00156                         if ($this->id)  {
00157                                 $params='&edit[pages]['.$row['uid'].']=edit';
00158                                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00159                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('editPage',1).'" alt="" />'.
00160                                                                 '</a>';
00161                         }
00162 
00163                                 // Adding "New record" icon:
00164                         if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink'])        {
00165                                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\'' . htmlspecialchars($this->backPath . 'db_new.php?id='.$this->id).'\');').'">'.
00166                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_el.gif','width="11" height="12"').' title="'.$LANG->getLL('newRecordGeneral',1).'" alt="" />'.
00167                                                                 '</a>';
00168                         }
00169 
00170                                 // Adding "Hide/Unhide" icon:
00171                         if ($this->id)  {
00172                                 if ($row['hidden'])     {
00173                                         $params='&data[pages]['.$row['uid'].'][hidden]=0';
00174                                         $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$GLOBALS['SOBE']->doc->issueCommand($params,-1).'\');').'">'.
00175                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$LANG->getLL('unHidePage',1).'" alt="" />'.
00176                                                                         '</a>';
00177                                 } else {
00178                                         $params='&data[pages]['.$row['uid'].'][hidden]=1';
00179                                         $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$GLOBALS['SOBE']->doc->issueCommand($params,-1).'\');').'">'.
00180                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$LANG->getLL('hidePage',1).'" alt="" />'.
00181                                                                         '</a>';
00182                                 }
00183                         }
00184 
00185                                 // Adding "move page" button:
00186                         if ($this->id)  {
00187                                 $theCtrlPanel[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'move_el.php?table=pages&uid='.$row['uid'].'\');').'">'.
00188                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/move_'.($this->table=='tt_content'?'record':'page').'.gif','width="11" height="12"').' title="'.$LANG->getLL('move_page',1).'" alt="" />'.
00189                                                                 '</a>';
00190                         }
00191                 }
00192 
00193                         // "Paste into page" link:
00194                 if (($localCalcPerms&8) || ($localCalcPerms&16))        {
00195                         $elFromTable = $this->clipObj->elFromTable('');
00196                         if (count($elFromTable))        {
00197                                 $theCtrlPanel[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'">'.
00198                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_paste',1).'" alt="" />'.
00199                                                                 '</a>';
00200                         }
00201                 }
00202 
00203                         // Finally, compile all elements of the control panel into table cells:
00204                 if (count($theCtrlPanel))       {
00205                         $theData['up'][]='
00206 
00207                                 <!--
00208                                         Control panel for page
00209                                 -->
00210                                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-ctrltop">
00211                                         <tr>
00212                                                 <td>'.implode('</td>
00213                                                 <td>',$theCtrlPanel).'</td>
00214                                         </tr>
00215                                 </table>';
00216                 }
00217 
00218 
00219                         // Add "clear-cache" link:
00220                 $theData['up'][]='<a href="'.htmlspecialchars($this->listURL().'&clear_cache=1').'">'.
00221                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clear_cache.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache',1).'" alt="" />'.
00222                                                 '</a>';
00223 
00224                         // Add "CSV" link, if a specific table is shown:
00225                 if ($this->table)       {
00226                         $theData['up'][]='<a href="'.htmlspecialchars($this->listURL().'&csv=1').'">'.
00227                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/csv.gif','width="27" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.csv',1).'" alt="" />'.
00228                                                         '</a>';
00229                 }
00230 
00231                         // Add "Export" link, if a specific table is shown:
00232                 if ($this->table && t3lib_extMgm::isLoaded('impexp'))   {
00233                         $theData['up'][]='<a href="'.htmlspecialchars($this->backPath.'mod.php?M=xMOD_tximpexp&tx_impexp[action]=export&tx_impexp[list][]='.rawurlencode($this->table.':'.$this->id)).'">'.
00234                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,t3lib_extMgm::extRelPath('impexp').'export.gif',' width="18" height="16"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:rm.export',1).'" alt="" />'.
00235                                                         '</a>';
00236                 }
00237 
00238                         // Add "refresh" link:
00239                 $theData['up'][]='<a href="'.htmlspecialchars($this->listURL()).'">'.
00240                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/refresh_n.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.reload',1).'" alt="" />'.
00241                                                 '</a>';
00242 
00243 
00244                         // Add icon with clickmenu, etc:
00245                 if ($this->id)  {       // If there IS a real page...:
00246 
00247                                 // Setting title of page + the "Go up" link:
00248                         $theData[$titleCol].='<br /><span title="'.htmlspecialchars($row['_thePathFull']).'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($row['_thePath'],-$this->fixedL)).'</span>';
00249                         $theData['up'][]='<a href="'.htmlspecialchars($this->listURL($row['pid'])).'" onclick="setHighlight('.$row['pid'].')">'.
00250                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/pages_up.gif','width="18" height="16"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" />'.
00251                                                         '</a>';
00252 
00253                                 // Make Icon:
00254                         $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,'pages',$this->id) : $iconImg;
00255                 } else {        // On root-level of page tree:
00256 
00257                                 // Setting title of root (sitename):
00258                         $theData[$titleCol].='<br />'.htmlspecialchars(t3lib_div::fixed_lgd_cs($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],-$this->fixedL));
00259 
00260                                 // Make Icon:
00261                         $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' alt="" />';
00262                 }
00263 
00264                         // If there is a returnUrl given, add a back-link:
00265                 if ($this->returnUrl)   {
00266                         $theData['up'][]='<a href="'.htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl,array('id'=>$this->id))).'" class="typo3-goBack">'.
00267                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/goback.gif','width="14" height="14"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack',1).'" alt="" />'.
00268                                                         '</a>';
00269                 }
00270 
00271                         // Finally, the "up" pseudo field is compiled into a table - has been accumulated in an array:
00272                 $theData['up']='
00273                         <table border="0" cellpadding="0" cellspacing="0">
00274                                 <tr>
00275                                         <td>'.implode('</td>
00276                                         <td>',$theData['up']).'</td>
00277                                 </tr>
00278                         </table>';
00279 
00280                         // ... and the element row is created:
00281                 $out.=$this->addelement(1,$theIcon,$theData,'',$this->leftMargin);
00282 
00283                         // ... and wrapped into a table and added to the internal ->HTMLcode variable:
00284                 $this->HTMLcode.='
00285 
00286 
00287                 <!--
00288                         Page header for db_list:
00289                 -->
00290                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-dblist-top">
00291                                 '.$out.'
00292                         </table>';
00293         }
00294 
00303         function getTable($table,$id,$rowlist)  {
00304                 global $TCA;
00305 
00306                         // Loading all TCA details for this table:
00307                 t3lib_div::loadTCA($table);
00308 
00309                         // Init
00310                 $addWhere = '';
00311                 $titleCol = $TCA[$table]['ctrl']['label'];
00312                 $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
00313                 $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
00314 
00315                         // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
00316                 $this->fieldArray=array();
00317                 $this->fieldArray[] = $titleCol;        // Add title column
00318                 if ($this->localizationView && $l10nEnabled)    {
00319                         $this->fieldArray[] = '_LOCALIZATION_';
00320                         $this->fieldArray[] = '_LOCALIZATION_b';
00321                         $addWhere.=' AND (
00322                                 '.$TCA[$table]['ctrl']['languageField'].'<=0
00323                                 OR 
00324                                 '.$TCA[$table]['ctrl']['transOrigPointerField'].' = 0
00325                         )';
00326                 }
00327                 if (!t3lib_div::inList($rowlist,'_CONTROL_'))   {
00328                         $this->fieldArray[] = '_CONTROL_';
00329                 }
00330                 if ($this->showClipboard)       {
00331                         $this->fieldArray[] = '_CLIPBOARD_';
00332                 }
00333                 if (!$this->dontShowClipControlPanels)  {
00334                         $this->fieldArray[]='_REF_';
00335                 }
00336                 if ($this->searchLevels)        {
00337                         $this->fieldArray[]='_PATH_';
00338                 }
00339                         // Cleaning up:
00340                 $this->fieldArray=array_unique(array_merge($this->fieldArray,t3lib_div::trimExplode(',',$rowlist,1)));
00341                 if ($this->noControlPanels)     {
00342                         $tempArray = array_flip($this->fieldArray);
00343                         unset($tempArray['_CONTROL_']);
00344                         unset($tempArray['_CLIPBOARD_']);
00345                         $this->fieldArray = array_keys($tempArray);
00346                 }
00347 
00348                         // Creating the list of fields to include in the SQL query:
00349                 $selectFields = $this->fieldArray;
00350                 $selectFields[] = 'uid';
00351                 $selectFields[] = 'pid';
00352                 if ($thumbsCol) $selectFields[] = $thumbsCol;   // adding column for thumbnails
00353                 if ($table=='pages')    {
00354                         if (t3lib_extMgm::isLoaded('cms'))      {
00355                                 $selectFields[] = 'module';
00356                                 $selectFields[] = 'extendToSubpages';
00357                         }
00358                         $selectFields[] = 'doktype';
00359                 }
00360                 if (is_array($TCA[$table]['ctrl']['enablecolumns']))    {
00361                         $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
00362                 }
00363                 if ($TCA[$table]['ctrl']['type'])       {
00364                         $selectFields[] = $TCA[$table]['ctrl']['type'];
00365                 }
00366                 if ($TCA[$table]['ctrl']['typeicon_column'])    {
00367                         $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
00368                 }
00369                 if ($TCA[$table]['ctrl']['versioningWS'])       {
00370                         $selectFields[] = 't3ver_id';
00371                         $selectFields[] = 't3ver_state';
00372                         $selectFields[] = 't3ver_wsid';
00373                         $selectFields[] = 't3ver_swapmode';             // Filtered out when pages in makeFieldList()
00374                 }
00375                 if ($l10nEnabled)       {
00376                         $selectFields[] = $TCA[$table]['ctrl']['languageField'];
00377                         $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField'];
00378                 }
00379                 if ($TCA[$table]['ctrl']['label_alt'])  {
00380                         $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1));
00381                 }
00382                 $selectFields = array_unique($selectFields);            // Unique list!
00383                 $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1));          // Making sure that the fields in the field-list ARE in the field-list from TCA!
00384                 $selFieldList = implode(',',$selectFields);             // implode it into a list of fields for the SQL-statement.
00385 
00386                         // Create the SQL query for selecting the elements in the listing:
00387                 $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList);       // (API function from class.db_list.inc)
00388                 $this->setTotalItems($queryParts);              // Finding the total amount of records on the page (API function from class.db_list.inc)
00389 
00390                         // Init:
00391                 $dbCount = 0;
00392                 $out = '';
00393 
00394                         // If the count query returned any number of records, we perform the real query, selecting records.
00395                 if ($this->totalItems)  {
00396                         $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00397                         $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00398                 }
00399 
00400                 $LOISmode = $this->listOnlyInSingleTableMode && !$this->table;
00401 
00402                         // If any records was selected, render the list:
00403                 if ($dbCount)   {
00404 
00405                                 // Half line is drawn between tables:
00406                         if (!$LOISmode) {
00407                                 $theData = Array();
00408                                 if (!$this->table && !$rowlist) {
00409                                         $theData[$titleCol] = '<img src="clear.gif" width="'.($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']?'230':'350').'" height="1" alt="" />';
00410                                         if (in_array('_CONTROL_',$this->fieldArray))    $theData['_CONTROL_']='';
00411                                         if (in_array('_CLIPBOARD_',$this->fieldArray))  $theData['_CLIPBOARD_']='';
00412                                 }
00413                                 $out.=$this->addelement(0,'',$theData,'class="c-table-row-spacer"',$this->leftMargin);
00414                         }
00415 
00416                                 // Header line is drawn
00417                         $theData = Array();
00418                         if ($this->disableSingleTableView)      {
00419                                 $theData[$titleCol] = '<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.')';
00420                         } else {
00421                                 $theData[$titleCol] = $this->linkWrapTable($table,'<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.') <img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/'.($this->table?'minus':'plus').'bullet_list.gif','width="18" height="12"').' hspace="10" class="absmiddle" title="'.$GLOBALS['LANG']->getLL(!$this->table?'expandView':'contractView',1).'" alt="" />');
00422                         }
00423 
00424                                 // CSH:
00425                         $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
00426 
00427                         if ($LOISmode)  {
00428                                 $out.='
00429                                         <tr>
00430                                                 <td class="c-headLineTable" style="width:95%;">'.$theData[$titleCol].'</td>
00431                                         </tr>';
00432 
00433                                 if ($GLOBALS['BE_USER']->uc["edit_showFieldHelp"])      {
00434                                         $GLOBALS['LANG']->loadSingleTableDescription($table);
00435                                         if (isset($GLOBALS['TCA_DESCR'][$table]['columns']['']))        {
00436                                                 $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$table.'.\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
00437                                                 $out.='
00438                                         <tr>
00439                                                 <td class="c-tableDescription">'.t3lib_BEfunc::helpTextIcon($table,'',$this->backPath,TRUE).$GLOBALS['TCA_DESCR'][$table]['columns']['']['description'].'</td>
00440                                         </tr>';
00441                                         }
00442                                 }
00443                         } else {
00444                                 $theUpIcon = ($table=='pages'&&$this->id&&isset($this->pageRow['pid'])) ? '<a href="'.htmlspecialchars($this->listURL($this->pageRow['pid'])).'" onclick="setHighlight('.$this->pageRow['pid'].')"><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/pages_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" /></a>':'';
00445                                 $out.=$this->addelement(1,$theUpIcon,$theData,' class="c-headLineTable"','');
00446                         }
00447 
00448                         If (!$LOISmode) {
00449                                         // Fixing a order table for sortby tables
00450                                 $this->currentTable = array();
00451                                 $currentIdList = array();
00452                                 $doSort = ($TCA[$table]['ctrl']['sortby'] && !$this->sortField);
00453 
00454                                 $prevUid = 0;
00455                                 $prevPrevUid = 0;
00456                                 $accRows = array();     // Accumulate rows here
00457                                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))    {
00458                                         $accRows[] = $row;
00459                                         $currentIdList[] = $row['uid'];
00460                                         if ($doSort)    {
00461                                                 if ($prevUid)   {
00462                                                         $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
00463                                                         $this->currentTable['next'][$prevUid] = '-'.$row['uid'];
00464                                                         $this->currentTable['prevUid'][$row['uid']] = $prevUid;
00465                                                 }
00466                                                 $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
00467                                                 $prevUid=$row['uid'];
00468                                         }
00469                                 }
00470                                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
00471 
00472                                         // CSV initiated
00473                                 if ($this->csvOutput) $this->initCSV();
00474 
00475                                         // Render items:
00476                                 $this->CBnames=array();
00477                                 $this->duplicateStack=array();
00478                                 $this->eCounter=$this->firstElementNumber;
00479 
00480                                 $iOut = '';
00481                                 $cc = 0;
00482                                 foreach($accRows as $row)       {
00483 
00484                                                 // Forward/Backwards navigation links:
00485                                         list($flag,$code) = $this->fwd_rwd_nav($table);
00486                                         $iOut.=$code;
00487 
00488                                                 // If render item, increment counter and call function
00489                                         if ($flag)      {
00490                                                 $cc++;
00491                                                 $iOut.= $this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol);
00492 
00493                                                         // If localization view is enabled it means that the selected records are either default or All language and here we will not select translations which point to the main record:
00494                                                 if ($this->localizationView && $l10nEnabled)    {
00495 
00496                                                                 // Look for translations of this record:
00497                                                         $translations = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00498                                                                 $selFieldList,
00499                                                                 $table,
00500                                                                 'pid='.$row['pid'].
00501                                                                         ' AND '.$TCA[$table]['ctrl']['languageField'].'>0'.
00502                                                                         ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
00503                                                                         t3lib_BEfunc::deleteClause($table).
00504                                                                         t3lib_BEfunc::versioningPlaceholderClause($table)
00505                                                         );
00506 
00507                                                                 // For each available translation, render the record:
00508                                                         if (is_array($translations)) {
00509                                                                 foreach($translations as $lRow) {
00510                                                                         if ($GLOBALS['BE_USER']->checkLanguageAccess($lRow[$TCA[$table]['ctrl']['languageField']]))     {
00511                                                                                 $currentIdList[] = $lRow['uid'];
00512                                                                                 $iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18);
00513                                                                         }
00514                                                                 }
00515                                                         }
00516                                                 }
00517                                         }
00518 
00519                                                 // Counter of total rows incremented:
00520                                         $this->eCounter++;
00521                                 }
00522 
00523                                         // The header row for the table is now created:
00524                                 $out.=$this->renderListHeader($table,$currentIdList);
00525                         }
00526 
00527                                 // The list of records is added after the header:
00528                         $out.=$iOut;
00529 
00530                                 // ... and it is all wrapped in a table:
00531                         $out='
00532 
00533 
00534 
00535                         <!--
00536                                 DB listing of elements: "'.htmlspecialchars($table).'"
00537                         -->
00538                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist'.($LOISmode?' typo3-dblist-overview':'').'">
00539                                         '.$out.'
00540                                 </table>';
00541 
00542                                 // Output csv if...
00543                         if ($this->csvOutput)   $this->outputCSV($table);       // This ends the page with exit.
00544                 }
00545 
00546                         // Return content:
00547                 return $out;
00548         }
00549 
00563         function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)  {
00564                 $iOut = '';
00565 
00566                 if (strlen($this->searchString))        {       // If in search mode, make sure the preview will show the correct page
00567                         $id_orig = $this->id;
00568                         $this->id = $row['pid'];
00569                 }
00570 
00571                         // In offline workspace, look for alternative record:
00572                 t3lib_BEfunc::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace);
00573 
00574                         // Background color, if any:
00575                 $row_bgColor=
00576                         $this->alternateBgColors ?
00577                         (($cc%2)?'' :' class="db_list_alt"') :
00578                         '';
00579 
00580                         // Overriding with versions background color if any:
00581                 $row_bgColor = $row['_CSSCLASS'] ? ' class="'.$row['_CSSCLASS'].'"' : $row_bgColor;
00582 
00583                         // Incr. counter.
00584                 $this->counter++;
00585 
00586                         // The icon with link
00587                 $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
00588                 $iconImg = t3lib_iconWorks::getIconImage($table,$row,$this->backPath,'title="'.htmlspecialchars($alttext).'"'.($indent ? ' style="margin-left: '.$indent.'px;"' : ''));
00589                 $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']) : $iconImg;
00590 
00591                         // Preparing and getting the data-array
00592                 $theData = Array();
00593                 foreach($this->fieldArray as $fCol)     {
00594                         if ($fCol==$titleCol)   {
00595                                 $recTitle = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
00596                                 $theData[$fCol] = $this->linkWrapItems($table,$row['uid'],$recTitle,$row);
00597                         } elseif ($fCol=='pid') {
00598                                 $theData[$fCol]=$row[$fCol];
00599                         } elseif ($fCol=='_PATH_') {
00600                                 $theData[$fCol]=$this->recPath($row['pid']);
00601                         } elseif ($fCol=='_REF_') {
00602                                 $theData[$fCol]=$this->makeRef($table,$row['uid']);
00603                         } elseif ($fCol=='_CONTROL_') {
00604                                 $theData[$fCol]=$this->makeControl($table,$row);
00605                         } elseif ($fCol=='_CLIPBOARD_') {
00606                                 $theData[$fCol]=$this->makeClip($table,$row);
00607 #                               $t3lib_transl8tools = new t3lib_transl8tools;
00608 #                               $theData[$fCol].=t3lib_div::view_array($t3lib_transl8tools->translationInfo($table,$row['uid']));
00609                         } elseif ($fCol=='_LOCALIZATION_') {
00610                                 list($lC1, $lC2) = $this->makeLocalizationPanel($table,$row);
00611                                 $theData[$fCol] = $lC1;
00612                                 $theData[$fCol.'b'] = $lC2;
00613                         } elseif ($fCol=='_LOCALIZATION_b') {
00614                                 // Do nothing, has been done above.
00615                         } else {
00616                                 $theData[$fCol] = $this->linkUrlMail(htmlspecialchars(t3lib_BEfunc::getProcessedValueExtra($table,$fCol,$row[$fCol],100,$row['uid'])),$row[$fCol]);
00617                         }
00618                 }
00619 
00620                 if (strlen($this->searchString))        {       // Reset the ID if it was overwritten
00621                         $this->id = $id_orig;
00622                 }
00623 
00624                         // Add row to CSV list:
00625                 if ($this->csvOutput) $this->addToCSV($row,$table);
00626 
00627                         // Create element in table cells:
00628                 $iOut.=$this->addelement(1,$theIcon,$theData,$row_bgColor);
00629 
00630                         // Render thumbsnails if a thumbnail column exists and there is content in it:
00631                 if ($this->thumbs && trim($row[$thumbsCol]))    {
00632                         $iOut.=$this->addelement(4,'', Array($titleCol=>$this->thumbCode($row,$table,$thumbsCol)),$row_bgColor);
00633                 }
00634 
00635                         // Finally, return table row element:
00636                 return $iOut;
00637         }
00638 
00648         function renderListHeader($table,$currentIdList)        {
00649                 global $TCA, $LANG;
00650 
00651                         // Init:
00652                 $theData = Array();
00653 
00654                         // Traverse the fields:
00655                 foreach($this->fieldArray as $fCol)     {
00656 
00657                                 // Calculate users permissions to edit records in the table:
00658                         $permsEdit = $this->calcPerms & ($table=='pages'?2:16);
00659 
00660                         switch((string)$fCol)   {
00661                                 case '_PATH_':                  // Path
00662                                         $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_',1).']</i>';
00663                                 break;
00664                                 case '_REF_':                   // References
00665                                         $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_',1).']</i>';
00666                                 break;
00667                                 case '_LOCALIZATION_':                  // Path
00668                                         $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_',1).']</i>';
00669                                 break;
00670                                 case '_LOCALIZATION_b':                 // Path
00671                                         $theData[$fCol] = $LANG->getLL('Localize',1);
00672                                 break;
00673                                 case '_CLIPBOARD_':             // Clipboard:
00674                                         $cells=array();
00675 
00676                                                 // If there are elements on the clipboard for this table, then display the "paste into" icon:
00677                                         $elFromTable = $this->clipObj->elFromTable($table);
00678                                         if (count($elFromTable))        {
00679                                                 $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'">'.
00680                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_paste',1).'" alt="" />'.
00681                                                                 '</a>';
00682                                         }
00683 
00684                                                 // If the numeric clipboard pads are enabled, display the control icons for that:
00685                                         if ($this->clipObj->current!='normal')  {
00686 
00687                                                         // The "select" link:
00688                                                 $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_copy.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_selectMarked',1).'" alt="" />',$table,'setCB');
00689 
00690                                                         // The "edit marked" link:
00691                                                 $editIdList = implode(',',$currentIdList);
00692                                                 $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00693                                                 $params='&edit['.$table.']['.$editIdList.']=edit&disHelp=1';
00694                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00695                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_editMarked',1).'" alt="" />'.
00696                                                                 '</a>';
00697 
00698                                                         // The "Delete marked" link:
00699                                                 $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('clip_deleteMarked',1).'" alt="" />',$table,'delete',sprintf($LANG->getLL('clip_deleteMarkedWarning'),$LANG->sL($TCA[$table]['ctrl']['title'])));
00700 
00701                                                         // The "Select all" link:
00702                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('checkOffCB(\''.implode(',',$this->CBnames).'\'); return false;').'">'.
00703                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_select.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_markRecords',1).'" alt="" />'.
00704                                                                 '</a>';
00705                                         } else {
00706                                                 $cells[]='';
00707                                         }
00708                                         $theData[$fCol]=implode('',$cells);
00709                                 break;
00710                                 case '_CONTROL_':               // Control panel:
00711                                         if (!$TCA[$table]['ctrl']['readOnly'])  {
00712 
00713                                                         // If new records can be created on this page, add links:
00714                                                 if ($this->calcPerms&($table=='pages'?8:16) && $this->showNewRecLink($table))   {
00715                                                         if ($table=="tt_content" && $this->newWizards)  {
00716                                                                         //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00717                                                                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00718                                                                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00719                                                                 $newContentWizScriptPath = $this->backPath.t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
00720 
00721                                                                 $theData[$fCol]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$newContentWizScriptPath.'?id='.$this->id.'\');').'">'.
00722                                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
00723                                                                                                 '</a>';
00724                                                         } elseif ($table=='pages' && $this->newWizards) {
00725                                                                 $theData[$fCol]='<a href="'.htmlspecialchars($this->backPath.'db_new.php?id='.$this->id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'">'.
00726                                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
00727                                                                                                 '</a>';
00728                                                         } else {
00729                                                                 $params='&edit['.$table.']['.$this->id.']=new';
00730                                                                 $theData[$fCol]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00731                                                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new',1).'" alt="" />'.
00732                                                                                                 '</a>';
00733                                                         }
00734                                                 }
00735 
00736                                                         // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
00737                                                 if ($permsEdit && $this->table && is_array($currentIdList))     {
00738                                                         $editIdList = implode(',',$currentIdList);
00739                                                         if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00740                                                         $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.implode(',',$this->fieldArray).'&disHelp=1';
00741                                                         $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00742                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$LANG->getLL('editShownColumns',1).'" alt="" />'.
00743                                                                                         '</a>';
00744                                                 }
00745                                         }
00746                                 break;
00747                                 default:                        // Regular fields header:
00748                                         $theData[$fCol]='';
00749                                         if ($this->table && is_array($currentIdList))   {
00750 
00751                                                         // If the numeric clipboard pads are selected, show duplicate sorting link:
00752                                                 if ($this->clipNumPane()) {
00753                                                         $theData[$fCol].='<a href="'.htmlspecialchars($this->listURL('',-1).'&duplicateField='.$fCol).'">'.
00754                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/select_duplicates.gif','width="11" height="11"').' title="'.$LANG->getLL('clip_duplicates',1).'" alt="" />'.
00755                                                                                         '</a>';
00756                                                 }
00757 
00758                                                         // If the table can be edited, add link for editing THIS field for all listed records:
00759                                                 if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol])  {
00760                                                         $editIdList = implode(',',$currentIdList);
00761                                                         if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00762                                                         $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.$fCol.'&disHelp=1';
00763                                                         $iTitle = sprintf($LANG->getLL('editThisColumn'),ereg_replace(':$','',trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol)))));
00764                                                         $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00765                                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'.
00766                                                                                         '</a>';
00767                                                 }
00768                                         }
00769                                         $theData[$fCol].=$this->addSortLink($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol,'<i>[|]</i>')),$fCol,$table);
00770                                 break;
00771                         }
00772                 }
00773 
00774                         // Create and return header table row:
00775                 return $this->addelement(1,'',$theData,' class="c-headLine"','');
00776         }
00777 
00778 
00779 
00780 
00781 
00782 
00783         /*********************************
00784          *
00785          * Rendering of various elements
00786          *
00787          *********************************/
00788 
00796         function makeControl($table,$row)       {
00797                 global $TCA, $LANG, $SOBE;
00798                 if ($this->dontShowClipControlPanels)   return '';
00799 
00800                         // Initialize:
00801                 t3lib_div::loadTCA($table);
00802                 $cells=array();
00803 
00804                         // If the listed table is 'pages' we have to request the permission settings for each page:
00805                 if ($table=='pages')    {
00806                         $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid']));
00807                 }
00808 
00809                         // This expresses the edit permissions for this particular element:
00810                 $permsEdit = ($table=='pages' && ($localCalcPerms&2)) || ($table!='pages' && ($this->calcPerms&16));
00811 
00812                         // "Show" link (only pages and tt_content elements)
00813                 if ($table=='pages' || $table=='tt_content')    {
00814                         $params='&edit['.$table.']['.$row['uid'].']=edit';
00815                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'], $this->backPath)).'">'.
00816                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'" alt="" />'.
00817                                         '</a>';
00818                 }
00819 
00820                         // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
00821                 if ($permsEdit) {
00822                         $params='&edit['.$table.']['.$row['uid'].']=edit';
00823                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00824                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2'.(!$TCA[$table]['ctrl']['readOnly']?'':'_d').'.gif','width="11" height="12"').' title="'.$LANG->getLL('edit',1).'" alt="" />'.
00825                                         '</a>';
00826                 }
00827 
00828                         // "Move" wizard link for pages/tt_content elements:
00829                 if (($table=="tt_content" && $permsEdit) || ($table=='pages'))  {
00830                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'move_el.php?table='.$table.'&uid='.$row['uid'].'\');').'">'.
00831                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/move_'.($table=='tt_content'?'record':'page').'.gif','width="11" height="12"').' title="'.$LANG->getLL('move_'.($table=='tt_content'?'record':'page'),1).'" alt="" />'.
00832                                         '</a>';
00833                 }
00834 
00835                         // If the extended control panel is enabled OR if we are seeing a single table:
00836                 if ($SOBE->MOD_SETTINGS['bigControlPanel'] || $this->table)     {
00837 
00838                                 // "Info": (All records)
00839                         $cells[]='<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'">'.
00840                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('showInfo',1).'" alt="" />'.
00841                                         '</a>';
00842 
00843                                 // If the table is NOT a read-only table, then show these links:
00844                         if (!$TCA[$table]['ctrl']['readOnly'])  {
00845 
00846                                         // "Revert" link (history/undo)
00847                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$row['uid']).'\',\'#latest\');').'">'.
00848                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/history2.gif','width="13" height="12"').' title="'.$LANG->getLL('history',1).'" alt="" />'.
00849                                                 '</a>';
00850 
00851                                         // Versioning:
00852                                 if (t3lib_extMgm::isLoaded('version'))  {
00853                                         $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace);
00854                                         if (is_array($vers))    {       // If table can be versionized.
00855                                                 if (count($vers)>1)     {
00856                                                         $st = 'background-color: #FFFF00; font-weight: bold;';
00857                                                         $lab = count($vers)-1;
00858                                                 } else {
00859                                                         $st = 'background-color: #9999cc; font-weight: bold;';
00860                                                         $lab = 'V';
00861                                                 }
00862 
00863                                                 $cells[]='<a href="'.htmlspecialchars($this->backPath.t3lib_extMgm::extRelPath('version')).'cm1/index.php?table='.rawurlencode($table).'&uid='.rawurlencode($row['uid']).'" style="'.htmlspecialchars($st).'">'.
00864                                                                 $lab.
00865                                                                 '</a>';
00866                                         }
00867                                 }
00868 
00869                                         // "Edit Perms" link:
00870                                 if ($table=='pages' && $GLOBALS['BE_USER']->check('modules','web_perm'))        {
00871                                         $cells[]='<a href="'.htmlspecialchars('mod/web/perm/index.php?id='.$row['uid'].'&return_id='.$row['uid'].'&edit=1').'">'.
00872                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/perm.gif','width="7" height="12"').' title="'.$LANG->getLL('permissions',1).'" alt="" />'.
00873                                                         '</a>';
00874                                 }
00875 
00876                                         // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
00877                                 if ($TCA[$table]['ctrl']['sortby'] || $TCA[$table]['ctrl']['useColumnsForDefaultValues'])       {
00878                                         if (
00879                                                 ($table!='pages' && ($this->calcPerms&16)) ||   // For NON-pages, must have permission to edit content on this parent page
00880                                                 ($table=='pages' && ($this->calcPerms&8))               // For pages, must have permission to create new pages here.
00881                                                 )       {
00882                                                 if ($this->showNewRecLink($table))      {
00883                                                         $params='&edit['.$table.']['.(-$row['uid']).']=new';
00884                                                         $cells[]='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'">'.
00885                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_'.($table=='pages'?'page':'el').'.gif','width="'.($table=='pages'?13:11).'" height="12"').' title="'.$LANG->getLL('new'.($table=='pages'?'Page':'Record'),1).'" alt="" />'.
00886                                                                         '</a>';
00887                                                 }
00888                                         }
00889                                 }
00890 
00891                                         // "Up/Down" links
00892                                 if ($permsEdit && $TCA[$table]['ctrl']['sortby']  && !$this->sortField && !$this->searchLevels) {
00893                                         if (isset($this->currentTable['prev'][$row['uid']]))    {       // Up
00894                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prev'][$row['uid']];
00895                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00896                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"').' title="'.$LANG->getLL('moveUp',1).'" alt="" />'.
00897                                                                 '</a>';
00898                                         } else {
00899                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_up.gif','width="11" height="10"',2).' alt="" />';
00900                                         }
00901                                         if ($this->currentTable['next'][$row['uid']])   {       // Down
00902                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['next'][$row['uid']];
00903                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00904                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"').' title="'.$LANG->getLL('moveDown',1).'" alt="" />'.
00905                                                                 '</a>';
00906                                         } else {
00907                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_down.gif','width="11" height="10"',2).' alt="" />';
00908                                         }
00909                                 }
00910 
00911                                         // "Hide/Unhide" links:
00912                                 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
00913                                 if ($permsEdit && $hiddenField && $TCA[$table]['columns'][$hiddenField] && (!$TCA[$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$table.':'.$hiddenField)))     {
00914                                         if ($row[$hiddenField]) {
00915                                                 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
00916                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00917                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_unhide.gif','width="11" height="10"').' title="'.$LANG->getLL('unHide'.($table=='pages'?'Page':''),1).'" alt="" />'.
00918                                                                 '</a>';
00919                                         } else {
00920                                                 $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
00921                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00922                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_hide.gif','width="11" height="10"').' title="'.$LANG->getLL('hide'.($table=='pages'?'Page':''),1).'" alt="" />'.
00923                                                                 '</a>';
00924                                         }
00925                                 }
00926 
00927                                         // "Delete" link:
00928                                 if (
00929                                         ($table=='pages' && ($localCalcPerms&4)) || ($table!='pages' && ($this->calcPerms&16))
00930                                         )       {
00931                                         $params='&cmd['.$table.']['.$row['uid'].'][delete]=1';
00932                                         $cells[]='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning').t3lib_BEfunc::referenceCount($table,$row['uid'],' (There are %s reference(s) to this record!)')).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'">'.
00933                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/garbage.gif','width="11" height="12"').' title="'.$LANG->getLL('delete',1).'" alt="" />'.
00934                                                         '</a>';
00935                                 }
00936 
00937                                         // "Levels" links: Moving pages into new levels...
00938                                 if ($permsEdit && $table=='pages' && !$this->searchLevels)      {
00939 
00940                                                 // Up (Paste as the page right after the current parent page)
00941                                         if ($this->calcPerms&8) {
00942                                                 $params='&cmd['.$table.']['.$row['uid'].'][move]='.-$this->id;
00943                                                 $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00944                                                                 '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_left.gif','width="11" height="10"').' title="'.$LANG->getLL('prevLevel',1).'" alt="" />'.
00945                                                                 '</a>';
00946                                         }
00947                                                 // Down (Paste as subpage to the page right above)
00948                                         if ($this->currentTable['prevUid'][$row['uid']])        {
00949                                                 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$this->currentTable['prevUid'][$row['uid']]));
00950                                                 if ($localCalcPerms&8)  {
00951                                                         $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prevUid'][$row['uid']];
00952                                                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'">'.
00953                                                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"').' title="'.$LANG->getLL('nextLevel',1).'" alt="" />'.
00954                                                                         '</a>';
00955                                                 } else {
00956                                                         $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"',2).' alt="" />';
00957                                                 }
00958                                         } else {
00959                                                 $cells[]='<img src="clear.gif" '.t3lib_iconWorks::skinImg($this->backPath,'gfx/button_right.gif','width="11" height="10"',2).' alt="" />';
00960                                         }
00961                                 }
00962                         }
00963                 }
00964 
00965                         // If the record is edit-locked by another user, we will show a little warning sign:
00966                 if ($lockInfo=t3lib_BEfunc::isRecordLocked($table,$row['uid'])) {
00967                         $cells[]='<a href="#" onclick="'.htmlspecialchars('alert('.$LANG->JScharCode($lockInfo['msg']).');return false;').'">'.
00968                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/recordlock_warning3.gif','width="17" height="12"').' title="'.htmlspecialchars($lockInfo['msg']).'" alt="" />'.
00969                                         '</a>';
00970                 }
00971 
00972 
00973                         // Compile items into a DIV-element:
00974                 return '
00975                                                                                         <!-- CONTROL PANEL: '.$table.':'.$row['uid'].' -->
00976                                                                                         <div class="typo3-DBctrl">'.implode('',$cells).'</div>';
00977         }
00978 
00986         function makeClip($table,$row)  {
00987                 global $TCA, $LANG;
00988 
00989                         // Return blank, if disabled:
00990                 if ($this->dontShowClipControlPanels)   return '';
00991                 $cells=array();
00992 
00993 
00994                         // Return blank, if disabled:
00995                         // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
00996                 if ($this->clipObj->current=='normal')  {       // For the "Normal" pad:
00997 
00998                                 // Show copy/cut icons:
00999                         $isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
01000                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'">'.
01001                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_copy'.($isSel=='copy'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy',1).'" alt="" />'.
01002                                         '</a>';
01003                         $cells[]='<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'">'.
01004                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_cut'.($isSel=='cut'?'_h':'').'.gif','width="12" height="12"').' title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut',1).'" alt="" />'.
01005                                         '</a>';
01006 
01007                 } else {        // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
01008 
01009                                 // Setting name of the element in ->CBnames array:
01010                         $n=$table.'|'.$row['uid'];
01011                         $this->CBnames[]=$n;
01012 
01013                                 // Check if the current element is selected and if so, prepare to set the checkbox as selected:
01014                         $checked = ($this->clipObj->isSelected($table,$row['uid'])?' checked="checked"':'');
01015 
01016                                 // If the "duplicateField" value is set then select all elements which are duplicates...
01017                         if ($this->duplicateField && isset($row[$this->duplicateField]))        {
01018                                 $checked='';
01019                                 if (in_array($row[$this->duplicateField], $this->duplicateStack))       {
01020                                         $checked=' checked="checked"';
01021                                 }
01022                                 $this->duplicateStack[] = $row[$this->duplicateField];
01023                         }
01024 
01025                                 // Adding the checkbox to the panel:
01026                         $cells[]='<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
01027                 }
01028 
01029                         // Now, looking for selected elements from the current table:
01030                 $elFromTable = $this->clipObj->elFromTable($table);
01031                 if (count($elFromTable) && $TCA[$table]['ctrl']['sortby'])      {       // IF elements are found and they can be individually ordered, then add a "paste after" icon:
01032                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'">'.
01033                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteAfter',1).'" alt="" />'.
01034                                         '</a>';
01035                 }
01036 
01037                         // Now, looking for elements in general:
01038                 $elFromTable = $this->clipObj->elFromTable('');
01039                 if ($table=='pages' && count($elFromTable))     {
01040                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'into',$elFromTable)).'">'.
01041                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$LANG->getLL('clip_pasteInto',1).'" alt="" />'.
01042                                         '</a>';
01043                 }
01044 
01045                         // Compile items into a DIV-element:
01046                 return '                                                        <!-- CLIPBOARD PANEL: '.$table.':'.$row['uid'].' -->
01047                                                                                         <div class="typo3-clipCtrl">'.implode('',$cells).'</div>';
01048         }
01049 
01057         function makeRef($table,$uid)   {
01058 
01059                         // Look up the path:
01060                 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01061                         '*',
01062                         'sys_refindex',
01063                         'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
01064                                 ' AND ref_uid='.intval($uid).
01065                                 ' AND deleted=0'
01066                 );
01067 
01068                         // Compile information for title tag:
01069                 $infoData=array();
01070                 if (is_array($rows)) {
01071                         foreach($rows as $row)  {
01072                                 $infoData[]=$row['tablename'].':'.$row['recuid'].':'.$row['field'];
01073                         }
01074                 }
01075 
01076                 return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$uid.'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
01077         }
01078 
01086         function makeLocalizationPanel($table,$row)     {
01087                 global $TCA,$LANG;
01088 
01089                 $out = array(
01090                         0 => '',
01091                         1 => '',
01092                 );
01093                 
01094                 $t8Tools = t3lib_div::makeInstance('t3lib_transl8tools');
01095                 $translations = $t8Tools->translationInfo($table,$row['uid']);
01096 
01097                         // Language title and icon:
01098                 $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
01099 
01100                 if (is_array($translations))    {
01101 
01102                                 // Traverse page translations and add icon for each language that does NOT yet exist:
01103                         $lNew = '';
01104                         foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)        {
01105                                 if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage))      {
01106                                         $href = $GLOBALS['TBE_TEMPLATE']->issueCommand(
01107                                                 '&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,
01108                                                 $this->listURL().'&justLocalized='.rawurlencode($table.':'.$row['uid'].':'.$lUid_OnPage)
01109                                         );
01110 
01111                                         $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
01112                                         $lC = '<a href="'.htmlspecialchars($href).'">'.$lC.'</a> ';
01113 
01114                                         $lNew.=$lC;
01115                                 }
01116                         }
01117                         
01118                         if ($lNew)      $out[1].= $lNew;
01119                 } else {
01120                         $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out[0];
01121                 }
01122                 
01123 
01124                 return $out;
01125         }
01126 
01134         function fieldSelectBox($table,$formFields=1)   {
01135                 global $TCA, $LANG;
01136 
01137                         // Init:
01138                 t3lib_div::loadTCA($table);
01139                 $formElements=array('','');
01140                 if ($formFields)        {
01141                         $formElements=array('<form action="'.htmlspecialchars($this->listURL()).'" method="post">','</form>');
01142                 }
01143 
01144                         // Load already selected fields, if any:
01145                 $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
01146 
01147                         // Request fields from table:
01148                 $fields = $this->makeFieldList($table);
01149 
01150                         // Add pseudo "control" fields
01151                 $fields[]='tstamp';
01152                 $fields[]='crdate';
01153                 $fields[]='_PATH_';
01154                 $fields[]='_REF_';
01155                 $fields[]='_LOCALIZATION_';
01156                 $fields[]='_CONTROL_';
01157                 $fields[]='_CLIPBOARD_';
01158 
01159                         // Create an option for each field:
01160                 $opt=array();
01161                 $opt[] = '<option value=""></option>';
01162                 foreach($fields as $fN) {
01163                         $fL = is_array($TCA[$table]['columns'][$fN]) ? ereg_replace(':$','',$LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '['.$fN.']';    // Field label
01164                         $opt[] = '
01165                                                                                         <option value="'.$fN.'"'.(in_array($fN,$setFields)?' selected="selected"':'').'>'.htmlspecialchars($fL).'</option>';
01166                 }
01167 
01168                         // Compile the options into a multiple selector box:
01169                 $lMenu = '
01170                                                                                 <select size="'.t3lib_div::intInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
01171                                                                                 </select>
01172                                 ';
01173 
01174                         // Table with the field selector::
01175                 $content.= '
01176                         '.$formElements[0].'
01177 
01178                                 <!--
01179                                         Field selector for extended table view:
01180                                 -->
01181                                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
01182                                         <tr>
01183                                                 <td>'.$lMenu.'</td>
01184                                                 <td><input type="submit" name="search" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.setFields',1).'" /></td>
01185                                         </tr>
01186                                 </table>
01187                         '.$formElements[1];
01188                 return $content;
01189         }
01190 
01191 
01192 
01193 
01194 
01195 
01196 
01197 
01198 
01199 
01200 
01201         /*********************************
01202          *
01203          * Helper functions
01204          *
01205          *********************************/
01206 
01217         function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')       {
01218                 $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.cmd_table.value=\''.$table.'\';document.dblistForm.submit();';
01219                 if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
01220                 return '<a href="#" onclick="'.htmlspecialchars($onClickEvent.'return false;').'">'.$string.'</a>';
01221         }
01222 
01228         function clipNumPane()  {
01229                 return in_Array('_CLIPBOARD_',$this->fieldArray) && $this->clipObj->current!='normal';
01230         }
01231 
01242         function addSortLink($code,$field,$table)       {
01243 
01244                         // Certain circumstances just return string right away (no links):
01245                 if ($field=='_CONTROL_' || $field=='_LOCALIZATION_' || $field=='_CLIPBOARD_' || $field=='_REF_' || $this->disableSingleTableView)       return $code;
01246 
01247                         // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
01248                 if ($field=='_PATH_')   $field=pid;
01249 
01250                         //       Create the sort link:
01251                 $sortUrl = $this->listURL('',-1,'sortField,sortRev,table').'&table='.$table.'&sortField='.$field.'&sortRev='.($this->sortRev || ($this->sortField!=$field)?0:1);
01252                 $sortArrow = ($this->sortField==$field?'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/red'.($this->sortRev?'up':'down').'.gif','width="7" height="4"').' alt="" />':'');
01253 
01254                         // Return linked field:
01255                 return '<a href="'.htmlspecialchars($sortUrl).'">'.$code.
01256                                 $sortArrow.
01257                                 '</a>';
01258         }
01259 
01267         function recPath($pid)  {
01268                 if (!isset($this->recPath_cache[$pid])) {
01269                         $this->recPath_cache[$pid] = t3lib_BEfunc::getRecordPath($pid,$this->perms_clause,20);
01270                 }
01271                 return $this->recPath_cache[$pid];
01272         }
01273 
01280         function showNewRecLink($table) {
01281                 return !count($this->allowedNewTables) || in_array($table,$this->allowedNewTables);
01282         }
01283 
01290         function makeReturnUrl()        {
01291                 return '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01292         }
01293 
01294 
01295 
01296 
01297 
01298 
01299 
01300 
01301 
01302 
01303 
01304         /************************************
01305          *
01306          * CSV related functions
01307          *
01308          ************************************/
01309 
01315         function initCSV()      {
01316 
01317                         // Reset:
01318                 $this->csvLines=array();
01319 
01320                         // Getting header line with field names:
01321                 $csvRow=array();
01322                 foreach($this->fieldArray as $fN)       {
01323                         $csvRow[]=$fN;
01324                 }
01325 
01326                         // Set the header + an empty row:
01327                 $this->setCsvRow($csvRow);
01328                 $this->csvLines[]='';
01329         }
01330 
01338         function addToCSV($row,$table)  {
01339 
01340                         // Traversing fields, adding values from $row:
01341                 $csvRow=array();
01342                 foreach($this->fieldArray as $fN)       {
01343                         if ($fN=='_PATH_')      {
01344                                 $csvRow[]=$this->recPath($row['pid']);
01345                         } elseif ($fN=='_REF_') {
01346                                 $csvRow[]=$this->makeRef($table, $row['uid']);
01347                         } else {
01348                                 $csvRow[]=$row[$fN];
01349                         }
01350                 }
01351 
01352                         // Set the values in the CSV list
01353                 $this->setCsvRow($csvRow);
01354         }
01355 
01362         function setCsvRow($csvRow)     {
01363                 $this->csvLines[] = t3lib_div::csvValues($csvRow);
01364         }
01365 
01373         function outputCSV($prefix)     {
01374 
01375                         // Setting filename:
01376                 $filename=$prefix.'_'.date('dmy-Hi').'.csv';
01377 
01378                         // Creating output header:
01379                 $mimeType = 'application/octet-stream';
01380                 Header('Content-Type: '.$mimeType);
01381                 Header('Content-Disposition: attachment; filename='.$filename);
01382 
01383                         // Printing the content of the CSV lines:
01384                 echo implode(chr(13).chr(10),$this->csvLines);
01385 
01386                         // Exits:
01387                 exit;
01388         }
01389 }
01390 
01391 
01392 
01393 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'])   {
01394         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
01395 }
01396 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6