⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.tx_cms_layout.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
				$fList = 'title;date;time;datetext;link,note';				$icon=1;				$out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');				return $out;			break;			case 'todo':					// Todo default				$fList = 'title,complete,priority,date';				$icon=0;				$out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');				return $out;			break;			case 'todo_ext':					// Todo extended				$fList = 'title;complete;priority;date;workgroup;responsible;category,note';				$icon=1;				$out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');				return $out;			break;			default:					// Overview, both todo and calender				$fList = 'title,date,time,week';				$icon=1;				$out = $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=0');				$out.= $this->makeOrdinaryList('tt_calender',$id, $fList, $icon, ' AND type=1');				return $out;			break;		}	}	/**	 * Renders shopping elements from the tt_products table from page id	 * NOTICE: Requires the tt_products extension to be loaded.	 *	 * @param	integer		Page id	 * @return	string		HTML for the listing	 */	function getTable_tt_products($id)	{		$type = $GLOBALS['SOBE']->MOD_SETTINGS['tt_products'];		switch($type)	{			case 'ext':				$fList = 'title;itemnumber;price;price2;inStock;category,image,note';				$icon=1;				$out = $this->makeOrdinaryList('tt_products',$id, $fList, $icon);			break;			default:				$fList = 'title,itemnumber,price,category,image';				$icon=1;				$out = $this->makeOrdinaryList('tt_products',$id, $fList, $icon);			break;		}		return $out;	}	/**********************************	 *	 * Generic listing of items	 *	 **********************************/	/**	 * Creates a standard list of elements from a table.	 *	 * @param	string		Table name	 * @param	integer		Page id.	 * @param	string		Comma list of fields to display	 * @param	boolean		If true, icon is shown	 * @param	string		Additional WHERE-clauses.	 * @return	string		HTML table	 */	function makeOrdinaryList($table, $id, $fList, $icon=0, $addWhere='')	{		global $TCA;			// Initialize:		$out = '';		$queryParts = $this->makeQueryArray($table, $id, $addWhere);		$this->setTotalItems($queryParts);		$dbCount = 0;			// Make query for records if there were any records found in the count operation:		if ($this->totalItems)	{			$result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);			$dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);		}			// If records were found, render the list:		$out = '';		if ($dbCount)	{				// Set fields			$this->fieldArray = explode(',','__cmds__,'.$fList);				// Header line is drawn			$theData = array();			$theData = $this->headerFields($this->fieldArray,$table,$theData);			if ($this->doEdit)	{				$theData['__cmds__'] = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit['.$table.']['.$this->id.']=new',$this->backPath)).'">'.					'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/new_el.gif').' title="'.$GLOBALS['LANG']->getLL('new',1).'" alt="" />'.					'</a>';			}			$out.= $this->addelement(1,'',$theData,' class="c-headLine"',15);				// Render Items			$this->eCounter = $this->firstElementNumber;			while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result))	{				t3lib_BEfunc::workspaceOL($table, $row);				list($flag,$code) = $this->fwd_rwd_nav();				$out.= $code;				if ($flag)	{					$params = '&edit['.$table.']['.$row['uid'].']=edit';					$Nrow = array();						// Setting icons/edit links:					if ($icon)	{						$Nrow['__cmds__']= $this->getIcon($table,$row);					}					if ($this->doEdit)	{						$Nrow['__cmds__'].= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$this->backPath)).'">'.										'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('edit',1).'" alt="" />'.										'</a>';					} else {						$Nrow['__cmds__'].= $this->noEditIcon();					}						// Get values:					$Nrow = $this->dataFields($this->fieldArray,$table,$row,$Nrow);					$tdparams = $this->eCounter%2 ? ' class="bgColor4"' : ' class="bgColor4-20"';					$out.= $this->addelement(1,'',$Nrow,$tdparams);				}				$this->eCounter++;			}				// Wrap it all in a table:			$out='				<!--					STANDARD LIST OF "'.$table.'"				-->				<table border="0" cellpadding="1" cellspacing="2" width="480" id="typo3-page-stdlist">					'.$out.'				</table>';		}		return $out;	}	/**	 * Adds content to all data fields in $out array	 *	 * @param	array		Array of fields to display. Each field name has a special feature which is that the field name can be specified as more field names. Eg. "field1,field2;field3". Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.	 * @param	string		Table name	 * @param	array		Record array	 * @param	array		Array to which the data is added	 * @return	array		$out array returned after processing.	 * @see makeOrdinaryList()	 */	function dataFields($fieldArr,$table,$row,$out=array())	{		global $TCA;			// Check table validity:		if ($TCA[$table])	{			t3lib_div::loadTCA($table);			$thumbsCol = $TCA[$table]['ctrl']['thumbnail'];				// Traverse fields:			foreach($fieldArr as $fieldName)	{				if ($TCA[$table]['columns'][$fieldName])	{	// Each field has its own cell (if configured in TCA)					if ($fieldName==$thumbsCol)	{	// If the column is a thumbnail column:						$out[$fieldName] = $this->thumbCode($row,$table,$fieldName);					} else {	// ... otherwise just render the output:						$out[$fieldName] = nl2br(htmlspecialchars(trim(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fieldName,$row[$fieldName],0,0,0,$row['uid']),250))));					}				} else {	// Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode the field name with ";" and check each value there as a TCA configured field)					$theFields = explode(';',$fieldName);						// Traverse fields, separated by ";" (displayed in a single cell).					foreach($theFields as $fName2)	{						if ($TCA[$table]['columns'][$fName2])	{							 $out[$fieldName].= '<b>'.$GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'],1).'</b>'.							 					'&nbsp;&nbsp;'.												htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table,$fName2,$row[$fName2],0,0,0,$row['uid']),25)).												'<br />';						}					}				}					// If no value, add a nbsp.				if (!$out[$fieldName])	$out[$fieldName]='&nbsp;';					// Wrap in dimmed-span tags if record is "disabled"				if ($this->isDisabled($table,$row))	{					$out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);				}			}		}		return $out;	}	/**	 * Header fields made for the listing of records	 *	 * @param	array		Field names	 * @param	string		The table name	 * @param	array		Array to which the headers are added.	 * @return	array		$out returned after addition of the header fields.	 * @see makeOrdinaryList()	 */	function headerFields($fieldArr,$table,$out=array())	{		global $TCA;		t3lib_div::loadTCA($table);		foreach($fieldArr as $fieldName)	{			$ll = $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fieldName]['label'],1);			$out[$fieldName] = '<b>'.($ll?$ll:'&nbsp;').'</b>';		}		return $out;	}	/**********************************	 *	 * Additional functions; Pages	 *	 **********************************/	/**	 * Adds pages-rows to an array, selecting recursively in the page tree.	 *	 * @param	array		Array which will accumulate page rows	 * @param	integer		Pid to select from	 * @param	string		Query-where clause	 * @param	string		Prefixed icon code.	 * @param	integer		Depth (decreasing)	 * @return	array		$theRows, but with added rows.	 */	function pages_getTree($theRows,$pid,$qWhere,$treeIcons,$depth) {		$depth--;		if ($depth>=0)	{			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($pid).$qWhere, '', 'sorting');			$c=0;			$rc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);			while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))	{				t3lib_BEfunc::workspaceOL('pages', $row);				$c++;				$row['treeIcons'] = $treeIcons.'<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/join'.($rc==$c?'bottom':'').'.gif','width="18" height="16"').' alt="" />';				$theRows[]=$row;					// Get the branch				$spaceOutIcons = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/ol/'.($rc==$c?'blank.gif':'line.gif'),'width="18" height="16"').' alt="" />';				$theRows = $this->pages_getTree($theRows,$row['uid'],$qWhere,$treeIcons.$spaceOutIcons,$row['php_tree_stop']?0:$depth);			}		} else {			$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'pages', 'pid='.intval($pid).$qWhere);			$row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);			if ($row[0])	{				$this->plusPages[$pid]=$row[0];			}		}		return $theRows;	}	/**	 * Adds a list item for the pages-rendering	 *	 * @param	array		Record array	 * @param	array		Field list	 * @return	string		HTML for the item	 */	function pages_drawItem($row,$fieldArr)	{		global $TCA;			// Initialization		$theIcon=$this->getIcon('pages',$row);			// 	Preparing and getting the data-array		$theData = Array();		foreach($fieldArr as $field)	{			switch($field)	{				case 'title':					$red = $this->plusPages[$row['uid']] ? '<font color="red"><b>+&nbsp;</b></font>' : '';					$pTitle = htmlspecialchars(t3lib_BEfunc::getProcessedValue('pages',$field,$row[$field],20));					if ($red)	{						$pTitle = '<a href="'.htmlspecialchars($this->script.'?id='.$row['uid']).'">'.$pTitle.'</a>';					}					$theData[$field]=$row['treeIcons'].$theIcon.$red.$pTitle.'&nbsp;&nbsp;';				break;				case 'php_tree_stop':				case 'TSconfig':					$theData[$field] = $row[$field]?'&nbsp;<b>x</b>':'&nbsp;';				break;				case 'uid':					if ($GLOBALS['BE_USER']->doesUserHaveAccess($row,2))	{						$params='&edit[pages]['.$row['uid'].']=edit';						$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="'.$GLOBALS['LANG']->getLL('editThisPage',1).'" alt="" />'.								'</a>';					} else $eI='';					$theData[$field] = '<span align="right">'.$row['uid'].$eI.'</span>';				break;				default:					if (substr($field,0,6)=='table_')	{						$f2 = substr($field,6);						if ($TCA[$f2])	{							$c = $this->numberOfRecords($f2,$row['uid']);							$theData[$field] = '&nbsp;&nbsp;'.($c?$c:'');						}					} elseif (substr($field,0,5)=='HITS_')	{						if (t3lib_extMgm::isLoaded('sys_stat'))	{							$fParts = explode(':',substr($field,5));							switch($fParts[0])	{								case 'days':									$timespan = mktime (0,0,0)+intval($fParts[1])*3600*24;										// Page hits									$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(													'count(*)',													'sys_stat',													$this->stat_select_field.'='.intval($row['uid']).'														AND tstamp>='.intval($timespan).'														AND tstamp<'.intval($timespan+3600*24)												);									list($number) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);									if ($number)	{											// Sessions										$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(														'count(*)',														'sys_stat',

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -