Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

t3lib_BEfunc Class Reference

List of all members.

Public Member Functions

 deleteClause ($table)
 Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field is configured in $TCA for the tablename, $table This function should ALWAYS be called in the backend for selection on tables which are configured in TCA since it will ensure consistent selection of records, even if they are marked deleted (in which case the system must always treat them as non-existent!) In the frontend a function, ->enableFields(), is known to filter hidden-field, start- and endtime and fe_groups as well.
 getRecord ($table, $uid, $fields='*', $where='')
 Gets record with uid=$uid from $table You can set $field to a list of fields (default is '*') Additional WHERE clauses can be added by $where (fx.
 getRecordRaw ($table, $where='', $fields='*')
 Returns the first record found from $table with $where as WHERE clause This function does NOT check if a record has the deleted flag set.
 getRecordsByField ($theTable, $theField, $theValue, $whereClause='', $groupBy='', $orderBy='', $limit='')
 Returns records from table, $theTable, where a field ($theField) equals the value, $theValue The records are returned in an array If no records were selected, the function returns nothing Usage: 8.
 fixVersioningPid ($table, &$rr)
 Find page-tree PID for versionized record Will look if the "pid" value of the input record is -1 and if the table supports versioning - if so, it will translate the -1 PID into the PID of the original record.
 searchQuery ($searchWords, $fields, $table='')
 Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields.
 listQuery ($field, $value)
 Returns a WHERE clause that can find a value ($value) in a list field ($field) For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between).
 splitTable_Uid ($str)
 Makes an backwards explode on the $str and returns an array with ($table,$uid).
 getSQLselectableList ($in_list, $tablename, $default_tablename)
 Returns a list of pure integers based on $in_list being a list of records with table-names prepended.
 BEenableFields ($table, $inv=0)
 Backend implementation of enableFields() Notice that "fe_groups" is not selected for - only disabled, starttime and endtime.
 mm_query ($select, $local_table, $mm_table, $foreign_table, $whereClause='', $groupBy='', $orderBy='', $limit='')
 Returns a SELECT query, selecting fields ($select) from two/three tables joined $local_table and $mm_table is mandatory.
 DBcompileInsert ($table, $fields_values)
 Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
 DBcompileUpdate ($table, $where, $fields_values)
 Creates an UPDATE SQL-statement for $table where $where-clause (typ.
 BEgetRootLine ($uid, $clause='')
 Returns what is called the 'RootLine'.
 openPageTree ($pid, $clearExpansion)
 Opens the page tree to the specified page id.
 getRecordPath ($uid, $clause, $titleLimit, $fullTitleLimit=0)
 Returns the path (visually) of a page $uid, fx.
 getExcludeFields ()
 Returns an array with the exclude-fields as defined in TCA Used for listing the exclude-fields in be_groups forms Usage: 2 (t3lib_tceforms + t3lib_transferdata).
 getExplicitAuthFieldValues ()
 Returns an array with explicit Allow/Deny fields.
 getSystemLanguages ()
 Returns an array with system languages:.
 readPageAccess ($id, $perms_clause)
 Returns a page record (of page with $id) with an extra field "_thePath" set to the record path IF the WHERE clause, $perms_clause, selects the record.
 getTCAtypes ($table, $rec, $useFieldNameAsKey=0)
 Returns the "types" configuration parsed into an array for the record, $rec, from table, $table Usage: 6.
 getTCAtypeValue ($table, $rec)
 Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $TCA If no "type" field is configured in the "ctrl"-section of the $TCA for the table, zero is used.
 getSpecConfParts ($str, $defaultExtras)
 Parses a part of the field lists in the "types"-section of $TCA arrays, namely the "special configuration" at index 3 (position 4) Elements are splitted by ":" and within those parts, parameters are splitted by "|".
 getSpecConfParametersFromArray ($pArr)
 Takes an array of "[key]=[value]" strings and returns an array with the keys set as keys pointing to the value.
 getFlexFormDS ($conf, $row, $table)
 Finds the Data Structure for a FlexForm field Usage: 5.
 storeHash ($hash, $data, $ident)
 Stores the string value $data in the 'cache_hash' table with the hash key, $hash, and visual/symbolic identification, $ident IDENTICAL to the function by same name found in t3lib_page: Usage: 2.
 getHash ($hash, $expTime)
 Retrieves the string content stored with hash key, $hash, in cache_hash IDENTICAL to the function by same name found in t3lib_page: Usage: 2.
 getPagesTSconfig ($id, $rootLine='', $returnPartArray=0)
 Returns the Page TSconfig for page with id, $id Requires class "t3lib_TSparser" Usage: 26 (spec.
 updatePagesTSconfig ($id, $pageTS, $TSconfPrefix, $impParams='')
 Updates Page TSconfig for a page with $id The function seems to take $pageTS as an array with properties and compare the values with those that already exists for the "object string", $TSconfPrefix, for the page, then sets those values which were not present.
 implodeTSParams ($p, $k='')
 Implodes a multi dimensional TypoScript array, $p, into a one-dimentional array (return value) Usage: 3.
 getUserNames ($fields='username, usergroup, usergroup_cached_list, uid', $where='')
 Returns an array with be_users records of all user NOT DELETED sorted by their username Keys in the array is the be_users uid Usage: 14 (spec.
 getGroupNames ($fields='title, uid', $where='')
 Returns an array with be_groups records (title, uid) of all groups NOT DELETED sorted by their title Usage: 8 (spec.
 getListGroupNames ($fields='title, uid')
 Returns an array with be_groups records (like ->getGroupNames) but: if the current BE_USER is admin, then all groups are returned, otherwise only groups that the current user is member of (usergroup_cached_list) will be returned.
 blindUserNames ($usernames, $groupArray, $excludeBlindedFlag=0)
 Returns the array $usernames with the names of all users NOT IN $groupArray changed to the uid (hides the usernames!).
 blindGroupNames ($groups, $groupArray, $excludeBlindedFlag=0)
 Corresponds to blindUserNames but works for groups instead Usage: 2 (module web_perm).
 daysUntil ($tstamp)
 Returns the difference in days between input $tstamp and $EXEC_TIME Usage: 2 (class t3lib_BEfunc).
 date ($tstamp)
 Returns $tstamp formatted as "ddmmyy" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy']) Usage: 11.
 datetime ($value)
 Returns $tstamp formatted as "ddmmyy hhmm" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy'] AND $TYPO3_CONF_VARS['SYS']['hhmm']) Usage: 28.
 time ($value)
 Returns $value (in seconds) formatted as hh:mm:ss For instance $value = 3600 + 60*2 + 3 should return "01:02:03" Usage: 1 (class t3lib_BEfunc).
 calcAge ($seconds, $labels= 'min|hrs|days|yrs')
 Returns the "age" in minutes / hours / days / years of the number of $seconds inputted.
 dateTimeAge ($tstamp, $prefix=1, $date='')
 Returns a formatted timestamp if $tstamp is set.
 titleAttrib ($content='', $hsc=0)
 Returns either title='' or alt='' attribute.
 titleAltAttrib ($content)
 Returns alt="" and title="" attributes with the value of $content.
 thumbCode ($row, $table, $field, $backPath, $thumbScript='', $uploaddir=NULL, $abs=0, $tparams='', $size='')
 Returns a linked image-tag for thumbnail(s)/fileicons/truetype-font-previews from a database row with a list of image files in a field All $TYPO3_CONF_VARS['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example) Thumbsnails are linked to the show_item.php script which will display further details.
 getThumbNail ($thumbScript, $theFile, $tparams='', $size='')
 Returns single image tag to thumbnail using a thumbnail script (like thumbs.php) Usage: 3.
 titleAttribForPages ($row, $perms_clause='', $includeAttrib=1)
 Returns title-attribute information for a page-record informing about id, alias, doktype, hidden, starttime, endtime, fe_group etc.
 getRecordIconAltText ($row, $table='pages')
 Returns title-attribute information for ANY record (from a table defined in TCA of course) The included information depends on features of the table, but if hidden, starttime, endtime and fe_group fields are configured for, information about the record status in regard to these features are is included.
 getLabelFromItemlist ($table, $col, $key)
 Returns the label of the first found entry in an "items" array from $TCA (tablename=$table/fieldname=$col) where the value is $key Usage: 9.
 getItemLabel ($table, $col, $printAllWrap='')
 Returns the label-value for fieldname $col in table, $table If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg.
 getRecordTitle ($table, $row, $prep=0)
 Returns the "title"-value in record, $row, from table, $table The field(s) from which the value is taken is determined by the "ctrl"-entries 'label', 'label_alt' and 'label_alt_force' Usage: 26.
 getProcessedValue ($table, $col, $value, $fixed_lgd_chars=0, $defaultPassthrough=0)
 Returns a human readable output of a value from a record For instance a database record relation would be looked up to display the title-value of that record.
 getProcessedValueExtra ($table, $fN, $fV, $fixed_lgd_chars=0)
 Same as ->getProcessedValue() but will go easy on fields like "tstamp" and "pid" which are not configured in TCA - they will be formatted by this function instead.
 getFileIcon ($ext)
 Returns file icon name (from $FILEICONS) for the fileextension $ext Usage: 10.
 getCommonSelectFields ($table, $prefix)
 Returns fields for a table, $table, which would typically be interesting to select This includes uid, the fields defined for title, icon-field.
 makeConfigForm ($configArray, $defaults, $dataPrefix)
 Makes a form for configuration of some values based on configuration found in the array $configArray, with default values from $defaults and a data-prefix $dataPrefix <form>-tags must be supplied separately Needs more documentation and examples, in particular syntax for configuration array.
 helpTextIcon ($table, $field, $BACK_PATH, $force=0)
 Returns help-text icon if configured for.
 helpText ($table, $field, $BACK_PATH, $styleAttrib='')
 Returns CSH help text (description), if configured for.
 cshItem ($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
 API for getting CSH icons/text for use in backend modules.
 editOnClick ($params, $backPath='', $requestUri='')
 Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.
 viewOnClick ($id, $backPath='', $rootLine='', $anchor='', $altUrl='', $addGetVars='')
 Returns a JavaScript string for viewing the page id, $id It will detect the correct domain name if needed and provide the link with the right back path.
 getModTSconfig ($id, $TSref)
 Returns the merged User/Page TSconfig for page id, $id.
 getFuncMenu ($mainParams, $elementName, $currentValue, $menuItems, $script='', $addparams='')
 Returns a selector box "function menu" for a module Requires the JS function jumpToUrl() to be available See Inside TYPO3 for details about how to use / make Function menus Usage: 50.
 getFuncCheck ($mainParams, $elementName, $currentValue, $script='', $addparams='', $tagParams='')
 Checkbox function menu.
 getFuncInput ($mainParams, $elementName, $currentValue, $size=10, $script="", $addparams="")
 Input field function menu Works like ->getFuncMenu() / ->getFuncCheck() but displays a input field instead which updates the script "onchange" Usage: 1.
 unsetMenuItems ($modTSconfig, $itemArray, $TSref)
 Removes menu items from $itemArray if they are configured to be removed by TSconfig for the module ($modTSconfig) See Inside TYPO3 about how to program modules and use this API.
 getSetUpdateSignal ($set='')
 Call to update the page tree frame (or something else..?) after t3lib_BEfunc::getSetUpdateSignal('updatePageTree') -> will set the page tree to be updated.
 getModuleData ($MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
 Returns an array which is most backend modules becomes MOD_SETTINGS containing values from function menus etc.
 lockRecords ($table='', $uid=0, $pid=0)
 Unlock or Lock a record from $table with $uid If $table and $uid is not set, then all locking for the current BE_USER is removed! Usage: 5.
 isRecordLocked ($table, $uid)
 Returns information about whether the record from table, $table, with uid, $uid is currently locked (edited by another user - which should issue a warning).
 exec_foreign_table_where_query ($fieldValue, $field='', $TSconfig=array(), $prefix='')
 Returns select statement for MM relations (as used by TCEFORMs etc) Usage: 3.

Member Function Documentation

t3lib_BEfunc::BEenableFields table,
inv = 0
 

Backend implementation of enableFields() Notice that "fe_groups" is not selected for - only disabled, starttime and endtime.

Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition. $GLOBALS["SIM_EXEC_TIME"] is used for date. Usage: 5

Parameters:
string $table is the table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $TCA.
boolean $inv means that the query will select all records NOT VISIBLE records (inverted selection)
Returns:
string WHERE clause part

Definition at line 390 of file class.t3lib_befunc.php.

Referenced by tx_cms_layout::getTable_tt_content(), and SC_db_layout::renderQuickEdit().

00390                                           {
00391       $ctrl = $GLOBALS['TCA'][$table]['ctrl'];
00392       $query=array();
00393       $invQuery=array();
00394       if (is_array($ctrl)) {
00395          if (is_array($ctrl['enablecolumns']))  {
00396             if ($ctrl['enablecolumns']['disabled'])   {
00397                $field = $table.'.'.$ctrl['enablecolumns']['disabled'];
00398                $query[]='NOT '.$field;
00399                $invQuery[]=$field;
00400             }
00401             if ($ctrl['enablecolumns']['starttime'])  {
00402                $field = $table.'.'.$ctrl['enablecolumns']['starttime'];
00403                $query[]='('.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')';
00404                $invQuery[]='('.$field.'!=0 AND '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')';
00405             }
00406             if ($ctrl['enablecolumns']['endtime']) {
00407                $field = $table.'.'.$ctrl['enablecolumns']['endtime'];
00408                $query[]='('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')';
00409                $invQuery[]='('.$field.'!=0 AND '.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')';
00410             }
00411          }
00412       }
00413       $outQ = ' AND '.($inv ? '('.implode(' OR ',$invQuery).')' : implode(' AND ',$query));
00414 
00415       return $outQ;
00416    }

t3lib_BEfunc::BEgetRootLine uid,
clause = ''
 

Returns what is called the 'RootLine'.

That is an array with information about the page records from a page id ($uid) and back to the root. By default deleted pages are filtered. This RootLine will follow the tree all the way to the root. This is opposite to another kind of root line known from the frontend where the rootline stops when a root-template is found. Usage: 1

Parameters:
integer Page id for which to create the root line.
string $clause can be used to select other criteria. It would typically be where-clauses that stops the proces if we meet a page, the user has no reading access to.
Returns:
array Root line array, all the way to the page tree root (or as far as $clause allows!)

Definition at line 519 of file class.t3lib_befunc.php.

References $val, debug(), deleteClause(), and fixVersioningPid().

Referenced by getPagesTSconfig(), getTCEFORM_TSconfig(), t3lib_userAuthGroup::isInWebMount(), and openPageTree().

00519                                              {
00520       $loopCheck = 100;
00521       $theRowArray = Array();
00522       $output=Array();
00523       while ($uid!=0 && $loopCheck>0)  {
00524          $loopCheck--;
00525          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00526                      'pid,uid,title,TSconfig,is_siteroot,storage_pid',
00527                      'pages',
00528                      'uid='.intval($uid).' '.
00529                         t3lib_BEfunc::deleteClause('pages').' '.
00530                         $clause     // whereClauseMightContainGroupOrderBy
00531                   );
00532          if ($GLOBALS['TYPO3_DB']->sql_error()) {
00533             debug($GLOBALS['TYPO3_DB']->sql_error(),1);
00534          }
00535          if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00536             t3lib_BEfunc::fixVersioningPid('pages',$row);
00537             $uid = $row['pid'];
00538             $theRowArray[]=$row;
00539          } else {
00540             break;
00541          }
00542       }
00543       if ($uid==0) {$theRowArray[]=Array('uid'=>0,'title'=>'');}
00544       if (is_array($theRowArray))   {
00545          reset($theRowArray);
00546          $c=count($theRowArray);
00547          while(list($key,$val)=each($theRowArray)) {
00548             $c--;
00549             $output[$c]['uid'] = $val['uid'];
00550             $output[$c]['pid'] = $val['pid'];
00551             if (isset($val['_ORIG_pid'])) $output[$c]['_ORIG_pid'] = $val['_ORIG_pid'];
00552             $output[$c]['title'] = $val['title'];
00553             $output[$c]['TSconfig'] = $val['TSconfig'];
00554             $output[$c]['is_siteroot'] = $val['is_siteroot'];
00555             $output[$c]['storage_pid'] = $val['storage_pid'];
00556          }
00557       }
00558       return $output;
00559    }

t3lib_BEfunc::blindGroupNames groups,
groupArray,
excludeBlindedFlag = 0
 

Corresponds to blindUserNames but works for groups instead Usage: 2 (module web_perm).

Parameters:
array Group names
array Group names (reference)
boolean If $excludeBlindedFlag is set, then these records are unset from the array $usernames
Returns:
array

Definition at line 1334 of file class.t3lib_befunc.php.

Referenced by SC_mod_web_perm_index::doEdit(), and SC_mod_web_perm_index::notEdit().

01334                                                                         {
01335       if (is_array($groups) && is_array($groupArray)) {
01336          while(list($uid,$row)=each($groups))   {
01337             $groupN=$uid;
01338             $set=0;
01339             if (t3lib_div::inArray($groupArray,$uid)) {
01340                $groupN=$row['title'];
01341                $set=1;
01342             }
01343             $groups[$uid]['title']=$groupN;
01344             if ($excludeBlindedFlag && !$set) {unset($groups[$uid]);}
01345          }
01346       }
01347       return $groups;
01348    }

t3lib_BEfunc::blindUserNames usernames,
groupArray,
excludeBlindedFlag = 0
 

Returns the array $usernames with the names of all users NOT IN $groupArray changed to the uid (hides the usernames!).

If $excludeBlindedFlag is set, then these records are unset from the array $usernames Takes $usernames (array made by t3lib_BEfunc::getUserNames()) and a $groupArray (array with the groups a certain user is member of) as input Usage: 8

Parameters:
array User names
array Group names
boolean If $excludeBlindedFlag is set, then these records are unset from the array $usernames
Returns:
array User names, blinded

Definition at line 1301 of file class.t3lib_befunc.php.

Referenced by SC_mod_web_perm_index::doEdit(), tx_cms_layout::getPageInfoBox(), and SC_mod_web_perm_index::notEdit().

01301                                                                            {
01302       if (is_array($usernames) && is_array($groupArray)) {
01303          while(list($uid,$row)=each($usernames))   {
01304             $userN=$uid;
01305             $set=0;
01306             if ($row['uid']!=$GLOBALS['BE_USER']->user['uid']) {
01307                reset($groupArray);
01308                while(list(,$v)=each($groupArray))  {
01309                   if ($v && t3lib_div::inList($row['usergroup_cached_list'],$v)) {
01310                      $userN = $row['username'];
01311                      $set=1;
01312                   }
01313                }
01314             } else {
01315                $userN = $row['username'];
01316                $set=1;
01317             }
01318             $usernames[$uid]['username']=$userN;
01319             if ($excludeBlindedFlag && !$set) {unset($usernames[$uid]);}
01320          }
01321       }
01322       return $usernames;
01323    }

t3lib_BEfunc::calcAge seconds,
labels = 'min|hrs|days|yrs'
 

Returns the "age" in minutes / hours / days / years of the number of $seconds inputted.

Usage: 15

Parameters:
integer $seconds could be the difference of a certain timestamp and time()
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")
Returns:
string Formatted time

Definition at line 1428 of file class.t3lib_befunc.php.

Referenced by isRecordLocked(), and tx_cms_layout::tt_board_drawItem().

01428                                                             {
01429       $labelArr = explode('|',$labels);
01430       $prefix='';
01431       if ($seconds<0)   {$prefix='-'; $seconds=abs($seconds);}
01432       if ($seconds<3600)   {
01433          $seconds = round ($seconds/60).' '.trim($labelArr[0]);
01434       } elseif ($seconds<24*3600)   {
01435          $seconds = round ($seconds/3600).' '.trim($labelArr[1]);
01436       } elseif ($seconds<365*24*3600)  {
01437          $seconds = round ($seconds/(24*3600)).' '.trim($labelArr[2]);
01438       } else {
01439          $seconds = round ($seconds/(365*24*3600)).' '.trim($labelArr[3]);
01440       }
01441       return $prefix.$seconds;
01442    }

t3lib_BEfunc::cshItem table,
field,
BACK_PATH,
wrap = '',
onlyIconMode = FALSE,
styleAttrib = ''
 

API for getting CSH icons/text for use in backend modules.

TCA_DESCR will be loaded if it isn't already Usage: ?

Parameters:
string Table name ('_MOD_'+module name)
string Field name (CSH locallang main key)
string Back path
string Wrap code for icon-mode, splitted by "|". Not used for full-text mode.
boolean If set, the full text will never be shown (only icon). Useful for places where it will break the page if the table with full text is shown.
string Additional style-attribute content for wrapping table (full text mode only)
Returns:
string HTML content for help text
See also:
helpText(), helpTextIcon()

Definition at line 2099 of file class.t3lib_befunc.php.

References $LANG, helpText(), helpTextIcon(), and table().

Referenced by SC_mod_tools_em_index::alterSettings(), SC_mod_web_perm_index::doEdit(), SC_mod_tools_em_index::extensionList_import(), SC_mod_tools_em_index::extensionList_installed(), SC_mod_tools_em_index::extensionList_loaded(), SC_wizard_forms::getFormHTML(), tx_cms_layout::getTable_pages(), tx_cms_layout::getTable_tt_content(), tx_wizardsortpages_webfunc_2::main(), tx_wizardcrpages_webfunc_2::main(), tx_infopagetsconfig_webinfo::main(), tx_cms_webinfo_lang::main(), tx_cms_webinfo_page::main(), SC_db_layout::main(), SC_move_el::main(), SC_mod_user_setup_index::main(), SC_mod_web_info_index::main(), SC_mod_web_func_index::main(), SC_file_upload::main(), SC_file_rename::main(), SC_file_newfolder::main(), SC_file_edit::main(), SC_alt_menu::main(), SC_alt_file_navframe::main(), SC_alt_doc::main(), SC_alt_db_navframe::main(), SC_alt_doc::makeCmenu(), SC_alt_doc::makeDocSel(), SC_mod_web_perm_index::notEdit(), SC_db_new::pagesOnly(), SC_db_new::regularNew(), SC_db_layout::renderListContent(), SC_db_layout::renderQuickEdit(), SC_mod_user_setup_index::setLabel(), and SC_mod_tools_em_index::showExtDetails().

02099                                                                                              {
02100       global $TCA_DESCR, $LANG, $BE_USER;
02101       if ($BE_USER->uc['edit_showFieldHelp'])   {
02102          $LANG->loadSingleTableDescription($table);
02103 
02104          if (is_array($TCA_DESCR[$table]))   {
02105                // Creating CSH icon and short description:
02106             $fullText = t3lib_BEfunc::helpText($table,$field,$BACK_PATH,$styleAttrib);
02107             $icon = t3lib_BEfunc::helpTextIcon($table,$field,$BACK_PATH,$onlyIconMode);
02108 
02109             if ($fullText && !$onlyIconMode) {
02110                $output = $fullText;
02111             } else {
02112                #$output = '<span style="position:absolute; filter: alpha(opacity=50); -moz-opacity: 0.50;">'.$icon.'</span>';
02113                $output = $icon;
02114 
02115                if ($output && $wrap)   {
02116                   $wrParts = explode('|',$wrap);
02117                   $output = $wrParts[0].$output.$wrParts[1];
02118                }
02119             }
02120 
02121             return $output;
02122          }
02123       }
02124    }

t3lib_BEfunc::date tstamp  ) 
 

Returns $tstamp formatted as "ddmmyy" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy']) Usage: 11.

Parameters:
integer Time stamp, seconds
Returns:
string Formatted time

Definition at line 1389 of file class.t3lib_befunc.php.

Referenced by dateTimeAge(), tx_cms_layout::getPageInfoBox(), getProcessedValue(), getRecordIconAltText(), tx_cms_webinfo_page::main(), and titleAttribForPages().

01389                            {
01390       return Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$tstamp);
01391    }

t3lib_BEfunc::datetime value  ) 
 

Returns $tstamp formatted as "ddmmyy hhmm" (According to $TYPO3_CONF_VARS['SYS']['ddmmyy'] AND $TYPO3_CONF_VARS['SYS']['hhmm']) Usage: 28.

Parameters:
integer Time stamp, seconds
Returns:
string Formatted time

Definition at line 1400 of file class.t3lib_befunc.php.

Referenced by dateTimeAge(), tx_cms_layout::getPageInfoBox(), getProcessedValue(), and getProcessedValueExtra().

01400                               {
01401       return Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'].' '.$GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],$value);
01402    }

t3lib_BEfunc::dateTimeAge tstamp,
prefix = 1,
date = ''
 

Returns a formatted timestamp if $tstamp is set.

The date/datetime will be followed by the age in parenthesis. Usage: 3

Parameters:
integer Time stamp, seconds
integer 1/-1 depending on polarity of age.
string $date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm"
Returns:
string

Definition at line 1454 of file class.t3lib_befunc.php.

References date(), datetime(), and time().

Referenced by titleAttribForPages().

01454                                                       {
01455       return $tstamp ?
01456             ($date=='date' ? t3lib_BEfunc::date($tstamp) : t3lib_BEfunc::datetime($tstamp)).
01457             ' ('.t3lib_BEfunc::calcAge($prefix*(time()-$tstamp),$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')).')' : '';
01458    }

t3lib_BEfunc::daysUntil tstamp  ) 
 

Returns the difference in days between input $tstamp and $EXEC_TIME Usage: 2 (class t3lib_BEfunc).

Parameters:
integer Time stamp, seconds
Returns:
integer

Definition at line 1377 of file class.t3lib_befunc.php.

01377                                  {
01378       $delta_t = $tstamp-$GLOBALS['EXEC_TIME'];
01379       return ceil($delta_t/(3600*24));
01380    }

t3lib_BEfunc::DBcompileInsert table,
fields_values
 

Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.

DEPRECIATED - $GLOBALS['TYPO3_DB']->INSERTquery() directly instead! But better yet, use $GLOBALS['TYPO3_DB']->exec_INSERTquery()

Parameters:
string Table name
array Field values as key=>value pairs.
Returns:
string Full SQL query for INSERT

Definition at line 476 of file class.t3lib_befunc.php.

References table().

00476                                                    {
00477       return $GLOBALS['TYPO3_DB']->INSERTquery($table, $fields_values);
00478    }

t3lib_BEfunc::DBcompileUpdate table,
where,
fields_values
 

Creates an UPDATE SQL-statement for $table where $where-clause (typ.

'uid=...') from the array with field/value pairs $fields_values. DEPRECIATED - $GLOBALS['TYPO3_DB']->UPDATEquery() directly instead! But better yet, use $GLOBALS['TYPO3_DB']->exec_UPDATEquery()

Parameters:
string Database tablename
string WHERE clause, eg. "uid=1"
array Field values as key=>value pairs.
Returns:
string Full SQL query for UPDATE

Definition at line 490 of file class.t3lib_befunc.php.

References table().

00490                                                             {
00491       return $GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fields_values);
00492    }

