Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00086 class recordList extends t3lib_recordList { 00087 00088 // External, static: 00089 var $tableList=''; // Specify a list of tables which are the only ones allowed to be displayed. 00090 var $returnUrl=''; // Return URL 00091 var $thumbs = 0; // Boolean. Thumbnails on records containing files (pictures) 00092 var $itemsLimitPerTable = 20; // default Max items shown per table in "multi-table mode", may be overridden by tables.php 00093 var $itemsLimitSingleTable = 100; // default Max items shown per table in "single-table mode", may be overridden by tables.php 00094 var $widthGif = '<img src="clear.gif" width="1" height="4" hspace="160" alt="" />'; 00095 var $script = 'db_list.php'; // Current script name 00096 var $allFields=0; // Indicates if all available fields for a user should be selected or not. 00097 var $localizationView=FALSE; // Whether to show localization view or not. 00098 00099 // Internal, static: GPvar: 00100 var $csvOutput=FALSE; // If set, csvList is outputted. 00101 var $sortField; // Field, to sort list by 00102 var $sortRev; // Field, indicating to sort in reverse order. 00103 var $displayFields; // Array, containing which fields to display in extended mode 00104 var $duplicateField; // String, can contain the field name from a table which must have duplicate values marked. 00105 00106 // Internal, static: 00107 var $id; // Page id 00108 var $table=''; // Tablename if single-table mode 00109 var $listOnlyInSingleTableMode=FALSE; // If true, records are listed only if a specific table is selected. 00110 var $firstElementNumber=0; // Pointer for browsing list 00111 var $searchString=''; // Search string 00112 var $searchLevels=''; // Levels to search down. 00113 var $showLimit=0; // Number of records to show 00114 var $pidSelect=''; // List of ids from which to select/search etc. (when search-levels are set high). See start() 00115 var $perms_clause=''; // Page select permissions 00116 var $calcPerms=0; // Some permissions... 00117 var $clickTitleMode = ''; // Mode for what happens when a user clicks the title of a record. 00118 var $modSharedTSconfig = array(); // Shared module configuration, used by localization features 00119 var $pageRecord = array(); // Loaded with page record with version overlay if any. 00120 var $hideTables = ''; // Tables which should not get listed 00121 00122 // Internal, dynamic: 00123 var $JScode = ''; // JavaScript code accumulation 00124 var $HTMLcode = ''; // HTML output 00125 var $iLimit=0; // "LIMIT " in SQL... 00126 var $eCounter=0; // Counting the elements no matter what... 00127 var $totalItems=''; // Set to the total number of items for a table when selecting. 00128 var $recPath_cache=array(); // Cache for record path 00129 var $setFields=array(); // Fields to display for the current table 00130 var $currentTable = array(); // Used for tracking next/prev uids 00131 var $duplicateStack=array(); // Used for tracking duplicate values of fields 00132 00133 00134 00135 00136 00148 function start($id,$table,$pointer,$search="",$levels="",$showLimit=0) { 00149 global $TCA; 00150 00151 // Setting internal variables: 00152 $this->id=intval($id); // sets the parent id 00153 if ($TCA[$table]) $this->table=$table; // Setting single table mode, if table exists: 00154 $this->firstElementNumber=$pointer; 00155 $this->searchString=trim($search); 00156 $this->searchLevels=trim($levels); 00157 $this->showLimit=t3lib_div::intInRange($showLimit,0,10000); 00158 00159 // Setting GPvars: 00160 $this->csvOutput = t3lib_div::_GP('csv') ? TRUE : FALSE; 00161 $this->sortField = t3lib_div::_GP('sortField'); 00162 $this->sortRev = t3lib_div::_GP('sortRev'); 00163 $this->displayFields = t3lib_div::_GP('displayFields'); 00164 $this->duplicateField = t3lib_div::_GP('duplicateField'); 00165 00166 if (t3lib_div::_GP('justLocalized')) { 00167 $this->localizationRedirect(t3lib_div::_GP('justLocalized')); 00168 } 00169 00170 // If thumbnails are disabled, set the "notfound" icon as default: 00171 if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) { 00172 $this->thumbScript='gfx/notfound_thumb.gif'; 00173 } 00174 00175 // Init dynamic vars: 00176 $this->counter=0; 00177 $this->JScode=''; 00178 $this->HTMLcode=''; 00179 00180 // Set select levels: 00181 $sL=intval($this->searchLevels); 00182 $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); 00183 00184 // this will hide records from display - it has nothing todo with user rights!! 00185 if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) { 00186 if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) { 00187 $this->perms_clause .= ' AND pages.uid NOT IN ('.$pidList.')'; 00188 } 00189 } 00190 00191 if ($sL>0) { 00192 $tree = $this->getTreeObject($id,$sL,$this->perms_clause); 00193 $this->pidSelect = 'pid IN ('.implode(',',$tree->ids).')'; 00194 } else { 00195 $this->pidSelect = 'pid='.intval($id); 00196 } 00197 00198 // Initialize languages: 00199 if ($this->localizationView) { 00200 $this->initializeLanguages(); 00201 } 00202 } 00203 00211 function generateList() { 00212 global $TCA; 00213 00214 // Set page record in header 00215 $this->pageRecord = t3lib_BEfunc::getRecordWSOL('pages',$this->id); 00216 00217 // Traverse the TCA table array: 00218 reset($TCA); 00219 while (list($tableName)=each($TCA)) { 00220 00221 // Checking if the table should be rendered: 00222 if ((!$this->table || $tableName==$this->table) && (!$this->tableList || t3lib_div::inList($this->tableList,$tableName)) && $GLOBALS['BE_USER']->check('tables_select',$tableName)) { // Checks that we see only permitted/requested tables: 00223 00224 // Load full table definitions: 00225 t3lib_div::loadTCA($tableName); 00226 00227 // Hide tables which are configured via TSConfig not to be shown (also works for admins): 00228 if (t3lib_div::inList($this->hideTables, $tableName)) continue; 00229 00230 // iLimit is set depending on whether we're in single- or multi-table mode 00231 if ($this->table) { 00232 $this->iLimit=(isset($TCA[$tableName]['interface']['maxSingleDBListItems'])?intval($TCA[$tableName]['interface']['maxSingleDBListItems']):$this->itemsLimitSingleTable); 00233 } else { 00234 $this->iLimit=(isset($TCA[$tableName]['interface']['maxDBListItems'])?intval($TCA[$tableName]['interface']['maxDBListItems']):$this->itemsLimitPerTable); 00235 } 00236 if ($this->showLimit) $this->iLimit = $this->showLimit; 00237 00238 // Setting fields to select: 00239 if ($this->allFields) { 00240 $fields = $this->makeFieldList($tableName); 00241 $fields[]='tstamp'; 00242 $fields[]='crdate'; 00243 $fields[]='_PATH_'; 00244 $fields[]='_CONTROL_'; 00245 if (is_array($this->setFields[$tableName])) { 00246 $fields = array_intersect($fields,$this->setFields[$tableName]); 00247 } else { 00248 $fields = array(); 00249 } 00250 } else { 00251 $fields = array(); 00252 } 00253 00254 // Find ID to use (might be different for "versioning_followPages" tables) 00255 if (intval($this->searchLevels)==0) { 00256 if ($TCA[$tableName]['ctrl']['versioning_followPages'] && $this->pageRecord['_ORIG_pid']==-1 && $this->pageRecord['t3ver_swapmode']==0) { 00257 $this->pidSelect = 'pid='.intval($this->pageRecord['_ORIG_uid']); 00258 } else { 00259 $this->pidSelect = 'pid='.intval($this->id); 00260 } 00261 } 00262 #debug($this->pidSelect,$tableName); 00263 // Finally, render the list: 00264 $this->HTMLcode.=$this->getTable($tableName, $this->id, implode(',',$fields)); 00265 } 00266 } 00267 } 00268 00275 function getSearchBox($formFields=1) { 00276 00277 // Setting form-elements, if applicable: 00278 $formElements=array('',''); 00279 if ($formFields) { 00280 $formElements=array('<form action="'.htmlspecialchars($this->listURL()).'" method="post">','</form>'); 00281 } 00282 00283 // Make level selector: 00284 $opt=array(); 00285 $parts = explode('|',$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.enterSearchLevels')); 00286 while(list($kv,$label)=each($parts)) { 00287 $opt[] = '<option value="'.$kv.'"'.($kv==intval($this->searchLevels)?' selected="selected"':'').'>'.htmlspecialchars($label).'</option>'; 00288 } 00289 $lMenu = '<select name="search_levels">'.implode('',$opt).'</select>'; 00290 00291 // Table with the search box: 00292 $content.= ' 00293 '.$formElements[0].' 00294 00295 <!-- 00296 Search box: 00297 --> 00298 <table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-search"> 00299 <tr> 00300 <td>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.enterSearchString',1).'<input type="text" name="search_field" value="'.htmlspecialchars($this->searchString).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(10).' /></td> 00301 <td>'.$lMenu.'</td> 00302 <td><input type="submit" name="search" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.search',1).'" /></td> 00303 </tr> 00304 <tr> 00305 <td colspan="3">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showRecords',1).':<input type="text" name="showLimit" value="'.htmlspecialchars($this->showLimit?$this->showLimit:'').'"'.$GLOBALS['SOBE']->doc->formWidth(4).' /></td> 00306 </tr> 00307 </table> 00308 '.$formElements[1]; 00309 $content.=t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['BACK_PATH'],'|<br/>'); 00310 return $content; 00311 } 00312 00319 function showSysNotesForPage() { 00320 global $TCA; 00321 00322 $out=''; 00323 00324 // Checking if extension is loaded: 00325 if (!t3lib_extMgm::isLoaded('sys_note')) return ''; 00326 00327 // Create query for selecting the notes: 00328 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','sys_note','pid IN ('.$this->id.') AND (personal=0 OR cruser='.intval($GLOBALS['BE_USER']->user['uid']).')'.t3lib_BEfunc::deleteClause('sys_note').t3lib_BEfunc::versioningPlaceholderClause('sys_note')); 00329 00330 // Executing query: 00331 $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result); 00332 00333 // If some notes were found, render them: 00334 if ($dbCount) { 00335 $cat = array(); 00336 00337 // Load full table description: 00338 t3lib_div::loadTCA('sys_note'); 00339 00340 // Traverse note-types and get labels: 00341 if ($TCA['sys_note'] && $TCA['sys_note']['columns']['category'] && is_array($TCA['sys_note']['columns']['category']['config']['items'])) { 00342 foreach($TCA['sys_note']['columns']['category']['config']['items'] as $el) { 00343 $cat[$el[1]]=$GLOBALS['LANG']->sL($el[0]); 00344 } 00345 } 00346 00347 // For each note found, make rendering: 00348 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { 00349 00350 // Create content: 00351 $iconImg = t3lib_iconWorks::getIconImage('sys_note',$row,$this->backPath,''); 00352 $subject = htmlspecialchars($row['subject']); 00353 $fields = array(); 00354 $fields['Author:'] = htmlspecialchars($row['author'].($row['email'] && $row['author'] ? ', ':'').$row['email']); 00355 $fields['Category:'] = htmlspecialchars($cat[$row['category']]); 00356 $fields['Note:'] = nl2br(htmlspecialchars($row['message'])); 00357 00358 // Compile content: 00359 $out.=' 00360 00361 00362 <!-- 00363 Sys-notes for the db_list.php: 00364 --> 00365 <table border="0" cellpadding="1" cellspacing="1" id="typo3-dblist-sysnotes"> 00366 <tr><td colspan="2" class="bgColor2">'.$iconImg.'<strong>'.$subject.'</strong></td></tr> 00367 <tr><td class="bgColor4">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.category',1).'</td><td class="bgColor4">'.$fields['Category:'].'</td></tr> 00368 <tr><td class="bgColor4">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.author',1).'</td><td class="bgColor4">'.$fields['Author:'].'</td></tr> 00369 <tr><td class="bgColor4">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.note',1).'</td><td class="bgColor4">'.$fields['Note:'].'</td></tr> 00370 </table> 00371 '; 00372 } 00373 } 00374 return $out; 00375 } 00376 00377 00378 00379 00380 00381 00382 00383 00384 /****************************** 00385 * 00386 * Various helper functions 00387 * 00388 ******************************/ 00389 00396 function setDispFields() { 00397 00398 // Getting from session: 00399 $dispFields = $GLOBALS['BE_USER']->getModuleData('db_list.php/displayFields'); 00400 00401 // If fields has been inputted, then set those as the value and push it to session variable: 00402 if (is_array($this->displayFields)) { 00403 reset($this->displayFields); 00404 $tKey = key($this->displayFields); 00405 $dispFields[$tKey]=$this->displayFields[$tKey]; 00406 $GLOBALS['BE_USER']->pushModuleData('db_list.php/displayFields',$dispFields); 00407 } 00408 00409 // Setting result: 00410 $this->setFields=$dispFields; 00411 } 00412 00421 function thumbCode($row,$table,$field) { 00422 return t3lib_BEfunc::thumbCode($row,$table,$field,$this->backPath,$this->thumbScript); 00423 } 00424 00434 function makeQueryArray($table, $id, $addWhere="",$fieldList='*') { 00435 global $TCA; 00436 00437 // Set ORDER BY: 00438 $orderBy = ($TCA[$table]['ctrl']['sortby']) ? 'ORDER BY '.$TCA[$table]['ctrl']['sortby'] : $TCA[$table]['ctrl']['default_sortby']; 00439 if ($this->sortField) { 00440 if (in_array($this->sortField,$this->makeFieldList($table,1))) { 00441 $orderBy = 'ORDER BY '.$this->sortField; 00442 if ($this->sortRev) $orderBy.=' DESC'; 00443 } 00444 } 00445 00446 // Set LIMIT: 00447 $limit = $this->iLimit ? ($this->firstElementNumber ? $this->firstElementNumber.',' : '').($this->iLimit+1) : ''; 00448 00449 // Filtering on displayable pages (permissions): 00450 $pC = ($table=='pages' && $this->perms_clause)?' AND '.$this->perms_clause:''; 00451 00452 // Adding search constraints: 00453 $search = $this->makeSearchString($table); 00454 00455 // Compiling query array: 00456 $queryParts = array( 00457 'SELECT' => $fieldList, 00458 'FROM' => $table, 00459 'WHERE' => $this->pidSelect. 00460 ' '.$pC. 00461 t3lib_BEfunc::deleteClause($table). 00462 t3lib_BEfunc::versioningPlaceholderClause($table). 00463 ' '.$addWhere. 00464 ' '.$search, 00465 'GROUPBY' => '', 00466 'ORDERBY' => $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy), 00467 'LIMIT' => $limit 00468 ); 00469 00470 // Return query: 00471 return $queryParts; 00472 } 00473 00481 function setTotalItems($queryParts) { 00482 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00483 'count(*)', 00484 $queryParts['FROM'], 00485 $queryParts['WHERE'] 00486 ); 00487 list($rCount) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); 00488 $this->totalItems = $rCount; 00489 } 00490 00497 function makeSearchString($table) { 00498 global $TCA; 00499 00500 // Make query, only if table is valid and a search string is actually defined: 00501 if ($TCA[$table] && $this->searchString) { 00502 00503 // Loading full table description - we need to traverse fields: 00504 t3lib_div::loadTCA($table); 00505 00506 // Initialize field array: 00507 $sfields=array(); 00508 $sfields[]='uid'; // Adding "uid" by default. 00509 00510 // Traverse the configured columns and add all columns that can be searched: 00511 foreach($TCA[$table]['columns'] as $fieldName => $info) { 00512 if ($info['config']['type']=='text' || ($info['config']['type']=='input' && !ereg('date|time|int',$info['config']['eval']))) { 00513 $sfields[]=$fieldName; 00514 } 00515 } 00516 00517 // If search-fields were defined (and there always are) we create the query: 00518 if (count($sfields)) { 00519 $like = ' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table).'%\''; // Free-text searching... 00520 $queryPart = ' AND ('.implode($like.' OR ',$sfields).$like.')'; 00521 00522 // Return query: 00523 return $queryPart; 00524 } 00525 } 00526 } 00527 00536 function linkWrapTable($table,$code) { 00537 if ($this->table!=$table) { 00538 return '<a href="'.htmlspecialchars($this->listURL('',$table)).'">'.$code.'</a>'; 00539 } else { 00540 return '<a href="'.htmlspecialchars($this->listURL('','','sortField,sortRev,table')).'">'.$code.'</a>'; 00541 } 00542 } 00543 00553 function linkWrapItems($table,$uid,$code,$row) { 00554 global $TCA, $LANG; 00555 00556 $origCode = $code; 00557 00558 // If the title is blank, make a "no title" label: 00559 if (!strcmp($code,'')) { 00560 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i> - '.htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$row),$GLOBALS['BE_USER']->uc['titleLen'])); 00561 } else { 00562 $code = htmlspecialchars(t3lib_div::fixed_lgd_cs($code,$this->fixedL)); 00563 } 00564 00565 switch((string)$this->clickTitleMode) { 00566 case 'edit': 00567 // If the listed table is 'pages' we have to request the permission settings for each page: 00568 if ($table=='pages') { 00569 $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$row['uid'])); 00570 $permsEdit = $localCalcPerms&2; 00571 } else { 00572 $permsEdit = $this->calcPerms&16; 00573 } 00574 00575 // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id) 00576 if ($permsEdit) { 00577 $params='&edit['.$table.']['.$row['uid'].']=edit'; 00578 $code = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,'',-1)).'" title="'.$LANG->getLL('edit',1).'">'. 00579 $code. 00580 '</a>'; 00581 } 00582 break; 00583 case 'show': 00584 // "Show" link (only pages and tt_content elements) 00585 if ($table=='pages' || $table=='tt_content') { 00586 $code = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::viewOnClick($table=='tt_content'?$this->id.'#'.$row['uid']:$row['uid'])).'" title="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage',1).'">'. 00587 $code. 00588 '</a>'; 00589 } 00590 break; 00591 case 'info': 00592 // "Info": (All records) 00593 $code = '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$row['uid'].'\'); return false;').'" title="'.$LANG->getLL('showInfo',1).'">'. 00594 $code. 00595 '</a>'; 00596 break; 00597 default: 00598 // Output the label now: 00599 if ($table=='pages') { 00600 $code = '<a href="'.htmlspecialchars($this->listURL($uid,'')).'" onclick="setHighlight('.$uid.')">'.$code.'</a>'; 00601 } else { 00602 $code = $this->linkUrlMail($code,$origCode); 00603 } 00604 break; 00605 } 00606 00607 return $code; 00608 } 00609 00617 function linkUrlMail($code,$testString) { 00618 00619 // Check for URL: 00620 $schema = parse_url($testString); 00621 if ($schema['scheme'] && t3lib_div::inList('http,https,ftp',$schema['scheme'])) { 00622 return '<a href="'.htmlspecialchars($testString).'" target="_blank">'.$code.'</a>'; 00623 } 00624 00625 // Check for email: 00626 if (t3lib_div::validEmail($testString)) { 00627 return '<a href="mailto:'.htmlspecialchars($testString).'" target="_blank">'.$code.'</a>'; 00628 } 00629 00630 // Return if nothing else... 00631 return $code; 00632 } 00633 00644 function listURL($altId='',$table=-1,$exclList='') { 00645 return $this->script. 00646 '?id='.(strcmp($altId,'')?$altId:$this->id). 00647 '&table='.rawurlencode($table==-1?$this->table:$table). 00648 ($this->thumbs?'&imagemode='.$this->thumbs:''). 00649 ($this->returnUrl?'&returnUrl='.rawurlencode($this->returnUrl):''). 00650 ($this->searchString?'&search_field='.rawurlencode($this->searchString):''). 00651 ($this->searchLevels?'&search_levels='.rawurlencode($this->searchLevels):''). 00652 ($this->showLimit?'&showLimit='.rawurlencode($this->showLimit):''). 00653 ((!$exclList || !t3lib_div::inList($exclList,'sortField')) && $this->sortField?'&sortField='.rawurlencode($this->sortField):''). 00654 ((!$exclList || !t3lib_div::inList($exclList,'sortRev')) && $this->sortRev?'&sortRev='.rawurlencode($this->sortRev):'') 00655 ; 00656 } 00657 00663 function requestUri() { 00664 return $this->listURL(); 00665 } 00666 00674 function makeFieldList($table,$dontCheckUser=0) { 00675 global $TCA,$BE_USER; 00676 00677 // Init fieldlist array: 00678 $fieldListArr = array(); 00679 00680 // Check table: 00681 if (is_array($TCA[$table])) { 00682 t3lib_div::loadTCA($table); 00683 00684 // Traverse configured columns and add them to field array, if available for user. 00685 foreach($TCA[$table]['columns'] as $fN => $fieldValue) { 00686 if ($dontCheckUser || 00687 ((!$fieldValue['exclude'] || $BE_USER->check('non_exclude_fields',$table.':'.$fN)) && $fieldValue['config']['type']!='passthrough')) { 00688 $fieldListArr[]=$fN; 00689 } 00690 } 00691 00692 // Add special fields: 00693 if ($dontCheckUser || $BE_USER->isAdmin()) { 00694 $fieldListArr[]='uid'; 00695 $fieldListArr[]='pid'; 00696 if ($TCA[$table]['ctrl']['tstamp']) $fieldListArr[]=$TCA[$table]['ctrl']['tstamp']; 00697 if ($TCA[$table]['ctrl']['crdate']) $fieldListArr[]=$TCA[$table]['ctrl']['crdate']; 00698 if ($TCA[$table]['ctrl']['cruser_id']) $fieldListArr[]=$TCA[$table]['ctrl']['cruser_id']; 00699 if ($TCA[$table]['ctrl']['sortby']) $fieldListArr[]=$TCA[$table]['ctrl']['sortby']; 00700 if ($TCA[$table]['ctrl']['versioningWS']) { 00701 $fieldListArr[]='t3ver_id'; 00702 $fieldListArr[]='t3ver_state'; 00703 $fieldListArr[]='t3ver_wsid'; 00704 if ($table==='pages') { 00705 $fieldListArr[]='t3ver_swapmode'; 00706 } 00707 } 00708 } 00709 } 00710 return $fieldListArr; 00711 } 00712 00721 function getTreeObject($id,$depth,$perms_clause) { 00722 $tree = t3lib_div::makeInstance('t3lib_pageTree'); 00723 $tree->init('AND '.$perms_clause); 00724 $tree->makeHTML=0; 00725 $tree->fieldArray = Array('uid','php_tree_stop'); 00726 if ($depth) { 00727 $tree->getTree($id, $depth, ''); 00728 } 00729 $tree->ids[]=$id; 00730 return $tree; 00731 } 00732 00739 function localizationRedirect($justLocalized) { 00740 global $TCA; 00741 00742 list($table,$orig_uid,$language) = explode(':',$justLocalized); 00743 00744 if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) { 00745 list($localizedRecord) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 00746 'uid', 00747 $table, 00748 $TCA[$table]['ctrl']['languageField'].'='.intval($language).' AND '. 00749 $TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($orig_uid). 00750 t3lib_BEfunc::deleteClause($table). 00751 t3lib_BEfunc::versioningPlaceholderClause($table) 00752 ); 00753 00754 if (is_array($localizedRecord)) { 00755 // Create parameters and finally run the classic page module for creating a new page translation 00756 $params = '&edit['.$table.']['.$localizedRecord['uid'].']=edit'; 00757 $returnUrl = '&returnUrl='.rawurlencode($this->listURL()); 00758 $location = $GLOBALS['BACK_PATH'].'alt_doc.php?'.$params.$returnUrl; 00759 00760 header('Location: '.t3lib_div::locationHeaderUrl($location)); 00761 exit; 00762 } 00763 } 00764 } 00765 } 00766 00767 00768 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list.inc']) { 00769 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list.inc']); 00770 } 00771 ?>