Bug #18482 » public-static-t3lib_befunc.patch
t3lib/class.t3lib_befunc.php (working copy) | ||
---|---|---|
* @package TYPO3
|
||
* @subpackage t3lib
|
||
*/
|
||
class t3lib_BEfunc {
|
||
final class t3lib_BEfunc {
|
||
... | ... | |
* @param string Table alias if any
|
||
* @return string WHERE clause for filtering out deleted records, eg " AND tablename.deleted=0"
|
||
*/
|
||
function deleteClause($table,$tableAlias='') {
|
||
public static function deleteClause($table,$tableAlias='') {
|
||
global $TCA;
|
||
if ($TCA[$table]['ctrl']['delete']) {
|
||
if ($TCA[$table]['ctrl']['delete']) {
|
||
return ' AND '.($tableAlias ? $tableAlias : $table).'.'.$TCA[$table]['ctrl']['delete'].'=0';
|
||
} else {
|
||
return '';
|
||
... | ... | |
* @param boolean Use the deleteClause to check if a record is deleted (default true)
|
||
* @return array Returns the row if found, otherwise nothing
|
||
*/
|
||
function getRecord($table,$uid,$fields='*',$where='',$useDeleteClause=true) {
|
||
if ($GLOBALS['TCA'][$table]) {
|
||
public static function getRecord($table,$uid,$fields='*',$where='',$useDeleteClause=true) {
|
||
if ($GLOBALS['TCA'][$table]) {
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||
$fields,
|
||
$table,
|
||
... | ... | |
* @param boolean Use the deleteClause to check if a record is deleted (default true)
|
||
* @return array Returns the row if found, otherwise nothing
|
||
*/
|
||
function getRecordWSOL($table,$uid,$fields='*',$where='',$useDeleteClause=true) {
|
||
public static function getRecordWSOL($table,$uid,$fields='*',$where='',$useDeleteClause=true) {
|
||
if ($fields !== '*') {
|
||
$internalFields = t3lib_div::uniqueList($fields.',uid,pid'.($table == 'pages' ? ',t3ver_swapmode' : ''));
|
||
$row = t3lib_BEfunc::getRecord($table,$uid,$internalFields,$where,$useDeleteClause);
|
||
... | ... | |
* @param string $fields is a list of fields to select, default is '*'
|
||
* @return array First row found, if any, FALSE otherwise
|
||
*/
|
||
function getRecordRaw($table,$where='',$fields='*') {
|
||
public static function getRecordRaw($table,$where='',$fields='*') {
|
||
$row = FALSE;
|
||
if (FALSE !== ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, '', '', '1'))) {
|
||
if (FALSE !== ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, '', '', '1'))) {
|
||
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
||
$GLOBALS['TYPO3_DB']->sql_free_result($res);
|
||
}
|
||
... | ... | |
* @param boolean Use the deleteClause to check if a record is deleted (default true)
|
||
* @return mixed Multidimensional array with selected records (if any is selected)
|
||
*/
|
||
function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='',$useDeleteClause=true) {
|
||
public static function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='',$useDeleteClause=true) {
|
||
global $TCA;
|
||
if (is_array($TCA[$theTable])) {
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||
... | ... | |
$limit
|
||
);
|
||
$rows = array();
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$rows[] = $row;
|
||
}
|
||
$GLOBALS['TYPO3_DB']->sql_free_result($res);
|
||
... | ... | |
* @return string WHERE clause for search
|
||
* @deprecated Use $GLOBALS['TYPO3_DB']->searchQuery() directly!
|
||
*/
|
||
function searchQuery($searchWords,$fields,$table='') {
|
||
public static function searchQuery($searchWords,$fields,$table='') {
|
||
return $GLOBALS['TYPO3_DB']->searchQuery($searchWords,$fields,$table);
|
||
}
|
||
... | ... | |
* @return string WHERE clause for a query
|
||
* @deprecated Use $GLOBALS['TYPO3_DB']->listQuery() directly!
|
||
*/
|
||
function listQuery($field,$value) {
|
||
public static function listQuery($field,$value) {
|
||
return $GLOBALS['TYPO3_DB']->listQuery($field,$value,'');
|
||
}
|
||
... | ... | |
* @param string [tablename]_[uid] string to explode
|
||
* @return array
|
||
*/
|
||
function splitTable_Uid($str) {
|
||
public static function splitTable_Uid($str) {
|
||
list($uid,$table) = explode('_',strrev($str),2);
|
||
return array(strrev($table),strrev($uid));
|
||
}
|
||
... | ... | |
* @param string $default_tablename denotes what table the number '45' is from (if nothing is prepended on the value)
|
||
* @return string List of ids
|
||
*/
|
||
function getSQLselectableList($in_list,$tablename,$default_tablename) {
|
||
public static function getSQLselectableList($in_list,$tablename,$default_tablename) {
|
||
$list = Array();
|
||
if ((string)trim($in_list)!='') {
|
||
if ((string)trim($in_list)!='') {
|
||
$tempItemArray = explode(',',trim($in_list));
|
||
while(list($key,$val)=each($tempItemArray)) {
|
||
while(list($key,$val)=each($tempItemArray)) {
|
||
$val = strrev($val);
|
||
$parts = explode('_',$val,2);
|
||
if ((string)trim($parts[0])!='') {
|
||
if ((string)trim($parts[0])!='') {
|
||
$theID = intval(strrev($parts[0]));
|
||
$theTable = trim($parts[1]) ? strrev(trim($parts[1])) : $default_tablename;
|
||
if ($theTable==$tablename) {$list[]=$theID;}
|
||
... | ... | |
* @param boolean $inv means that the query will select all records NOT VISIBLE records (inverted selection)
|
||
* @return string WHERE clause part
|
||
*/
|
||
function BEenableFields($table,$inv=0) {
|
||
public static function BEenableFields($table,$inv=0) {
|
||
$ctrl = $GLOBALS['TCA'][$table]['ctrl'];
|
||
$query=array();
|
||
$invQuery=array();
|
||
if (is_array($ctrl)) {
|
||
if (is_array($ctrl['enablecolumns'])) {
|
||
if ($ctrl['enablecolumns']['disabled']) {
|
||
if (is_array($ctrl)) {
|
||
if (is_array($ctrl['enablecolumns'])) {
|
||
if ($ctrl['enablecolumns']['disabled']) {
|
||
$field = $table.'.'.$ctrl['enablecolumns']['disabled'];
|
||
$query[]=$field.'=0';
|
||
$invQuery[]=$field.'!=0';
|
||
... | ... | |
$query[]=$field.'=0';
|
||
$invQuery[]=$field.'!=0';
|
||
}
|
||
if ($ctrl['enablecolumns']['starttime']) {
|
||
if ($ctrl['enablecolumns']['starttime']) {
|
||
$field = $table.'.'.$ctrl['enablecolumns']['starttime'];
|
||
$query[]='('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
|
||
$invQuery[]='('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
|
||
... | ... | |
$query[]='('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
|
||
$invQuery[]='('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
|
||
}
|
||
if ($ctrl['enablecolumns']['endtime']) {
|
||
if ($ctrl['enablecolumns']['endtime']) {
|
||
$field = $table.'.'.$ctrl['enablecolumns']['endtime'];
|
||
$query[]='('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
|
||
$invQuery[]='('.$field.'!=0 AND '.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
|
||
... | ... | |
* @deprecated
|
||
* @see t3lib_DB::exec_SELECT_mm_query()
|
||
*/
|
||
function mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') {
|
||
public static function mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') {
|
||
$query = $GLOBALS['TYPO3_DB']->SELECTquery(
|
||
$select,
|
||
$local_table.','.$mm_table.($foreign_table?','.$foreign_table:''),
|
||
... | ... | |
* @return string Full SQL query for INSERT
|
||
* @deprecated
|
||
*/
|
||
function DBcompileInsert($table,$fields_values) {
|
||
public static function DBcompileInsert($table,$fields_values) {
|
||
return $GLOBALS['TYPO3_DB']->INSERTquery($table, $fields_values);
|
||
}
|
||
... | ... | |
* @return string Full SQL query for UPDATE
|
||
* @deprecated
|
||
*/
|
||
function DBcompileUpdate($table,$where,$fields_values) {
|
||
public static function DBcompileUpdate($table,$where,$fields_values) {
|
||
return $GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fields_values);
|
||
}
|
||
... | ... | |
* @param boolean If true, version overlay is applied. This must be requested specifically because it is usually only wanted when the rootline is used for visual output while for permission checking you want the raw thing!
|
||
* @return array Root line array, all the way to the page tree root (or as far as $clause allows!)
|
||
*/
|
||
function BEgetRootLine($uid,$clause='',$workspaceOL=FALSE) {
|
||
if (is_array($GLOBALS['T3_VAR']['BEgetRootLine_cache'][$uid][$clause][$workspaceOL?1:0])) {
|
||
public static function BEgetRootLine($uid,$clause='',$workspaceOL=FALSE) {
|
||
if (is_array($GLOBALS['T3_VAR']['BEgetRootLine_cache'][$uid][$clause][$workspaceOL?1:0])) {
|
||
return $GLOBALS['T3_VAR']['BEgetRootLine_cache'][$uid][$clause][$workspaceOL?1:0];
|
||
}
|
||
$pid = $uid;
|
||
$loopCheck = 100;
|
||
$theRowArray = Array();
|
||
$output = Array();
|
||
while ($uid!=0 && $loopCheck>0) {
|
||
while ($uid!=0 && $loopCheck>0) {
|
||
$loopCheck--;
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||
'pid,uid,title,TSconfig,is_siteroot,storage_pid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_swapmode,t3ver_stage',
|
||
... | ... | |
t3lib_BEfunc::deleteClause('pages').' '.
|
||
$clause // whereClauseMightContainGroupOrderBy
|
||
);
|
||
if ($GLOBALS['TYPO3_DB']->sql_error()) {
|
||
if ($GLOBALS['TYPO3_DB']->sql_error()) {
|
||
debug($GLOBALS['TYPO3_DB']->sql_error(),1);
|
||
}
|
||
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
if($workspaceOL) t3lib_BEfunc::workspaceOL('pages',$row);
|
||
if (is_array($row)) {
|
||
if (is_array($row)) {
|
||
t3lib_BEfunc::fixVersioningPid('pages',$row);
|
||
$uid = $row['pid'];
|
||
$theRowArray[] = $row;
|
||
... | ... | |
}
|
||
}
|
||
if ($uid==0) {$theRowArray[] = Array('uid'=>0,'title'=>'');}
|
||
if (is_array($theRowArray)) {
|
||
if (is_array($theRowArray)) {
|
||
reset($theRowArray);
|
||
$c=count($theRowArray);
|
||
while(list($key,$val)=each($theRowArray)) {
|
||
while(list($key,$val)=each($theRowArray)) {
|
||
$c--;
|
||
$output[$c]['uid'] = $val['uid'];
|
||
$output[$c]['pid'] = $val['pid'];
|
||
... | ... | |
* @param boolean If set, then other open branches are closed.
|
||
* @return void
|
||
*/
|
||
function openPageTree($pid,$clearExpansion) {
|
||
public static function openPageTree($pid,$clearExpansion) {
|
||
global $BE_USER;
|
||
// Get current expansion data:
|
||
if ($clearExpansion) {
|
||
if ($clearExpansion) {
|
||
$expandedPages = array();
|
||
} else {
|
||
$expandedPages = unserialize($BE_USER->uc['browseTrees']['browsePages']);
|
||
... | ... | |
// First, find out what mount index to use (if more than one DB mount exists):
|
||
$mountIndex = 0;
|
||
$mountKeys = array_flip($BE_USER->returnWebmounts());
|
||
foreach($rL as $rLDat) {
|
||
if (isset($mountKeys[$rLDat['uid']])) {
|
||
foreach($rL as $rLDat) {
|
||
if (isset($mountKeys[$rLDat['uid']])) {
|
||
$mountIndex = $mountKeys[$rLDat['uid']];
|
||
break;
|
||
}
|
||
}
|
||
// Traverse rootline and open paths:
|
||
foreach($rL as $rLDat) {
|
||
foreach($rL as $rLDat) {
|
||
$expandedPages[$mountIndex][$rLDat['uid']] = 1;
|
||
}
|
||
... | ... | |
* @param integer Title limit of Full title (typ. set to 1000 or so)
|
||
* @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set.
|
||
*/
|
||
function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0) {
|
||
public static function getRecordPath($uid, $clause, $titleLimit, $fullTitleLimit=0) {
|
||
if (!$titleLimit) { $titleLimit=1000; }
|
||
$loopCheck = 100;
|
||
... | ... | |
$loopCheck = 100;
|
||
$output = $fullOutput = '/';
|
||
while ($uid!=0 && $loopCheck>0) {
|
||
while ($uid!=0 && $loopCheck>0) {
|
||
$loopCheck--;
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||
'uid,pid,title,t3ver_oid,t3ver_wsid,t3ver_swapmode',
|
||
... | ... | |
t3lib_BEfunc::deleteClause('pages').
|
||
(strlen(trim($clause)) ? ' AND '.$clause : '')
|
||
);
|
||
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
t3lib_BEfunc::workspaceOL('pages',$row);
|
||
if (is_array($row)) {
|
||
if (is_array($row)) {
|
||
t3lib_BEfunc::fixVersioningPid('pages',$row);
|
||
if ($row['_ORIG_pid'] && $row['t3ver_swapmode']>0) { // Branch points
|
||
... | ... | |
}
|
||
}
|
||
if ($fullTitleLimit) {
|
||
if ($fullTitleLimit) {
|
||
return array($output, $fullOutput);
|
||
} else {
|
||
return $output;
|
||
... | ... | |
*
|
||
* @return array Array of arrays with excludeFields (fieldname, table:fieldname) from all TCA entries
|
||
*/
|
||
function getExcludeFields() {
|
||
public static function getExcludeFields() {
|
||
global $TCA;
|
||
// All TCA keys:
|
||
$theExcludeArray = Array();
|
||
... | ... | |
// All TCA keys:
|
||
$theExcludeArray = Array();
|
||
$tc_keys = array_keys($TCA);
|
||
foreach($tc_keys as $table) {
|
||
foreach($tc_keys as $table) {
|
||
// Load table
|
||
t3lib_div::loadTCA($table);
|
||
// All field names configured:
|
||
if (is_array($TCA[$table]['columns'])) {
|
||
if (is_array($TCA[$table]['columns'])) {
|
||
$f_keys = array_keys($TCA[$table]['columns']);
|
||
foreach($f_keys as $field) {
|
||
if ($TCA[$table]['columns'][$field]['exclude']) {
|
||
foreach($f_keys as $field) {
|
||
if ($TCA[$table]['columns'][$field]['exclude']) {
|
||
// Get Human Readable names of fields and table:
|
||
$Fname=$GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
|
||
// add entry:
|
||
... | ... | |
*
|
||
* @return array Array with information from all of $TCA
|
||
*/
|
||
function getExplicitAuthFieldValues() {
|
||
public static function getExplicitAuthFieldValues() {
|
||
global $TCA;
|
||
// Initialize:
|
||
... | ... | |
t3lib_div::loadTCA($table);
|
||
// All field names configured:
|
||
if (is_array($TCA[$table]['columns'])) {
|
||
if (is_array($TCA[$table]['columns'])) {
|
||
$f_keys = array_keys($TCA[$table]['columns']);
|
||
foreach($f_keys as $field) {
|
||
foreach($f_keys as $field) {
|
||
$fCfg = $TCA[$table]['columns'][$field]['config'];
|
||
if ($fCfg['type']=='select' && $fCfg['authMode']) {
|
||
... | ... | |
if ($fCfg['type']=='select' && $fCfg['authMode']) {
|
||
// Check for items:
|
||
if (is_array($fCfg['items'])) {
|
||
if (is_array($fCfg['items'])) {
|
||
// Get Human Readable names of fields and table:
|
||
$allowDenyOptions[$table.':'.$field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
|
||
... | ... | |
$allowDenyOptions[$table.':'.$field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
|
||
// Check for items:
|
||
foreach($fCfg['items'] as $iVal) {
|
||
foreach($fCfg['items'] as $iVal) {
|
||
if (strcmp($iVal[1],'')) { // Values '' is not controlled by this setting.
|
||
// Find iMode:
|
||
... | ... | |
// Find iMode:
|
||
$iMode = '';
|
||
switch((string)$fCfg['authMode']) {
|
||
switch((string)$fCfg['authMode']) {
|
||
case 'explicitAllow':
|
||
$iMode = 'ALLOW';
|
||
break;
|
||
... | ... | |
$iMode = 'DENY';
|
||
break;
|
||
case 'individual':
|
||
if (!strcmp($iVal[4],'EXPL_ALLOW')) {
|
||
if (!strcmp($iVal[4],'EXPL_ALLOW')) {
|
||
$iMode = 'ALLOW';
|
||
} elseif (!strcmp($iVal[4],'EXPL_DENY')) {
|
||
} elseif (!strcmp($iVal[4],'EXPL_DENY')) {
|
||
$iMode = 'DENY';
|
||
}
|
||
break;
|
||
}
|
||
// Set iMode:
|
||
if ($iMode) {
|
||
if ($iMode) {
|
||
$allowDenyOptions[$table.':'.$field]['items'][$iVal[1]] = array($iMode, $GLOBALS['LANG']->sl($iVal[0]), $adLabel[$iMode]);
|
||
}
|
||
}
|
||
... | ... | |
*
|
||
* @return array Array with languages
|
||
*/
|
||
function getSystemLanguages() {
|
||
public static function getSystemLanguages() {
|
||
// Initialize, add default language:
|
||
$sysLanguages = array();
|
||
... | ... | |
// Traverse languages
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,flag','sys_language','pid=0'.t3lib_BEfunc::deleteClause('sys_language'));
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$sysLanguages[] = array($row['title'].' ['.$row['uid'].']', $row['uid'], ($row['flag'] ? 'flags/'.$row['flag'] : ''));
|
||
}
|
||
... | ... | |
* @param string $perms_clause is typically a value generated with $BE_USER->getPagePermsClause(1);
|
||
* @return array Returns page record if OK, otherwise false.
|
||
*/
|
||
function readPageAccess($id,$perms_clause) {
|
||
if ((string)$id!='') {
|
||
public static function readPageAccess($id,$perms_clause) {
|
||
if ((string)$id!='') {
|
||
$id = intval($id);
|
||
if (!$id) {
|
||
if ($GLOBALS['BE_USER']->isAdmin()) {
|
||
if (!$id) {
|
||
if ($GLOBALS['BE_USER']->isAdmin()) {
|
||
$path = '/';
|
||
$pageinfo['_thePath'] = $path;
|
||
return $pageinfo;
|
||
}
|
||
} else {
|
||
$pageinfo = t3lib_BEfunc::getRecord('pages',$id,'*',($perms_clause ? ' AND '.$perms_clause : ''));
|
||
if ($pageinfo['uid'] && $GLOBALS['BE_USER']->isInWebMount($id,$perms_clause)) {
|
||
if ($pageinfo['uid'] && $GLOBALS['BE_USER']->isInWebMount($id,$perms_clause)) {
|
||
t3lib_BEfunc::workspaceOL('pages', $pageinfo);
|
||
if (is_array($pageinfo)) {
|
||
if (is_array($pageinfo)) {
|
||
t3lib_BEfunc::fixVersioningPid('pages', $pageinfo);
|
||
list($pageinfo['_thePath'],$pageinfo['_thePathFull']) = t3lib_BEfunc::getRecordPath(intval($pageinfo['uid']), $perms_clause, 15, 1000);
|
||
return $pageinfo;
|
||
... | ... | |
* @param boolean If $useFieldNameAsKey is set, then the fieldname is associative keys in the return array, otherwise just numeric keys.
|
||
* @return array
|
||
*/
|
||
function getTCAtypes($table,$rec,$useFieldNameAsKey=0) {
|
||
public static function getTCAtypes($table,$rec,$useFieldNameAsKey=0) {
|
||
global $TCA;
|
||
t3lib_div::loadTCA($table);
|
||
... | ... | |
$altFieldList = array();
|
||
// Traverse fields in types config and parse the configuration into a nice array:
|
||
foreach($fieldList as $k => $v) {
|
||
foreach($fieldList as $k => $v) {
|
||
list($pFieldName, $pAltTitle, $pPalette, $pSpec) = t3lib_div::trimExplode(';', $v);
|
||
$defaultExtras = is_array($TCA[$table]['columns'][$pFieldName]) ? $TCA[$table]['columns'][$pFieldName]['defaultExtras'] : '';
|
||
$specConfParts = t3lib_BEfunc::getSpecConfParts($pSpec, $defaultExtras);
|
||
... | ... | |
'spec' => $specConfParts,
|
||
'origString' => $v
|
||
);
|
||
if ($useFieldNameAsKey) {
|
||
if ($useFieldNameAsKey) {
|
||
$altFieldList[$fieldList[$k]['field']] = $fieldList[$k];
|
||
}
|
||
}
|
||
if ($useFieldNameAsKey) {
|
||
if ($useFieldNameAsKey) {
|
||
$fieldList = $altFieldList;
|
||
}
|
||
... | ... | |
* @return string Field value
|
||
* @see getTCAtypes()
|
||
*/
|
||
function getTCAtypeValue($table,$rec) {
|
||
public static function getTCAtypeValue($table,$rec) {
|
||
global $TCA;
|
||
// If no field-value, set it to zero. If there is no type matching the field-value (which now may be zero...) test field-value '1' as default.
|
||
... | ... | |
// If no field-value, set it to zero. If there is no type matching the field-value (which now may be zero...) test field-value '1' as default.
|
||
t3lib_div::loadTCA($table);
|
||
if ($TCA[$table]) {
|
||
if ($TCA[$table]) {
|
||
$field = $TCA[$table]['ctrl']['type'];
|
||
$fieldValue = $field ? ($rec[$field] ? $rec[$field] : 0) : 0;
|
||
if (!is_array($TCA[$table]['types'][$fieldValue])) $fieldValue = 1;
|
||
... | ... | |
* @param string The ['defaultExtras'] value from field configuration
|
||
* @return array
|
||
*/
|
||
function getSpecConfParts($str, $defaultExtras) {
|
||
public static function getSpecConfParts($str, $defaultExtras) {
|
||
// Add defaultExtras:
|
||
$specConfParts = t3lib_div::trimExplode(':', $defaultExtras.':'.$str, 1);
|
||
... | ... | |
$specConfParts = t3lib_div::trimExplode(':', $defaultExtras.':'.$str, 1);
|
||
$reg = array();
|
||
if (count($specConfParts)) {
|
||
foreach($specConfParts as $k2 => $v2) {
|
||
if (count($specConfParts)) {
|
||
foreach($specConfParts as $k2 => $v2) {
|
||
unset($specConfParts[$k2]);
|
||
if (ereg('(.*)\[(.*)\]',$v2,$reg)) {
|
||
if (ereg('(.*)\[(.*)\]',$v2,$reg)) {
|
||
$specConfParts[trim($reg[1])] = array(
|
||
'parameters' => t3lib_div::trimExplode('|', $reg[2], 1)
|
||
);
|
||
... | ... | |
* @param array Array of "[key]=[value]" strings to convert.
|
||
* @return array
|
||
*/
|
||
function getSpecConfParametersFromArray($pArr) {
|
||
public static function getSpecConfParametersFromArray($pArr) {
|
||
$out=array();
|
||
if (is_array($pArr)) {
|
||
if (is_array($pArr)) {
|
||
reset($pArr);
|
||
while(list($k,$v)=each($pArr)) {
|
||
while(list($k,$v)=each($pArr)) {
|
||
$parts=explode('=',$v,2);
|
||
if (count($parts)==2) {
|
||
if (count($parts)==2) {
|
||
$out[trim($parts[0])]=trim($parts[1]);
|
||
} else {
|
||
$out[$k]=$v;
|
||
... | ... | |
* @return mixed If array, the data structure was found and returned as an array. Otherwise (string) it is an error message.
|
||
* @see t3lib_TCEforms::getSingleField_typeFlex()
|
||
*/
|
||
function getFlexFormDS($conf,$row,$table,$fieldName='',$WSOL=TRUE,$newRecordPidValue=0) {
|
||
public static function getFlexFormDS($conf,$row,$table,$fieldName='',$WSOL=TRUE,$newRecordPidValue=0) {
|
||
global $TYPO3_CONF_VARS;
|
||
// Get pointer field etc from TCA-config:
|
||
... | ... | |
} else $srcPointer='default';
|
||
// Get Data Source: Detect if it's a file reference and in that case read the file and parse as XML. Otherwise the value is expected to be XML.
|
||
if (substr($ds_array[$srcPointer],0,5)=='FILE:') {
|
||
if (substr($ds_array[$srcPointer],0,5)=='FILE:') {
|
||
$file = t3lib_div::getFileAbsFileName(substr($ds_array[$srcPointer],5));
|
||
if ($file && @is_file($file)) {
|
||
if ($file && @is_file($file)) {
|
||
$dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file));
|
||
} else $dataStructArray = 'The file "'.substr($ds_array[$srcPointer],5).'" in ds-array key "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message.
|
||
} else {
|
||
... | ... | |
$srcPointer = $row[$ds_pointerField];
|
||
// Searching recursively back if 'ds_pointerField_searchParent' is defined (typ. a page rootline, or maybe a tree-table):
|
||
if ($ds_searchParentField && !$srcPointer) {
|
||
if ($ds_searchParentField && !$srcPointer) {
|
||
$rr = t3lib_BEfunc::getRecord($table,$row['uid'],'uid,'.$ds_searchParentField); // Get the "pid" field - we cannot know that it is in the input record! ###NOTE_A###
|
||
if ($WSOL) {
|
||
if ($WSOL) {
|
||
t3lib_BEfunc::workspaceOL($table,$rr);
|
||
t3lib_BEfunc::fixVersioningPid($table,$rr,TRUE); // Added "TRUE" 23/03/06 before 4.0. (Also to similar call below!). Reason: When t3lib_refindex is scanning the system in Live workspace all Pages with FlexForms will not find their inherited datastructure. Thus all references from workspaces are removed! Setting TRUE means that versioning PID doesn't check workspace of the record. I can't see that this should give problems anywhere. See more information inside t3lib_refindex!
|
||
}
|
||
... | ... | |
if (!is_array($rr) || isset($uidAcc[$rr['uid']])) break;
|
||
$uidAcc[$rr['uid']]=1;
|
||
if ($WSOL) {
|
||
if ($WSOL) {
|
||
t3lib_BEfunc::workspaceOL($table,$rr);
|
||
t3lib_BEfunc::fixVersioningPid($table,$rr,TRUE);
|
||
}
|
||
... | ... | |
}
|
||
// If there is a srcPointer value:
|
||
if ($srcPointer) {
|
||
if ($srcPointer) {
|
||
if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up:
|
||
list($tName,$fName) = explode(':',$ds_tableField,2);
|
||
if ($tName && $fName && is_array($GLOBALS['TCA'][$tName])) {
|
||
if ($tName && $fName && is_array($GLOBALS['TCA'][$tName])) {
|
||
$dataStructRec = t3lib_BEfunc::getRecord($tName, $srcPointer);
|
||
if ($WSOL) {
|
||
if ($WSOL) {
|
||
t3lib_BEfunc::workspaceOL($tName,$dataStructRec);
|
||
}
|
||
$dataStructArray = t3lib_div::xml2array($dataStructRec[$fName]);
|
||
} else $dataStructArray = 'No tablename ('.$tName.') or fieldname ('.$fName.') was found an valid!';
|
||
} else { // Otherwise expect it to be a file:
|
||
$file = t3lib_div::getFileAbsFileName($srcPointer);
|
||
if ($file && @is_file($file)) {
|
||
if ($file && @is_file($file)) {
|
||
$dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file));
|
||
} else $dataStructArray='The file "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message.
|
||
}
|
||
... | ... | |
* @param string $ident is just a textual identification in order to inform about the content! May be 20 characters long.
|
||
* @return void
|
||
*/
|
||
function storeHash($hash,$data,$ident) {
|
||
public static function storeHash($hash,$data,$ident) {
|
||
$insertFields = array(
|
||
'hash' => $hash,
|
||
'content' => $data,
|
||
... | ... | |
* @param integer $expTime represents the expire time in seconds. For instance a value of 3600 would allow cached content within the last hour, otherwise nothing is returned.
|
||
* @return string
|
||
*/
|
||
function getHash($hash,$expTime=0) {
|
||
public static function getHash($hash,$expTime=0) {
|
||
// if expTime is not set, the hash will never expire
|
||
$expTime = intval($expTime);
|
||
if ($expTime) {
|
||
... | ... | |
* @return array Page TSconfig
|
||
* @see t3lib_TSparser
|
||
*/
|
||
function getPagesTSconfig($id,$rootLine='',$returnPartArray=0) {
|
||
public static function getPagesTSconfig($id,$rootLine='',$returnPartArray=0) {
|
||
$id=intval($id);
|
||
if (!is_array($rootLine)) {
|
||
if (!is_array($rootLine)) {
|
||
$rootLine = t3lib_BEfunc::BEgetRootLine($id,'',TRUE);
|
||
}
|
||
ksort($rootLine); // Order correctly
|
||
... | ... | |
ksort($rootLine); // Order correctly
|
||
$TSdataArray = array();
|
||
$TSdataArray['defaultPageTSconfig']=$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig']; // Setting default configuration:
|
||
foreach($rootLine as $k => $v) {
|
||
foreach($rootLine as $k => $v) {
|
||
$TSdataArray['uid_'.$v['uid']]=$v['TSconfig'];
|
||
}
|
||
$TSdataArray = t3lib_TSparser::checkIncludeLines_array($TSdataArray);
|
||
if ($returnPartArray) {
|
||
if ($returnPartArray) {
|
||
return $TSdataArray;
|
||
}
|
||
... | ... | |
$hash = md5('pageTS:'.$userTS);
|
||
$cachedContent = t3lib_BEfunc::getHash($hash,0);
|
||
$TSconfig = array();
|
||
if (isset($cachedContent)) {
|
||
if (isset($cachedContent)) {
|
||
$TSconfig = unserialize($cachedContent);
|
||
} else {
|
||
$parseObj = t3lib_div::makeInstance('t3lib_TSparser');
|
||
... | ... | |
// get User TSconfig overlay
|
||
$userTSconfig = $GLOBALS['BE_USER']->userTS['page.'];
|
||
if (is_array($userTSconfig)) {
|
||
if (is_array($userTSconfig)) {
|
||
$TSconfig = t3lib_div::array_merge_recursive_overrule($TSconfig, $userTSconfig);
|
||
}
|
||
return $TSconfig;
|
||
... | ... | |
* @internal
|
||
* @see implodeTSParams(), getPagesTSconfig()
|
||
*/
|
||
function updatePagesTSconfig($id,$pageTS,$TSconfPrefix,$impParams='') {
|
||
public static function updatePagesTSconfig($id,$pageTS,$TSconfPrefix,$impParams='') {
|
||
$id=intval($id);
|
||
if (is_array($pageTS) && $id>0) {
|
||
if (!is_array($impParams)) {
|
||
if (is_array($pageTS) && $id>0) {
|
||
if (!is_array($impParams)) {
|
||
$impParams =t3lib_BEfunc::implodeTSParams(t3lib_BEfunc::getPagesTSconfig($id));
|
||
}
|
||
reset($pageTS);
|
||
... | ... | |
}
|
||
reset($pageTS);
|
||
$set=array();
|
||
while(list($f,$v)=each($pageTS)) {
|
||
while(list($f,$v)=each($pageTS)) {
|
||
$f = $TSconfPrefix.$f;
|
||
if ((!isset($impParams[$f])&&trim($v)) || strcmp(trim($impParams[$f]),trim($v))) {
|
||
if ((!isset($impParams[$f])&&trim($v)) || strcmp(trim($impParams[$f]),trim($v))) {
|
||
$set[$f]=trim($v);
|
||
}
|
||
}
|
||
if (count($set)) {
|
||
if (count($set)) {
|
||
// Get page record and TS config lines
|
||
$pRec = t3lib_befunc::getRecord('pages',$id);
|
||
$TSlines = explode(chr(10),$pRec['TSconfig']);
|
||
$TSlines = array_reverse($TSlines);
|
||
// Reset the set of changes.
|
||
reset($set);
|
||
while(list($f,$v)=each($set)) {
|
||
while(list($f,$v)=each($set)) {
|
||
reset($TSlines);
|
||
$inserted=0;
|
||
while(list($ki,$kv)=each($TSlines)) {
|
||
if (substr($kv,0,strlen($f)+1)==$f.'=') {
|
||
while(list($ki,$kv)=each($TSlines)) {
|
||
if (substr($kv,0,strlen($f)+1)==$f.'=') {
|
||
$TSlines[$ki]=$f.'='.$v;
|
||
$inserted=1;
|
||
break;
|
||
... | ... | |
break;
|
||
}
|
||
}
|
||
if (!$inserted) {
|
||
if (!$inserted) {
|
||
$TSlines = array_reverse($TSlines);
|
||
$TSlines[]=$f.'='.$v;
|
||
$TSlines = array_reverse($TSlines);
|
||
... | ... | |
* @param string Prefix string
|
||
* @return array Imploded TypoScript objectstring/values
|
||
*/
|
||
function implodeTSParams($p,$k='') {
|
||
public static function implodeTSParams($p,$k='') {
|
||
$implodeParams=array();
|
||
if (is_array($p)) {
|
||
if (is_array($p)) {
|
||
reset($p);
|
||
while(list($kb,$val)=each($p)) {
|
||
if (is_array($val)) {
|
||
while(list($kb,$val)=each($p)) {
|
||
if (is_array($val)) {
|
||
$implodeParams = array_merge($implodeParams,t3lib_BEfunc::implodeTSParams($val,$k.$kb));
|
||
} else {
|
||
$implodeParams[$k.$kb]=$val;
|
||
... | ... | |
* @param string Optional $where clause (fx. "AND username='pete'") can be used to limit query
|
||
* @return array
|
||
*/
|
||
function getUserNames($fields='username,usergroup,usergroup_cached_list,uid',$where='') {
|
||
public static function getUserNames($fields='username,usergroup,usergroup_cached_list,uid',$where='') {
|
||
$be_user_Array=Array();
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_users', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_users'), '', 'username');
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$be_user_Array[$row['uid']]=$row;
|
||
}
|
||
return $be_user_Array;
|
||
... | ... | |
* @param string WHERE clause
|
||
* @return array
|
||
*/
|
||
function getGroupNames($fields='title,uid', $where='') {
|
||
public static function getGroupNames($fields='title,uid', $where='') {
|
||
$be_group_Array = Array();
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_groups', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_groups'), '', 'title');
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$be_group_Array[$row['uid']] = $row;
|
||
}
|
||
return $be_group_Array;
|
||
... | ... | |
* @param string Field list; $fields specify the fields selected (default: title,uid)
|
||
* @return array
|
||
*/
|
||
function getListGroupNames($fields='title,uid') {
|
||
public static function getListGroupNames($fields='title,uid') {
|
||
$exQ=' AND hide_in_lists=0';
|
||
if (!$GLOBALS['BE_USER']->isAdmin()) {
|
||
if (!$GLOBALS['BE_USER']->isAdmin()) {
|
||
$exQ.=' AND uid IN ('.($GLOBALS['BE_USER']->user['usergroup_cached_list']?$GLOBALS['BE_USER']->user['usergroup_cached_list']:0).')';
|
||
}
|
||
return t3lib_BEfunc::getGroupNames($fields,$exQ);
|
||
... | ... | |
* @param boolean If $excludeBlindedFlag is set, then these records are unset from the array $usernames
|
||
* @return array User names, blinded
|
||
*/
|
||
function blindUserNames($usernames,$groupArray,$excludeBlindedFlag=0) {
|
||
if (is_array($usernames) && is_array($groupArray)) {
|
||
while(list($uid,$row)=each($usernames)) {
|
||
public static function blindUserNames($usernames,$groupArray,$excludeBlindedFlag=0) {
|
||
if (is_array($usernames) && is_array($groupArray)) {
|
||
while(list($uid,$row)=each($usernames)) {
|
||
$userN=$uid;
|
||
$set=0;
|
||
if ($row['uid']!=$GLOBALS['BE_USER']->user['uid']) {
|
||
if ($row['uid']!=$GLOBALS['BE_USER']->user['uid']) {
|
||
reset($groupArray);
|
||
while(list(,$v)=each($groupArray)) {
|
||
if ($v && t3lib_div::inList($row['usergroup_cached_list'],$v)) {
|
||
while(list(,$v)=each($groupArray)) {
|
||
if ($v && t3lib_div::inList($row['usergroup_cached_list'],$v)) {
|
||
$userN = $row['username'];
|
||
$set=1;
|
||
}
|
||
... | ... | |
* @param boolean If $excludeBlindedFlag is set, then these records are unset from the array $usernames
|
||
* @return array
|
||
*/
|
||
function blindGroupNames($groups,$groupArray,$excludeBlindedFlag=0) {
|
||
if (is_array($groups) && is_array($groupArray)) {
|
||
while(list($uid,$row)=each($groups)) {
|
||
public static function blindGroupNames($groups,$groupArray,$excludeBlindedFlag=0) {
|
||
if (is_array($groups) && is_array($groupArray)) {
|
||
while(list($uid,$row)=each($groups)) {
|
||
$groupN=$uid;
|
||
$set=0;
|
||
if (t3lib_div::inArray($groupArray,$uid)) {
|
||
if (t3lib_div::inArray($groupArray,$uid)) {
|
||
$groupN=$row['title'];
|
||
$set=1;
|
||
}
|
||
... | ... | |
* @param integer Time stamp, seconds
|
||
* @return integer
|
||
*/
|
||
function daysUntil($tstamp) {
|
||
public static function daysUntil($tstamp) {
|
||
$delta_t = $tstamp-$GLOBALS['EXEC_TIME'];
|
||
return ceil($delta_t/(3600*24));
|
||
}
|
||
... | ... | |
* @param integer Time stamp, seconds
|
||
* @return string Formatted time
|
||
*/
|
||
function date($tstamp) {
|
||
public static function date($tstamp) {
|
||
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp);
|
||
}
|
||
... | ... | |
* @param integer Time stamp, seconds
|
||
* @return string Formatted time
|
||
*/
|
||
function datetime($value) {
|
||
public static function datetime($value) {
|
||
return date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $value);
|
||
}
|
||
... | ... | |
* @param boolean Output hh:mm:ss. If false: hh:mm
|
||
* @return string Formatted time
|
||
*/
|
||
function time($value, $withSeconds = TRUE) {
|
||
public static function time($value, $withSeconds = TRUE) {
|
||
$hh = floor($value/3600);
|
||
$min = floor(($value-$hh*3600)/60);
|
||
$sec = $value-$hh*3600-$min*60;
|
||
... | ... | |
$min = floor(($value-$hh*3600)/60);
|
||
$sec = $value-$hh*3600-$min*60;
|
||
$l = sprintf('%02d',$hh).':'.sprintf('%02d',$min);
|
||
if ($withSeconds) {
|
||
if ($withSeconds) {
|
||
$l .= ':'.sprintf('%02d',$sec);
|
||
}
|
||
return $l;
|
||
... | ... | |
* @param string $labels should be something like ' min| hrs| days| yrs'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears")
|
||
* @return string Formatted time
|
||
*/
|
||
function calcAge($seconds,$labels = 'min|hrs|days|yrs') {
|
||
public static function calcAge($seconds,$labels = 'min|hrs|days|yrs') {
|
||
$labelArr = explode('|',$labels);
|
||
$prefix='';
|
||
if ($seconds<0) {$prefix='-'; $seconds=abs($seconds);}
|
||
if ($seconds<3600) {
|
||
if ($seconds<3600) {
|
||
$seconds = round ($seconds/60).' '.trim($labelArr[0]);
|
||
} elseif ($seconds<24*3600) {
|
||
} elseif ($seconds<24*3600) {
|
||
$seconds = round ($seconds/3600).' '.trim($labelArr[1]);
|
||
} elseif ($seconds<365*24*3600) {
|
||
} elseif ($seconds<365*24*3600) {
|
||
$seconds = round ($seconds/(24*3600)).' '.trim($labelArr[2]);
|
||
} else {
|
||
$seconds = round ($seconds/(365*24*3600)).' '.trim($labelArr[3]);
|
||
... | ... | |
* @param string $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm"
|
||
* @return string
|
||
*/
|
||
function dateTimeAge($tstamp,$prefix=1,$date='') {
|
||
public static function dateTimeAge($tstamp,$prefix=1,$date='') {
|
||
return $tstamp ?
|
||
($date=='date' ? t3lib_BEfunc::date($tstamp) : t3lib_BEfunc::datetime($tstamp)).
|
||
' ('.t3lib_BEfunc::calcAge($prefix*(time()-$tstamp),$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')).')' : '';
|
||
... | ... | |
* @return string
|
||
* @deprecated The idea made sense with older browsers, but now all browsers should support the "title" attribute - so just hardcode the title attribute instead!
|
||
*/
|
||
function titleAttrib($content='',$hsc=0) {
|
||
public static function titleAttrib($content='',$hsc=0) {
|
||
global $CLIENT;
|
||
$attrib= ($CLIENT['BROWSER']=='net'&&$CLIENT['VERSION']<5)||$CLIENT['BROWSER']=='konqu' ? 'alt' : 'title';
|
||
return strcmp($content,'')?' '.$attrib.'="'.($hsc?htmlspecialchars($content):$content).'"' : $attrib;
|
||
... | ... | |
* @param string Value for 'alt' and 'title' attributes (will be htmlspecialchars()'ed before output)
|
||
* @return string
|
||
*/
|
||
function titleAltAttrib($content) {
|
||
public static function titleAltAttrib($content) {
|
||
$out='';
|
||
$out.=' alt="'.htmlspecialchars($content).'"';
|
||
$out.=' title="'.htmlspecialchars($content).'"';
|
||
... | ... | |
* @param integer Optional: $size is [w]x[h] of the thumbnail. 56 is default.
|
||
* @return string Thumbnail image tag.
|
||
*/
|
||
function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='') {
|
||
public static function thumbCode($row,$table,$field,$backPath,$thumbScript='',$uploaddir=NULL,$abs=0,$tparams='',$size='') {
|
||
global $TCA;
|
||
// Load table.
|
||
t3lib_div::loadTCA($table);
|
||
... | ... | |
$uploaddir = preg_replace('#/$#','',$uploaddir);
|
||
// Set thumbs-script:
|
||
if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
|
||
if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
|
||
$thumbScript='gfx/notfound_thumb.gif';
|
||
} elseif(!$thumbScript) {
|
||
} elseif(!$thumbScript) {
|
||
$thumbScript='thumbs.php';
|
||
}
|
||
// Check and parse the size parameter
|
||
... | ... | |
// Traverse files:
|
||
$thumbs = explode(',', $row[$field]);
|
||
$thumbData='';
|
||
while(list(,$theFile)=each($thumbs)) {
|
||
if (trim($theFile)) {
|
||
while(list(,$theFile)=each($thumbs)) {
|
||
if (trim($theFile)) {
|
||
$fI = t3lib_div::split_fileref($theFile);
|
||
$ext = $fI['fileext'];
|
||
// New 190201 start
|
||
... | ... | |
if (is_array($imgInfo)) {$max = max($imgInfo[0],$imgInfo[1]);}
|
||
}
|
||
// use the original image if it's size fits to the thumbnail size
|
||
if ($max && $max<=(count($sizeParts)&&max($sizeParts)?max($sizeParts):56)) {
|
||
if ($max && $max<=(count($sizeParts)&&max($sizeParts)?max($sizeParts):56)) {
|
||
$theFile = $url = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile);
|
||
$onClick = 'top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;';
|
||
$thumbData.= '<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="'.$backPath.$url.'" '.$imgInfo[3].' hspace="2" border="0" title="'.trim($url).'"'.$tparams.' alt="" /></a> ';
|
||
... | ... | |
* @param integer $size is the size of the thumbnail send along to "thumbs.php"
|
||
* @return string Image tag
|
||
*/
|
||
function getThumbNail($thumbScript,$theFile,$tparams='',$size='') {
|
||
public static function getThumbNail($thumbScript,$theFile,$tparams='',$size='') {
|
||
$check = basename($theFile).':'.filemtime($theFile).':'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
|
||
$params = '&file='.rawurlencode($theFile);
|
||
$params.= trim($size)?'&size='.trim($size):'';
|
||
... | ... | |
* @param boolean If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already
|
||
* @return string
|
||
*/
|
||
function titleAttribForPages($row,$perms_clause='',$includeAttrib=1) {
|
||
public static function titleAttribForPages($row,$perms_clause='',$includeAttrib=1) {
|
||
global $TCA,$LANG;
|
||
$parts=array();
|
||
$parts[] = 'id='.$row['uid'];
|
||
if ($row['alias']) $parts[]=$LANG->sL($TCA['pages']['columns']['alias']['label']).' '.$row['alias'];
|
||
if ($row['pid']<0) $parts[] = 'v#1.'.$row['t3ver_id'];
|
||
switch($row['t3ver_state']) {
|
||
switch($row['t3ver_state']) {
|
||
case 1:
|
||
$parts[] = 'PLH WSID#'.$row['t3ver_wsid'];
|
||
break;
|
||
... | ... | |
break;
|
||
}
|
||
if ($row['doktype']=='3') {
|
||
if ($row['doktype']=='3') {
|
||
$parts[]=$LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url'];
|
||
} elseif ($row['doktype']=='4') {
|
||
if ($perms_clause) {
|
||
} elseif ($row['doktype']=='4') {
|
||
if ($perms_clause) {
|
||
$label = t3lib_BEfunc::getRecordPath(intval($row['shortcut']),$perms_clause,20);
|
||
} else {
|
||
$lRec = t3lib_BEfunc::getRecordWSOL('pages',intval($row['shortcut']),'title');
|
||
... | ... | |
$lRec = t3lib_BEfunc::getRecordWSOL('pages',intval($row['shortcut']),'title');
|
||
$label = $lRec['title'];
|
||
}
|
||
if ($row['shortcut_mode']>0) {
|
||
if ($row['shortcut_mode']>0) {
|
||
$label.=', '.$LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']).' '.
|
||
$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','shortcut_mode',$row['shortcut_mode']));
|
||
}
|
||
... | ... | |
$LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','shortcut_mode',$row['shortcut_mode']));
|
||
}
|
||
$parts[]=$LANG->sL($TCA['pages']['columns']['shortcut']['label']).' '.$label;
|
||
} elseif ($row['doktype']=='7') {
|
||
if ($perms_clause) {
|
||
} elseif ($row['doktype']=='7') {
|
||
if ($perms_clause) {
|
||
$label = t3lib_BEfunc::getRecordPath(intval($row['mount_pid']),$perms_clause,20);
|
||
} else {
|
||
$lRec = t3lib_BEfunc::getRecordWSOL('pages',intval($row['mount_pid']),'title');
|
||
$label = $lRec['title'];
|
||
}
|
||
$parts[]=$LANG->sL($TCA['pages']['columns']['mount_pid']['label']).' '.$label;
|
||
if ($row['mount_pid_ol']) {
|
||
if ($row['mount_pid_ol']) {
|
||
$parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']);
|
||
}
|
||
}
|
||
... | ... | |
if ($row['hidden']) $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
|
||
if ($row['starttime']) $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['starttime'],-1,'date');
|
||
if ($row['endtime']) $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['endtime'],-1,'date');
|
||
if ($row['fe_group']) {
|
||
if ($row['fe_group']) {
|
||
$fe_groups = array();
|
||
foreach (t3lib_div::intExplode(',',$row['fe_group']) as $fe_group) {
|
||
if ($fe_group<0) {
|
||
foreach (t3lib_div::intExplode(',',$row['fe_group']) as $fe_group) {
|
||
if ($fe_group<0) {
|
||
$fe_groups[] = $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','fe_group',$fe_group));
|
||
} else {
|
||
$lRec = t3lib_BEfunc::getRecordWSOL('fe_groups',$fe_group,'title');
|
||
... | ... | |
* @param string Table name
|
||
* @return string
|
||
*/
|
||
function getRecordIconAltText($row,$table='pages') {
|
||
if ($table=='pages') {
|
||
public static function getRecordIconAltText($row,$table='pages') {
|
||
if ($table=='pages') {
|
||
$out = t3lib_BEfunc::titleAttribForPages($row,'',0);
|
||
} else {
|
||
$ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
|
||
... | ... | |
$ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
|
||
$out='id='.$row['uid']; // Uid is added
|
||
if ($table=='pages' && $row['alias']) {
|
||
if ($table=='pages' && $row['alias']) {
|
||
$out.=' / '.$row['alias'];
|
||
}
|
||
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $row['pid']<0) {
|
||
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $row['pid']<0) {
|
||
$out.=' - v#1.'.$row['t3ver_id'];
|
||
}
|
||
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
|
||
switch($row['t3ver_state']) {
|
||
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
|
||
switch($row['t3ver_state']) {
|
||
case 1:
|
||
$out.= ' - PLH WSID#'.$row['t3ver_wsid'];
|
||
break;
|
||
... | ... | |
if ($ctrl['disabled']) { // Hidden ...
|
||
$out.=($row[$ctrl['disabled']]?' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.hidden'):'');
|
||
}
|
||
if ($ctrl['starttime']) {
|
||
if ($row[$ctrl['starttime']] > $GLOBALS['EXEC_TIME']) {
|
||
if ($ctrl['starttime']) {
|
||
if ($row[$ctrl['starttime']] > $GLOBALS['EXEC_TIME']) {
|
||
$out.=' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.starttime').':'.t3lib_BEfunc::date($row[$ctrl['starttime']]).' ('.t3lib_BEfunc::daysUntil($row[$ctrl['starttime']]).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days').')';
|
||
}
|
||
}
|
||
if ($row[$ctrl['endtime']]) {
|
||
if ($row[$ctrl['endtime']]) {
|
||
$out.=' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.endtime').': '.t3lib_BEfunc::date($row[$ctrl['endtime']]).' ('.t3lib_BEfunc::daysUntil($row[$ctrl['endtime']]).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.days').')';
|
||
}
|
||
}
|
||
... | ... | |
* @param string items-array value to match
|
||
* @return string Label for item entry
|
||
*/
|
||
function getLabelFromItemlist($table,$col,$key) {
|
||
public static function getLabelFromItemlist($table,$col,$key) {
|
||
global $TCA;
|
||
// Load full TCA for $table
|
||
t3lib_div::loadTCA($table);
|
||
... | ... | |
t3lib_div::loadTCA($table);
|
||
// Check, if there is an "items" array:
|
||
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]) && is_array($TCA[$table]['columns'][$col]['config']['items'])) {
|
||
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]) && is_array($TCA[$table]['columns'][$col]['config']['items'])) {
|
||
// Traverse the items-array...
|
||
reset($TCA[$table]['columns'][$col]['config']['items']);
|
||
while(list($k,$v)=each($TCA[$table]['columns'][$col]['config']['items'])) {
|
||
while(list($k,$v)=each($TCA[$table]['columns'][$col]['config']['items'])) {
|
||
// ... and return the first found label where the value was equal to $key
|
||
if (!strcmp($v[1],$key)) return $v[0];
|
||
}
|
||
... | ... | |
* @param string Wrap value - set function description
|
||
* @return string
|
||
*/
|
||
function getItemLabel($table,$col,$printAllWrap='') {
|
||
public static function getItemLabel($table,$col,$printAllWrap='') {
|
||
global $TCA;
|
||
// Load full TCA for $table
|
||
t3lib_div::loadTCA($table);
|
||
... | ... | |
// Load full TCA for $table
|
||
t3lib_div::loadTCA($table);
|
||
// Check if column exists
|
||
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) {
|
||
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) {
|
||
// Re
|
||
return $TCA[$table]['columns'][$col]['label'];
|
||
}
|
||
if ($printAllWrap) {
|
||
if ($printAllWrap) {
|
||
$parts = explode('|',$printAllWrap);
|
||
return $parts[0].$col.$parts[1];
|
||
}
|
||
... | ... | |
* @param boolean If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized).
|
||
* @return string
|
||
*/
|
||
function getRecordTitle($table,$row,$prep=FALSE,$forceResult=TRUE) {
|
||
public static function getRecordTitle($table,$row,$prep=FALSE,$forceResult=TRUE) {
|
||
global $TCA;
|
||
if (is_array($TCA[$table])) {
|
||
... | ... | |
if (is_array($TCA[$table])) {
|
||
// If configured, call userFunc
|
||
if ($TCA[$table]['ctrl']['label_userFunc']) {
|
||
if ($TCA[$table]['ctrl']['label_userFunc']) {
|
||
$params['table'] = $table;
|
||
$params['row'] = $row;
|
||
$params['title'] = '';
|
||
... | ... | |
// No userFunc: Build label
|
||
$t = t3lib_BEfunc::getProcessedValue($table,$TCA[$table]['ctrl']['label'],$row[$TCA[$table]['ctrl']['label']],0,0,false,$row['uid'],$forceResult);
|
||
if ($TCA[$table]['ctrl']['label_alt'] && ($TCA[$table]['ctrl']['label_alt_force'] || !strcmp($t,''))) {
|
||
if ($TCA[$table]['ctrl']['label_alt'] && ($TCA[$table]['ctrl']['label_alt_force'] || !strcmp($t,''))) {
|
||
$altFields=t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1);
|
||
$tA=array();
|
||
if (!empty($t)) $tA[] = $t;
|
||
foreach ($altFields as $fN) {
|
||
foreach ($altFields as $fN) {
|
||
$t = trim(strip_tags($row[$fN]));
|
||
if (strcmp($t,'')) {
|
||
if (strcmp($t,'')) {
|
||
$t = t3lib_BEfunc::getProcessedValue($table,$fN,$t,0,0,false,$row['uid']);
|
||
if (!$TCA[$table]['ctrl']['label_alt_force']) {
|
||
if (!$TCA[$table]['ctrl']['label_alt_force']) {
|
||
break;
|
||
}
|
||
$tA[] = $t;
|
||
... | ... | |
$tA[] = $t;
|
||
}
|
||
}
|
||
if ($TCA[$table]['ctrl']['label_alt_force']) {
|
||
if ($TCA[$table]['ctrl']['label_alt_force']) {
|
||
$t=implode(', ',$tA);
|
||
}
|
||
}
|
||
}
|
||
// If the current result is empty, set it to '[No title]' (localized) and prepare for output if requested
|
||
if ($prep || $forceResult) {
|
||
if ($prep || $forceResult) {
|
||
if ($prep) {
|
||
$t = t3lib_BEfunc::getRecordTitlePrep($t);
|
||
}
|
||
... | ... | |
* @param integer $titleLength: Crop title after this length - if not set, BE_USER->uc['titleLen'] is used
|
||
* @return string The processed title string, wrapped in <span title="...">|</span> if cropped
|
||
*/
|
||
function getRecordTitlePrep($title, $titleLength=0) {
|
||
public static function getRecordTitlePrep($title, $titleLength=0) {
|
||
// If $titleLength is not a valid positive integer, use BE_USER->uc['titleLen']:
|
||
if (!$titleLength || !t3lib_div::testInt($titleLength) || $titleLength < 0) {
|
||
$titleLength = $GLOBALS['BE_USER']->uc['titleLen'];
|
||
... | ... | |
* @param boolean $prep: Wrap result in <em>|</em>
|
||
* @return string Localized [No title] string
|
||
*/
|
||
function getNoRecordTitle($prep=FALSE) {
|
||
public static function getNoRecordTitle($prep=FALSE) {
|
||
$noTitle = '['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']';
|
||
if ($prep) $noTitle = '<em>'.$noTitle.'</em>';
|
||
return $noTitle;
|
||
... | ... | |
* @param boolean If t3lib_BEfunc::getRecordTitle is used to process the value, this parameter is forwarded.
|
||
* @return string
|
||
*/
|
||
function getProcessedValue($table,$col,$value,$fixed_lgd_chars=0,$defaultPassthrough=0,$noRecordLookup=FALSE,$uid=0,$forceResult=TRUE) {
|
||
public static function getProcessedValue($table,$col,$value,$fixed_lgd_chars=0,$defaultPassthrough=0,$noRecordLookup=FALSE,$uid=0,$forceResult=TRUE) {
|
||
global $TCA;
|
||
global $TYPO3_CONF_VARS;
|
||
// Load full TCA for $table
|
||
... | ... | |
// Load full TCA for $table
|
||
t3lib_div::loadTCA($table);
|
||
// Check if table and field is configured:
|
||
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) {
|
||
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col])) {
|
||
// Depending on the fields configuration, make a meaningful output value.
|
||
$theColConf = $TCA[$table]['columns'][$col]['config'];
|
||
... | ... | |
}
|
||
$l='';
|
||
switch((string)$theColConf['type']) {
|
||
switch((string)$theColConf['type']) {
|
||
case 'radio':
|
||
$l=t3lib_BEfunc::getLabelFromItemlist($table,$col,$value);
|
||
$l=$GLOBALS['LANG']->sL($l);
|
||
... | ... | |
$l=$GLOBALS['LANG']->sL($l);
|
||
break;
|
||
case 'select':
|
||
if ($theColConf['MM']) {
|
||
if ($theColConf['MM']) {
|
||
// Display the title of MM related records in lists
|
||
if ($noRecordLookup) {
|
||
if ($noRecordLookup) {
|
||
$MMfield = $theColConf['foreign_table'].'.uid';
|
||
} else {
|
||
$MMfields = array($theColConf['foreign_table'].'.'.$TCA[$theColConf['foreign_table']]['ctrl']['label']);
|
||
foreach (t3lib_div::trimExplode(',', $TCA[$theColConf['foreign_table']]['ctrl']['label_alt'], 1) as $f) {
|
||
foreach (t3lib_div::trimExplode(',', $TCA[$theColConf['foreign_table']]['ctrl']['label_alt'], 1) as $f) {
|
||
$MMfields[] = $theColConf['foreign_table'].'.'.$f;
|
||
}
|
||
$MMfield = join(',',$MMfields);
|
||
... | ... | |
$theColConf['foreign_table'],
|
||
'uid IN ('.implode(',', $selectUids).')'
|
||
);
|
||
while($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
|
||
while($MMrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($MMres)) {
|
||
$mmlA[] = ($noRecordLookup?$MMrow['uid']:t3lib_BEfunc::getRecordTitle($theColConf['foreign_table'], $MMrow, FALSE, $forceResult));
|
||
}
|
||
if (is_array($mmlA)) {
|
||
... | ... | |
} else {
|
||
$l = t3lib_BEfunc::getLabelFromItemlist($table,$col,$value);
|
||
$l = $GLOBALS['LANG']->sL($l);
|
||
if ($theColConf['foreign_table'] && !$l && $TCA[$theColConf['foreign_table']]) {
|
||
if ($noRecordLookup) {
|
||
if ($theColConf['foreign_table'] && !$l && $TCA[$theColConf['foreign_table']]) {
|
||
if ($noRecordLookup) {
|
||
$l = $value;
|
||
} else {
|
||
$rParts = t3lib_div::trimExplode(',',$value,1);
|
||
... | ... | |
$rParts = t3lib_div::trimExplode(',',$value,1);
|
||
reset($rParts);
|
||
$lA = array();
|
||
while(list(,$rVal)=each($rParts)) {
|
||
while(list(,$rVal)=each($rParts)) {
|
||
$rVal = intval($rVal);
|
||
if ($rVal>0) {
|
||
$r=t3lib_BEfunc::getRecordWSOL($theColConf['foreign_table'],$rVal);
|
||
} else {
|
||
$r=t3lib_BEfunc::getRecordWSOL($theColConf['neg_foreign_table'],-$rVal);
|
||
}
|
||
if (is_array($r)) {
|
||
if (is_array($r)) {
|
||
$lA[]=$GLOBALS['LANG']->sL($rVal>0?$theColConf['foreign_table_prefix']:$theColConf['neg_foreign_table_prefix']).t3lib_BEfunc::getRecordTitle($rVal>0?$theColConf['foreign_table']:$theColConf['neg_foreign_table'],$r,FALSE,$forceResult);
|
||
} else {
|
||
$lA[]=$rVal?'['.$rVal.'!]':'';
|
||
... | ... | |
$l = implode(', ',t3lib_div::trimExplode(',',$value,1));
|
||
break;
|
||
case 'check':
|
||
if (!is_array($theColConf['items']) || count($theColConf['items'])==1) {
|
||
if (!is_array($theColConf['items']) || count($theColConf['items'])==1) {
|
||
$l = $value ? 'Yes' : '';
|
||
} else {
|
||
reset($theColConf['items']);
|
||
... | ... | |
} else {
|
||
reset($theColConf['items']);
|
||
$lA=Array();
|
||
while(list($key,$val)=each($theColConf['items'])) {
|
||
while(list($key,$val)=each($theColConf['items'])) {
|
||
if ($value & pow(2,$key)) {$lA[]=$GLOBALS['LANG']->sL($val[0]);}
|
||
}
|
||
$l = implode(', ',$lA);
|
||
}
|
||
break;
|
||
case 'input':
|
||
if ($value) {
|
||
if (t3lib_div::inList($theColConf['eval'],'date')) {
|
||
if ($value) {
|
||
if (t3lib_div::inList($theColConf['eval'],'date')) {
|
||
$l = t3lib_BEfunc::date($value).' ('.(time()-$value>0?'-':'').t3lib_BEfunc::calcAge(abs(time()-$value), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')).')';
|
||
} elseif (t3lib_div::inList($theColConf['eval'],'time')) {
|
||
} elseif (t3lib_div::inList($theColConf['eval'],'time')) {
|
||
$l = t3lib_BEfunc::time($value, FALSE);
|
||
} elseif (t3lib_div::inList($theColConf['eval'],'timesec')) {
|
||
} elseif (t3lib_div::inList($theColConf['eval'],'timesec')) {
|
||
$l = t3lib_BEfunc::time($value);
|
||
} elseif (t3lib_div::inList($theColConf['eval'],'datetime')) {
|
||
} elseif (t3lib_div::inList($theColConf['eval'],'datetime')) {
|
||
$l = t3lib_BEfunc::datetime($value);
|
||
} else {
|
||
$l = $value;
|
||
... | ... | |
$l = strip_tags($value);
|
||
break;
|
||
default:
|
||
if ($defaultPassthrough) {
|
||
if ($defaultPassthrough) {
|
||
$l=$value;
|
||
} elseif ($theColConf['MM']) {
|
||
} elseif ($theColConf['MM']) {
|
||
$l='N/A';
|
||
} elseif ($value) {
|
||
} elseif ($value) {
|
||
$l=t3lib_div::fixed_lgd_cs(strip_tags($value),200);
|
||
}
|
||
break;
|
||
... | ... | |
}
|
||
}
|
||
if ($fixed_lgd_chars) {
|
||
if ($fixed_lgd_chars) {
|
||
return t3lib_div::fixed_lgd_cs($l,$fixed_lgd_chars);
|
||
} else {
|
||
return $l;
|
||
... | ... | |
* @return string
|
||
* @see getProcessedValue()
|
||
*/
|
||
function getProcessedValueExtra($table,$fN,$fV,$fixed_lgd_chars=0,$uid=0,$forceResult=TRUE) {
|
||
public static function getProcessedValueExtra($table,$fN,$fV,$fixed_lgd_chars=0,$uid=0,$forceResult=TRUE) {
|
||
global $TCA;
|
||
$fVnew = t3lib_BEfunc::getProcessedValue($table,$fN,$fV,$fixed_lgd_chars,0,0,$uid,$forceResult);
|
||
if (!isset($fVnew)) {
|
||
if (is_array($TCA[$table])) {
|
||
if ($fN==$TCA[$table]['ctrl']['tstamp'] || $fN==$TCA[$table]['ctrl']['crdate']) {
|
||
if (!isset($fVnew)) {
|
||
if (is_array($TCA[$table])) {
|
||
if ($fN==$TCA[$table]['ctrl']['tstamp'] || $fN==$TCA[$table]['ctrl']['crdate']) {
|
||
$fVnew = t3lib_BEfunc::datetime($fV);
|
||
} elseif ($fN=='pid'){
|
||
$fVnew = t3lib_BEfunc::getRecordPath($fV,'1=1',20); // Fetches the path with no regard to the users permissions to select pages.
|
||
... | ... | |
* @param string File extension, lowercase
|
||
* @return string File icon filename
|
||
*/
|
||
function getFileIcon($ext) {
|
||
public static function getFileIcon($ext) {
|
||
return $GLOBALS['FILEICONS'][$ext] ? $GLOBALS['FILEICONS'][$ext] : $GLOBALS['FILEICONS']['default'];
|
||
}
|
||
... | ... | |
* @param array Preset fields (must include prefix if that is used)
|
||
* @return string List of fields.
|
||
*/
|
||
function getCommonSelectFields($table,$prefix='',$fields = array()) {
|
||
public static function getCommonSelectFields($table,$prefix='',$fields = array()) {
|
||
global $TCA;
|
||
$fields[] = $prefix.'uid';
|
||
$fields[] = $prefix.$TCA[$table]['ctrl']['label'];
|
||
... | ... | |
$fields[] = $prefix.'uid';
|
||
$fields[] = $prefix.$TCA[$table]['ctrl']['label'];
|
||
if ($TCA[$table]['ctrl']['label_alt']) {
|
||
if ($TCA[$table]['ctrl']['label_alt']) {
|
||
$secondFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1);
|
||
foreach($secondFields as $fieldN) {
|
||
foreach($secondFields as $fieldN) {
|
||
$fields[] = $prefix.$fieldN;
|
||
}
|
||
}
|
||
if ($TCA[$table]['ctrl']['versioningWS']) {
|
||
if ($TCA[$table]['ctrl']['versioningWS']) {
|
||
$fields[] = $prefix.'t3ver_id';
|
||
$fields[] = $prefix.'t3ver_state';
|
||
$fields[] = $prefix.'t3ver_wsid';
|
||
... | ... | |
* @param string Prefix for formfields
|
||
* @return string HTML for a form.
|
||
*/
|
||
function makeConfigForm($configArray,$defaults,$dataPrefix) {
|
||
public static function makeConfigForm($configArray,$defaults,$dataPrefix) {
|
||
$params = $defaults;
|
||
if (is_array($configArray)) {
|
||
if (is_array($configArray)) {
|
||
reset($configArray);
|
||
$lines=array();
|
||
while(list($fname,$config)=each($configArray)) {
|
||
if (is_array($config)) {
|
||
while(list($fname,$config)=each($configArray)) {
|
||
if (is_array($config)) {
|
||
$lines[$fname]='<strong>'.htmlspecialchars($config[1]).'</strong><br />';
|
||
$lines[$fname].=$config[2].'<br />';
|
||
switch($config[0]) {
|
||
switch($config[0]) {
|
||
case 'string':
|
||
case 'short':
|
||
$formEl = '<input type="text" name="'.$dataPrefix.'['.$fname.']" value="'.$params[$fname].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth($config[0]=='short'?24:48).' />';
|
||
... | ... | |
case 'select':
|
||
reset($config[3]);
|
||
$opt=array();
|
||
while(list($k,$v)=each($config[3])) {
|
||
while(list($k,$v)=each($config[3])) {
|
||
$opt[]='<option value="'.htmlspecialchars($k).'"'.($params[$fname]==$k?' selected="selected"':'').'>'.htmlspecialchars($v).'</option>';
|
||
}
|
||
$formEl = '<select name="'.$dataPrefix.'['.$fname.']">'.implode('',$opt).'</select>';
|
||
... | ... | |
* @param boolean Force display of icon nomatter BE_USER setting for help
|
||
* @return string HTML content for a help icon/text
|
||
*/
|
||
function helpTextIcon($table,$field,$BACK_PATH,$force=0) {
|
||
public static function helpTextIcon($table,$field,$BACK_PATH,$force=0) {
|
||
global $TCA_DESCR,$BE_USER;
|
||
$onClick = 'vHWin=window.open(\''.$BACK_PATH.'view_help.php?tfID='.($table.'.'.$field).'\',\'viewFieldHelp\',\'height=400,width=600,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;';
|
||
... | ... | |
* @param string DEPRECATED: Additional style-attribute content for wrapping table (now: only in function cshItem needed)
|
||
* @return string HTML content for help text
|
||
*/
|
||
function helpText($table,$field,$BACK_PATH,$styleAttrib='') {
|
||
public static function helpText($table,$field,$BACK_PATH,$styleAttrib='') {
|
||
global $TCA_DESCR,$BE_USER;
|
||
$output = '';
|
||
if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field])) {
|
||
if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field])) {
|
||
$data = $TCA_DESCR[$table]['columns'][$field];
|
||
// add see also arrow
|
||
if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) {
|
||
if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) {
|
||
$arrow = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/rel_db.gif','width="13" height="12"').' class="absmiddle" alt="" />';
|
||
}
|
||
// add description text
|
||
... | ... | |
* @return string HTML content for help text
|
||
* @see helpText(), helpTextIcon()
|
||
*/
|
||
function cshItem($table,$field,$BACK_PATH,$wrap='',$onlyIconMode=FALSE, $styleAttrib='') {
|
||
public static function cshItem($table,$field,$BACK_PATH,$wrap='',$onlyIconMode=FALSE, $styleAttrib='') {
|
||
global $TCA_DESCR, $LANG, $BE_USER;
|
||
if ($BE_USER->uc['edit_showFieldHelp']) {
|
||
if ($BE_USER->uc['edit_showFieldHelp']) {
|
||
$LANG->loadSingleTableDescription($table);
|
||
if (is_array($TCA_DESCR[$table])) {
|
||
if (is_array($TCA_DESCR[$table])) {
|
||
// Creating CSH icon and short description:
|
||
$fullText = t3lib_BEfunc::helpText($table,$field,$BACK_PATH,'');
|
||
$icon = t3lib_BEfunc::helpTextIcon($table,$field,$BACK_PATH);
|
||
... | ... | |
} else {
|
||
$output = $icon;
|
||
if ($output && $wrap) {
|
||
if ($output && $wrap) {
|
||
$wrParts = explode('|',$wrap);
|
||
$output = $wrParts[0].$output.$wrParts[1];
|
||
}
|
||
... | ... | |
* @return string
|
||
* @see template::issueCommand()
|
||
*/
|
||
function editOnClick($params,$backPath='',$requestUri='') {
|
||
public static function editOnClick($params,$backPath='',$requestUri='') {
|
||
$retUrl = 'returnUrl='.($requestUri==-1?"'+T3_THIS_LOCATION+'":rawurlencode($requestUri?$requestUri:t3lib_div::getIndpEnv('REQUEST_URI')));
|
||
return "window.location.href='".$backPath."alt_doc.php?".$retUrl.$params."'; return false;";
|
||
}
|
||
... | ... | |
* @param boolean If true, then the preview window will gain the focus.
|
||
* @return string
|
||
*/
|
||
function viewOnClick($id,$backPath='',$rootLine='',$anchor='',$altUrl='',$addGetVars='',$switchFocus=TRUE) {
|
||
if ($altUrl) {
|
||
public static function viewOnClick($id,$backPath='',$rootLine='',$anchor='',$altUrl='',$addGetVars='',$switchFocus=TRUE) {
|
||
if ($altUrl) {
|
||
$url = $altUrl;
|
||
} else {
|
||