t3lib_BEfunc::deleteClause table  ) 
 

Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field is configured in $TCA for the tablename, $table This function should ALWAYS be called in the backend for selection on tables which are configured in TCA since it will ensure consistent selection of records, even if they are marked deleted (in which case the system must always treat them as non-existent!) In the frontend a function, ->enableFields(), is known to filter hidden-field, start- and endtime and fe_groups as well.

But that is a job of the frontend, not the backend. If you need filtering on those fields as well in the backend you can use ->BEenableFields() though. Usage: 71

Parameters:
string Table name present in $TCA
Returns:
string WHERE clause for filtering out deleted records, eg " AND NOT tablename.deleted"

Definition at line 188 of file class.t3lib_befunc.php.

References $TCA.

Referenced by BEgetRootLine(), exec_foreign_table_where_query(), getRecord(), getRecordPath(), getRecordsByField(), getSystemLanguages(), tx_cms_layout::getTable_pages(), tx_cms_layout::getTable_sys_note(), tx_cms_layout::getTable_tt_board(), t3lib_positionMap::printContentElementColumns(), and SC_db_layout::renderQuickEdit().

00188                                  {
00189       global $TCA;
00190       if ($TCA[$table]['ctrl']['delete']) {
00191          return ' AND NOT '.$table.'.'.$TCA[$table]['ctrl']['delete'];
00192       } else {
00193          return '';
00194       }
00195    }

t3lib_BEfunc::editOnClick params,
backPath = '',
requestUri = ''
 

Returns a JavaScript string (for an onClick handler) which will load the alt_doc.php script that shows the form for editing of the record(s) you have send as params.

REMEMBER to always htmlspecialchar() content in href-properties to ampersands get converted to entities (XHTML requirement and XSS precaution) Usage: 35

Parameters:
string $params is parameters sent along to alt_doc.php. This requires a much more details description which you must seek in Inside TYPO3s documentation of the alt_doc.php API. And example could be '&edit[pages][123]=edit' which will show edit form for page record 123.
string $backPath must point back to the TYPO3_mainDir directory (where alt_doc.php is)
string $requestUri is an optional returnUrl you can set - automatically set to REQUEST_URI.
Returns:
string
See also:
template::issueCommand()

Definition at line 2137 of file class.t3lib_befunc.php.

Referenced by tx_cms_layout::linkEditContent(), SC_db_new::linkWrap(), tx_infopagetsconfig_webinfo::main(), tx_cms_layout::newContentElementOnClick(), t3lib_positionMap::onClickEvent(), and tx_cms_layout::tt_content_drawHeader().

02137                                                                {
02138       $retUrl = 'returnUrl='.($requestUri==-1?"'+T3_THIS_LOCATION+'":rawurlencode($requestUri?$requestUri:t3lib_div::getIndpEnv('REQUEST_URI')));
02139       return "document.location='".$backPath."alt_doc.php?".$retUrl.$params."'; return false;";
02140    }

t3lib_BEfunc::exec_foreign_table_where_query fieldValue,
field = '',
TSconfig = array(),
prefix = ''
 

Returns select statement for MM relations (as used by TCEFORMs etc) Usage: 3.

Parameters:
array Configuration array for the field, taken from $TCA
string Field name
array TSconfig array from which to get further configuration settings for the field name
string Prefix string for the key "*foreign_table_where" from $fieldValue array
Returns:
string Part of query

Definition at line 2509 of file class.t3lib_befunc.php.

References $TCA, deleteClause(), and getCommonSelectFields().

Referenced by getSingleField_typeFlex_sheetMenu(), and t3lib_transferData::selectAddForeign().

