📄 class.tx_cms_layout.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)* All rights reserved** This script is part of the TYPO3 project. The TYPO3 project is* free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** The GNU General Public License can be found at* http://www.gnu.org/copyleft/gpl.html.* A copy is found in the textfile GPL.txt and important notices to the license* from the author is found in LICENSE.txt distributed with these scripts.*** This script is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * Include file extending db_list.inc for use with the web_layout module * * $Id: class.tx_cms_layout.php 1868 2006-12-12 11:24:10Z ingmars $ * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj * XHTML compliant * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 115: class tx_cms_layout extends recordList * * SECTION: Renderings * 180: function getTable($table,$id) * 240: function getTable_pages($id) * 378: function getTable_tt_content($id) * 754: function getTable_fe_users($id) * 780: function getTable_sys_note($id) * 873: function getTable_tt_board($id) * 955: function getTable_tt_address($id) * 985: function getTable_tt_links($id) * 1011: function getTable_tt_guest($id) * 1026: function getTable_tt_news($id) * 1047: function getTable_tt_calender($id) * 1097: function getTable_tt_products($id) * * SECTION: Generic listing of items * 1143: function makeOrdinaryList($table, $id, $fList, $icon=0, $addWhere='') * 1224: function dataFields($fieldArr,$table,$row,$out=array()) * 1275: function headerFields($fieldArr,$table,$out=array()) * * SECTION: Additional functions; Pages * 1317: function pages_getTree($theRows,$pid,$qWhere,$treeIcons,$depth) * 1350: function pages_drawItem($row,$fieldArr) * * SECTION: Additional functions; Content Elements * 1461: function tt_content_drawColHeader($colName,$editParams,$newParams) * 1513: function tt_content_drawHeader($row,$space=0,$disableMoveAndNewButtons=FALSE,$langMode=FALSE) * 1643: function tt_content_drawItem($row, $isRTE=FALSE) * 1806: function getNonTranslatedTTcontentUids($defLanguageCount,$id,$lP) * 1836: function newLanguageButton($defLanguageCount,$lP) * 1857: function infoGif($infoArr) * 1873: function newContentElementOnClick($id,$colPos,$sys_language) * 1891: function linkEditContent($str,$row) * 1909: function linkRTEbutton($row) * 1930: function languageSelector($id) * 1967: function getResult($result) * * SECTION: Additional functions; Message board items (tt_board) * 2036: function tt_board_getTree($theRows,$parent,$pid,$qWhere,$treeIcons) * 2071: function tt_board_drawItem($table,$row,$re) * * SECTION: Various helper functions * 2118: function numberOfRecords($table,$pid) * 2137: function renderText($input) * 2151: function getIcon($table,$row) * 2174: function getProcessedValue($table,$fieldList,$row,&$info) * 2194: function isDisabled($table,$row) * 2212: function wordWrapper($content,$max=50,$char=' -') * 2229: function noEditIcon($label='noEditItems') * 2238: function cleanTableNames() * 2274: function isRTEforField($table,$row,$field) * 2304: function getSpecConfForField($table,$row,$field) * * SECTION: External renderings * 2341: function getPageInfoBox($rec,$edit=0) * 2510: function getTableMenu($id) * 2575: function strip_tags($content, $fillEmptyContent=false) * * TOTAL FUNCTIONS: 43 * (This index is automatically created/updated by the extension "extdeveval") * *//** * Child class for the Web > Page module * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage core */class tx_cms_layout extends recordList { // External, static: For page statistics: var $stat_select_field='page_id'; // fieldname from sys_stat to select on. var $stat_codes=array(); // eg. "HITS_days:-1" // External, static: Flags of various kinds: var $pI_showUser=0; // If true, users/groups are shown in the page info box. var $pI_showStat=1; // If true, hit statistics are shown in the page info box. var $nextThree = 3; // The number of successive records to edit when showing content elements. var $pages_noEditColumns=0; // If true, disables the edit-column icon for tt_content elements var $option_showBigButtons=1; // If true, shows big buttons for editing page properties, moving, creating elements etc. in the columns view. var $option_newWizard=1; // If true, new-wizards are linked to rather than the regular new-element list. var $ext_function=0; // If set to "1", will link a big button to content element wizard. var $doEdit=1; // If true, elements will have edit icons (probably this is whethere the user has permission to edit the page content). Set externally. var $agePrefixes = ' min| hrs| days| yrs'; // Age prefixes for displaying times. May be set externally to localized values. var $externalTables = array(); // Array of tables which is configured to be listed by the Web > Page module in addition to the default tables. var $descrTable; // "Pseudo" Description -table name var $defLangBinding=FALSE; // If set true, the language mode of tt_content elements will be rendered with hard binding between default language content elements and their translations! // External, static: Configuration of tt_content element display: var $tt_contentConfig = Array ( 'showInfo' => 1, // Boolean: Display info-marks or not 'showCommands' => 1, // Boolean: Display up/down arrows and edit icons for tt_content records 'showCommands_info' => 1, // Boolean: Displays infoGif with the command buttons 'single' => 1, // Boolean: If set, the content of column(s) $this->tt_contentConfig['showSingleCol'] is shown in the total width of the page 'showSingleCol' => 0, // The column(s) to show if single mode (under each other) 'languageCols' => 0, 'languageMode' => 0, 'languageColsPointer' => 0, 'showHidden' => 1, // Displays hidden records as well 'sys_language_uid' => 0, // Which language 'cols' => '1,0,2,3' // The order of the rows: Default is left(1), Normal(0), right(2), margin(3) ); // Internal, dynamic: var $allowedTableNames=array(); // Will contain a list of tables which can be listed by the user. var $activeTables = array(); // Contains icon/title of pages which are listed in the tables menu (see getTableMenu() function ) var $tt_contentData = Array( 'nextThree' => Array(), 'prev' => Array(), 'next' => Array() ); var $CType_labels=array(); // Used to store labels for CTypes for tt_content elements var $itemLabels=array(); // Used to store labels for the various fields in tt_content elements /***************************************** * * Renderings * *****************************************/ /** * Adds the code of a single table * * @param string Table name * @param integer Current page id * @return string HTML for listing. */ function getTable($table,$id) { // Load full table definition: t3lib_div::loadTCA($table); if (isset($this->externalTables[$table])) { $fList = $this->externalTables[$table][0]['fList']; // eg. "name;title;email;company,image" $icon = $this->externalTables[$table][0]['icon']; // Boolean, // Create listing $out = $this->makeOrdinaryList($table, $id, $fList, $icon); return $out; } else { // Branch out based on table name: // Notice: Most of these tables belongs to other extensions than 'cms'. Each of these tables can be rendered only if the extensions they belong to is loaded. switch($table) { case 'pages': return $this->getTable_pages($id); break; case 'tt_content': return $this->getTable_tt_content($id); break; case 'fe_users': return $this->getTable_fe_users($id); break; case 'sys_note': return $this->getTable_sys_note($id); break; case 'tt_board': return $this->getTable_tt_board($id); break; case 'tt_address': return $this->getTable_tt_address($id); break; case 'tt_links': return $this->getTable_tt_links($id); break; case 'tt_guest': return $this->getTable_tt_guest($id); break; case 'tt_news': return $this->getTable_tt_news($id); break; case 'tt_calender': return $this->getTable_tt_calender($id); break; case 'tt_products': return $this->getTable_tt_products($id); break; } } } /** * Renders records from the pages table from page id * (Used to get information about the page tree content by "Web>Info"!) * * @param integer Page id * @return string HTML for the listing */ function getTable_pages($id) { global $TCA; // Initializing: $out=''; $delClause = t3lib_BEfunc::deleteClause('pages').' AND '.$GLOBALS['BE_USER']->getPagePermsClause(1); // Select clause for pages: // Select current page: if (!$id) { $row = $GLOBALS['SOBE']->pageinfo; // The root has a pseudo record in pageinfo... } else { $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid='.intval($id).$delClause); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); t3lib_BEfunc::workspaceOL('pages', $row); } // If there was found a page: if (is_array($row)) { // Select which fields to show: $pKey = $GLOBALS['SOBE']->MOD_SETTINGS['function']=='tx_cms_webinfo_hits' ? 'hits' : $GLOBALS['SOBE']->MOD_SETTINGS['pages']; switch($pKey) { case 'hits': $this->fieldArray = explode(',','title,'.implode(',',$this->stat_codes)); break; case 1: $this->cleanTableNames(); $tableNames=$this->allowedTableNames; $this->fieldArray = explode(',','title,uid,'.implode(',',array_keys($tableNames))); break; case 2: $this->fieldArray = explode(',','title,uid,lastUpdated,newUntil,no_cache,cache_timeout,php_tree_stop,TSconfig,storage_pid,is_siteroot,fe_login_mode'); break; default: $this->fieldArray = explode(',','title,uid,alias,starttime,endtime,fe_group,target,url,shortcut,shortcut_mode'); break; } // Getting select-depth: $depth=intval($GLOBALS['SOBE']->MOD_SETTINGS['pages_levels']); // Half line is drawn $theData = Array(); $theData['subject'] = $this->widthGif; $out.=$this->addelement(0,'',$theData); // Overriding a few things: $this->no_noWrap=0; $this->oddColumnsTDParams=' class="bgColor3-20"'; // Items $this->eCounter=$this->firstElementNumber; // Creating elements: list($flag,$code) = $this->fwd_rwd_nav(); $out.=$code; $editUids=array(); if ($flag) { // Getting children: $theRows = Array(); $theRows = $this->pages_getTree($theRows,$row['uid'],$delClause.t3lib_BEfunc::versioningPlaceholderClause('pages'),'',$depth); if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2)) $editUids[]=$row['uid']; $out.=$this->pages_drawItem($row,$this->fieldArray); // Traverse all pages selected: foreach($theRows as $n => $sRow) { if ($GLOBALS['BE_USER']->doesUserHaveAccess($sRow,2)) $editUids[]=$sRow['uid']; $out.=$this->pages_drawItem($sRow,$this->fieldArray); } $this->eCounter++; } // Header line is drawn $theData = Array(); $editIdList = implode(',', $editUids); // Traverse fields (as set above) in order to create header values: foreach($this->fieldArray as $field) { if ($editIdList && isset($TCA['pages']['columns'][$field]) && $field!='uid' && !$this->pages_noEditColumns) { $params='&edit[pages]['.$editIdList.']=edit&columnsOnly='.$field.'&disHelp=1'; $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'),ereg_replace(':$','',trim($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('pages',$field))))); $eI= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath,'')).'">'. '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.htmlspecialchars($iTitle).'" alt="" />'. '</a>'; } else $eI=''; switch($field) { case 'title': $theData[$field] = ' <b>'.$GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label']).'</b>'.$eI; break; case 'uid': $theData[$field] = ' <b>ID:</b>'; break; default: if (substr($field,0,6)=='table_') { $f2 = substr($field,6); if ($TCA[$f2]) { $theData[$field] = ' '.t3lib_iconWorks::getIconImage($f2,array(),$this->backPath,'title="'.$GLOBALS['LANG']->sL($TCA[$f2]['ctrl']['title'],1).'"'); } } elseif (substr($field,0,5)=='HITS_') { $fParts = explode(':',substr($field,5)); switch($fParts[0]) { case 'days': $timespan = mktime (0,0,0)+intval($fParts[1])*3600*24; $theData[$field]=' '.date('d',$timespan); break; default: $theData[$field] = ''; break; } } else { $theData[$field] = ' <b>'.$GLOBALS['LANG']->sL($TCA['pages']['columns'][$field]['label'],1).'</b>'.$eI; } break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -