class.db_list_extra.inc

Go to the documentation of this file.
00001 <?php
00002 /*************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2009 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 ***************************************************************/
00027 /**
00028  * Include file extending recordList which extended t3lib_recordList
00029  * Used specifically for the Web>List module (db_list.php)
00030  *
00031  * $Id: class.db_list_extra.inc 8191 2010-07-14 12:14:23Z lolli $
00032  * Revised for TYPO3 3.6 December/2003 by Kasper Skaarhoj
00033  * XHTML compliant
00034  *
00035  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00036  */
00037 /**
00038  * [CLASS/FUNCTION INDEX of SCRIPT]
00039  *
00040  *
00041  *
00042  *   91: class localRecordList extends recordList
00043  *  123:     function writeTop($row)
00044  *  304:     function getTable($table,$id,$rowlist)
00045  *  559:     function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)
00046  *  648:     function renderListHeader($table,$currentIdList)
00047  *
00048  *              SECTION: Rendering of various elements
00049  *  796:     function makeControl($table,$row)
00050  *  986:     function makeClip($table,$row)
00051  * 1057:     function makeRef($table,$uid)
00052  * 1086:     function makeLocalizationPanel($table,$row)
00053  * 1148:     function fieldSelectBox($table,$formFields=1)
00054  *
00055  *              SECTION: Helper functions
00056  * 1231:     function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')
00057  * 1242:     function clipNumPane()
00058  * 1256:     function addSortLink($code,$field,$table)
00059  * 1281:     function recPath($pid)
00060  * 1294:     function showNewRecLink($table)
00061  * 1304:     function makeReturnUrl()
00062  *
00063  *              SECTION: CSV related functions
00064  * 1329:     function initCSV()
00065  * 1352:     function addToCSV($row,$table)
00066  * 1376:     function setCsvRow($csvRow)
00067  * 1387:     function outputCSV($prefix)
00068  *
00069  * TOTAL FUNCTIONS: 19
00070  * (This index is automatically created/updated by the extension "extdeveval")
00071  *
00072  */
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 /**
00084  * Class for rendering of Web>List module
00085  *
00086  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00087  * @package TYPO3
00088  * @subpackage core
00089  */
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 $deniedNewTables=array();           // Used to indicate which tables (values in the array) that cannot have a create-new-record link. If the array is empty, all tables are allowed.
00096     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!).
00097 
00098     var $dontShowClipControlPanels=FALSE;   // If true, will disable the rendering of clipboard + control panels.
00099     var $showClipboard=FALSE;               // If true, will show the clipboard in the field list.
00100     var $noControlPanels = FALSE;           // If true, will DISABLE all control panels in lists. (Takes precedence)
00101     var $clickMenuEnabled = TRUE;           // If true, clickmenus will be rendered
00102 
00103     var $totalRowCount;                     // count of record rows in view
00104 
00105     var $spaceIcon;                         // space icon used for alignment
00106 
00107         // Internal:
00108     var $pageRow=array();                   // Set to the page record (see writeTop())
00109 
00110         // Used to accumulate CSV lines for CSV export.
00111     protected $csvLines = array();
00112 
00113     var $csvOutput=FALSE;                   // If set, the listing is returned as CSV instead.
00114 
00115     /**
00116      * Clipboard object
00117      *
00118      * @var t3lib_clipboard
00119      */
00120     var $clipObj;
00121     var $CBnames=array();                   // Tracking names of elements (for clipboard use)
00122     var $duplicateStack=array();            // Used to track which elements has duplicates and how many
00123 
00124     /**
00125      * references of the current record
00126      *
00127      * @var array
00128      *
00129      * @deprecated since 4.4: Use getReferenceCount instead
00130      */
00131     public $references;
00132 
00133     /**
00134      * [$tablename][$uid] = number of references to this record
00135      *
00136      * @var array
00137      */
00138     protected $referenceCount = array();
00139 
00140     var $translations;                      // Translations of the current record
00141     var $selFieldList;                      // select fields for the query which fetches the translations of the current record
00142 
00143     public function __construct() {
00144         parent::__construct();
00145     }
00146 
00147     /**
00148      * Create the panel of buttons for submitting the form or otherwise perform operations.
00149      *
00150      * @return  array   all available buttons as an assoc. array
00151      */
00152     public function getButtons()    {
00153         global $LANG;
00154 
00155         $buttons = array(
00156             'csh' => '',
00157             'view' => '',
00158             'edit' => '',
00159             'hide_unhide' => '',
00160             'move' => '',
00161             'new_record' => '',
00162             'paste' => '',
00163             'level_up' => '',
00164             'cache' => '',
00165             'reload' => '',
00166             'shortcut' => '',
00167             'back' => '',
00168             'csv' => '',
00169             'export' => ''
00170         );
00171 
00172             // Get users permissions for this page record:
00173         $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageRow);
00174 
00175             // CSH
00176         if (!strlen($this->id)) {
00177             $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module_noId', $GLOBALS['BACK_PATH'], '', TRUE);
00178         } elseif(!$this->id) {
00179             $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module_root', $GLOBALS['BACK_PATH'], '', TRUE);
00180         } else {
00181             $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_module', $GLOBALS['BACK_PATH'], '', TRUE);
00182         }
00183 
00184         if (isset($this->id)) {
00185                 // View  Exclude doktypes 254,255 Configuration: mod.web_list.noViewWithDokTypes = 254,255
00186             if (isset($GLOBALS['SOBE']->modTSconfig['properties']['noViewWithDokTypes'])) {
00187                 $noViewDokTypes = t3lib_div::trimExplode(',', $GLOBALS['SOBE']->modTSconfig['properties']['noViewWithDokTypes'], true);
00188             } else {
00189                     //default exclusion: doktype 254, 255
00190                 $noViewDokTypes = array('254', '255');
00191             }
00192 
00193             if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) {
00194                 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $this->backPath, t3lib_BEfunc::BEgetRootLine($this->id))) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' .
00195                                 t3lib_iconWorks::getSpriteIcon('actions-document-view') .
00196                             '</a>';
00197             }
00198 
00199                 // New record
00200             if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink']) {
00201                 $buttons['new_record'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'db_new.php?id=' . $this->id . '\');') . '" title="' . $LANG->getLL('newRecordGeneral', TRUE) . '">' .
00202                                     t3lib_iconWorks::getSpriteIcon('actions-document-new') .
00203                                 '</a>';
00204             }
00205 
00206                 // If edit permissions are set (see class.t3lib_userauthgroup.php)
00207             if ($localCalcPerms&2 && !empty($this->id)) {
00208 
00209                     // Edit
00210                 $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
00211                 $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, -1)) . '" title="' . $LANG->getLL('editPage', TRUE) . '">' .
00212                                     t3lib_iconWorks::getSpriteIcon('actions-document-open') .
00213                                 '</a>';
00214                     // Unhide
00215                 if ($this->pageRow['hidden'])   {
00216                     $params = '&data[pages][' . $this->pageRow['uid'] . '][hidden]=0';
00217                     $buttons['hide_unhide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $LANG->getLL('unHidePage', TRUE) . '">' .
00218                                         t3lib_iconWorks::getSpriteIcon('actions-edit-unhide') .
00219                                     '</a>';
00220                     // Hide
00221                 } else {
00222                     $params = '&data[pages][' . $this->pageRow['uid'] . '][hidden]=1';
00223                     $buttons['hide_unhide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $LANG->getLL('hidePage', TRUE) . '">'.
00224                                         t3lib_iconWorks::getSpriteIcon('actions-edit-hide') .
00225                                     '</a>';
00226                 }
00227 
00228                     // Move
00229                 $buttons['move'] = '<a href="#" onclick="' . htmlspecialchars('return jumpExt(\'' . $this->backPath . 'move_el.php?table=pages&uid=' . $this->pageRow['uid'] . '\');') . '" title="' . $LANG->getLL('move_page', TRUE) . '">' .
00230                                     (($this->table == 'tt_content') ? t3lib_iconWorks::getSpriteIcon('actions-document-move') : t3lib_iconWorks::getSpriteIcon('actions-page-move')) .
00231                                 '</a>';
00232 
00233                     // Up one level
00234                 $buttons['level_up'] = '<a href="' . htmlspecialchars($this->listURL($this->pageRow['pid'])) . '" onclick="setHighlight(' . $this->pageRow['pid'] . ')" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE) . '">' .
00235                                 t3lib_iconWorks::getSpriteIcon('actions-view-go-up') .
00236                             '</a>';
00237 
00238             }
00239 
00240 
00241                 // Paste
00242             if (($localCalcPerms&8) || ($localCalcPerms&16)) {
00243                 $elFromTable = $this->clipObj->elFromTable('');
00244                 if (count($elFromTable)) {
00245                     $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id)) . '" onclick="' . htmlspecialchars('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable)) . '" title="' . $LANG->getLL('clip_paste', TRUE) . '">' .
00246                                         t3lib_iconWorks::getSpriteIcon('actions-document-paste-after') .
00247                                     '</a>';
00248                 }
00249             }
00250 
00251                 // Cache
00252             $buttons['cache'] = '<a href="' . htmlspecialchars($this->listURL() . '&clear_cache=1') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.clear_cache', TRUE) . '">' .
00253                                 t3lib_iconWorks::getSpriteIcon('actions-system-cache-clear') .
00254                             '</a>';
00255 
00256             if ($this->table) {
00257 
00258                     // CSV
00259                 $buttons['csv'] = '<a href="' . htmlspecialchars($this->listURL() . '&csv=1') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.csv', TRUE) . '">' .
00260                                     t3lib_iconWorks::getSpriteIcon('mimetypes-text-csv') .
00261                                 '</a>';
00262 
00263                     // Export
00264                 if (t3lib_extMgm::isLoaded('impexp')) {
00265                     $url = $this->backPath . t3lib_extMgm::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export';
00266                     $buttons['export'] = '<a href="' . htmlspecialchars($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id)) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.export', TRUE) . '">' .
00267                                 t3lib_iconWorks::getSpriteIcon('actions-document-export-t3d') .
00268                             '</a>';
00269                 }
00270 
00271             }
00272 
00273                 // Reload
00274             $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.reload', TRUE) . '">' .
00275                                 t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
00276                             '</a>';
00277 
00278                 // Shortcut
00279             if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
00280                 $buttons['shortcut'] = $GLOBALS['TBE_TEMPLATE']->makeShortcutIcon('id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_list');
00281             }
00282 
00283                 // Back
00284             if ($this->returnUrl) {
00285                 $buttons['back'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', TRUE) . '">' .
00286                                     t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
00287                                 '</a>';
00288             }
00289         }
00290 
00291         return $buttons;
00292     }
00293 
00294     /**
00295      * Creates the listing of records from a single table
00296      *
00297      * @param   string      Table name
00298      * @param   integer     Page id
00299      * @param   string      List of fields to show in the listing. Pseudo fields will be added including the record header.
00300      * @return  string      HTML table with the listing for the record.
00301      */
00302     function getTable($table,$id,$rowlist)  {
00303         global $TCA, $TYPO3_CONF_VARS;
00304 
00305             // Loading all TCA details for this table:
00306         t3lib_div::loadTCA($table);
00307 
00308             // Init
00309         $addWhere = '';
00310         $titleCol = $TCA[$table]['ctrl']['label'];
00311         $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
00312         $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
00313         $tableCollapsed = (!$this->tablesCollapsed[$table]) ? false : true;
00314 
00315         // prepare space icon
00316         $this->spaceIcon = t3lib_iconWorks::getSpriteIcon('empty-empty', array('style' => 'background-position: 0 10px;'));
00317 
00318             // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
00319         $this->fieldArray=array();
00320             // title Column
00321         $this->fieldArray[] = $titleCol;    // Add title column
00322             // Control-Panel
00323         if (!t3lib_div::inList($rowlist,'_CONTROL_'))   {
00324             $this->fieldArray[] = '_CONTROL_';
00325             $this->fieldArray[] = '_AFTERCONTROL_';
00326         }
00327             // Clipboard
00328         if ($this->showClipboard)   {
00329             $this->fieldArray[] = '_CLIPBOARD_';
00330         }
00331             // Ref
00332         if (!$this->dontShowClipControlPanels)  {
00333             $this->fieldArray[]='_REF_';
00334             $this->fieldArray[]='_AFTERREF_';
00335         }
00336             // Path
00337         if ($this->searchLevels)    {
00338             $this->fieldArray[]='_PATH_';
00339         }
00340             // Localization
00341         if ($this->localizationView && $l10nEnabled)    {
00342             $this->fieldArray[] = '_LOCALIZATION_';
00343             $this->fieldArray[] = '_LOCALIZATION_b';
00344             $addWhere.=' AND (
00345                 '.$TCA[$table]['ctrl']['languageField'].'<=0
00346                 OR
00347                 '.$TCA[$table]['ctrl']['transOrigPointerField'].' = 0
00348             )';
00349         }
00350             // Cleaning up:
00351         $this->fieldArray=array_unique(array_merge($this->fieldArray,t3lib_div::trimExplode(',',$rowlist,1)));
00352         if ($this->noControlPanels) {
00353             $tempArray = array_flip($this->fieldArray);
00354             unset($tempArray['_CONTROL_']);
00355             unset($tempArray['_CLIPBOARD_']);
00356             $this->fieldArray = array_keys($tempArray);
00357         }
00358 
00359             // Creating the list of fields to include in the SQL query:
00360         $selectFields = $this->fieldArray;
00361         $selectFields[] = 'uid';
00362         $selectFields[] = 'pid';
00363         if ($thumbsCol) $selectFields[] = $thumbsCol;   // adding column for thumbnails
00364         if ($table=='pages')    {
00365             if (t3lib_extMgm::isLoaded('cms'))  {
00366                 $selectFields[] = 'module';
00367                 $selectFields[] = 'extendToSubpages';
00368                 $selectFields[] = 'nav_hide';
00369             }
00370             $selectFields[] = 'doktype';
00371         }
00372         if (is_array($TCA[$table]['ctrl']['enablecolumns']))    {
00373             $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
00374         }
00375         if ($TCA[$table]['ctrl']['type'])   {
00376             $selectFields[] = $TCA[$table]['ctrl']['type'];
00377         }
00378         if ($TCA[$table]['ctrl']['typeicon_column'])    {
00379             $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
00380         }
00381         if ($TCA[$table]['ctrl']['versioningWS'])   {
00382             $selectFields[] = 't3ver_id';
00383             $selectFields[] = 't3ver_state';
00384             $selectFields[] = 't3ver_wsid';
00385             $selectFields[] = 't3ver_swapmode';     // Filtered out when pages in makeFieldList()
00386         }
00387         if ($l10nEnabled)   {
00388             $selectFields[] = $TCA[$table]['ctrl']['languageField'];
00389             $selectFields[] = $TCA[$table]['ctrl']['transOrigPointerField'];
00390         }
00391         if ($TCA[$table]['ctrl']['label_alt'])  {
00392             $selectFields = array_merge($selectFields,t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1));
00393         }
00394         $selectFields = array_unique($selectFields);        // Unique list!
00395         $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1));      // Making sure that the fields in the field-list ARE in the field-list from TCA!
00396         $selFieldList = implode(',',$selectFields);     // implode it into a list of fields for the SQL-statement.
00397         $this->selFieldList = $selFieldList;
00398 
00399         /**
00400          * @hook            DB-List getTable
00401          * @date            2007-11-16
00402          * @request     Malte Jansen  <mail@maltejansen.de>
00403          */
00404         if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
00405             foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
00406                 $hookObject = t3lib_div::getUserObj($classData);
00407 
00408                 if(!($hookObject instanceof t3lib_localRecordListGetTableHook)) {
00409                     throw new UnexpectedValueException('$hookObject must implement interface t3lib_localRecordListGetTableHook', 1195114460);
00410                 }
00411 
00412                 $hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
00413             }
00414         }
00415 
00416             // Create the SQL query for selecting the elements in the listing:
00417         if ($this->csvOutput) { // do not do paging when outputting as CSV
00418             $this->iLimit = 0;
00419         }
00420 
00421         if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
00422                 // Get the two previous rows for sorting if displaying page > 1
00423             $this->firstElementNumber = $this->firstElementNumber - 2;
00424             $this->iLimit = $this->iLimit + 2;
00425             $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList);   // (API function from class.db_list.inc)
00426             $this->firstElementNumber = $this->firstElementNumber + 2;
00427             $this->iLimit = $this->iLimit - 2;
00428         } else {
00429             $queryParts = $this->makeQueryArray($table, $id,$addWhere,$selFieldList);   // (API function from class.db_list.inc)
00430         }
00431 
00432         $this->setTotalItems($queryParts);      // Finding the total amount of records on the page (API function from class.db_list.inc)
00433 
00434             // Init:
00435         $dbCount = 0;
00436         $out = '';
00437         $listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
00438 
00439             // If the count query returned any number of records, we perform the real query, selecting records.
00440         if ($this->totalItems)  {
00441             // Fetch records only if not in single table mode or if in multi table mode and not collapsed
00442             if ($listOnlyInSingleTableMode || (!$this->table && $tableCollapsed)) {
00443                 $dbCount = $this->totalItems;
00444             } else {
00445                     // set the showLimit to the number of records when outputting as CSV
00446                 if ($this->csvOutput) {
00447                     $this->showLimit = $this->totalItems;
00448                     $this->iLimit = $this->totalItems;
00449                 }
00450                 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
00451                 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
00452             }
00453         }
00454 
00455             // If any records was selected, render the list:
00456         if ($dbCount)   {
00457 
00458                 // Half line is drawn between tables:
00459             if (!$listOnlyInSingleTableMode)    {
00460                 $theData = Array();
00461                 if (!$this->table && !$rowlist) {
00462                     $theData[$titleCol] = '<img src="clear.gif" width="'.($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel']?'230':'350').'" height="1" alt="" />';
00463                     if (in_array('_CONTROL_',$this->fieldArray))    $theData['_CONTROL_']='';
00464                     if (in_array('_CLIPBOARD_',$this->fieldArray))  $theData['_CLIPBOARD_']='';
00465                 }
00466                 $out.=$this->addelement(0,'',$theData,'class="c-table-row-spacer"',$this->leftMargin);
00467             }
00468 
00469                 // Header line is drawn
00470             $theData = Array();
00471             if ($this->disableSingleTableView)  {
00472                 $theData[$titleCol] = '<span class="c-table">'.$GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'],1).'</span> ('.$this->totalItems.')';
00473             } else {
00474                 $theData[$titleCol] = $this->linkWrapTable($table, '<span class="c-table">' . $GLOBALS['LANG']->sL($TCA[$table]['ctrl']['title'], TRUE) . '</span> (' . $this->totalItems . ') ' .
00475                         ($this->table ? t3lib_iconWorks::getSpriteIcon('actions-view-table-collapse', array('title' => $GLOBALS['LANG']->getLL('contractView', TRUE))) : t3lib_iconWorks::getSpriteIcon('actions-view-table-expand', array('title' => $GLOBALS['LANG']->getLL('expandView', TRUE))))
00476                     );
00477             }
00478 
00479                 // CSH:
00480             $theData[$titleCol].= t3lib_BEfunc::cshItem($table,'',$this->backPath,'',FALSE,'margin-bottom:0px; white-space: normal;');
00481 
00482             if ($listOnlyInSingleTableMode) {
00483                 $out.='
00484                     <tr>
00485                         <td class="t3-row-header" style="width:95%;">' . $theData[$titleCol] . '</td>
00486                     </tr>';
00487 
00488                 if ($GLOBALS['BE_USER']->uc["edit_showFieldHelp"])  {
00489                     $GLOBALS['LANG']->loadSingleTableDescription($table);
00490                     if (isset($GLOBALS['TCA_DESCR'][$table]['columns']['']))    {
00491                         $onClick = 'vHWin=window.open(\'view_help.php?tfID='.$table.'.\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
00492                         $out.='
00493                     <tr>
00494                         <td class="c-tableDescription">'.t3lib_BEfunc::helpTextIcon($table,'',$this->backPath,TRUE).$GLOBALS['TCA_DESCR'][$table]['columns']['']['description'].'</td>
00495                     </tr>';
00496                     }
00497                 }
00498             } else {
00499                 // Render collapse button if in multi table mode
00500                 $collapseIcon = '';
00501                 if (!$this->table) {
00502                     $collapseIcon = '<a href="' . htmlspecialchars($this->listURL() . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1')) . '" title="' . ($tableCollapsed ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.expandTable', TRUE) : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.collapseTable', TRUE)) . '">' .
00503                             ($tableCollapsed ? t3lib_iconWorks::getSpriteIcon('actions-view-list-expand', array('class' => 'collapseIcon')) : t3lib_iconWorks::getSpriteIcon('actions-view-list-collapse', array('class' => 'collapseIcon'))) .
00504                         '</a>';
00505                 }
00506                 $out .= $this->addElement(1, $collapseIcon, $theData, ' class="t3-row-header"', '');
00507             }
00508 
00509             // Render table rows only if in multi table view and not collapsed or if in single table view
00510             if (!$listOnlyInSingleTableMode && (!$tableCollapsed || $this->table)) {
00511                     // Fixing a order table for sortby tables
00512                 $this->currentTable = array();
00513                 $currentIdList = array();
00514                 $doSort = ($TCA[$table]['ctrl']['sortby'] && !$this->sortField);
00515 
00516                 $prevUid = 0;
00517                 $prevPrevUid = 0;
00518 
00519                     // Get first two rows and initialize prevPrevUid and prevUid if on page > 1
00520                 if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
00521                     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
00522                     $prevPrevUid = -(int) $row['uid'];
00523                     $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
00524                     $prevUid = $row['uid'];
00525                 }
00526 
00527                 $accRows = array(); // Accumulate rows here
00528                 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))    {
00529 
00530                         // In offline workspace, look for alternative record:
00531                     t3lib_BEfunc::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace, TRUE);
00532 
00533                     if (is_array($row)) {
00534                         $accRows[] = $row;
00535                         $currentIdList[] = $row['uid'];
00536                         if ($doSort)    {
00537                             if ($prevUid)   {
00538                                 $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
00539                                 $this->currentTable['next'][$prevUid] = '-'.$row['uid'];
00540                                 $this->currentTable['prevUid'][$row['uid']] = $prevUid;
00541                             }
00542                             $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
00543                             $prevUid=$row['uid'];
00544                         }
00545                     }
00546                 }
00547                 $GLOBALS['TYPO3_DB']->sql_free_result($result);
00548 
00549                 $this->totalRowCount = count($accRows);
00550 
00551                     // CSV initiated
00552                 if ($this->csvOutput) $this->initCSV();
00553 
00554                     // Render items:
00555                 $this->CBnames=array();
00556                 $this->duplicateStack=array();
00557                 $this->eCounter=$this->firstElementNumber;
00558 
00559                 $iOut = '';
00560                 $cc = 0;
00561 
00562                 foreach($accRows as $row)   {
00563                     // Render item row if counter < limit
00564                     if ($cc < $this->iLimit) {
00565                         $cc++;
00566                         $this->translations = FALSE;
00567                         $iOut.= $this->renderListRow($table,$row,$cc,$titleCol,$thumbsCol);
00568 
00569                             // 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:
00570                         if ($this->localizationView && $l10nEnabled)    {
00571                                 // For each available translation, render the record:
00572                             if (is_array($this->translations)) {
00573                                 foreach ($this->translations as $lRow) {
00574                                         // $lRow isn't always what we want - if record was moved we've to work with the placeholder records otherwise the list is messed up a bit
00575                                     if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
00576                                         $tmpRow = t3lib_BEfunc::getRecordRaw($table, 't3ver_move_id="'.intval($lRow['uid']) . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . t3lib_beFunc::deleteClause($table), $selFieldList);
00577                                         $lRow = is_array($tmpRow)?$tmpRow:$lRow;
00578                                     }
00579                                         // In offline workspace, look for alternative record:
00580                                     t3lib_BEfunc::workspaceOL($table, $lRow, $GLOBALS['BE_USER']->workspace, true);
00581                                     if (is_array($lRow) && $GLOBALS['BE_USER']->checkLanguageAccess($lRow[$TCA[$table]['ctrl']['languageField']]))  {
00582                                         $currentIdList[] = $lRow['uid'];
00583                                         $iOut.=$this->renderListRow($table,$lRow,$cc,$titleCol,$thumbsCol,18);
00584                                     }
00585                                 }
00586                             }
00587                         }
00588                     }
00589 
00590                         // Counter of total rows incremented:
00591                     $this->eCounter++;
00592                 }
00593 
00594                     // Record navigation is added to the beginning and end of the table if in single table mode
00595                 if ($this->table) {
00596                     $pageNavigation = $this->renderListNavigation();
00597                     $iOut = $pageNavigation . $iOut . $pageNavigation;
00598                 } else {
00599                         // show that there are more records than shown
00600                     if ($this->totalItems > $this->itemsLimitPerTable) {
00601                         $countOnFirstPage = $this->totalItems > $this->itemsLimitSingleTable ? $this->itemsLimitSingleTable : $this->totalItems;
00602                         $hasMore = ($this->totalItems > $this->itemsLimitSingleTable);
00603                         $iOut .= '<tr><td colspan="' . count($this->fieldArray) . '" style="padding:5px;">
00604                                 <a href="'.htmlspecialchars($this->listURL() . '&table=' . rawurlencode($table)) . '">' .
00605                                 '<img' . t3lib_iconWorks::skinImg($this->backPath,'gfx/pildown.gif', 'width="14" height="14"') .' alt="" />'.
00606                                 ' <i>[1 - ' . $countOnFirstPage . ($hasMore ? '+' : '') . ']</i></a>
00607                                 </td></tr>';
00608                         }
00609 
00610                 }
00611 
00612                     // The header row for the table is now created:
00613                 $out .= $this->renderListHeader($table,$currentIdList);
00614             }
00615 
00616                 // The list of records is added after the header:
00617             $out .= $iOut;
00618             unset($iOut);
00619 
00620                 // ... and it is all wrapped in a table:
00621             $out='
00622 
00623 
00624 
00625             <!--
00626                 DB listing of elements: "'.htmlspecialchars($table).'"
00627             -->
00628                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist'.($listOnlyInSingleTableMode?' typo3-dblist-overview':'').'">
00629                     '.$out.'
00630                 </table>';
00631 
00632                 // Output csv if...
00633             if ($this->csvOutput)   $this->outputCSV($table);   // This ends the page with exit.
00634         }
00635 
00636             // Return content:
00637         return $out;
00638     }
00639 
00640     /**
00641      * Rendering a single row for the list
00642      *
00643      * @param   string      Table name
00644      * @param   array       Current record
00645      * @param   integer     Counter, counting for each time an element is rendered (used for alternating colors)
00646      * @param   string      Table field (column) where header value is found
00647      * @param   string      Table field (column) where (possible) thumbnails can be found
00648      * @param   integer     Indent from left.
00649      * @return  string      Table row for the element
00650      * @access private
00651      * @see getTable()
00652      */
00653     function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)  {
00654         $iOut = '';
00655 
00656         if (strlen($this->searchString))    {   // If in search mode, make sure the preview will show the correct page
00657             $id_orig = $this->id;
00658             $this->id = $row['pid'];
00659         }
00660 
00661         if (is_array($row)) {
00662                 // add special classes for first and last row
00663             $rowSpecial = '';
00664             if ($cc == 1 && $indent == 0) {
00665                 $rowSpecial .= ' firstcol';
00666             }
00667             if ($cc == $this->totalRowCount || $cc == $this->iLimit) {
00668                 $rowSpecial .= ' lastcol';
00669             }
00670 
00671                 // Background color, if any:
00672             if ($this->alternateBgColors) {
00673                 $row_bgColor = ($cc%2) ? ' class="db_list_normal'.$rowSpecial.'"' : ' class="db_list_alt'.$rowSpecial.'"';
00674             } else {
00675                 $row_bgColor = ' class="db_list_normal'.$rowSpecial.'"';
00676             }
00677                 // Overriding with versions background color if any:
00678             $row_bgColor = $row['_CSSCLASS'] ? ' class="'.$row['_CSSCLASS'].'"' : $row_bgColor;
00679 
00680                 // Incr. counter.
00681             $this->counter++;
00682 
00683                 // The icon with link
00684             $alttext = t3lib_BEfunc::getRecordIconAltText($row,$table);
00685             $iconImg = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => ($indent ? ' margin-left: ' . $indent . 'px;' : '')));
00686 
00687 
00688             $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg,$table,$row['uid']) : $iconImg;
00689 
00690                 // Preparing and getting the data-array
00691             $theData = Array();
00692             foreach($this->fieldArray as $fCol) {
00693                 if ($fCol==$titleCol)   {
00694                     $recTitle = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
00695                         // If the record is edit-locked by another user, we will show a little warning sign:
00696                     if (($lockInfo = t3lib_BEfunc::isRecordLocked($table, $row['uid']))) {
00697                         $warning = '<a href="#" onclick="' . htmlspecialchars('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . '); return false;') . '" title="' . htmlspecialchars($lockInfo['msg']) . '">' .
00698                                 t3lib_iconWorks::getSpriteIcon('status-warning-in-use') .
00699                             '</a>';
00700                     }
00701                     $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
00702 
00703                         // Render thumbsnails if a thumbnail column exists and there is content in it:
00704                     if ($this->thumbs && trim($row[$thumbsCol])) {
00705                         $theData[$fCol] .= '<br />' . $this->thumbCode($row,$table,$thumbsCol);
00706                     }
00707 
00708                     $localizationMarkerClass = '';
00709                     if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField'])
00710                     && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0) {
00711                             // it's a translated record
00712                         $localizationMarkerClass = ' localization';
00713                     }
00714                 } elseif ($fCol == 'pid') {
00715                     $theData[$fCol]=$row[$fCol];
00716                 } elseif ($fCol == '_PATH_') {
00717                     $theData[$fCol]=$this->recPath($row['pid']);
00718                 } elseif ($fCol == '_REF_') {
00719                     $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']);
00720                 } elseif ($fCol == '_CONTROL_') {
00721                     $theData[$fCol]=$this->makeControl($table,$row);
00722                 } elseif ($fCol == '_AFTERCONTROL_' || $fCol == '_AFTERREF_') {
00723                     $theData[$fCol] = '&nbsp;';
00724                 } elseif ($fCol == '_CLIPBOARD_') {
00725                     $theData[$fCol]=$this->makeClip($table,$row);
00726                 } elseif ($fCol == '_LOCALIZATION_') {
00727                     list($lC1, $lC2) = $this->makeLocalizationPanel($table,$row);
00728                     $theData[$fCol] = $lC1;
00729                     $theData[$fCol.'b'] = $lC2;
00730                 } elseif ($fCol == '_LOCALIZATION_b') {
00731                     // Do nothing, has been done above.
00732                 } else {
00733                     $tmpProc = t3lib_BEfunc::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']);
00734                     $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
00735                     $row[$fCol] = $tmpProc;
00736                 }
00737             }
00738 
00739             if (strlen($this->searchString))    {   // Reset the ID if it was overwritten
00740                 $this->id = $id_orig;
00741             }
00742 
00743                 // Add row to CSV list:
00744             if ($this->csvOutput) {
00745                 $this->addToCSV($row,$table);
00746             }
00747 
00748             // Add classes to table cells
00749             $this->addElement_tdCssClass[$titleCol]         = 'col-title' . $localizationMarkerClass;
00750             if (!$this->dontShowClipControlPanels) {
00751                 $this->addElement_tdCssClass['_CONTROL_']       = 'col-control';
00752                 $this->addElement_tdCssClass['_AFTERCONTROL_']  = 'col-control-space';
00753                 $this->addElement_tdCssClass['_CLIPBOARD_']     = 'col-clipboard';
00754             }
00755             $this->addElement_tdCssClass['_PATH_']          = 'col-path';
00756             $this->addElement_tdCssClass['_LOCALIZATION_']  = 'col-localizationa';
00757             $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';
00758 
00759                 // Create element in table cells:
00760             $iOut.=$this->addelement(1,$theIcon,$theData,$row_bgColor);
00761 
00762                 // Finally, return table row element:
00763             return $iOut;
00764         }
00765     }
00766 
00767     /**
00768      * Write sys_refindex entries for current record to $this->references
00769      *
00770      * @param   string      Table name
00771      * @param   integer     Uid of current record
00772      * @return  void
00773      *
00774      * @deprecated since 4.4: Use getReferenceCount instead
00775      */
00776     function setReferences($table, $uid) {
00777         t3lib_div::logDeprecatedFunction();
00778 
00779         $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
00780             'tablename, recuid, field',
00781             'sys_refindex',
00782             'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
00783                 ' AND ref_uid='.intval($uid).
00784                 ' AND deleted=0'
00785         );
00786         $this->references = $rows;
00787     }
00788 
00789     /**
00790      * Gets the number of records referencing the record with the UID $uid in
00791      * the table $tableName.
00792      *
00793      * @param string $tableName
00794      *        table name of the referenced record, must not be empty
00795      * @param integer $uid
00796      *        UID of the referenced record, must be > 0
00797      *
00798      * @return integer the number of references to record $uid in table
00799      *                 $tableName, will be >= 0
00800      */
00801     protected function getReferenceCount($tableName, $uid) {
00802         if (!isset($this->referenceCount[$tableName][$uid])) {
00803             $numberOfReferences = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
00804                 '*',
00805                 'sys_refindex',
00806                 'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
00807                     $tableName, 'sys_refindex'
00808                 ) .
00809                     ' AND ref_uid = ' . $uid .
00810                     ' AND deleted = 0'
00811             );
00812 
00813             $this->referenceCount[$tableName][$uid] = $numberOfReferences;
00814         }
00815 
00816         return $this->referenceCount[$tableName][$uid];
00817     }
00818 
00819     /**
00820      * Rendering the header row for a table
00821      *
00822      * @param   string      Table name
00823      * @param   array       Array of the currently displayed uids of the table
00824      * @return  string      Header table row
00825      * @access private
00826      * @see getTable()
00827      */
00828     function renderListHeader($table, $currentIdList)   {
00829         global $TCA, $LANG, $TYPO3_CONF_VARS;
00830 
00831             // Init:
00832         $theData = Array();
00833 
00834             // Traverse the fields:
00835         foreach($this->fieldArray as $fCol) {
00836 
00837                 // Calculate users permissions to edit records in the table:
00838             $permsEdit = $this->calcPerms & ($table=='pages'?2:16);
00839 
00840             switch((string)$fCol)   {
00841                 case '_PATH_':          // Path
00842                     $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._PATH_',1).']</i>';
00843                 break;
00844                 case '_REF_':           // References
00845                     $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_mod_file_list.xml:c__REF_',1).']</i>';
00846                 break;
00847                 case '_LOCALIZATION_':          // Path
00848                     $theData[$fCol] = '<i>['.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels._LOCALIZATION_',1).']</i>';
00849                 break;
00850                 case '_LOCALIZATION_b':         // Path
00851                     $theData[$fCol] = $LANG->getLL('Localize',1);
00852                 break;
00853                 case '_CLIPBOARD_':     // Clipboard:
00854                     $cells=array();
00855 
00856                         // If there are elements on the clipboard for this table, then display the "paste into" icon:
00857                     $elFromTable = $this->clipObj->elFromTable($table);
00858                     if (count($elFromTable))    {
00859                         $cells['pasteAfter']='<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,$this->id)).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg('pages',$this->pageRow,'into',$elFromTable)).'" title="' . $LANG->getLL('clip_paste', TRUE) . '">' .
00860                                     t3lib_iconWorks::getSpriteIcon('actions-document-paste-after') .
00861                                 '</a>';
00862                     }
00863 
00864                         // If the numeric clipboard pads are enabled, display the control icons for that:
00865                     if ($this->clipObj->current!='normal')  {
00866 
00867                             // The "select" link:
00868                         $cells['copyMarked']=$this->linkClipboardHeaderIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-copy', array('title' => $LANG->getLL('clip_selectMarked', TRUE))), $table, 'setCB');
00869 
00870                             // The "edit marked" link:
00871                         $editIdList = implode(',',$currentIdList);
00872                         $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00873                         $params='&edit['.$table.']['.$editIdList.']=edit&disHelp=1';
00874                         $cells['edit']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'" title="' . $LANG->getLL('clip_editMarked', TRUE) . '">' .
00875                                 t3lib_iconWorks::getSpriteIcon('actions-document-open') .
00876                                 '</a>';
00877 
00878                             // The "Delete marked" link:
00879                         $cells['delete']=$this->linkClipboardHeaderIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => $LANG->getLL('clip_deleteMarked', TRUE))), $table,'delete',sprintf($LANG->getLL('clip_deleteMarkedWarning'), $LANG->sL($TCA[$table]['ctrl']['title'])));
00880 
00881                             // The "Select all" link:
00882                         $cells['markAll'] = '<a class="cbcCheckAll" rel="" href="#" onclick="' . htmlspecialchars('checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;') . '" title="' . $LANG->getLL('clip_markRecords', TRUE) . '">' .
00883                                 t3lib_iconWorks::getSpriteIcon('actions-document-select') .
00884                                 '</a>';
00885                     } else {
00886                         $cells['empty']='';
00887                     }
00888                     /**
00889                      * @hook            renderListHeaderActions: Allows to change the clipboard icons of the Web>List table headers
00890                      * @date            2007-11-20
00891                      * @request     Bernhard Kraft  <krafbt@kraftb.at>
00892                      * @usage       Above each listed table in Web>List a header row is shown. This hook allows to modify the icons responsible for the clipboard functions (shown above the clipboard checkboxes when a clipboard other than "Normal" is selected), or other "Action" functions which perform operations on the listed records.
00893                      */
00894                     if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']))    {
00895                         foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData)   {
00896                             $hookObject = t3lib_div::getUserObj($classData);
00897                             if(!($hookObject instanceof localRecordList_actionsHook))   {
00898                                 throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567850);
00899                             }
00900                             $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
00901                         }
00902                     }
00903                     $theData[$fCol]=implode('',$cells);
00904                 break;
00905                 case '_CONTROL_':       // Control panel:
00906                     if (!$TCA[$table]['ctrl']['readOnly'])  {
00907 
00908                             // If new records can be created on this page, add links:
00909                         if ($this->calcPerms&($table=='pages'?8:16) && $this->showNewRecLink($table))   {
00910                             if ($table=="tt_content" && $this->newWizards)  {
00911                                     //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00912                                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00913                                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00914                                 $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';
00915 
00916                                 $icon = '<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$newContentWizScriptPath.'?id='.$this->id.'\');').'" title="' . $LANG->getLL('new', TRUE) . '">'.
00917                                                     ($table == 'pages' ? t3lib_iconWorks::getSpriteIcon('actions-page-new') : t3lib_iconWorks::getSpriteIcon('actions-document-new')) .
00918                                                 '</a>';
00919                             } elseif ($table=='pages' && $this->newWizards) {
00920                                 $icon = '<a href="'.htmlspecialchars($this->backPath.'db_new.php?id='.$this->id.'&pagesOnly=1&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'" title="'.$LANG->getLL('new', TRUE).'">'.
00921                                                     ($table=='pages' ? t3lib_iconWorks::getSpriteIcon('actions-page-new') : t3lib_iconWorks::getSpriteIcon('actions-document-new')) .
00922                                                 '</a>';
00923 
00924                             } else {
00925                                 $params = '&edit['.$table.']['.$this->id.']=new';
00926                                 if ($table == 'pages_language_overlay') {
00927                                     $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int) $this->pageRow['doktype'];
00928                                 }
00929                                 $icon   = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'" title="'.$LANG->getLL('new', TRUE).'">'.
00930                                                     ($table=='pages' ? t3lib_iconWorks::getSpriteIcon('actions-page-new') : t3lib_iconWorks::getSpriteIcon('actions-document-new')) .
00931                                                 '</a>';
00932                             }
00933                         }
00934 
00935                             // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
00936                         if ($permsEdit && $this->table && is_array($currentIdList)) {
00937                             $editIdList = implode(',',$currentIdList);
00938                             if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00939                             $params = '&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.implode(',',$this->fieldArray).'&disHelp=1';
00940                             $icon  .= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'" title="'.$LANG->getLL('editShownColumns', TRUE) . '">'.
00941                                                 t3lib_iconWorks::getSpriteIcon('actions-document-open') .
00942                                             '</a>';
00943                         }
00944                             // add an empty entry, so column count fits again after moving this into $icon
00945                         $theData[$fCol] = '&nbsp;';
00946                     }
00947                 break;
00948                 case '_AFTERCONTROL_':  // space column
00949                 case '_AFTERREF_':  // space column
00950                     $theData[$fCol] = '&nbsp;';
00951                 break;
00952                 default:            // Regular fields header:
00953                     $theData[$fCol]='';
00954                     if ($this->table && is_array($currentIdList))   {
00955 
00956                             // If the numeric clipboard pads are selected, show duplicate sorting link:
00957                         if ($this->clipNumPane()) {
00958                             $theData[$fCol].='<a href="'.htmlspecialchars($this->listURL('',-1).'&duplicateField='.$fCol).'" title="'.$LANG->getLL('clip_duplicates', TRUE) . '">'.
00959                                                 t3lib_iconWorks::getSpriteIcon('actions-document-duplicates-select') .
00960                                             '</a>';
00961                         }
00962 
00963                             // If the table can be edited, add link for editing THIS field for all listed records:
00964                         if (!$TCA[$table]['ctrl']['readOnly'] && $permsEdit && $TCA[$table]['columns'][$fCol])  {
00965                             $editIdList = implode(',',$currentIdList);
00966                             if ($this->clipNumPane()) $editIdList = "'+editList('".$table."','".$editIdList."')+'";
00967                             $params='&edit['.$table.']['.$editIdList.']=edit&columnsOnly='.$fCol.'&disHelp=1';
00968                             $iTitle = sprintf($LANG->getLL('editThisColumn'),rtrim(trim($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol))),':'));
00969                             $theData[$fCol].='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'" title="'.htmlspecialchars($iTitle).'">'.
00970                                                 t3lib_iconWorks::getSpriteIcon('actions-document-open') .
00971                                             '</a>';
00972                         }
00973                     }
00974                     $theData[$fCol].=$this->addSortLink($LANG->sL(t3lib_BEfunc::getItemLabel($table,$fCol,'<i>[|]</i>')),$fCol,$table);
00975                 break;
00976             }
00977 
00978         }
00979 
00980         /**
00981          * @hook            renderListHeader: Allows to change the contents of columns/cells of the Web>List table headers
00982          * @date            2007-11-20
00983          * @request     Bernhard Kraft  <krafbt@kraftb.at>
00984          * @usage       Above each listed table in Web>List a header row is shown. Containing the labels of all shown fields and additional icons to create new records for this table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc.
00985          */
00986         if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']))    {
00987             foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData)   {
00988                 $hookObject = t3lib_div::getUserObj($classData);
00989                 if(!($hookObject instanceof localRecordList_actionsHook))   {
00990                     throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567855);
00991                 }
00992                 $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
00993             }
00994         }
00995 
00996             // Create and return header table row:
00997         return $this->addelement(1, $icon, $theData, ' class="c-headLine"', '');
00998     }
00999 
01000     /**
01001      * Creates a page browser for tables with many records
01002      *
01003      * @return  string  Navigation HTML
01004      *
01005      */
01006     protected function renderListNavigation() {
01007         $totalPages = ceil($this->totalItems / $this->iLimit);
01008 
01009         $content = '';
01010         $returnContent = '';
01011 
01012             // Show page selector if not all records fit into one page
01013         if ($totalPages > 1) {
01014             $first = $previous = $next = $last = $reload = '';
01015             $listURL = $this->listURL('', $this->table);
01016 
01017                 // 1 = first page
01018             $currentPage = floor(($this->firstElementNumber + 1) / $this->iLimit) + 1;
01019 
01020                 // Compile first, previous, next, last and refresh buttons
01021             if ($currentPage > 1) {
01022                 $labelFirst = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:first');
01023 
01024                 $first = '<a href="' . $listURL . '&pointer=0">' .
01025                     t3lib_iconWorks::getSpriteIcon('actions-view-paging-first', array('title'=> $labelFirst)) .
01026                 '</a>';
01027             } else {
01028                 $first = t3lib_iconWorks::getSpriteIcon('actions-view-paging-first-disabled');
01029             }
01030 
01031             if (($currentPage - 1) > 0) {
01032                 $labelPrevious = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:previous');
01033 
01034                 $previous = '<a href="' . $listURL . '&pointer=' . (($currentPage - 2) * $this->iLimit) . '">' .
01035                     t3lib_iconWorks::getSpriteIcon('actions-view-paging-previous', array('title' => $labelPrevious)) .
01036                     '</a>';
01037             } else {
01038                 $previous = t3lib_iconWorks::getSpriteIcon('actions-view-paging-previous-disabled');
01039             }
01040 
01041             if (($currentPage + 1) <= $totalPages) {
01042                 $labelNext = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:next');
01043 
01044                 $next = '<a href="' . $listURL . '&pointer=' . (($currentPage) * $this->iLimit) . '">' .
01045                     t3lib_iconWorks::getSpriteIcon('actions-view-paging-next', array('title' => $labelNext)) .
01046                     '</a>';
01047             } else {
01048                 $next = t3lib_iconWorks::getSpriteIcon('actions-view-paging-next-disabled');
01049             }
01050 
01051             if ($currentPage != $totalPages) {
01052                 $labelLast = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:last');
01053 
01054                 $last = '<a href="' . $listURL . '&pointer=' . (($totalPages - 1) * $this->iLimit) . '">' .
01055                     t3lib_iconWorks::getSpriteIcon('actions-view-paging-last', array('title' => $labelLast)) .
01056                     '</a>';
01057             } else {
01058                 $last = t3lib_iconWorks::getSpriteIcon('actions-view-paging-last-disabled');
01059             }
01060 
01061             $reload = '<a href="#" onclick="document.dblistForm.action=\''
01062                 . $listURL . '&pointer=\'+calculatePointer(); document.dblistForm.submit(); return true;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:reload', TRUE) . '">' .
01063                     t3lib_iconWorks::getSpriteIcon('actions-system-refresh') .
01064                 '</a>';
01065 
01066             // Add js to traverse a page select input to a pointer value
01067             $content = '
01068 <script type="text/JavaScript">
01069 /*<![CDATA[*/
01070 
01071     function calculatePointer(){
01072         page = document.getElementById(\'jumpPage\').value;
01073 
01074         if (page > ' . $totalPages . ') {
01075             page = ' . $totalPages . ';
01076         }
01077 
01078         if (page < 1) {
01079             page = 1;
01080         }
01081 
01082         pointer = (page - 1) * ' . $this->iLimit . ';
01083 
01084         return pointer;
01085     }
01086 
01087 /*]]>*/
01088 </script>
01089 ';
01090 
01091             $pageNumberInput = '<span>
01092                 <input type="text" value="' . $currentPage
01093                 . '" size="3" id="jumpPage" name="jumpPage" onkeyup="if (event.keyCode == Event.KEY_RETURN) { document.dblistForm.action=\'' . $listURL . '&pointer=\'+calculatePointer(); document.dblistForm.submit(); } return true;" />
01094                 </span>';
01095             $pageIndicator = '<span class="pageIndicator">'
01096                 . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:pageIndicator'), $pageNumberInput, $totalPages)
01097                 . '</span>';
01098 
01099             if ($this->totalItems > ($this->firstElementNumber + $this->iLimit)) {
01100                 $lastElementNumber = $this->firstElementNumber + $this->iLimit;
01101             } else {
01102                 $lastElementNumber = $this->totalItems;
01103             }
01104             $rangeIndicator = '<span class="pageIndicator">'
01105                 . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xml:rangeIndicator'), $this->firstElementNumber + 1, $lastElementNumber)
01106                 . '</span>';
01107 
01108             $content .= '<div id="typo3-dblist-pagination">'
01109                 . $first . $previous
01110                 . '<span class="bar">&nbsp;</span>'
01111                 . $rangeIndicator . '<span class="bar">&nbsp;</span>'
01112                 . $pageIndicator . '<span class="bar">&nbsp;</span>'
01113                 . $next . $last . '<span class="bar">&nbsp;</span>'
01114                 . $reload
01115                 . '</div>';
01116 
01117             $data = Array();
01118             $titleColumn = $this->fieldArray[0];
01119             $data[$titleColumn] = $content;
01120 
01121             $returnContent = $this->addElement(1, '', $data);
01122         } // end of if pages > 1
01123 
01124         return $returnContent;
01125     }
01126 
01127 
01128 
01129 
01130 
01131 
01132     /*********************************
01133      *
01134      * Rendering of various elements
01135      *
01136      *********************************/
01137 
01138     /**
01139      * Creates the control panel for a single record in the listing.
01140      *
01141      * @param   string      The table
01142      * @param   array       The record for which to make the control panel.
01143      * @return  string      HTML table with the control panel (unless disabled)
01144      */
01145     function makeControl($table,$row)   {
01146         global $TCA, $LANG, $SOBE, $TYPO3_CONF_VARS;
01147 
01148         if ($this->dontShowClipControlPanels)   return '';
01149 
01150             // Initialize:
01151         t3lib_div::loadTCA($table);
01152         $cells=array();
01153 
01154             // If the listed table is 'pages' we have to request the permission settings for each page:
01155         if ($table=='pages')    {
01156             $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid']));
01157         }
01158 
01159             // This expresses the edit permissions for this particular element:
01160         $permsEdit = ($table=='pages' && ($localCalcPerms&2)) || ($table!='pages' && ($this->calcPerms&16));
01161 
01162             // "Show" link (only pages and tt_content elements)
01163         if ($table=='pages' || $table=='tt_content')    {
01164             $params='&edit['.$table.']['.$row['uid'].']=edit';
01165             $cells['view']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'], $this->backPath)).'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE).'">'.
01166                         t3lib_iconWorks::getSpriteIcon('actions-document-view') .
01167                     '</a>';
01168         } elseif(!$this->table) {
01169             $cells['view'] = $this->spaceIcon;
01170         }
01171 
01172             // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
01173         if ($permsEdit) {
01174             $params='&edit['.$table.']['.$row['uid'].']=edit';
01175             $cells['edit']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'" title="'.$LANG->getLL('edit', TRUE).'">'.
01176                         ( $TCA[$table]['ctrl']['readOnly'] ? t3lib_iconWorks::getSpriteIcon('actions-document-open-read-only') : t3lib_iconWorks::getSpriteIcon('actions-document-open') ).
01177                     '</a>';
01178         } elseif(!$this->table) {
01179             $cells['edit'] = $this->spaceIcon;
01180         }
01181 
01182             // "Move" wizard link for pages/tt_content elements:
01183         if (($table=="tt_content" && $permsEdit) || ($table=='pages'))  {
01184             $cells['move']='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'move_el.php?table='.$table.'&uid='.$row['uid'].'\');').'" title="'.$LANG->getLL('move_' . ($table == 'tt_content' ? 'record' : 'page'), TRUE) . '">' .
01185                         ($table == 'tt_content' ? t3lib_iconWorks::getSpriteIcon('actions-document-move') : t3lib_iconWorks::getSpriteIcon('actions-page-move')) .
01186                     '</a>';
01187         } elseif(!$this->table) {
01188             $cells['move'] = $this->spaceIcon;
01189         }
01190 
01191             // If the extended control panel is enabled OR if we are seeing a single table:
01192         if ($SOBE->MOD_SETTINGS['bigControlPanel'] || $this->table) {
01193 
01194                 // "Info": (All records)
01195             $cells['viewBig']='<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'" title="'.$LANG->getLL('showInfo', TRUE).'">'.
01196                         t3lib_iconWorks::getSpriteIcon('actions-document-info') .
01197                     '</a>';
01198 
01199                 // If the table is NOT a read-only table, then show these links:
01200             if (!$TCA[$table]['ctrl']['readOnly'])  {
01201 
01202                     // "Revert" link (history/undo)
01203                 $cells['history']='<a href="#" onclick="'.htmlspecialchars('return jumpExt(\''.$this->backPath.'show_rechis.php?element='.rawurlencode($table.':'.$row['uid']).'\',\'#latest\');').'" title="'.$LANG->getLL('history', TRUE).'">'.
01204                             t3lib_iconWorks::getSpriteIcon('actions-document-history-open') .
01205                         '</a>';
01206 
01207                     // Versioning:
01208                 if (t3lib_extMgm::isLoaded('version'))  {
01209                     $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row);
01210                     if (is_array($vers))    {   // If table can be versionized.
01211                         $versionIcon = 'no-version';
01212                         if (count($vers) > 1) {
01213                             $versionIcon = count($vers) - 1;
01214                         }
01215 
01216                         $cells['version'] = '<a href="' . htmlspecialchars($this->backPath . t3lib_extMgm::extRelPath('version') . 'cm1/index.php?table=' . rawurlencode($table) . '&uid=' . rawurlencode($row['uid'])) . '" title="' . $LANG->getLL('displayVersions', TRUE) . '">' .
01217                                 t3lib_iconWorks::getSpriteIcon('status-version-' . $versionIcon) .
01218                                 '</a>';
01219                     } elseif(!$this->table) {
01220                         $cells['version'] = $this->spaceIcon;
01221                     }
01222                 }
01223 
01224                     // "Edit Perms" link:
01225                 if ($table=='pages' && $GLOBALS['BE_USER']->check('modules','web_perm'))    {
01226                     $cells['perms']='<a href="'.htmlspecialchars('mod/web/perm/index.php?id='.$row['uid'].'&return_id='.$row['uid'].'&edit=1').'" title="'.$LANG->getLL('permissions', TRUE).'">'.
01227                                 t3lib_iconWorks::getSpriteIcon('status-status-locked') .
01228                             '</a>';
01229                 } elseif(!$this->table && $GLOBALS['BE_USER']->check('modules','web_perm')) {
01230                     $cells['perms'] = $this->spaceIcon;
01231                 }
01232 
01233                     // "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):
01234                 if ($TCA[$table]['ctrl']['sortby'] || $TCA[$table]['ctrl']['useColumnsForDefaultValues'])   {
01235                     if (
01236                         ($table!='pages' && ($this->calcPerms&16)) ||   // For NON-pages, must have permission to edit content on this parent page
01237                         ($table=='pages' && ($this->calcPerms&8))       // For pages, must have permission to create new pages here.
01238                         )   {
01239                         if ($this->showNewRecLink($table))  {
01240                             $params='&edit['.$table.']['.(-($row['_MOVE_PLH']?$row['_MOVE_PLH_uid']:$row['uid'])).']=new';
01241                             $cells['new']='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,-1)).'" title="'.$LANG->getLL('new'.($table=='pages'?'Page':'Record'), TRUE).'">'.
01242                                         ($table=='pages' ? t3lib_iconWorks::getSpriteIcon('actions-page-new') : t3lib_iconWorks::getSpriteIcon('actions-document-new')) .
01243                                     '</a>';
01244                         }
01245                     }
01246                 } elseif(!$this->table) {
01247                     $cells['new'] = $this->spaceIcon;
01248                 }
01249 
01250                     // "Up/Down" links
01251                 if ($permsEdit && $TCA[$table]['ctrl']['sortby']  && !$this->sortField && !$this->searchLevels) {
01252                     if (isset($this->currentTable['prev'][$row['uid']]))    {   // Up
01253                         $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prev'][$row['uid']];
01254                         $cells['moveUp']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$LANG->getLL('moveUp', TRUE) . '">' .
01255                                     t3lib_iconWorks::getSpriteIcon('actions-move-up') .
01256                                 '</a>';
01257                     } else {
01258                         $cells['moveUp'] = $this->spaceIcon;
01259                     }
01260                     if ($this->currentTable['next'][$row['uid']])   {   // Down
01261                         $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['next'][$row['uid']];
01262                         $cells['moveDown']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$LANG->getLL('moveDown', TRUE) . '">' .
01263                                     t3lib_iconWorks::getSpriteIcon('actions-move-down') .
01264                                 '</a>';
01265                     } else {
01266                         $cells['moveDown'] = $this->spaceIcon;
01267                     }
01268                 } elseif(!$this->table) {
01269                     $cells['moveUp']  = $this->spaceIcon;
01270                     $cells['moveDown'] = $this->spaceIcon;
01271                 }
01272 
01273                     // "Hide/Unhide" links:
01274                 $hiddenField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
01275                 if ($permsEdit && $hiddenField && $TCA[$table]['columns'][$hiddenField] && (!$TCA[$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$table.':'.$hiddenField))) {
01276                     if ($row[$hiddenField]) {
01277                         $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
01278                         $cells['hide']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$LANG->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' .
01279                                     t3lib_iconWorks::getSpriteIcon('actions-edit-unhide') .
01280                                 '</a>';
01281                     } else {
01282                         $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
01283                         $cells['hide']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$LANG->getLL('hide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' .
01284                                     t3lib_iconWorks::getSpriteIcon('actions-edit-hide') .
01285                                 '</a>';
01286                     }
01287                 } elseif(!$this->table) {
01288                     $cells['hide'] = $this->spaceIcon;
01289                 }
01290 
01291                     // "Delete" link:
01292                 if (($table=='pages' && ($localCalcPerms&4)) || ($table!='pages' && ($this->calcPerms&16))) {
01293                     $titleOrig = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
01294                     $title = t3lib_div::slashJS(t3lib_div::fixed_lgd_cs($titleOrig, $this->fixedL), 1);
01295                     $params = '&cmd['.$table.']['.$row['uid'].'][delete]=1';
01296 
01297                     $refCountMsg = t3lib_BEfunc::referenceCount(
01298                         $table,
01299                         $row['uid'],
01300                         ' ' . $GLOBALS['LANG']->sL(
01301                             'LLL:EXT:lang/locallang_core.xml:labels.referencesToRecord'
01302                         ),
01303                         $this->getReferenceCount($table, $row['uid'])
01304                     ) .
01305                         t3lib_BEfunc::translationCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord'));
01306                     $cells['delete']='<a href="#" onclick="'.htmlspecialchars('if (confirm('.$LANG->JScharCode($LANG->getLL('deleteWarning').' "'. $title.'" '.$refCountMsg).')) {jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');} return false;').'" title="' . $LANG->getLL('delete', TRUE) . '">' .
01307                             t3lib_iconWorks::getSpriteIcon('actions-edit-delete') .
01308                             '</a>';
01309                 } elseif(!$this->table) {
01310                     $cells['delete'] = $this->spaceIcon;
01311                 }
01312 
01313                     // "Levels" links: Moving pages into new levels...
01314                 if ($permsEdit && $table=='pages' && !$this->searchLevels)  {
01315 
01316                         // Up (Paste as the page right after the current parent page)
01317                     if ($this->calcPerms&8) {
01318                         $params='&cmd['.$table.']['.$row['uid'].'][move]='.-$this->id;
01319                         $cells['moveLeft']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$LANG->getLL('prevLevel', TRUE).'">'.
01320                                     t3lib_iconWorks::getSpriteIcon('actions-move-left') .
01321                                 '</a>';
01322                     }
01323                         // Down (Paste as subpage to the page right above)
01324                     if ($this->currentTable['prevUid'][$row['uid']])    {
01325                         $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$this->currentTable['prevUid'][$row['uid']]));
01326                         if ($localCalcPerms&8)  {
01327                             $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prevUid'][$row['uid']];
01328                             $cells['moveRight']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$LANG->getLL('nextLevel', TRUE).'">'.
01329                                         t3lib_iconWorks::getSpriteIcon('actions-move-right') .
01330                                     '</a>';
01331                         } else {
01332                             $cells['moveRight'] = $this->spaceIcon;
01333                         }
01334                     } else {
01335                         $cells['moveRight'] = $this->spaceIcon;
01336                     }
01337                 } elseif(!$this->table) {
01338                     $cells['moveLeft'] = $this->spaceIcon;
01339                     $cells['moveRight'] = $this->spaceIcon;
01340                 }
01341             }
01342         }
01343 
01344 
01345         /**
01346          * @hook            recStatInfoHooks: Allows to insert HTML before record icons on various places
01347          * @date            2007-09-22
01348          * @request     Kasper Skaarhoj  <kasper2007@typo3.com>
01349          */
01350         if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
01351             $stat='';
01352             $_params = array($table,$row['uid']);
01353             foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
01354                 $stat.=t3lib_div::callUserFunction($_funcRef,$_params,$this);
01355             }
01356             $cells['stat'] = $stat;
01357         }
01358         /**
01359          * @hook            makeControl: Allows to change control icons of records in list-module
01360          * @date            2007-11-20
01361          * @request     Bernhard Kraft  <krafbt@kraftb.at>
01362          * @usage       This hook method gets passed the current $cells array as third parameter. This array contains values for the icons/actions generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries.
01363          */
01364         if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
01365             foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
01366                 $hookObject = t3lib_div::getUserObj($classData);
01367                 if(!($hookObject instanceof localRecordList_actionsHook))   {
01368                     throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567840);
01369                 }
01370                 $cells = $hookObject->makeControl($table, $row, $cells, $this);
01371             }
01372         }
01373 
01374             // Compile items into a DIV-element:
01375         return '
01376                                             <!-- CONTROL PANEL: '.$table.':'.$row['uid'].' -->
01377                                             <div class="typo3-DBctrl">'.implode('',$cells).'</div>';
01378     }
01379 
01380     /**
01381      * Creates the clipboard panel for a single record in the listing.
01382      *
01383      * @param   string      The table
01384      * @param   array       The record for which to make the clipboard panel.
01385      * @return  string      HTML table with the clipboard panel (unless disabled)
01386      */
01387     function makeClip($table,$row)  {
01388         global $TCA, $LANG, $TYPO3_CONF_VARS;
01389 
01390             // Return blank, if disabled:
01391         if ($this->dontShowClipControlPanels)   return '';
01392         $cells=array();
01393 
01394         $cells['pasteAfter'] = $cells['pasteInto'] = $this->spaceIcon;
01395             //enables to hide the copy, cut and paste icons for localized records - doesn't make much sense to perform these options for them
01396         $isL10nOverlay = $this->localizationView && $table != 'pages_language_overlay' && $row[$TCA[$table]['ctrl']['transOrigPointerField']] != 0;
01397             // Return blank, if disabled:
01398             // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
01399         if ($this->clipObj->current=='normal')  {   // For the "Normal" pad:
01400 
01401                 // Show copy/cut icons:
01402             $isSel = (string)$this->clipObj->isSelected($table,$row['uid']);
01403             $cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],1,($isSel=='copy'),array('returnUrl'=>'')).'\');').'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.copy', TRUE).'">'.
01404                         ((!$isSel=='copy') ? t3lib_iconWorks::getSpriteIcon('actions-edit-copy') : t3lib_iconWorks::getSpriteIcon('actions-edit-copy-release')) .
01405                     '</a>';
01406             $cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="'.htmlspecialchars('return jumpSelf(\''.$this->clipObj->selUrlDB($table,$row['uid'],0,($isSel=='cut'),array('returnUrl'=>'')).'\');').'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:cm.cut', TRUE).'">'.
01407                         ((!$isSel=='cut') ? t3lib_iconWorks::getSpriteIcon('actions-edit-cut') : t3lib_iconWorks::getSpriteIcon('actions-edit-cut-release')) .
01408                     '</a>';
01409 
01410         } else {    // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
01411 
01412                 // Setting name of the element in ->CBnames array:
01413             $n=$table.'|'.$row['uid'];
01414             $this->CBnames[]=$n;
01415 
01416                 // Check if the current element is selected and if so, prepare to set the checkbox as selected:
01417             $checked = ($this->clipObj->isSelected($table,$row['uid'])?' checked="checked"':'');
01418 
01419                 // If the "duplicateField" value is set then select all elements which are duplicates...
01420             if ($this->duplicateField && isset($row[$this->duplicateField]))    {
01421                 $checked='';
01422                 if (in_array($row[$this->duplicateField], $this->duplicateStack))   {
01423                     $checked=' checked="checked"';
01424                 }
01425                 $this->duplicateStack[] = $row[$this->duplicateField];
01426             }
01427 
01428                 // Adding the checkbox to the panel:
01429             $cells['select'] = $isL10nOverlay ? $this->spaceIcon : '<input type="hidden" name="CBH['.$n.']" value="0" /><input type="checkbox" name="CBC['.$n.']" value="1" class="smallCheckboxes"'.$checked.' />';
01430         }
01431 
01432             // Now, looking for selected elements from the current table:
01433         $elFromTable = $this->clipObj->elFromTable($table);
01434         if (count($elFromTable) && $TCA[$table]['ctrl']['sortby'])  {   // IF elements are found and they can be individually ordered, then add a "paste after" icon:
01435             $cells['pasteAfter'] = $isL10nOverlay ? $this->spaceIcon : '<a href="'.htmlspecialchars($this->clipObj->pasteUrl($table,-$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'after',$elFromTable)).'" title="'.$LANG->getLL('clip_pasteAfter', TRUE).'">'.
01436                         t3lib_iconWorks::getSpriteIcon('actions-document-paste-after') .
01437                     '</a>';
01438         }
01439 
01440             // Now, looking for elements in general:
01441         $elFromTable = $this->clipObj->elFromTable('');
01442         if ($table=='pages' && count($elFromTable)) {
01443             $cells['pasteInto']='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('',$row['uid'])).'" onclick="'.htmlspecialchars('return '.$this->clipObj->confirmMsg($table,$row,'into',$elFromTable)).'" title="'.$LANG->getLL('clip_pasteInto', TRUE).'">'.
01444                         t3lib_iconWorks::getSpriteIcon('actions-document-paste-into') .
01445                     '</a>';
01446         }
01447 
01448         /*
01449          * @hook            makeClip: Allows to change clip-icons of records in list-module
01450          * @date            2007-11-20
01451          * @request     Bernhard Kraft  <krafbt@kraftb.at>
01452          * @usage       This hook method gets passed the current $cells array as third parameter. This array contains values for the clipboard icons generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries.
01453          */
01454         if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
01455             foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
01456                 $hookObject = t3lib_div::getUserObj($classData);
01457                 if(!($hookObject instanceof localRecordList_actionsHook))   {
01458                     throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567845);
01459                 }
01460                 $cells = $hookObject->makeClip($table, $row, $cells, $this);
01461             }
01462         }
01463 
01464             // Compile items into a DIV-element:
01465         return '                            <!-- CLIPBOARD PANEL: '.$table.':'.$row['uid'].' -->
01466                                             <div class="typo3-clipCtrl">'.implode('',$cells).'</div>';
01467     }
01468 
01469     /**
01470      * Make reference count
01471      *
01472      * @param   string      Table name
01473      * @param   integer     UID of record
01474      * @return  string      HTML-table
01475      *
01476      * @deprecated since 4.4: Use getReferenceHTML() instead
01477      */
01478     function makeRef($table,$uid)   {
01479         t3lib_div::logDeprecatedFunction();
01480 
01481             // Compile information for title tag:
01482         $infoData=array();
01483         if (is_array($this->references)) {
01484             foreach ($this->references as $row) {
01485                 $infoData[]=$row['tablename'].':'.$row['recuid'].':'.$row['field'];
01486             }
01487         }
01488 
01489         return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$uid.'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd_cs(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
01490     }
01491 
01492     /**
01493      * Creates the HTML for a reference count for the record with the UID $uid
01494      * in the table $tableName.
01495      *
01496      * @param string $tableName
01497      *        table name of the referenced record, must not be empty
01498      * @param integer $uid
01499      *        UID of the referenced record, must be > 0
01500      *
01501      * @return string HTML of reference a link, will be empty if there are no
01502      *                references to the corresponding record
01503      */
01504     protected function createReferenceHtml($tableName, $uid) {
01505         $referenceCount = $this->getReferenceCount($tableName, $uid);
01506         if ($referenceCount == 0) {
01507             return '';
01508         }
01509 
01510         $queryResult = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01511             'tablename, recuid, field',
01512             'sys_refindex',
01513             'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr(
01514                 $tableName, 'sys_refindex'
01515             ) .
01516                 ' AND ref_uid = ' . $uid .
01517                 ' AND deleted = 0',
01518             '',
01519             '',
01520             '0,20'
01521         );
01522 
01523         $referenceTitles = array();
01524 
01525         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($queryResult)) {
01526             $referenceTitles[] = $row['tablename'] . ':' . $row['recuid'] .
01527                 ':' . $row['field'];
01528             if (strlen(implode(' / ', $referenceTitles)) >= 100) {
01529                 break;
01530             }
01531         }
01532         $GLOBALS['TYPO3_DB']->sql_free_result($queryResult);
01533 
01534         return '<a href="#" ' .
01535             'onclick="' . htmlspecialchars(
01536                 'top.launchView(\'' . $tableName . '\', \'' . $uid .
01537                 '\'); return false;'
01538             ) . '" ' .
01539             'title="' . htmlspecialchars(
01540                 t3lib_div::fixed_lgd_cs(implode(' / ', $referenceTitles), 100)
01541             ) . '">' . $referenceCount . '</a>';
01542     }
01543 
01544     /**
01545      * Creates the localization panel
01546      *
01547      * @param   string      The table
01548      * @param   array       The record for which to make the localization panel.
01549      * @return  array       Array with key 0/1 with content for column 1 and 2
01550      */
01551     function makeLocalizationPanel($table,$row) {
01552         global $TCA,$LANG;
01553 
01554         $out = array(
01555             0 => '',
01556             1 => '',
01557         );
01558 
01559         $translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row, $this->selFieldList);
01560         $this->translations = $translations['translations'];
01561 
01562             // Language title and icon:
01563         $out[0] = $this->languageFlag($row[$TCA[$table]['ctrl']['languageField']]);
01564 
01565         if (is_array($translations))    {
01566 
01567                 // Traverse page translations and add icon for each language that does NOT yet exist:
01568             $lNew = '';
01569             foreach($this->pageOverlays as $lUid_OnPage => $lsysRec)    {
01570                 if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage))  {
01571                     $href = $this->backPath . $GLOBALS['TBE_TEMPLATE']->issueCommand(
01572                         '&cmd['.$table.']['.$row['uid'].'][localize]='.$lUid_OnPage,
01573                         $this->listURL().'&justLocalized='.rawurlencode($table.':'.$row['uid'].':'.$lUid_OnPage)
01574                     );
01575                     $language = t3lib_BEfunc::getRecord('sys_language', $lUid_OnPage, 'title');
01576                     $lC = ($this->languageIconTitles[$lUid_OnPage]['flagIcon'] ? '<img src="'.$this->languageIconTitles[$lUid_OnPage]['flagIcon'].'" class="absmiddle" alt="" />' : $this->languageIconTitles[$lUid_OnPage]['title']);
01577                     $lC = '<a href="' . htmlspecialchars($href) . '" title="' . htmlspecialchars($language['title']) . '">' . $lC . '</a> ';
01578 
01579                     $lNew.=$lC;
01580                 }
01581             }
01582 
01583             if ($lNew)  $out[1].= $lNew;
01584         } else {
01585             $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;'.$out[0];
01586         }
01587 
01588 
01589         return $out;
01590     }
01591 
01592     /**
01593      * Create the selector box for selecting fields to display from a table:
01594      *
01595      * @param   string      Table name
01596      * @param   boolean     If true, form-fields will be wrapped around the table.
01597      * @return  string      HTML table with the selector box (name: displayFields['.$table.'][])
01598      */
01599     function fieldSelectBox($table,$formFields=1)   {
01600         global $TCA, $LANG;
01601 
01602             // Init:
01603         t3lib_div::loadTCA($table);
01604         $formElements=array('','');
01605         if ($formFields)    {
01606             $formElements=array('<form action="'.htmlspecialchars($this->listURL()).'" method="post">','</form>');
01607         }
01608 
01609             // Load already selected fields, if any:
01610         $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
01611 
01612             // Request fields from table:
01613         $fields = $this->makeFieldList($table, false, true);
01614 
01615             // Add pseudo "control" fields
01616         $fields[]='_PATH_';
01617         $fields[]='_REF_';
01618         $fields[]='_LOCALIZATION_';
01619         $fields[]='_CONTROL_';
01620         $fields[]='_CLIPBOARD_';
01621 
01622             // Create an option for each field:
01623         $opt=array();
01624         $opt[] = '<option value=""></option>';
01625         foreach($fields as $fN) {
01626             $fL = is_array($TCA[$table]['columns'][$fN]) ? rtrim($LANG->sL($TCA[$table]['columns'][$fN]['label']),':') : '['.$fN.']';   // Field label
01627             $opt[] = '
01628                                             <option value="'.$fN.'"'.(in_array($fN,$setFields)?' selected="selected"':'').'>'.htmlspecialchars($fL).'</option>';
01629         }
01630 
01631             // Compile the options into a multiple selector box:
01632         $lMenu = '
01633                                         <select size="'.t3lib_div::intInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
01634                                         </select>
01635                 ';
01636 
01637             // Table with the field selector::
01638         $content.= '
01639             '.$formElements[0].'
01640 
01641                 <!--
01642                     Field selector for extended table view:
01643                 -->
01644                 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
01645                     <tr>
01646                         <td>'.$lMenu.'</td>
01647                         <td><input type="submit" name="search" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.setFields',1).'" /></td>
01648                     </tr>
01649                 </table>
01650             '.$formElements[1];
01651         return $content;
01652     }
01653 
01654 
01655 
01656 
01657 
01658 
01659 
01660 
01661 
01662 
01663 
01664     /*********************************
01665      *
01666      * Helper functions
01667      *
01668      *********************************/
01669 
01670     /**
01671      * Creates a link around $string. The link contains an onclick action which submits the script with some clipboard action.
01672      * Currently, this is used for setting elements / delete elements.
01673      *
01674      * @param   string      The HTML content to link (image/text)
01675      * @param   string      Table name
01676      * @param   string      Clipboard command (eg. "setCB" or "delete")
01677      * @param   string      Warning text, if any ("delete" uses this for confirmation)
01678      * @return  string      <a> tag wrapped link.
01679      */
01680     function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')   {
01681         $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.cmd_table.value=\''.$table.'\';document.dblistForm.submit();';
01682         if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
01683         return '<a href="#" onclick="'.htmlspecialchars($onClickEvent.'return false;').'">'.$string.'</a>';
01684     }
01685 
01686     /**
01687      * Returns true if a numeric clipboard pad is selected/active
01688      *
01689      * @return  boolean
01690      */
01691     function clipNumPane()  {
01692         return in_Array('_CLIPBOARD_',$this->fieldArray) && $this->clipObj->current!='normal';
01693     }
01694 
01695     /**
01696      * Creates a sort-by link on the input string ($code).
01697      * It will automatically detect if sorting should be ascending or descending depending on $this->sortRev.
01698      * Also some fields will not be possible to sort (including if single-table-view is disabled).
01699      *
01700      * @param   string      The string to link (text)
01701      * @param   string      The fieldname represented by the title ($code)
01702      * @param   string      Table name
01703      * @return  string      Linked $code variable
01704      */
01705     function addSortLink($code,$field,$table)   {
01706 
01707             // Certain circumstances just return string right away (no links):
01708         if ($field=='_CONTROL_' || $field=='_LOCALIZATION_' || $field=='_CLIPBOARD_' || $field=='_REF_' || $this->disableSingleTableView)   return $code;
01709 
01710             // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
01711         if ($field=='_PATH_')   $field=pid;
01712 
01713             //   Create the sort link:
01714         $sortUrl = $this->listURL('',-1,'sortField,sortRev,table').'&table='.$table.'&sortField='.$field.'&sortRev='.($this->sortRev || ($this->sortField!=$field)?0:1);
01715         $sortArrow = ($this->sortField==$field?'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/red'.($this->sortRev?'up':'down').'.gif','width="7" height="4"').' alt="" />':'');
01716 
01717             // Return linked field:
01718         return '<a href="'.htmlspecialchars($sortUrl).'">'.$code.
01719                 $sortArrow.
01720                 '</a>';
01721     }
01722 
01723     /**
01724      * Returns the path for a certain pid
01725      * The result is cached internally for the session, thus you can call this function as much as you like without performance problems.
01726      *
01727      * @param   integer     The page id for which to get the path
01728      * @return  string      The path.
01729      */
01730     function recPath($pid)  {
01731         if (!isset($this->recPath_cache[$pid])) {
01732             $this->recPath_cache[$pid] = t3lib_BEfunc::getRecordPath($pid,$this->perms_clause,20);
01733         }
01734         return $this->recPath_cache[$pid];
01735     }
01736 
01737     /**
01738      * Returns true if a link for creating new records should be displayed for $table
01739      *
01740      * @param   string      Table name
01741      * @return  boolean     Returns true if a link for creating new records should be displayed for $table
01742      * @see     SC_db_new::showNewRecLink
01743      */
01744     function showNewRecLink($table) {
01745             // No deny/allow tables are set:
01746         if (!count($this->allowedNewTables) && !count($this->deniedNewTables)) {
01747             return true;
01748             // If table is not denied (which takes precedence over allowed tables):
01749         } elseif (!in_array($table, $this->deniedNewTables) && (!count($this->allowedNewTables) || in_array($table, $this->allowedNewTables))) {
01750             return true;
01751             // If table is denied or allowed tables are set, but table is not part of:
01752         } else {
01753             return false;
01754         }
01755     }
01756 
01757     /**
01758      * Creates the "&returnUrl" parameter for links - this is used when the script links to other scripts and passes its own URL with the link so other scripts can return to the listing again.
01759      * Uses REQUEST_URI as value.
01760      *
01761      * @return  string
01762      */
01763     function makeReturnUrl()    {
01764         return '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01765     }
01766 
01767 
01768 
01769 
01770 
01771 
01772 
01773 
01774 
01775 
01776 
01777     /************************************
01778      *
01779      * CSV related functions
01780      *
01781      ************************************/
01782 
01783     /**
01784      * Initializes internal csvLines array with the header of field names
01785      *
01786      * @return  void
01787      */
01788     protected function initCSV() {
01789         $this->addHeaderRowToCSV();
01790     }
01791 
01792     /**
01793      * Add header line with field names as CSV line
01794      *
01795      * @return void
01796      */
01797     protected function addHeaderRowToCSV() {
01798             // Add header row, control fields will be reduced inside addToCSV()
01799         $this->addToCSV(array_combine($this->fieldArray, $this->fieldArray));
01800     }
01801 
01802     /**
01803      * Adds selected columns of one table row as CSV line.
01804      *
01805      * @param   array       Record array, from which the values of fields found in $this->fieldArray will be listed in the CSV output.
01806      * @param   string      Table name @deprecated since 4.4
01807      * @return  void
01808      */
01809     protected function addToCSV(array $row = array(), $table = '') {
01810         $rowReducedByControlFields = self::removeControlFieldsFromFieldRow($row);
01811         $rowReducedToSelectedColumns = array_intersect_key($rowReducedByControlFields, array_flip($this->fieldArray));
01812         $this->setCsvRow($rowReducedToSelectedColumns);
01813     }
01814 
01815     /**
01816      * Remove control fields from row for CSV export
01817      *
01818      * @param array fieldNames => fieldValues
01819      * @return array Input array reduces by control fields
01820      */
01821     protected static function removeControlFieldsFromFieldRow(array $row = array()) {
01822             // Possible control fields in a list row
01823         $controlFields = array(
01824             '_PATH_',
01825             '_REF_',
01826             '_CONTROL_',
01827             '_AFTERCONTROL_',
01828             '_AFTERREF_',
01829             '_CLIPBOARD_',
01830             '_LOCALIZATION_',
01831             '_LOCALIZATION_b',
01832         );
01833         return array_diff_key($row, array_flip($controlFields));
01834     }
01835 
01836 
01837     /**
01838      * Adds input row of values to the internal csvLines array as a CSV formatted line
01839      *
01840      * @param   array       Array with values to be listed.
01841      * @return  void
01842      */
01843     function setCsvRow($csvRow) {
01844         $this->csvLines[] = t3lib_div::csvValues($csvRow);
01845     }
01846 
01847     /**
01848      * Compiles the internal csvLines array to a csv-string and outputs it to the browser.
01849      * This function exits!
01850      *
01851      * @param   string      Filename prefix:
01852      * @return  void        EXITS php execusion!
01853      */
01854     function outputCSV($prefix) {
01855 
01856             // Setting filename:
01857         $filename=$prefix.'_'.date('dmy-Hi').'.csv';
01858 
01859             // Creating output header:
01860         $mimeType = 'application/octet-stream';
01861         Header('Content-Type: '.$mimeType);
01862         Header('Content-Disposition: attachment; filename='.$filename);
01863 
01864             // Printing the content of the CSV lines:
01865         echo implode(chr(13).chr(10),$this->csvLines);
01866 
01867             // Exits:
01868         exit;
01869     }
01870 }
01871 
01872 
01873 
01874 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'])   {
01875     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
01876 }
01877 
01878 ?>

Generated on Sat Jul 24 04:17:28 2010 for TYPO3 API by  doxygen 1.4.7