t3lib_BEfunc::fixVersioningPid table,
&$  rr
 

Find page-tree PID for versionized record Will look if the "pid" value of the input record is -1 and if the table supports versioning - if so, it will translate the -1 PID into the PID of the original record.

Parameters:
string Table name
array Record array passed by reference. As minimum, "pid" and "uid" fields must exist! "t3ver_oid" is nice and will save you a DB query.
Returns:
void (Passed by ref).
See also:
t3lib_page::fixVersioningPid()

Definition at line 286 of file class.t3lib_befunc.php.

References $TCA, getRecord(), and table().

Referenced by BEgetRootLine(), SC_wizard_rte::checkEditAccess(), t3lib_TCEmain::doesRecordExist(), getFlexFormDS(), getRecordPath(), t3lib_TCEmain::getRecordProperties(), getSingleField_typeFlex_sheetMenu(), and SC_alt_doc::makeEditForm().

00286                                           {
00287       global $TCA;
00288 
00289       if ($rr['pid']==-1 && $TCA[$table]['ctrl']['versioning'])   {
00290          if ($rr['t3ver_oid']>0) {  // If "t3ver_oid" is already a field, just set this:
00291             $oid = $rr['t3ver_oid'];
00292          } else { // Otherwise we have to expect "uid" to be in the record and look up based on this:
00293             $newPidRec = t3lib_BEfunc::getRecord($table,$rr['uid'],'t3ver_oid');
00294             if (is_array($newPidRec))  {
00295                $oid = $newPidRec['t3ver_oid'];
00296             }
00297          }
00298 
00299             // If ID of current online version is found, look up the PID value of that:
00300          if ($oid)   {
00301             $oidRec = t3lib_BEfunc::getRecord($table,$oid,'pid');
00302             if (is_array($oidRec))  {
00303                $rr['_ORIG_pid'] = $rr['pid'];
00304                $rr['pid'] = $oidRec['pid'];
00305             }
00306          }
00307       }
00308    }

t3lib_BEfunc::getCommonSelectFields table,
prefix
 

Returns fields for a table, $table, which would typically be interesting to select This includes uid, the fields defined for title, icon-field.

Returned as a list ready for query ($prefix can be set to eg. "pages." if you are selecting from the pages table and want the table name prefixed) Usage: 3

Parameters:
string Table name, present in TCA
string Table prefix
Returns:
string List of fields.

Definition at line 1910 of file class.t3lib_befunc.php.

References $TCA, and table().

Referenced by exec_foreign_table_where_query().

01910                                                    {
01911       global $TCA;
01912       $fields = array();
01913       $fields[] = $prefix.'uid';
01914       $fields[] = $prefix.$TCA[$table]['ctrl']['label'];
01915 
01916       if ($TCA[$table]['ctrl']['label_alt']) {
01917          $secondFields = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1);
01918          foreach($secondFields as $fieldN)   {
01919             $fields[] = $prefix.$fieldN;
01920          }
01921       }
01922       if ($TCA[$table]['ctrl']['versioning'])   {
01923          $fields[] = $prefix.'t3ver_id';
01924       }
01925 
01926       if ($TCA[$table]['ctrl']['selicon_field'])   $fields[] = $prefix.$TCA[$table]['ctrl']['selicon_field'];
01927       if ($TCA[$table]['ctrl']['typeicon_column']) $fields[] = $prefix.$TCA[$table]['ctrl']['typeicon_column'];
01928 
01929       if (is_array($TCA[$table]['ctrl']['enablecolumns']))     {
01930          if ($TCA[$table]['ctrl']['enablecolumns']['disabled'])   $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['disabled'];
01931          if ($TCA[$table]['ctrl']['enablecolumns']['starttime'])  $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['starttime'];
01932          if ($TCA[$table]['ctrl']['enablecolumns']['endtime']) $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['endtime'];
01933          if ($TCA[$table]['ctrl']['enablecolumns']['fe_group'])   $fields[] = $prefix.$TCA[$table]['ctrl']['enablecolumns']['fe_group'];
01934       }
01935 
01936       return implode(',',array_unique($fields));
01937    }

t3lib_BEfunc::getExcludeFields  ) 
 

Returns an array with the exclude-fields as defined in TCA Used for listing the exclude-fields in be_groups forms Usage: 2 (t3lib_tceforms + t3lib_transferdata).

Returns:
array Array of arrays with excludeFields (fieldname, table:fieldname) from all TCA entries

Definition at line 655 of file class.t3lib_befunc.php.

References $TCA, and table().

Referenced by getSingleField_typeFlex_sheetMenu(), and t3lib_transferData::selectAddSpecial().

00655                                  {
00656       global $TCA;
00657          // All TCA keys:
00658       $theExcludeArray = Array();
00659       $tc_keys = array_keys($TCA);
00660       foreach($tc_keys as $table)   {
00661             // Load table
00662          t3lib_div::loadTCA($table);
00663             // All field names configured:
00664          if (is_array($TCA[$table]['columns'])) {
00665             $f_keys = array_keys($TCA[$table]['columns']);
00666             foreach($f_keys as $field) {
00667                if ($TCA[$table]['columns'][$field]['exclude']) {
00668                      // Get Human Readable names of fields and table:
00669                   $Fname=$GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
00670                      // add entry:
00671                   $theExcludeArray[] = Array($Fname , $table.':'.$field);
00672                }
00673             }
00674          }
00675       }
00676       return $theExcludeArray;
00677    }

t3lib_BEfunc::getExplicitAuthFieldValues  ) 
 

Returns an array with explicit Allow/Deny fields.

Used for listing these field/value pairs in be_groups forms

Returns:
array Array with information from all of $TCA

Definition at line 685 of file class.t3lib_befunc.php.

References $TCA, and table().

Referenced by getSingleField_typeFlex_sheetMenu(), and t3lib_transferData::selectAddSpecial().

00685                                           {
00686       global $TCA;
00687 
00688          // Initialize:
00689       $adLabel = array(
00690          'ALLOW' => $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.allow'),
00691          'DENY' => $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.deny'),
00692       );
00693 
00694          // All TCA keys:
00695       $allowDenyOptions = Array();
00696       $tc_keys = array_keys($TCA);
00697       foreach($tc_keys as $table)   {
00698 
00699             // Load table
00700          t3lib_div::loadTCA($table);
00701 
00702             // All field names configured:
00703          if (is_array($TCA[$table]['columns'])) {
00704             $f_keys = array_keys($TCA[$table]['columns']);
00705             foreach($f_keys as $field) {
00706                $fCfg = $TCA[$table]['columns'][$field]['config'];
00707                if ($fCfg['type']=='select' && $fCfg['authMode'])  {
00708 
00709                      // Check for items:
00710                   if (is_array($fCfg['items'])) {
00711                         // Get Human Readable names of fields and table:
00712                      $allowDenyOptions[$table.':'.$field]['tableFieldLabel'] = $GLOBALS['LANG']->sl($TCA[$table]['ctrl']['title']).': '.$GLOBALS['LANG']->sl($TCA[$table]['columns'][$field]['label']);
00713 
00714                         // Check for items:
00715                      foreach($fCfg['items'] as $iVal) {
00716                         if (strcmp($iVal[1],''))   {  // Values '' is not controlled by this setting.
00717 
00718                               // Find iMode:
00719                            $iMode = '';
00720                            switch((string)$fCfg['authMode'])   {
00721                               case 'explicitAllow':
00722                                  $iMode = 'ALLOW';
00723                               break;
00724                               case 'explicitDeny':
00725                                  $iMode = 'DENY';
00726                               break;
00727                               case 'individual':
00728                                  if (!strcmp($iVal[4],'EXPL_ALLOW')) {
00729                                     $iMode = 'ALLOW';
00730                                  } elseif (!strcmp($iVal[4],'EXPL_DENY'))  {
00731                                     $iMode = 'DENY';
00732                                  }
00733                               break;
00734                            }
00735 
00736                               // Set iMode:
00737                            if ($iMode) {
00738                               $allowDenyOptions[$table.':'.$field]['items'][$iVal[1]] = array($iMode, $GLOBALS['LANG']->sl($iVal[0]), $adLabel[$iMode]);
00739                            }
00740                         }
00741                      }
00742                   }
00743                }
00744             }
00745          }
00746       }
00747 
00748       return $allowDenyOptions;
00749    }

t3lib_BEfunc::getFileIcon ext  ) 
 

Returns file icon name (from $FILEICONS) for the fileextension $ext Usage: 10.

Parameters:
string File extension, lowercase
Returns:
string File icon filename

Definition at line 1896 of file class.t3lib_befunc.php.

Referenced by localFolderTree::SC_browse_links::expandPage(), getSingleField_typeGroup(), SC_show_item::renderFileInfo(), and thumbCode().

01896                               {
01897       return $GLOBALS['FILEICONS'][$ext] ? $GLOBALS['FILEICONS'][$ext] : $GLOBALS['FILEICONS']['default'];
01898    }

t3lib_BEfunc::getFlexFormDS conf,
row,
table
 

Finds the Data Structure for a FlexForm field Usage: 5.

Parameters:
array Field config array
array Record data
string The table name
Returns:
mixed If array, the data structure was found and returned as an array. Otherwise (string) it is an error message.
See also:
t3lib_TCEforms::getSingleField_typeFlex()

Definition at line 942 of file class.t3lib_befunc.php.

References fixVersioningPid(), getRecord(), and table().

Referenced by t3lib_TCEmain::checkValue_flex(), t3lib_TCEmain::copyRecord_procBasedOnFieldType(), getSingleField_typeFlex(), t3lib_TCEmain::remapListedDBRecords(), and t3lib_transferData::renderRecord_flexProc().

00942                                              {
00943 
00944          // Get pointer field etc from TCA-config:
00945       $ds_pointerField =   $conf['ds_pointerField'];
00946       $ds_array =       $conf['ds'];
00947       $ds_tableField =  $conf['ds_tableField'];
00948       $ds_searchParentField =    $conf['ds_pointerField_searchParent'];
00949 
00950          // Find source value:
00951       $dataStructArray='';
00952       if (is_array($ds_array))   {  // If there is a data source array, that takes precedence
00953             // If a pointer field is set, take the value from that field in the $row array and use as key.
00954          if ($ds_pointerField)   {
00955             $srcPointer = $row[$ds_pointerField];
00956             $srcPointer = isset($ds_array[$srcPointer]) ? $srcPointer : 'default';
00957          } else $srcPointer='default';
00958 
00959             // 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.
00960          if (substr($ds_array[$srcPointer],0,5)=='FILE:')   {
00961             $file = t3lib_div::getFileAbsFileName(substr($ds_array[$srcPointer],5));
00962             if ($file && @is_file($file)) {
00963                $dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file));
00964             } else $dataStructArray = 'The file "'.substr($dsSrc,5).'" in ds-array key "'.$srcPointer.'" was not found ("'.$file.'")'; // Error message.
00965          } else {
00966             $dataStructArray = t3lib_div::xml2array($ds_array[$srcPointer]);
00967          }
00968 
00969       } elseif ($ds_pointerField) { // If pointer field AND possibly a table/field is set:
00970             // Value of field pointed to:
00971          $srcPointer = $row[$ds_pointerField];
00972 
00973             // Searching recursively back if 'ds_pointerField_searchParent' is defined (typ. a page rootline, or maybe a tree-table):
00974          if ($ds_searchParentField && !$srcPointer)   {
00975             $rr = t3lib_BEfunc::getRecord($table,$row['uid'],'uid,'.$ds_searchParentField);  // Get the "pid" field - we cannot know that it is in the input record!
00976             t3lib_BEfunc::fixVersioningPid($table,$rr);
00977             $uidAcc=array();  // Used to avoid looping, if any should happen.
00978             $subFieldPointer = $conf['ds_pointerField_searchParent_subField'];
00979             while(!$srcPointer)     {
00980                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00981                            'uid,'.$ds_pointerField.','.$ds_searchParentField.($subFieldPointer?','.$subFieldPointer:''),
00982                            $table,
00983                            'uid='.intval($rr[$ds_searchParentField]).t3lib_BEfunc::deleteClause($table)
00984                         );
00985                $rr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00986 
00987                   // break if no result from SQL db or if looping...
00988                if (!is_array($rr) || isset($uidAcc[$rr['uid']]))  break;
00989                $uidAcc[$rr['uid']]=1;
00990 
00991                t3lib_BEfunc::fixVersioningPid($table,$rr);
00992                $srcPointer = ($subFieldPointer && $rr[$subFieldPointer]) ? $rr[$subFieldPointer] : $rr[$ds_pointerField];
00993             }
00994          }
00995 
00996             // If there is a srcPointer value:
00997          if ($srcPointer)  {
00998             if (t3lib_div::testInt($srcPointer))   {  // If integer, then its a record we will look up:
00999                list($tName,$fName) = explode(':',$ds_tableField,2);
01000                if ($tName && $fName && is_array($GLOBALS['TCA'][$tName]))  {
01001                   $dataStructRec = t3lib_BEfunc::getRecord($tName, $srcPointer);
01002                   $dataStructArray = t3lib_div::xml2array($dataStructRec[$fName]);
01003                } else $dataStructArray = 'No tablename ('.$tName.') or fieldname ('.$fName.') was found an valid!';
01004             } else { // Otherwise expect it to be a file:
01005                $file = t3lib_div::getFileAbsFileName($srcPointer);
01006                if ($file && @is_file($file)) {
01007                   $dataStructArray = t3lib_div::xml2array(t3lib_div::getUrl($file));
01008                } else $dataStructArray='The file "'.$srcPointer.'" was not found ("'.$file.'")';   // Error message.
01009             }
01010          } else $dataStructArray='No source value in fieldname "'.$ds_pointerField.'"';   // Error message.
01011       } else $dataStructArray='No proper configuration!';
01012       return $dataStructArray;
01013    }

t3lib_BEfunc::getFuncCheck mainParams,
elementName,
currentValue,
script = '',
addparams = '',
tagParams = ''
 

Checkbox function menu.

Works like ->getFuncMenu() but takes no $menuItem array since this is a simple checkbox. Usage: 34

Parameters:
mixed $mainParams $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
string $elementName it the form elements name, probably something like "SET[...]"
string $currentValue is the value to be selected currently.
string $script is the script to send the &id to, if empty it's automatically found
string $addParams is additional parameters to pass to the script.
string Additional attributes for the checkbox input tag
Returns:
string HTML code for checkbox
See also:
getFuncMenu()

Definition at line 2245 of file class.t3lib_befunc.php.

References PATH_thisScript.

Referenced by SC_mod_tools_em_index::main(), localFolderTree::SC_browse_links::main_file(), SC_db_layout::renderListContent(), and SC_db_layout::renderQuickEdit().

02245                                                                                                          {
02246       if (!is_array($mainParams)) {
02247          $mainParams = array('id' => $mainParams);
02248       }
02249       $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
02250 
02251       if (!$script) {basename(PATH_thisScript);}
02252       $onClick = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+(this.checked?1:0),this);';
02253       return '<input type="checkbox" name="'.$elementName.'"'.($currentValue?' checked="checked"':'').' onclick="'.htmlspecialchars($onClick).'"'.($tagParams?' '.$tagParams:'').' />';
02254    }

t3lib_BEfunc::getFuncInput mainParams,
elementName,
currentValue,
size = 10,
script = "",
addparams = ""
 

Input field function menu Works like ->getFuncMenu() / ->getFuncCheck() but displays a input field instead which updates the script "onchange" Usage: 1.

Parameters:
mixed $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
string $elementName it the form elements name, probably something like "SET[...]"
string $currentValue is the value to be selected currently.
integer Relative size of input field, max is 48
string $script is the script to send the &id to, if empty it's automatically found
string $addParams is additional parameters to pass to the script.
Returns:
string HTML code for input text field.
See also:
getFuncMenu()

Definition at line 2270 of file class.t3lib_befunc.php.

References PATH_thisScript.

02270                                                                                                    {
02271       if (!is_array($mainParams)) {
02272          $mainParams = array('id' => $mainParams);
02273       }
02274       $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
02275 
02276       if (!$script) {basename(PATH_thisScript);}
02277       $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+escape(this.value),this);';
02278       return '<input type="text"'.$GLOBALS['TBE_TEMPLATE']->formWidth($size).' name="'.$elementName.'" value="'.htmlspecialchars($currentValue).'" onchange="'.htmlspecialchars($onChange).'" />';
02279    }

t3lib_BEfunc::getFuncMenu mainParams,
elementName,
currentValue,
menuItems,
script = '',
addparams = ''
 

Returns a selector box "function menu" for a module Requires the JS function jumpToUrl() to be available See Inside TYPO3 for details about how to use / make Function menus Usage: 50.

Parameters:
mixed $id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
string $elementName it the form elements name, probably something like "SET[...]"
string $currentValue is the value to be selected currently.
array $menuItems is an array with the menu items for the selector box
string $script is the script to send the &id to, if empty it's automatically found
string $addParams is additional parameters to pass to the script.
Returns:
string HTML code for selector box

Definition at line 2202 of file class.t3lib_befunc.php.

References PATH_thisScript.

Referenced by tx_infopagetsconfig_webinfo::main(), tx_cms_webinfo_lang::main(), tx_cms_webinfo_page::main(), SC_db_layout::main(), SC_mod_web_perm_index::main(), SC_mod_tools_em_index::main(), SC_mod_web_perm_index::notEdit(), SC_db_layout::renderListContent(), and SC_mod_tools_em_index::showExtDetails().

02202                                                                                                       {
02203       if (is_array($menuItems))  {
02204          if (!is_array($mainParams)) {
02205             $mainParams = array('id' => $mainParams);
02206          }
02207          $mainParams = t3lib_div::implodeArrayForUrl('',$mainParams);
02208 
02209          if (!$script) { $script=basename(PATH_thisScript); }
02210 
02211          $options = array();
02212          foreach($menuItems as $value => $label)   {
02213             $options[] = '<option value="'.htmlspecialchars($value).'"'.(!strcmp($currentValue,$value)?' selected="selected"':'').'>'.
02214                         t3lib_div::deHSCentities(htmlspecialchars($label)).
02215                         '</option>';
02216          }
02217          if (count($options)) {
02218             $onChange = 'jumpToUrl(\''.$script.'?'.$mainParams.$addparams.'&'.$elementName.'=\'+this.options[this.selectedIndex].value,this);';
02219             return '
02220 
02221                <!-- Function Menu of module -->
02222                <select name="'.$elementName.'" onchange="'.htmlspecialchars($onChange).'">
02223                   '.implode('
02224                   ',$options).'
02225                </select>
02226                      ';
02227          }
02228       }
02229    }

t3lib_BEfunc::getGroupNames fields = 'title,
uid'  ,
where = ''
 

Returns an array with be_groups records (title, uid) of all groups NOT DELETED sorted by their title Usage: 8 (spec.

ext. "beuser" and module "web_perm")

Parameters:
string Field list
string WHERE clause
Returns:
array

Definition at line 1265 of file class.t3lib_befunc.php.

Referenced by SC_mod_web_perm_index::doEdit(), getListGroupNames(), and SC_mod_web_perm_index::notEdit().

01265                                                             {
01266       $be_group_Array = Array();
01267       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_groups', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_groups'), '', 'title');
01268       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
01269          $be_group_Array[$row['uid']] = $row;
01270       }
01271       return $be_group_Array;
01272    }

t3lib_BEfunc::getHash hash,
expTime
 

Retrieves the string content stored with hash key, $hash, in cache_hash IDENTICAL to the function by same name found in t3lib_page: Usage: 2.

Parameters:
string Hash key, 32 bytes hex
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.
Returns:
string

Definition at line 1068 of file class.t3lib_befunc.php.

Referenced by t3lib_userAuthGroup::fetchGroupData(), and getPagesTSconfig().

01068                                     {
01069          // if expTime is not set, the hash will never expire
01070       $expTime = intval($expTime);
01071       if ($expTime)  {
01072          $whereAdd = ' AND tstamp > '.(time()-$expTime);
01073       }
01074       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash="'.$GLOBALS['TYPO3_DB']->quoteStr($hash, 'cache_hash').'"'.$whereAdd);
01075       if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
01076          return $row['content'];
01077       }
01078    }

t3lib_BEfunc::getItemLabel table,
col,
printAllWrap = ''
 

Returns the label-value for fieldname $col in table, $table If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg.

$printAllWrap='|' and the fieldname was 'not_found_field' then the return value would be 'not_found_field' Usage: 17

Parameters:
string Table name, present in $TCA
string Field name
string Wrap value - set function description
Returns:
string

Definition at line 1717 of file class.t3lib_befunc.php.

References $TCA, and table().

01717                                                          {
01718       global $TCA;
01719          // Load full TCA for $table
01720       t3lib_div::loadTCA($table);
01721          // Check if column exists
01722       if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]))  {
01723             // Re
01724          return $TCA[$table]['columns'][$col]['label'];
01725       }
01726       if ($printAllWrap)   {
01727          $parts = explode('|',$printAllWrap);
01728          return $parts[0].$col.$parts[1];
01729       }
01730    }

t3lib_BEfunc::getLabelFromItemlist table,
col,
key
 

Returns the label of the first found entry in an "items" array from $TCA (tablename=$table/fieldname=$col) where the value is $key Usage: 9.

Parameters:
string Table name, present in $TCA
string Field name, present in $TCA
string items-array value to match
Returns:
string Label for item entry

Definition at line 1691 of file class.t3lib_befunc.php.

References table().

Referenced by getProcessedValue(), and titleAttribForPages().

01691                                                    {
01692       global $TCA;
01693          // Load full TCA for $table
01694       t3lib_div::loadTCA($table);
01695 
01696          // Check, if there is an "items" array:
01697       if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]) && is_array($TCA[$table]['columns'][$col]['config']['items']))   {
01698             // Traverse the items-array...
01699          reset($TCA[$table]['columns'][$col]['config']['items']);
01700          while(list($k,$v)=each($TCA[$table]['columns'][$col]['config']['items']))  {
01701                // ... and return the first found label where the value was equal to $key
01702             if (!strcmp($v[1],$key))   return $v[0];
01703          }
01704       }
01705    }

t3lib_BEfunc::getListGroupNames fields = 'title,
uid' 
 

Returns an array with be_groups records (like ->getGroupNames) but: if the current BE_USER is admin, then all groups are returned, otherwise only groups that the current user is member of (usergroup_cached_list) will be returned.

  • Usage: 2 (module "web_perm" and ext. taskcenter)

Parameters:
string Field list; $fields specify the fields selected (default: title,uid)
Returns:
array

Definition at line 1282 of file class.t3lib_befunc.php.

References getGroupNames().

Referenced by SC_mod_web_perm_index::doEdit().

01282                                                    {
01283       $exQ=' AND hide_in_lists=0';
01284       if (!$GLOBALS['BE_USER']->isAdmin())   {
01285          $exQ.=' AND uid IN ('.($GLOBALS['BE_USER']->user['usergroup_cached_list']?$GLOBALS['BE_USER']->user['usergroup_cached_list']:0).')';
01286       }
01287       return t3lib_BEfunc::getGroupNames($fields,$exQ);
01288    }

t3lib_BEfunc::getModTSconfig id,
TSref
 

Returns the merged User/Page TSconfig for page id, $id.

Please read details about module programming elsewhere! Usage: 15

Parameters:
integer Page uid
string $TSref is an object string which determines the path of the TSconfig to return.
Returns:
array

Definition at line 2181 of file class.t3lib_befunc.php.

References getPagesTSconfig().

Referenced by t3lib_positionMap::getModConfig(), SC_db_new_content_el::init(), t3lib_recordList::initializeLanguages(), tx_infopagetsconfig_webinfo::main(), SC_db_new_content_el::main(), SC_db_layout::main(), SC_move_el::main(), SC_db_new::main(), SC_alt_doc::main(), SC_db_layout::menuConfig(), SC_db_list::menuConfig(), and t3lib_SCbase::menuConfig().

02181                                        {
02182       $pageTS_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref,t3lib_BEfunc::getPagesTSconfig($id));
02183       $BE_USER_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref);
02184       $modTSconfig = t3lib_div::array_merge_recursive_overrule($pageTS_modOptions,$BE_USER_modOptions);
02185       return $modTSconfig;
02186    }

t3lib_BEfunc::getModuleData MOD_MENU,
CHANGED_SETTINGS,
modName,
type = '',
dontValidateList = '',
setDefaultList = ''
 

Returns an array which is most backend modules becomes MOD_SETTINGS containing values from function menus etc.

determining the function of the module. This is kind of session variable management framework for the backend users. If a key from MOD_MENU is set in the CHANGED_SETTINGS array (eg. a value is passed to the script from the outside), this value is put into the settings-array Ultimately, see Inside TYPO3 for how to use this function in relation to your modules. Usage: 23

Parameters:
array MOD_MENU is an array that defines the options in menus.
array CHANGED_SETTINGS represents the array used when passing values to the script from the menus.
string modName is the name of this module. Used to get the correct module data.
string If type is 'ses' then the data is stored as session-lasting data. This means that it'll be wiped out the next time the user logs in.
string dontValidateList can be used to list variables that should not be checked if their value is found in the MOD_MENU array. Used for dynamically generated menus.
string List of default values from $MOD_MENU to set in the output array (only if the values from MOD_MENU are not arrays)
Returns:
array The array $settings, which holds a key for each MOD_MENU key and the values of each key will be within the range of values for each menuitem

Definition at line 2365 of file class.t3lib_befunc.php.

References menu().

Referenced by t3lib_SCbase::checkExtObj(), t3lib_extobjbase::handleExternalFunctionValue(), SC_alt_doc::init(), localFolderTree::SC_browse_links::main_file(), SC_db_layout::menuConfig(), SC_mod_web_perm_index::menuConfig(), SC_mod_tools_em_index::menuConfig(), SC_file_list::menuConfig(), SC_db_list::menuConfig(), t3lib_SCbase::menuConfig(), t3lib_fullsearch::procesStoreControl(), and t3lib_modSettings::writeStoredSetting().

02365                                                                                                                         {
02366 
02367       if ($modName && is_string($modName))   {
02368                // GETTING stored user-data from this module:
02369          $settings = $GLOBALS['BE_USER']->getModuleData($modName,$type);
02370 
02371          $changed=0;
02372          if (!is_array($settings))  {
02373             $changed=1;
02374             $settings=array();
02375          }
02376          if (is_array($MOD_MENU))   {
02377             reset($MOD_MENU);
02378             while(list($key,$var)=each($MOD_MENU)) {
02379                   // If a global var is set before entering here. eg if submitted, then it's substituting the current value the array.
02380                if (is_array($CHANGED_SETTINGS) && isset($CHANGED_SETTINGS[$key]) && strcmp($settings[$key],$CHANGED_SETTINGS[$key]))   {
02381                   $settings[$key] = (string)$CHANGED_SETTINGS[$key];
02382                   $changed=1;
02383                }
02384                   // If the $var is an array, which denotes the existence of a menu, we check if the value is permitted
02385                if (is_array($var) && (!$dontValidateList || !t3lib_div::inList($dontValidateList,$key))) {
02386                      // If the setting is an array or not present in the menu-array, MOD_MENU, then the default value is inserted.
02387                   if (is_array($settings[$key]) || !isset($MOD_MENU[$key][$settings[$key]])) {
02388                      $settings[$key]=(string)key($var);
02389                      $changed=1;
02390                   }
02391                }
02392                if ($setDefaultList && !is_array($var))   {  // Sets default values (only strings/checkboxes, not menus)
02393                   if (t3lib_div::inList($setDefaultList,$key) && !isset($settings[$key])) {
02394                      $settings[$key]=$var;
02395                   }
02396                }
02397             }
02398          } else {die ('No menu!');}
02399 
02400          if ($changed)  {
02401             $GLOBALS['BE_USER']->pushModuleData($modName,$settings);
02402          }
02403 
02404          return  $settings;
02405       } else {die ('Wrong module name: "'.$modName.'"');}
02406    }

t3lib_BEfunc::getPagesTSconfig id,
rootLine = '',
returnPartArray = 0
 

Returns the Page TSconfig for page with id, $id Requires class "t3lib_TSparser" Usage: 26 (spec.

in ext info_pagetsconfig)

Parameters:
integer Page uid for which to create Page TSconfig
array If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
boolean If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
Returns:
array Page TSconfig
See also:
t3lib_TSparser

Definition at line 1104 of file class.t3lib_befunc.php.

References BEgetRootLine(), checkIncludeLines_array(), getHash(), and storeHash().

Referenced by getModTSconfig(), tx_infopagetsconfig_webinfo::main(), and updatePagesTSconfig().

01104                                                                   {
01105       $id=intval($id);
01106       if (!is_array($rootLine))  {
01107          $rootLine = t3lib_BEfunc::BEgetRootLine($id,'');
01108       }
01109       ksort($rootLine); // Order correctly, changed 030102
01110       reset($rootLine);
01111       $TSdataArray = array();
01112       $TSdataArray['defaultPageTSconfig']=$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];   // Setting default configuration:
01113       while(list($k,$v)=each($rootLine))  {
01114          $TSdataArray['uid_'.$v['uid']]=$v['TSconfig'];
01115       }
01116       $TSdataArray = t3lib_TSparser::checkIncludeLines_array($TSdataArray);
01117       if ($returnPartArray)   {
01118          return $TSdataArray;
01119       }
01120 
01121          // Parsing the user TS (or getting from cache)
01122       $userTS = implode($TSdataArray,chr(10).'[GLOBAL]'.chr(10));
01123       $hash = md5('pageTS:'.$userTS);
01124       $cachedContent = t3lib_BEfunc::getHash($hash,0);
01125       $TSconfig = array();
01126       if (isset($cachedContent)) {
01127          $TSconfig = unserialize($cachedContent);
01128       } else {
01129          $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
01130          $parseObj->parse($userTS);
01131          $TSconfig = $parseObj->setup;
01132          t3lib_BEfunc::storeHash($hash,serialize($TSconfig),'PAGES_TSconfig');
01133       }
01134       return $TSconfig;
01135    }

t3lib_BEfunc::getProcessedValue table,
col,
value,
fixed_lgd_chars = 0,
defaultPassthrough = 0
 

Returns a human readable output of a value from a record For instance a database record relation would be looked up to display the title-value of that record.

A checkbox with a "1" value would be "Yes", etc. $table/$col is tablename and fieldname REMEMBER to pass the output through htmlspecialchars() if you output it to the browser! (To protect it from XSS attacks and be XHTML compliant) Usage: 24

Parameters:
string Table name, present in TCA
string Field name, present in TCA
string $value is the value of that field from a selected record
integer $fixed_lgd_chars is the max amount of characters the value may occupy
boolean $defaultPassthrough flag means that values for columns that has no conversion will just be pass through directly (otherwise cropped to 200 chars or returned as "N/A")
Returns:
string

Definition at line 1778 of file class.t3lib_befunc.php.

References $TCA, date(), datetime(), getLabelFromItemlist(), getRecord(), table(), and time().

Referenced by getProcessedValueExtra(), and getSingleField_typeFlex_sheetMenu().

01778                                                                                              {
01779       global $TCA;
01780          // Load full TCA for $table
01781       t3lib_div::loadTCA($table);
01782          // Check if table and field is configured:
01783       if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$col]))  {
01784             // Depending on the fields configuration, make a meaningful output value.
01785          $theColConf = $TCA[$table]['columns'][$col]['config'];
01786          $l='';
01787          switch((string)$theColConf['type']) {
01788             case 'radio':
01789                $l=t3lib_BEfunc::getLabelFromItemlist($table,$col,$value);
01790             break;
01791             case 'select':
01792                if ($theColConf['MM'])  {
01793                   $l='N/A';
01794                } else {
01795                   $l=t3lib_BEfunc::getLabelFromItemlist($table,$col,$value);
01796                   $l=$GLOBALS['LANG']->sL($l);
01797                   if ($theColConf['foreign_table'] && !$l && $TCA[$theColConf['foreign_table']])   {
01798                      $rParts = t3lib_div::trimExplode(',',$value,1);
01799                      reset($rParts);
01800                      $lA=array();
01801                      while(list(,$rVal)=each($rParts))   {
01802                         $rVal = intval($rVal);
01803                         if ($rVal>0) {
01804                            $r=t3lib_BEfunc::getRecord($theColConf['foreign_table'],$rVal);
01805                         } else {
01806                            $r=t3lib_BEfunc::getRecord($theColConf['neg_foreign_table'],-$rVal);
01807                         }
01808                         if (is_array($r)) {
01809                            $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);
01810                         } else {
01811                            $lA[]=$rVal?'['.$rVal.'!]':'';
01812                         }
01813                      }
01814                      $l=implode(',',$lA);
01815                   }
01816                }
01817             break;
01818             case 'check':
01819                if (!is_array($theColConf['items']) || count($theColConf['items'])==1)  {
01820                   $l = $value ? 'Yes' : '';
01821                } else {
01822                   reset($theColConf['items']);
01823                   $lA=Array();
01824                   while(list($key,$val)=each($theColConf['items']))  {
01825                      if ($value & pow(2,$key))  {$lA[]=$GLOBALS['LANG']->sL($val[0]);}
01826                   }
01827                   $l = implode($lA,', ');
01828                }
01829             break;
01830             case 'input':
01831                if ($value) {
01832                   if (t3lib_div::inList($theColConf['eval'],'date')) {
01833                      $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')).')';
01834                   } elseif (t3lib_div::inList($theColConf['eval'],'time')) {
01835                      $l = t3lib_BEfunc::time($value);
01836                   } elseif (t3lib_div::inList($theColConf['eval'],'datetime'))   {
01837                      $l = t3lib_BEfunc::datetime($value);
01838                   } else {
01839                      $l = $value;
01840                   }
01841                }
01842             break;
01843             default:
01844                if ($defaultPassthrough)   {
01845                   $l=$value;
01846                } elseif ($theColConf['MM'])  {
01847                   $l='N/A';
01848                } elseif ($value) {
01849                   $l=t3lib_div::fixed_lgd_cs(strip_tags($value),200);
01850                }
01851             break;
01852          }
01853          if ($fixed_lgd_chars)   {
01854             return t3lib_div::fixed_lgd_cs($l,$fixed_lgd_chars);
01855          } else {
01856             return $l;
01857          }
01858       }
01859    }

t3lib_BEfunc::getProcessedValueExtra table,
fN,
fV,
fixed_lgd_chars = 0
 

Same as ->getProcessedValue() but will go easy on fields like "tstamp" and "pid" which are not configured in TCA - they will be formatted by this function instead.

Usage: 2

Parameters:
string Table name, present in TCA
string Field name
string Field value
integer $fixed_lgd_chars is the max amount of characters the value may occupy
Returns:
string
See also:
getProcessedValue()

Definition at line 1872 of file class.t3lib_befunc.php.

References $TCA, datetime(), getProcessedValue(), getRecordPath(), and table().

01872                                                                         {
01873       global $TCA;
01874       $fVnew = t3lib_BEfunc::getProcessedValue($table,$fN,$fV,$fixed_lgd_chars);
01875       if (!isset($fVnew))  {
01876          if (is_array($TCA[$table]))   {
01877             if ($fN==$TCA[$table]['ctrl']['tstamp'] || $fN==$TCA[$table]['ctrl']['crdate'])  {
01878                $fVnew = t3lib_BEfunc::datetime($fV);
01879             } elseif ($fN=='pid'){
01880                $fVnew = t3lib_BEfunc::getRecordPath($fV,'1',20);  // Fetches the path with no regard to the users permissions to select pages.
01881             } else {
01882                $fVnew = $fV;
01883             }
01884          }
01885       }
01886       return $fVnew;
01887    }

t3lib_BEfunc::getRecord table,
uid,
fields = '*',
where = ''
 

Gets record with uid=$uid from $table You can set $field to a list of fields (default is '*') Additional WHERE clauses can be added by $where (fx.

' AND blabla=1') Will automatically check if records has been deleted and if so, not return anything. $table must be found in $TCA Usage: 99

Parameters:
string Table name present in $TCA
integer UID of record
string List of fields to select
string Additional WHERE clause, eg. " AND blablabla=0"
Returns:
array Returns the row if found, otherwise nothing

Definition at line 211 of file class.t3lib_befunc.php.

References deleteClause(), and table().

Referenced by SC_wizard_rte::checkEditAccess(), t3lib_positionMap::checkNewPageInPid(), t3lib_TCEmain::copyRecord_localize(), SC_alt_main::editPageHandling(), SC_alt_shortcut::editPageIdFunc(), localFolderTree::SC_browse_links::expandPage(), fixVersioningPid(), SC_wizard_forms::formsWizard(), SC_wizard_forms::getConfigCode(), getFlexFormDS(), getProcessedValue(), getSingleField_typeFlex_sheetMenu(), getSingleField_typeGroup(), getTSconfig_pidValue(), getVersionSelector(), SC_wizard_add::init(), SC_show_item::init(), SC_db_new::init(), t3lib_recordList::initializeLanguages(), SC_wizard_rte::main(), SC_wizard_list::main(), tx_wizardsortpages_webfunc_2::main(), tx_wizardcrpages_webfunc_2::main(), tx_infopagetsconfig_webinfo::main(), tx_cms_webinfo_lang::main(), SC_db_new_content_el::main(), SC_move_el::main(), SC_alt_doc::makeEditForm(), SC_alt_doc::processData(), t3lib_fullsearch::procesStoreControl(), readPageAccess(), t3lib_userAuthGroup::recordEditAccessInternals(), SC_wizard_table::tableWizard(), titleAttribForPages(), t3lib_parsehtml_proc::TS_links_rte(), and t3lib_TCEmain::version_swap().

00211                                                          {
00212       if ($GLOBALS['TCA'][$table])  {
00213          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, 'uid='.intval($uid).t3lib_BEfunc::deleteClause($table).$where);
00214          if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00215             return $row;
00216          }
00217       }
00218    }

t3lib_BEfunc::getRecordIconAltText row,
table = 'pages'
 

Returns title-attribute information for ANY record (from a table defined in TCA of course) The included information depends on features of the table, but if hidden, starttime, endtime and fe_group fields are configured for, information about the record status in regard to these features are is included.

"pages" table can be used as well and will return the result of ->titleAttribForPages() for that page. Usage: 10

Parameters:
array Table row; $row is a row from the table, $table
string Table name
Returns:
string

Definition at line 1654 of file class.t3lib_befunc.php.

References $out, date(), and titleAttribForPages().

Referenced by tx_cms_layout::getIcon().

01654                                                       {
01655       if ($table=='pages') {
01656          $out = t3lib_BEfunc::titleAttribForPages($row,'',0);
01657       } else {
01658          $ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
01659 
01660          $out='id='.$row['uid']; // Uid is added
01661          if ($table=='pages' && $row['alias'])  {
01662             $out.=' / '.$row['alias'];
01663          }
01664          if ($GLOBALS['TCA'][$table]['ctrl']['versioning'] && $row['t3ver_id'])  {
01665             $out.=' - v#'.$row['t3ver_id'];
01666          }
01667          if ($ctrl['disabled'])  {     // Hidden ...
01668             $out.=($row[$ctrl['disabled']]?' - '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.hidden'):'');
01669          }
01670          if ($ctrl['starttime']) {
01671             if ($row[$ctrl['starttime']] > $GLOBALS['EXEC_TIME']) {
01672                $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').')';
01673             }
01674          }
01675          if ($row[$ctrl['endtime']])   {
01676             $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').')';
01677          }
01678       }
01679       return htmlspecialchars($out);
01680    }

t3lib_BEfunc::getRecordPath uid,
clause,
titleLimit,
fullTitleLimit = 0
 

Returns the path (visually) of a page $uid, fx.

"/First page/Second page/Another subpage" Each part of the path will be limited to $titleLimit characters Deleted pages are filtered out. Usage: 15

Parameters:
integer Page uid for which to create record path
string $clause is additional where clauses, eg. "
integer Title limit
integer Title limit of Full title (typ. set to 1000 or so)
Returns:
mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set.

Definition at line 613 of file class.t3lib_befunc.php.

References deleteClause(), and fixVersioningPid().

Referenced by SC_alt_shortcut::editPageIdFunc(), getProcessedValueExtra(), getSingleField_typeFlex_sheetMenu(), readPageAccess(), and titleAttribForPages().

00613                                                                            {
00614       if (!$titleLimit) { $titleLimit=1000; }
00615 
00616       $loopCheck = 100;
00617       $output = $fullOutput = '/';
00618       while ($uid!=0 && $loopCheck>0)  {
00619          $loopCheck--;
00620          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00621                   'uid,pid,title',
00622                   'pages',
00623                   'uid='.intval($uid).
00624                      t3lib_BEfunc::deleteClause('pages').
00625                      (strlen(trim($clause)) ? ' AND '.$clause : '')
00626                );
00627          if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00628             t3lib_BEfunc::fixVersioningPid('pages',$row);
00629 
00630             if ($row['_ORIG_pid'])  {
00631                $output = ' [#VEP#]'.$output;    // Adding visual token - Versioning Entry Point - that tells that THIS position was where the versionized branch got connected to the main tree. I will have to find a better name or something...
00632             }
00633             $uid = $row['pid'];
00634             $output = '/'.t3lib_div::fixed_lgd_cs(strip_tags($row['title']),$titleLimit).$output;
00635             if ($fullTitleLimit) $fullOutput = '/'.t3lib_div::fixed_lgd_cs(strip_tags($row['title']),$fullTitleLimit).$fullOutput;
00636          } else {
00637             break;
00638          }
00639       }
00640 
00641       if ($fullTitleLimit) {
00642          return array($output, $fullOutput);
00643       } else {
00644          return $output;
00645       }
00646    }

t3lib_BEfunc::getRecordRaw table,
where = '',
fields = '*'
 

Returns the first record found from $table with $where as WHERE clause This function does NOT check if a record has the deleted flag set.

$table does NOT need to be configured in $TCA The query used is simply this: $query='SELECT '.$fields.' FROM '.$table.' WHERE '.$where; Usage: 5 (ext: sys_todos)

Parameters:
string Table name (not necessarily in TCA)
string WHERE clause
string $fields is a list of fields to select, default is '*'
Returns:
array First row found, if any

Definition at line 233 of file class.t3lib_befunc.php.

References table().

00233                                                          {
00234       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where);
00235       if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))  {
00236          return $row;
00237       }
00238    }

t3lib_BEfunc::getRecordsByField theTable,
theField,
theValue,
whereClause = '',
groupBy = '',
orderBy = '',
limit = ''
 

Returns records from table, $theTable, where a field ($theField) equals the value, $theValue The records are returned in an array If no records were selected, the function returns nothing Usage: 8.

Parameters:
string Table name present in $TCA
string Field to select on
string Value that $theField must match
string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
string Optional GROUP BY field(s), if none, supply blank string.
string Optional ORDER BY field(s), if none, supply blank string.
string Optional LIMIT value ([begin,]max), if none, supply blank string.
Returns:
mixed Multidimensional array with selected records (if any is selected)

Definition at line 255 of file class.t3lib_befunc.php.

References deleteClause().

Referenced by t3lib_TCEmain::copyRecord_localize(), SC_alt_main::editPageHandling(), SC_alt_shortcut::editPageIdFunc(), localFolderTree::SC_browse_links::expandPage(), firstDomainRecord(), tx_cms_layout::getTable_tt_content(), SC_db_layout::renderQuickEdit(), and t3lib_parsehtml_proc::TS_links_rte().

00255                                                                                                                {
00256       global $TCA;
00257       if (is_array($TCA[$theTable])) {
00258          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00259                   '*',
00260                   $theTable,
00261                   $theField.'="'.$GLOBALS['TYPO3_DB']->quoteStr($theValue, $theTable).'"'.
00262                      t3lib_BEfunc::deleteClause($theTable).' '.
00263                      $whereClause,  // whereClauseMightContainGroupOrderBy
00264                   $groupBy,
00265                   $orderBy,
00266                   $limit
00267                );
00268          $rows = array();
00269          while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00270             $rows[] = $row;
00271          }
00272          $GLOBALS['TYPO3_DB']->sql_free_result($res);
00273          if (count($rows)) return $rows;
00274       }
00275    }

t3lib_BEfunc::getRecordTitle table,
row,
prep = 0
 

Returns the "title"-value in record, $row, from table, $table The field(s) from which the value is taken is determined by the "ctrl"-entries 'label', 'label_alt' and 'label_alt_force' Usage: 26.

Parameters:
string Table name, present in TCA
array Row from table
boolean If set, result is prepared for output: The output is cropped to a limited lenght (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '[No title]' is returned (localized). Further, the output is htmlspecialchars()'ed
Returns:
string

Definition at line 1742 of file class.t3lib_befunc.php.

References $TCA, and table().

Referenced by t3lib_positionMap::getRecordHeader(), SC_db_new_content_el::main(), SC_move_el::main(), SC_alt_doc::makeEditForm(), and t3lib_transferData::selectAddForeign().

01742                                                 {
01743       global $TCA;
01744       if (is_array($TCA[$table]))   {
01745          $t = $row[$TCA[$table]['ctrl']['label']];
01746          if ($TCA[$table]['ctrl']['label_alt'] && ($TCA[$table]['ctrl']['label_alt_force'] || !strcmp($t,''))) {
01747             $altFields=t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['label_alt'],1);
01748             $tA=array();
01749             $tA[]=$t;
01750             while(list(,$fN)=each($altFields))  {
01751                $t = $tA[] = trim(strip_tags($row[$fN]));
01752                if (strcmp($t,'') && !$TCA[$table]['ctrl']['label_alt_force']) break;
01753             }
01754             if ($TCA[$table]['ctrl']['label_alt_force']) $t=implode(', ',$tA);
01755          }
01756          if ($prep)  {
01757             $t = htmlspecialchars(t3lib_div::fixed_lgd_cs($t,$GLOBALS['BE_USER']->uc['titleLen']));
01758             if (!strcmp(trim($t),''))  $t='<em>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</em>';
01759          }
01760          return $t;
01761       }
01762    }

t3lib_BEfunc::getSetUpdateSignal set = ''  ) 
 

Call to update the page tree frame (or something else..?) after t3lib_BEfunc::getSetUpdateSignal('updatePageTree') -> will set the page tree to be updated.

t3lib_BEfunc::getSetUpdateSignal() -> will return some JavaScript that does the update (called in the typo3/template.php file, end() function) Usage: 11

Parameters:
string Whether to set or clear the update signal. When setting, this value contains strings telling WHAT to set. At this point it seems that the value "updatePageTree" is the only one it makes sense to set.
Returns:
string HTML code (<script> section)

Definition at line 2314 of file class.t3lib_befunc.php.

References $key, $out, and getSetUpdateSignal().

Referenced by endPage(), SC_tce_file::finish(), getSetUpdateSignal(), SC_tce_db::main(), tx_wizardsortpages_webfunc_2::main(), tx_wizardcrpages_webfunc_2::main(), SC_db_list::main(), and SC_alt_doc::processData().

02314                                           {
02315       global $BE_USER;
02316       $key = 't3lib_BEfunc::getSetUpdateSignal';
02317       $out='';
02318       if ($set)   {
02319          $modData=array();
02320          $modData['set']=$set;
02321          $BE_USER->pushModuleData($key,$modData);
02322       } else {
02323          $modData = $BE_USER->getModuleData($key,'ses');
02324          if (trim($modData['set'])) {
02325             $l=explode(',',$modData['set']);
02326             while(list(,$v)=each($l))  {
02327                switch($v)  {
02328                   case 'updatePageTree':
02329                   case 'updateFolderTree':
02330                      $out.='
02331                <script type="text/javascript">
02332                /*<![CDATA[*/
02333                      if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)   {
02334                         top.content.nav_frame.refresh_nav();
02335                      }
02336                /*]]>*/
02337                </script>';
02338                   break;
02339                }
02340             }
02341             $modData=array();
02342             $modData['set']='';
02343             $BE_USER->pushModuleData($key,$modData);
02344          }
02345       }
02346       return $out;
02347    }

t3lib_BEfunc::getSpecConfParametersFromArray pArr  ) 
 

Takes an array of "[key]=[value]" strings and returns an array with the keys set as keys pointing to the value.

Better see it in action! Find example in Inside TYPO3 Usage: 6

Parameters:
array Array of "[key]=[value]" strings to convert.
Returns:
array

Definition at line 916 of file class.t3lib_befunc.php.

References $out.

Referenced by getSingleField_typeText(), tx_cms_layout::isRTEforField(), t3lib_parsehtml_proc::RTE_transform(), and t3lib_rteapi::transformContent().

00916                                                    {
00917       $out=array();
00918       if (is_array($pArr)) {
00919          reset($pArr);
00920          while(list($k,$v)=each($pArr))   {
00921             $parts=explode('=',$v,2);
00922             if (count($parts)==2)   {
00923                $out[trim($parts[0])]=trim($parts[1]);
00924             } else {
00925                $out[$k]=$v;
00926             }
00927          }
00928       }
00929       return $out;
00930    }

t3lib_BEfunc::getSpecConfParts str,
defaultExtras
 

Parses a part of the field lists in the "types"-section of $TCA arrays, namely the "special configuration" at index 3 (position 4) Elements are splitted by ":" and within those parts, parameters are splitted by "|".

Everything is returned in an array and you should rather see it visually than listen to me anymore now... Check out example in Inside TYPO3 Usage: 5

Parameters:
string Content from the "types" configuration of TCA (the special configuration) - see description of function
string The ['defaultExtras'] value from field configuration
Returns:
array

Definition at line 886 of file class.t3lib_befunc.php.

Referenced by t3lib_TCEmain::checkValue_flex_procInData_travDS(), getSingleField_typeFlex_sheetMenu(), and getTCAtypes().

00886                                                    {
00887 
00888          // Add defaultExtras:
00889       $specConfParts = t3lib_div::trimExplode(':', $defaultExtras.':'.$str, 1);
00890 
00891       if (count($specConfParts)) {
00892          foreach($specConfParts as $k2 => $v2)  {
00893             unset($specConfParts[$k2]);
00894             if (ereg('(.*)\[(.*)\]',$v2,$reg))  {
00895                $specConfParts[trim($reg[1])] = array(
00896                   'parameters' => t3lib_div::trimExplode('|', $reg[2], 1)
00897                );
00898             } else {
00899                $specConfParts[trim($v2)] = 1;
00900             }
00901          }
00902       } else {
00903          $specConfParts = array();
00904       }
00905       return $specConfParts;
00906    }

t3lib_BEfunc::getSQLselectableList in_list,
tablename,
default_tablename
 

Returns a list of pure integers based on $in_list being a list of records with table-names prepended.

Ex: $in_list = "pages_4,tt_content_12,45" would result in a return value of "4,45" if $tablename is "pages" and $default_tablename is 'pages' as well. Usage: 1 (t3lib_userauthgroup)

Parameters:
string Input list
string Table name from which ids is returned
string $default_tablename denotes what table the number '45' is from (if nothing is prepended on the value)
Returns:
string List of ids

Definition at line 362 of file class.t3lib_befunc.php.

References $val.

00362                                                                            {
00363       $list = Array();
00364       if ((string)trim($in_list)!='')  {
00365          $tempItemArray = explode(',',trim($in_list));
00366          while(list($key,$val)=each($tempItemArray))  {
00367             $val = strrev($val);
00368             $parts = explode('_',$val,2);
00369             if ((string)trim($parts[0])!='') {
00370                $theID = intval(strrev($parts[0]));
00371                $theTable = trim($parts[1]) ? strrev(trim($parts[1])) : $default_tablename;
00372                if ($theTable==$tablename) {$list[]=$theID;}
00373             }
00374          }
00375       }
00376       return implode(',',$list);
00377    }

t3lib_BEfunc::getSystemLanguages  ) 
 

Returns an array with system languages:.

Returns:
array Array with languages

Definition at line 756 of file class.t3lib_befunc.php.

References deleteClause().

Referenced by t3lib_transferData::selectAddSpecial().

00756                                  {
00757 
00758          // Initialize, add default language:
00759       $sysLanguages = array();
00760       $sysLanguages[] = array('Default language', 0);
00761 
00762          // Traverse languages
00763       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,flag','sys_language','pid=0'.t3lib_BEfunc::deleteClause('sys_language'));
00764       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00765          $sysLanguages[] = array($row['title'].' ['.$row['uid'].']', $row['uid'], ($row['flag'] ? '../t3lib/gfx/flags/'.$row['flag'] : ''));
00766       }
00767 
00768       return $sysLanguages;
00769    }

t3lib_BEfunc::getTCAtypes table,
rec,
useFieldNameAsKey = 0
 

Returns the "types" configuration parsed into an array for the record, $rec, from table, $table Usage: 6.

Parameters:
string Table name (present in TCA)
array Record from $table
boolean If $useFieldNameAsKey is set, then the fieldname is associative keys in the return array, otherwise just numeric keys.
Returns:
array

Definition at line 810 of file class.t3lib_befunc.php.

References $TCA, getSpecConfParts(), getTCAtypeValue(), and table().

Referenced by t3lib_TCEmain::fillInFieldArray(), t3lib_TCEforms::getListedFields(), getSingleField_typeFlex_sheetMenu(), tx_cms_layout::getSpecConfForField(), and t3lib_transferData::renderRecordRaw().

00810                                                             {
00811       global $TCA;
00812 
00813       t3lib_div::loadTCA($table);
00814       if ($TCA[$table]) {
00815 
00816             // Get type value:
00817          $fieldValue = t3lib_BEfunc::getTCAtypeValue($table,$rec);
00818 
00819             // Get typesConf
00820          $typesConf = $TCA[$table]['types'][$fieldValue];
00821 
00822             // Get fields list and traverse it
00823          $fieldList = explode(',', $typesConf['showitem']);
00824          $altFieldList = array();
00825 
00826             // Traverse fields in types config and parse the configuration into a nice array:
00827          foreach($fieldList as $k => $v)  {
00828             list($pFieldName, $pAltTitle, $pPalette, $pSpec) = t3lib_div::trimExplode(';', $v);
00829             $defaultExtras = is_array($TCA[$table]['columns'][$pFieldName]) ? $TCA[$table]['columns'][$pFieldName]['defaultExtras'] : '';
00830             $specConfParts = t3lib_BEfunc::getSpecConfParts($pSpec, $defaultExtras);
00831 
00832             $fieldList[$k]=array(
00833                'field' => $pFieldName,
00834                'title' => $pAltTitle,
00835                'palette' => $pPalette,
00836                'spec' => $specConfParts,
00837                'origString' => $v
00838             );
00839             if ($useFieldNameAsKey) {
00840                $altFieldList[$fieldList[$k]['field']] = $fieldList[$k];
00841             }
00842          }
00843          if ($useFieldNameAsKey) {
00844             $fieldList = $altFieldList;
00845          }
00846 
00847             // Return array:
00848          return $fieldList;
00849       }
00850    }

t3lib_BEfunc::getTCAtypeValue table,
rec
 

Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $TCA If no "type" field is configured in the "ctrl"-section of the $TCA for the table, zero is used.

If zero is not an index in the "types" section of $TCA for the table, then the $fieldValue returned will default to 1 (no matter if that is an index or not) Usage: 7

Parameters:
string Table name present in TCA
array Record from $table
Returns:
string Field value
See also:
getTCAtypes()

Definition at line 863 of file class.t3lib_befunc.php.

References $TCA, and table().

Referenced by t3lib_TCEmain::checkValue_flex_procInData_travDS(), t3lib_TCEmain::fillInFieldArray(), getSingleField_typeText(), getTCAtypes(), getTCEFORM_TSconfig(), and tx_cms_layout::isRTEforField().

00863                                           {
00864       global $TCA;
00865 
00866          // 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.
00867       t3lib_div::loadTCA($table);
00868       if ($TCA[$table]) {
00869          $field = $TCA[$table]['ctrl']['type'];
00870          $fieldValue = $field ? ($rec[$field] ? $rec[$field] : 0) : 0;
00871          if (!is_array($TCA[$table]['types'][$fieldValue])) $fieldValue = 1;
00872          return $fieldValue;
00873       }
00874    }

t3lib_BEfunc::getThumbNail thumbScript,
theFile,
tparams = '',
size = ''
 

Returns single image tag to thumbnail using a thumbnail script (like thumbs.php) Usage: 3.

Parameters:
string $thumbScript must point to "thumbs.php" relative to the script position
string $theFile must be the proper reference to the file thumbs.php should show
string $tparams are additional attributes for the image tag
integer $size is the size of the thumbnail send along to "thumbs.php"
Returns:
string Image tag

Definition at line 1578 of file class.t3lib_befunc.php.

Referenced by localFolderTree::SC_browse_links::expandPage().

01578                                                                      {
01579       $params = '&file='.rawurlencode($theFile);
01580       $params .= trim($size)?'&size='.trim($size):'';
01581       $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
01582       $th='<img src="'.htmlspecialchars($url).'" title="'.trim(basename($theFile)).'"'.($tparams?" ".$tparams:"").' alt="" />';
01583       return $th;
01584    }

t3lib_BEfunc::getUserNames fields = 'username,
usergroup  ,
usergroup_cached_list  ,
uid'  ,
where = ''
 

Returns an array with be_users records of all user NOT DELETED sorted by their username Keys in the array is the be_users uid Usage: 14 (spec.

ext. "beuser" and module "web_perm")

Parameters:
string Optional $fields list (default: username,usergroup,usergroup_cached_list,uid) can be used to set the selected fields
string Optional $where clause (fx. "AND username='pete'") can be used to limit query
Returns:
array

Definition at line 1247 of file class.t3lib_befunc.php.

Referenced by SC_mod_web_perm_index::doEdit(), tx_cms_layout::getPageInfoBox(), SC_mod_web_perm_index::notEdit(), and SC_mod_user_setup_index::simulateUser().

01247                                                                                              {
01248       $be_user_Array=Array();
01249 
01250       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'be_users', 'pid=0 '.$where.t3lib_BEfunc::deleteClause('be_users'), '', 'username');
01251       while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
01252          $be_user_Array[$row['uid']]=$row;
01253       }
01254       return $be_user_Array;
01255    }

t3lib_BEfunc::helpText table,
field,
BACK_PATH,
styleAttrib = ''
 

Returns CSH help text (description), if configured for.

TCA_DESCR must be loaded prior to this function and $BE_USER must have "edit_showFieldHelp" set to "text", otherwise nothing is returned Will automatically call t3lib_BEfunc::helpTextIcon() to get the icon for the text. Usage: 4

Parameters:
string Table name
string Field name
string Back path
string Additional style-attribute content for wrapping table
Returns:
string HTML content for help text

Definition at line 2047 of file class.t3lib_befunc.php.

References helpTextIcon(), and table().

Referenced by cshItem().

02047                                                                {
02048       global $TCA_DESCR,$BE_USER;
02049       if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && $BE_USER->uc['edit_showFieldHelp']=='text')  {
02050          $fDat = $TCA_DESCR[$table]['columns'][$field];
02051 
02052             // Get Icon:
02053          $editIcon = t3lib_BEfunc::helpTextIcon(
02054                            $table,
02055                            $field,
02056                            $BACK_PATH,
02057                            TRUE
02058                         );
02059             // Add title?
02060          $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;';
02061          $text =
02062                ($fDat['alttitle'] ? '<h4><a href="#" onclick="'.htmlspecialchars($onClick).'">'.$fDat['alttitle'].'</a></h4>' : '').
02063                $fDat['description'];
02064 
02065             // More information to get?
02066          if ($fDat['image_descr'] || $fDat['seeAlso'] || $fDat['details'] || $fDat['syntax'])   { // || $fDat['image'];
02067             $text.=' <a href="#" onclick="'.htmlspecialchars($onClick).'">'.
02068                   '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/rel_db.gif','width="13" height="12"').' class="absmiddle typo3-csh-more" alt="" />'.
02069                   '</a>';
02070          }
02071 
02072             // Additional styles?
02073          $params = $styleAttrib ? ' style="'.$styleAttrib.'"' : '';
02074 
02075             // Compile table with CSH information:
02076          return '<table border="0" cellpadding="2" cellspacing="0" class="typo3-csh-inline"'.$params.'>
02077                   <tr>
02078                      <td valign="top" width="14">'.$editIcon.'</td>
02079                      <td valign="top">'.$text.'</td>
02080                   </tr>
02081                </table>';
02082       }
02083    }

t3lib_BEfunc::helpTextIcon table,
field,
BACK_PATH,
force = 0
 

Returns help-text icon if configured for.

TCA_DESCR must be loaded prior to this function and $BE_USER must have 'edit_showFieldHelp' set to 'icon', otherwise nothing is returned Usage: 6

Parameters:
string Table name
string Field name
string Back path
boolean Force display of icon nomatter BE_USER setting for help
Returns:
string HTML content for a help icon/text

Definition at line 2025 of file class.t3lib_befunc.php.

References table().

Referenced by cshItem(), SC_mod_tools_em_index::helpCol(), and helpText().

02025                                                             {
02026       global $TCA_DESCR,$BE_USER;
02027       if (is_array($TCA_DESCR[$table]) && is_array($TCA_DESCR[$table]['columns'][$field]) && ($BE_USER->uc['edit_showFieldHelp']=='icon' || $force))  {
02028          $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;';
02029          return '<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
02030                '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/helpbubble.gif','width="14" height="14"').' hspace="2" border="0" class="typo3-csh-icon" alt="" />'.
02031                '</a>';
02032       }
02033    }

t3lib_BEfunc::implodeTSParams p,
k = ''
 

Implodes a multi dimensional TypoScript array, $p, into a one-dimentional array (return value) Usage: 3.

Parameters:
array TypoScript structure
string Prefix string
Returns:
array Imploded TypoScript objectstring/values

Definition at line 1210 of file class.t3lib_befunc.php.

References implodeTSParams().

Referenced by implodeTSParams(), and updatePagesTSconfig().

01210                                        {
01211       $implodeParams=array();
01212       if (is_array($p)) {
01213          reset($p);
01214          while(list($kb,$val)=each($p))   {
01215             if (is_array($val))  {
01216                $implodeParams = array_merge($implodeParams,t3lib_BEfunc::implodeTSParams($val,$k.$kb));
01217             } else {
01218                $implodeParams[$k.$kb]=$val;
01219             }
01220          }
01221       }
01222       return $implodeParams;
01223    }

t3lib_BEfunc::isRecordLocked table,
uid
 

Returns information about whether the record from table, $table, with uid, $uid is currently locked (edited by another user - which should issue a warning).

Notice: Locking is not strictly carried out since locking is abandoned when other backend scripts are activated - which means that a user CAN have a record "open" without having it locked. So this just serves as a warning that counts well in 90% of the cases, which should be sufficient. Usage: 5

Parameters:
string Table name
integer Record uid
Returns:
array

Definition at line 2469 of file class.t3lib_befunc.php.

References calcAge().

Referenced by SC_alt_doc::makeEditForm(), SC_db_layout::renderQuickEdit(), tx_cms_layout::tt_content_drawHeader(), and localPageTree::wrapIcon().

02469                                           {
02470       global $LOCKED_RECORDS;
02471       if (!is_array($LOCKED_RECORDS))  {
02472          $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
02473                      '*',
02474                      'sys_lockedrecords',
02475                      'sys_lockedrecords.userid!='.intval($GLOBALS['BE_USER']->user['uid']).'
02476                         AND sys_lockedrecords.tstamp > '.($GLOBALS['EXEC_TIME']-2*3600)
02477                   );
02478          while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
02479             $LOCKED_RECORDS[$row['record_table'].':'.$row['record_uid']]=$row;
02480             $LOCKED_RECORDS[$row['record_table'].':'.$row['record_uid']]['msg']=sprintf(
02481                $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecord'),
02482                $row['username'],
02483                t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'],$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
02484             );
02485             if ($row['record_pid'] && !isset($LOCKED_RECORDS[$row['record_table'].':'.$row['record_pid']])) {
02486                $LOCKED_RECORDS['pages:'.$row['record_pid']]['msg']=sprintf(
02487                   $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.lockedRecord_content'),
02488                   $row['username'],
02489                   t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME']-$row['tstamp'],$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears'))
02490                );
02491             }
02492          }
02493       }
02494       return $LOCKED_RECORDS[$table.':'.$uid];
02495    }

t3lib_BEfunc::listQuery field,
value
 

Returns a WHERE clause that can find a value ($value) in a list field ($field) For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between).

This query would be able to select that record based on the value "34", "234" or "5" regardless of their positioni in the list (left, middle or right). Is nice to look up list-relations to records or files in TYPO3 database tables. Usage: 0

Parameters:
string Table field name
string Value to find in list
Returns:
string WHERE clause for a query Use $GLOBALS['TYPO3_DB']->listQuery() directly!

Definition at line 335 of file class.t3lib_befunc.php.

00335                                        {
00336       return $GLOBALS['TYPO3_DB']->listQuery($field,$value,'');
00337    }

t3lib_BEfunc::lockRecords table = '',
uid = 0,
pid = 0
 

Unlock or Lock a record from $table with $uid If $table and $uid is not set, then all locking for the current BE_USER is removed! Usage: 5.

Parameters:
string Table name
integer Record uid
integer Record pid
Returns:
void

Definition at line 2440 of file class.t3lib_befunc.php.

References table().

Referenced by t3lib_transferData::lockRecord().

02440                                                    {
02441       $user_id = intval($GLOBALS['BE_USER']->user['uid']);
02442       if ($table && $uid)  {
02443          $fields_values = array(
02444             'userid' => $user_id,
02445             'tstamp' => $GLOBALS['EXEC_TIME'],
02446             'record_table' => $table,
02447             'record_uid' => $uid,
02448             'username' => $GLOBALS['BE_USER']->user['username'],
02449             'record_pid' => $pid
02450          );
02451 
02452          $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_lockedrecords', $fields_values);
02453       } else {
02454          $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_lockedrecords', 'userid='.intval($user_id));
02455       }
02456    }

t3lib_BEfunc::makeConfigForm configArray,
defaults,
dataPrefix
 

Makes a form for configuration of some values based on configuration found in the array $configArray, with default values from $defaults and a data-prefix $dataPrefix <form>-tags must be supplied separately Needs more documentation and examples, in particular syntax for configuration array.

See Inside TYPO3. That's were you can expect to find example, if anywhere. Usage: 1 (ext. direct_mail)

Parameters:
array Field configuration code.
array Defaults
string Prefix for formfields
Returns:
string HTML for a form.

Definition at line 1950 of file class.t3lib_befunc.php.

References $out, and debug().

01950                                                                {
01951       $params = $defaults;
01952       if (is_array($configArray))   {
01953          reset($configArray);
01954          $lines=array();
01955          while(list($fname,$config)=each($configArray))  {
01956             if (is_array($config))  {
01957                $lines[$fname]='<strong>'.htmlspecialchars($config[1]).'</strong><br />';
01958                $lines[$fname].=$config[2].'<br />';
01959                switch($config[0])   {
01960                   case 'string':
01961                   case 'short':
01962                      $formEl = '<input type="text" name="'.$dataPrefix.'['.$fname.']" value="'.$params[$fname].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth($config[0]=='short'?24:48).' />';
01963                   break;
01964                   case 'check':
01965                      $formEl = '<input type="hidden" name="'.$dataPrefix.'['.$fname.']" value="0" /><input type="checkbox" name="'.$dataPrefix.'['.$fname.']" value="1"'.($params[$fname]?' checked="checked"':'').' />';
01966                   break;
01967                   case 'comment':
01968                      $formEl = '';
01969                   break;
01970                   case 'select':
01971                      reset($config[3]);
01972                      $opt=array();
01973                      while(list($k,$v)=each($config[3])) {
01974                         $opt[]='<option value="'.htmlspecialchars($k).'"'.($params[$fname]==$k?' selected="selected"':'').'>'.htmlspecialchars($v).'</option>';
01975                      }
01976                      $formEl = '<select name="'.$dataPrefix.'['.$fname.']">'.implode('',$opt).'</select>';
01977                   break;
01978                   default:
01979                      debug($config);
01980                   break;
01981                }
01982                $lines[$fname].=$formEl;
01983                $lines[$fname].='<br /><br />';
01984             } else {
01985                $lines[$fname]='<hr />';
01986                if ($config)   $lines[$fname].='<strong>'.strtoupper(htmlspecialchars($config)).'</strong><br />';
01987                if ($config)   $lines[$fname].='<br />';
01988             }
01989          }
01990       }
01991       $out = implode('',$lines);
01992       $out.='<input type="submit" name="submit" value="Update configuration" />';
01993       return $out;
01994    }

t3lib_BEfunc::mm_query select,
local_table,
mm_table,
foreign_table,
whereClause = '',
groupBy = '',
orderBy = '',
limit = ''
 

Returns a SELECT query, selecting fields ($select) from two/three tables joined $local_table and $mm_table is mandatory.

$foreign_table is optional. The JOIN is done with [$local_table].uid <--> [$mm_table].uid_local / [$mm_table].uid_foreign <--> [$foreign_table].uid The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $TCA in Inside TYPO3 for more details. DEPRECIATED - Use $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query() instead since that will return the result pointer while this returns the query. Using this function may make your application less fitted for DBAL later.

Parameters:
string Field list for SELECT
string Tablename, local table
string Tablename, relation table
string Tablename, foreign table
string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
string Optional GROUP BY field(s), if none, supply blank string.
string Optional ORDER BY field(s), if none, supply blank string.
string Optional LIMIT value ([begin,]max), if none, supply blank string.
Returns:
string Full SQL query
See also:
t3lib_DB::exec_SELECT_mm_query()

Definition at line 454 of file class.t3lib_befunc.php.

00454                                                                                                                         {
00455       $query = $GLOBALS['TYPO3_DB']->SELECTquery(
00456                $select,
00457                $local_table.','.$mm_table.($foreign_table?','.$foreign_table:''),
00458                $local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').' '.
00459                   $whereClause,  // whereClauseMightContainGroupOrderBy
00460                $groupBy,
00461                $orderBy,
00462                $limit
00463             );
00464       return $query;
00465    }

t3lib_BEfunc::openPageTree pid,
clearExpansion
 

Opens the page tree to the specified page id.

Parameters:
integer Page id.
boolean If set, then other open branches are closed.
Returns:
void

Definition at line 568 of file class.t3lib_befunc.php.

References BEgetRootLine().

Referenced by SC_alt_main::editPageHandling(), and SC_alt_shortcut::editPageIdFunc().

00568                                                 {
00569       global $BE_USER;
00570 
00571          // Get current expansion data:
00572       if ($clearExpansion) {
00573          $expandedPages = array();
00574       } else {
00575          $expandedPages = unserialize($BE_USER->uc['browseTrees']['browsePages']);
00576       }
00577 
00578          // Get rootline:
00579       $rL = t3lib_BEfunc::BEgetRootLine($pid);
00580 
00581          // First, find out what mount index to use (if more than one DB mount exists):
00582       $mountIndex = 0;
00583       $mountKeys = array_flip($BE_USER->returnWebmounts());
00584       foreach($rL as $rLDat)  {
00585          if (isset($mountKeys[$rLDat['uid']]))  {
00586             $mountIndex = $mountKeys[$rLDat['uid']];
00587             break;
00588          }
00589       }
00590 
00591          // Traverse rootline and open paths:
00592       foreach($rL as $rLDat)  {
00593          $expandedPages[$mountIndex][$rLDat['uid']] = 1;
00594       }
00595 
00596          // Write back:
00597       $BE_USER->uc['browseTrees']['browsePages'] = serialize($expandedPages);
00598       $BE_USER->writeUC();
00599    }

t3lib_BEfunc::readPageAccess id,
perms_clause
 

Returns a page record (of page with $id) with an extra field "_thePath" set to the record path IF the WHERE clause, $perms_clause, selects the record.

Thus is works as an access check that returns a page record if access was granted, otherwise not. If $id is zero a pseudo root-page with "_thePath" set is returned IF the current BE_USER is admin. In any case ->isInWebMount must return true for the user (regardless of $perms_clause) Usage: 21

Parameters:
integer Page uid for which to check read-access
string $perms_clause is typically a value generated with $BE_USER->getPagePermsClause(1);
Returns:
array Returns page record if OK, otherwise false.

Definition at line 781 of file class.t3lib_befunc.php.

References getRecord(), and getRecordPath().

Referenced by localFolderTree::SC_browse_links::expandPage(), SC_db_new_content_el::init(), SC_db_layout::init(), SC_show_item::init(), SC_db_new::init(), SC_alt_db_navframe::initializeTemporaryDBmount(), SC_move_el::main(), SC_mod_web_perm_index::main(), SC_mod_web_info_index::main(), SC_mod_web_func_index::main(), and SC_db_list::main().

00781                                                 {
00782       if ((string)$id!='') {
00783          $id = intval($id);
00784          if (!$id)   {
00785             if ($GLOBALS['BE_USER']->isAdmin()) {
00786                $path = '/';
00787                $pageinfo['_thePath'] = $path;
00788                return $pageinfo;
00789             }
00790          } else {
00791             $pageinfo = t3lib_BEfunc::getRecord('pages',$id,'*',($perms_clause ? ' AND '.$perms_clause : ''));
00792             if ($pageinfo['uid'] && $GLOBALS['BE_USER']->isInWebMount($id,$perms_clause)) {
00793                list($pageinfo['_thePath'],$pageinfo['_thePathFull']) = t3lib_BEfunc::getRecordPath(intval($pageinfo['uid']), $perms_clause, 15, 1000);
00794                return $pageinfo;
00795             }
00796          }
00797       }
00798       return false;
00799    }

t3lib_BEfunc::searchQuery searchWords,
fields,
table = ''
 

Returns a WHERE clause which will make an AND search for the words in the $searchWords array in any of the fields in array $fields.

Usage: 0

Parameters:
array Array of search words
array Array of fields
string Table in which we are searching (for DBAL detection of quoteStr() method)
Returns:
string WHERE clause for search Use $GLOBALS['TYPO3_DB']->searchQuery() directly!

Definition at line 320 of file class.t3lib_befunc.php.

References table().

00320                                                          {
00321       return $GLOBALS['TYPO3_DB']->searchQuery($searchWords,$fields,$table);
00322    }

t3lib_BEfunc::splitTable_Uid str  ) 
 

Makes an backwards explode on the $str and returns an array with ($table,$uid).

Example: tt_content_45 => array('tt_content',45) Usage: 1

Parameters:
string [tablename]_[uid] string to explode
Returns:
array

Definition at line 347 of file class.t3lib_befunc.php.

References table().

Referenced by getSingleField_typeGroup().

00347                                  {
00348       list($uid,$table) = explode('_',strrev($str),2);
00349       return array(strrev($table),strrev($uid));
00350    }

t3lib_BEfunc::storeHash hash,
data,
ident
 

Stores the string value $data in the 'cache_hash' table with the hash key, $hash, and visual/symbolic identification, $ident IDENTICAL to the function by same name found in t3lib_page: Usage: 2.

Parameters:
string Hash key, 32 bytes hex
string $data must be serialized before function call
string Visual/symbolic identification (informational only)
Returns:
void

Definition at line 1048 of file class.t3lib_befunc.php.

References time().

Referenced by t3lib_userAuthGroup::fetchGroupData(), and getPagesTSconfig().

01048                                           {
01049       $insertFields = array(
01050          'hash' => $hash,
01051          'content' => $data,
01052          'ident' => $ident,
01053          'tstamp' => time()
01054       );
01055       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash="'.$GLOBALS['TYPO3_DB']->quoteStr($hash, 'cache_hash').'"');
01056       $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
01057    }

t3lib_BEfunc::thumbCode row,
table,
field,
backPath,
thumbScript = '',
uploaddir = NULL,
abs = 0,
tparams = '',
size = ''
 

Returns a linked image-tag for thumbnail(s)/fileicons/truetype-font-previews from a database row with a list of image files in a field All $TYPO3_CONF_VARS['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example) Thumbsnails are linked to the show_item.php script which will display further details.

Usage: 7

Parameters:
array $row is the database row from the table, $table.
string Table name for $row (present in TCA)
string $field is pointing to the field with the list of image files
string Back path prefix for image tag src="" field
string Optional: $thumbScript os by default 'thumbs.php' if you don't set it otherwise
string Optional: $uploaddir is the directory relative to PATH_site where the image files from the $field value is found (Is by default set to the entry in $TCA for that field! so you don't have to!)
boolean If set, uploaddir is NOT prepended with "../"
string Optional: $tparams is additional attributes for the image tags
integer Optional: $size is [w]x[h] of the thumbnail. 56 is default.
Returns:
string Thumbnail image tag.

Definition at line 1509 of file class.t3lib_befunc.php.

References $TCA, getFileIcon(), PATH_site, and table().

01509                                                                                                                   {
01510       global $TCA;
01511          // Load table.
01512       t3lib_div::loadTCA($table);
01513 
01514          // Find uploaddir automatically
01515       $uploaddir = (is_null($uploaddir)) ? $TCA[$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir;
01516       $uploaddir = preg_replace('#/$#','',$uploaddir);
01517 
01518          // Set thumbs-script:
01519       if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'])   {
01520          $thumbScript='gfx/notfound_thumb.gif';
01521       } elseif(!$thumbScript) {
01522          $thumbScript='thumbs.php';
01523       }
01524          // Check and parse the size parameter
01525       $sizeParts=array();
01526       if ($size = trim($size)) {
01527          $sizeParts = explode('x', $size.'x'.$size);
01528          if(!intval($sizeParts[0])) $size='';
01529       }
01530 
01531          // Traverse files:
01532       $thumbs = explode(',', $row[$field]);
01533       $thumbData='';
01534       while(list(,$theFile)=each($thumbs))   {
01535          if (trim($theFile))  {
01536             $fI = t3lib_div::split_fileref($theFile);
01537             $ext = $fI['fileext'];
01538                   // New 190201 start
01539             $max=0;
01540             if (t3lib_div::inList('gif,jpg,png',$ext)) {
01541                $imgInfo=@getimagesize(PATH_site.$uploaddir.'/'.$theFile);
01542                if (is_array($imgInfo)) {$max = max($imgInfo[0],$imgInfo[1]);}
01543             }
01544                // use the original image if it's size fits to the thumbnail size
01545             if ($max && $max<=(count($sizeParts)&&max($sizeParts)?max($sizeParts):56)) {
01546                $url = $uploaddir.'/'.trim($theFile);
01547                $theFile = '../'.$url;
01548                $onClick='top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;';
01549                $thumbData.='<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="../'.$backPath.$url.'" '.$imgInfo[3].' hspace="2" border="0" title="'.trim($url).'"'.$tparams.' alt="" /></a> ';
01550                   // New 190201 stop
01551             } elseif ($ext=='ttf' || t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$ext)) {
01552                $theFile = ($abs?'':'../').($uploaddir?$uploaddir.'/':'').trim($theFile);
01553                $params = '&file='.rawurlencode($theFile);
01554                $params .= $size?'&size='.$size:'';
01555                $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
01556                $onClick='top.launchView(\''.$theFile.'\',\'\',\''.$backPath.'\');return false;';
01557                $thumbData.='<a href="#" onclick="'.htmlspecialchars($onClick).'"><img src="'.htmlspecialchars($backPath.$url).'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /></a> ';
01558             } else {
01559                $icon = t3lib_BEfunc::getFileIcon($ext);
01560                $url = 'gfx/fileicons/'.$icon;
01561                $thumbData.='<img src="'.$backPath.$url.'" hspace="2" border="0" title="'.trim($theFile).'"'.$tparams.' alt="" /> ';
01562             }
01563          }
01564       }
01565       return $thumbData;
01566    }

t3lib_BEfunc::time value  ) 
 

Returns $value (in seconds) formatted as hh:mm:ss For instance $value = 3600 + 60*2 + 3 should return "01:02:03" Usage: 1 (class t3lib_BEfunc).

Parameters:
integer Time stamp, seconds
Returns:
string Formatted time

Definition at line 1412 of file class.t3lib_befunc.php.

Referenced by ADMCMD_previewCmds(), dateTimeAge(), getProcessedValue(), and storeHash().

01412                            {
01413       $hh = floor($value/3600);
01414       $min = floor(($value-$hh*3600)/60);
01415       $sec = $value-$hh*3600-$min*60;
01416       $l = sprintf('%02d',$hh).':'.sprintf('%02d',$min).':'.sprintf('%02d',$sec);
01417       return $l;
01418    }

t3lib_BEfunc::titleAltAttrib content  ) 
 

Returns alt="" and title="" attributes with the value of $content.

Usage: 7

Parameters:
string Value for 'alt' and 'title' attributes (will be htmlspecialchars()'ed before output)
Returns:
string

Definition at line 1485 of file class.t3lib_befunc.php.

References $out.

Referenced by getSingleField_typeFlex_sheetMenu().

01485                                        {
01486       $out='';
01487       $out.=' alt="'.htmlspecialchars($content).'"';
01488       $out.=' title="'.htmlspecialchars($content).'"';
01489       return $out;
01490    }

t3lib_BEfunc::titleAttrib content = '',
hsc = 0
 

Returns either title='' or alt='' attribute.

This depends on the client browser and whether it supports title='' or not (which is the default) If no $content is given only the attribute name is returned. The returned attribute with content will have a leading space char. Warning: Be careful to submit empty $content var - that will return just the attribute name! Usage: 0

Parameters:
string String to set as title-attribute. If no $content is given only the attribute name is returned.
boolean If $hsc is set, then content of the attribute is htmlspecialchar()'ed (which is good for XHTML and other reasons...)
Returns:
string The idea made sense with older browsers, but now all browsers should support the "title" attribute - so just hardcode the title attribute instead!

Definition at line 1472 of file class.t3lib_befunc.php.

References $CLIENT.

01472                                              {
01473       global $CLIENT;
01474       $attrib= ($CLIENT['BROWSER']=='net'&&$CLIENT['VERSION']<5)||$CLIENT['BROWSER']=='konqu' ? 'alt' : 'title';
01475       return strcmp($content,'')?' '.$attrib.'="'.($hsc?htmlspecialchars($content):$content).'"' : $attrib;
01476    }

t3lib_BEfunc::titleAttribForPages row,
perms_clause = '',
includeAttrib = 1
 

Returns title-attribute information for a page-record informing about id, alias, doktype, hidden, starttime, endtime, fe_group etc.

Usage: 8

Parameters:
array Input must be a page row ($row) with the proper fields set (be sure - send the full range of fields for the table)
string $perms_clause is used to get the record path of the shortcut page, if any (and doktype==4)
boolean If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already
Returns:
string

Definition at line 1595 of file class.t3lib_befunc.php.

References $LANG, $out, date(), dateTimeAge(), getLabelFromItemlist(), getRecord(), and getRecordPath().

Referenced by getRecordIconAltText(), and t3lib_browseTree::getTitleAttrib().

01595                                                                         {
01596       global $TCA,$LANG;
01597       $parts=array();
01598       $parts[] = 'id='.$row['uid'];
01599       if ($row['alias'])   $parts[]=$LANG->sL($TCA['pages']['columns']['alias']['label']).' '.$row['alias'];
01600       if ($row['t3ver_id'])   $parts[] = 'v#'.$row['t3ver_id'];
01601       if ($row['doktype']=='3')  {
01602          $parts[]=$LANG->sL($TCA['pages']['columns']['url']['label']).' '.$row['url'];
01603       } elseif ($row['doktype']=='4')  {
01604          if ($perms_clause)   {
01605             $label = t3lib_BEfunc::getRecordPath(intval($row['shortcut']),$perms_clause,20);
01606          } else {
01607             $lRec = t3lib_BEfunc::getRecord('pages',intval($row['shortcut']),'title');
01608             $label = $lRec['title'];
01609          }
01610          if ($row['shortcut_mode']>0)  {
01611             $label.=', '.$LANG->sL($TCA['pages']['columns']['shortcut_mode']['label']).' '.
01612                      $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','shortcut_mode',$row['shortcut_mode']));
01613          }
01614          $parts[]=$LANG->sL($TCA['pages']['columns']['shortcut']['label']).' '.$label;
01615       } elseif ($row['doktype']=='7')  {
01616          if ($perms_clause)   {
01617             $label = t3lib_BEfunc::getRecordPath(intval($row['mount_pid']),$perms_clause,20);
01618          } else {
01619             $lRec = t3lib_BEfunc::getRecord('pages',intval($row['mount_pid']),'title');
01620             $label = $lRec['title'];
01621          }
01622          $parts[]=$LANG->sL($TCA['pages']['columns']['mount_pid']['label']).' '.$label;
01623          if ($row['mount_pid_ol'])  {
01624             $parts[] = $LANG->sL($TCA['pages']['columns']['mount_pid_ol']['label']);
01625          }
01626       }
01627       if ($row['nav_hide'])   $parts[] = ereg_replace(':$','',$LANG->sL($TCA['pages']['columns']['nav_hide']['label']));
01628       if ($row['hidden'])  $parts[] = $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.hidden');
01629       if ($row['starttime'])  $parts[] = $LANG->sL($TCA['pages']['columns']['starttime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['starttime'],-1,'date');
01630       if ($row['endtime']) $parts[] = $LANG->sL($TCA['pages']['columns']['endtime']['label']).' '.t3lib_BEfunc::dateTimeAge($row['endtime'],-1,'date');
01631       if ($row['fe_group'])   {
01632          if ($row['fe_group']<0) {
01633             $label = $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('pages','fe_group',$row['fe_group']));
01634          } else {
01635             $lRec = t3lib_BEfunc::getRecord('fe_groups',$row['fe_group'],'title');
01636             $label = $lRec['title'];
01637          }
01638          $parts[] = $LANG->sL($TCA['pages']['columns']['fe_group']['label']).' '.$label;
01639       }
01640       $out = htmlspecialchars(implode(' - ',$parts));
01641       return $includeAttrib ? 'title="'.$out.'"' : $out;
01642    }

t3lib_BEfunc::unsetMenuItems modTSconfig,
itemArray,
TSref
 

Removes menu items from $itemArray if they are configured to be removed by TSconfig for the module ($modTSconfig) See Inside TYPO3 about how to program modules and use this API.

Usage: 4

Parameters:
array Module TS config array
array Array of items from which to remove items.
string $TSref points to the "object string" in $modTSconfig
Returns:
array The modified $itemArray is returned.

Definition at line 2291 of file class.t3lib_befunc.php.

Referenced by SC_db_layout::menuConfig(), t3lib_SCbase::menuConfig(), and tx_funcwizards_webfunc::modMenu().

02291                                                             {
02292          // Getting TS-config options for this module for the Backend User:
02293       $conf = $GLOBALS['BE_USER']->getTSConfig($TSref,$modTSconfig);
02294       if (is_array($conf['properties']))  {
02295          reset($conf['properties']);
02296          while(list($key,$val)=each($conf['properties']))   {
02297             if (!$val)  {
02298                unset($itemArray[$key]);
02299             }
02300          }
02301       }
02302       return $itemArray;
02303    }

t3lib_BEfunc::updatePagesTSconfig id,
pageTS,
TSconfPrefix,
impParams = ''
 

Updates Page TSconfig for a page with $id The function seems to take $pageTS as an array with properties and compare the values with those that already exists for the "object string", $TSconfPrefix, for the page, then sets those values which were not present.

$impParams can be supplied as already known Page TSconfig, otherwise it's calculated.

THIS DOES NOT CHECK ANY PERMISSIONS. SHOULD IT? More documentation is needed.

Usage: 1 (ext. direct_mail)

Parameters:
integer Page id
array Page TS array to write
string Prefix for object paths
array [Description needed.]
Returns:
void

Definition at line 1155 of file class.t3lib_befunc.php.

References getPagesTSconfig(), and implodeTSParams().

01155                                                                            {
01156       $id=intval($id);
01157       if (is_array($pageTS) && $id>0)  {
01158          if (!is_array($impParams)) {
01159             $impParams =t3lib_BEfunc::implodeTSParams(t3lib_BEfunc::getPagesTSconfig($id));
01160          }
01161          reset($pageTS);
01162          $set=array();
01163          while(list($f,$v)=each($pageTS)) {
01164             $f = $TSconfPrefix.$f;
01165             if ((!isset($impParams[$f])&&trim($v)) || strcmp(trim($impParams[$f]),trim($v))) {
01166                $set[$f]=trim($v);
01167             }
01168          }
01169          if (count($set))  {
01170                // Get page record and TS config lines
01171             $pRec = t3lib_befunc::getRecord('pages',$id);
01172             $TSlines = explode(chr(10),$pRec['TSconfig']);
01173             $TSlines = array_reverse($TSlines);
01174                // Reset the set of changes.
01175             reset($set);
01176             while(list($f,$v)=each($set)) {
01177                reset($TSlines);
01178                $inserted=0;
01179                while(list($ki,$kv)=each($TSlines)) {
01180                   if (substr($kv,0,strlen($f)+1)==$f.'=')   {
01181                      $TSlines[$ki]=$f.'='.$v;
01182                      $inserted=1;
01183                      break;
01184                   }
01185                }
01186                if (!$inserted)   {
01187                   $TSlines = array_reverse($TSlines);
01188                   $TSlines[]=$f.'='.$v;
01189                   $TSlines = array_reverse($TSlines);
01190                }
01191             }
01192             $TSlines = array_reverse($TSlines);
01193 
01194                // store those changes
01195             $TSconf = implode(chr(10),$TSlines);
01196 
01197             $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid='.intval($id), array('TSconfig' => $TSconf));
01198          }
01199       }
01200    }

t3lib_BEfunc::viewOnClick id,
backPath = '',
rootLine = '',
anchor = '',
altUrl = '',
addGetVars = ''
 

Returns a JavaScript string for viewing the page id, $id It will detect the correct domain name if needed and provide the link with the right back path.

Also it will re-use any window already open. Usage: 8

Parameters:
integer $id is page id
string $backpath must point back to TYPO3_mainDir (where the site is assumed to be one level above)
array If root line is supplied the function will look for the first found domain record and use that URL instead (if found)
string $anchor is optional anchor to the URL
string $altUrl is an alternative URL which - if set - will make all other parameters ignored: The function will just return the window.open command wrapped around this URL!
string Additional GET variables.
Returns:
string

Definition at line 2155 of file class.t3lib_befunc.php.

References firstDomainRecord(), and getDomainStartPage().

Referenced by SC_db_layout::main().

02155                                                                                              {
02156       if ($altUrl)   {
02157          $url = $altUrl;
02158       } else {
02159          if ($rootLine) {
02160             $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
02161             if (t3lib_BEfunc::getDomainStartPage($parts['host'],$parts['path'])) {
02162                $preUrl_temp = t3lib_BEfunc::firstDomainRecord($rootLine);
02163             }
02164          }
02165          $preUrl = $preUrl_temp ? 'http://'.$preUrl_temp : $backPath.'..';
02166          $url = $preUrl.'/index.php?id='.$id.$addGetVars.$anchor;
02167       }
02168 
02169       return "previewWin=window.open('".$url."','newTypo3FrontendWindow','status=1,menubar=1,resizable=1,location=1,scrollbars=1,toolbar=1');previewWin.focus();";
02170    }


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:06:45 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913