Base class for frontend plugins
Most modern frontend plugins are extension classes of this one.
This class contains functions which assists these plugins in creating lists,
searching, displaying menus, page-browsing (next/previous/1/2/3) and handling
links.
Functions are all prefixed "pi_" which is reserved for this class. Those
functions can of course be overridden in the extension classes (that is the
point...)
Files: 1
Total filesizes: 40 Kbytes
Functions and classes: 34
Base class for frontend plugins
Most modern frontend plugins are extension classes of this one.
This class contains functions which assists these plugins in creating lists,
searching, displaying menus, page-browsing (next/previous/1/2/3) and handling
links.
Functions are all prefixed "pi_" which is reserved for this class. Those
functions can of course be overridden in the extension classes (that is the
point...)
@package: TYPO3
@subpackage: tslib
Base class for frontend plugins
Most modern frontend plugins are extension classes of this one.
This class contains functions which assists these plugins in creating lists,
searching, displaying menus, page-browsing (next/previous/1/2/3) and handling
links.
Functions are all prefixed "pi_" which is reserved for this class. Those
functions can of course be overridden in the extension classes (that is the
point...)
Filesize: | 40 K |
Func/Classes: | 34 |
Tags: | @author Kasper Skaarhoj <kasper@typo3.com> @package TYPO3 @subpackage tslib |
Base class for frontend plugins
Most modern frontend plugins are extension classes of this one.
This class contains functions which assists these plugins in creating lists,
searching, displaying menus, page-browsing (next/previous/1/2/3) and handling
links.
Functions are all prefixed "pi_" which is reserved for this class. Those
functions can of course be overridden in the extension classes (that is the
point...)
Returns: | [type] | ... |
@author Kasper Skaarhoj <kasper@typo3.com> | ||
@package TYPO3 | ||
@subpackage tslib |
Class Constructor (true constructor)
Initializes $this->piVars if $this->prefixId is set to any value
Will also set $this->LLkey based on the config.language setting.
Returns: | void |
If internal TypoScript property "_DEFAULT_PI_VARS." is set then it will merge the current $this->piVars array onto these default values.
Returns: | void |
Get URL to some page.
Returns the URL to page $id with $target and an array of additional url-parameters, $urlParameters
Simple example: $this->pi_getPageLink(123) to get the URL for page-id 123.
The function basically calls $this->cObj->getTypoLink_URL()
$id | integer | Page id |
$target='' | string | Target value to use. Affects the &type-value of the URL, defaults to current. |
$urlParameters=array() | array | Additional URL parameters to set (key/value pairs) |
Returns: | string | The resulting URL |
@see pi_linkToPage() |
Link a string to some page.
Like pi_getPageLink() but takes a string as first parameter which will in
turn be wrapped with the URL including target attribute
Simple example: $this->pi_getPageLink('My link', 123) to get something
like <a href="index.php?id=123&type=1">My link</a> (or <a
href="123.1.html">My link</a> if simulateStaticDocuments is set)
$str | string | The content string to wrap in <a> tags |
$id | integer | Page id |
$target='' | string | Target value to use. Affects the &type-value of the URL, defaults to current. |
$urlParameters=array() | array | Additional URL parameters to set (key/value pairs) |
Returns: | string | The input string wrapped in <a> tags with the URL and target set. |
@see pi_getPageLink(), tslib_cObj::getTypoLink() |
Link string to the current page.
Returns the $str wrapped in <a>-tags with a link to the CURRENT page,
but with $urlParameters set as extra parameters for the page.
$str | string | The content string to wrap in <a> tags |
$urlParameters=array() | array | Array with URL parameters as key/value pairs. They will be "imploded" and added to the list of parameters defined in the plugins TypoScript property "parent.addParams" plus $this->pi_moreParams. |
$cache=0 | boolean | If $cache is set, the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER_INT). Otherwise the no_cache-parameter will be a part of the link. |
Returns: | string | The input string wrapped in <a> tags |
@see pi_linkTP_keepPIvars(), tslib_cObj::typoLink() |
Link a string to the current page while keeping currently set values in piVars.
Like pi_linkTP, but $urlParameters is by default set to $this->piVars with $overrulePIvars overlaid.
This means any current entries from this->piVars are passed on (except
the key "DATA" which will be unset before!) and entries in $overrulePIvars
will OVERRULE the current in the link.
$str | string | The content string to wrap in <a> tags |
$overrulePIvars=array() | array | Array of values to override in the current piVars. Contrary to pi_linkTP the keys in this array must correspond to the real piVars array and therefore NOT be prefixed with the $this->prefixId string. Further, if a value is a blank string it means the piVar key will not be a part of the link (unset) |
$cache=0 | boolean | If $cache is set, the page is asked to be cached by a &cHash value (unless the current plugin using this class is a USER_INT). Otherwise the no_cache-parameter will be a part of the link. |
$clearAnyway=0 | boolean | If set, then the current values of piVars will NOT be preserved anyways... Practical if you want an easy way to set piVars without having to worry about the prefix, "tx_xxxxx[]" |
Returns: | string | The input string wrapped in <a> tags |
@see pi_linkTP() |
Get URL to the current page while keeping currently set values in piVars.
Same as pi_linkTP_keepPIvars but returns only the URL from the link.
$overrulePIvars=array() | array | See pi_linkTP_keepPIvars |
$cache=0 | boolean | See pi_linkTP_keepPIvars |
$clearAnyway=0 | boolean | See pi_linkTP_keepPIvars |
Returns: | string | The URL ($this->cObj->lastTypoLinkUrl) |
@see pi_linkTP_keepPIvars() |
Wraps the $str in a link to a single display of the record (using piVars[showUid])
Uses pi_linkTP for the linking
$str | string | The content string to wrap in <a> tags |
$uid | integer | UID of the record for which to display details (basically this will become the value of [showUid] |
$cache=0 | boolean | See pi_linkTP_keepPIvars |
$mergeArr=array() | array | Array of values to override in the current piVars. Same as $overrulePIvars in pi_linkTP_keepPIvars |
Returns: | string | The input string wrapped in <a> tags |
@see pi_linkTP(), pi_linkTP_keepPIvars() |
Will change the href value from <a> in the input string and turn it into an onclick event that will open a new window with the URL
$str | string | The string to process. This should be a string already wrapped/including a <a> tag which will be modified to contain an onclick handler. Only the attributes "href" and "onclick" will be left. |
$winName='' | string | Window name for the pop-up window |
$winParams='width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1' | string | Window parameters, see the default list for inspiration |
Returns: | string | The processed input string, modified IF a <a> tag was found |
Returns
a results browser. This means a bar of page numbers plus a "previous" and
"next" link. For each entry in the bar the piVars "pointer" will be pointing
to the "result page" to show.
Using $this->piVars['pointer'] as pointer to the page to display
Using $this->internal['res_count'], $this->internal['results_at_a_time']
and $this->internal['maxPages'] for count number, how many results to
show and the max number of pages to include in the browse bar.
$showResultCount=1 | boolean | If set (default) the text "Displaying results..." will be show, otherwise not. |
$tableParams='' | string | Attributes for the table tag which is wrapped around the table cells containing the browse links |
Returns: | string | Output HTML, wrapped in <div>-tags with a class attribute |
Returns a Search box, sending search words to piVars "sword" and setting the "no_cache" parameter as well in the form.
Submits the search request to the current REQUEST_URI
$tableParams='' | string | Attributes for the table tag which is wrapped around the table cells containing the search box |
Returns: | string | Output HTML, wrapped in <div>-tags with a class attribute |
Returns a mode selector; a little menu in a table normally put in the top of the page/list.
$items=array() | array | Key/Value pairs for the menu; keys are the piVars[mode] values and the "values" are the labels for them. |
$tableParams='' | string | Attributes for the table tag which is wrapped around the table cells containing the menu |
Returns: | string | Output HTML, wrapped in <div>-tags with a class attribute |
Returns the list of items based on the input MySQL result pointer
For each result row the internal var, $this->internal['currentRow'], is set with the row returned.
$this->pi_list_header() makes the header row for the list
$this->pi_list_row() is used for rendering each row
Notice that these two functions are typically ALWAYS defined in the extension
class of the plugin since they are directly concerned with the specific layout
for that plugins purpose.
$res | pointer | Result pointer to a MySQL result which can be traversed. |
$tableParams='' | string | Attributes for the table tag which is wrapped around the table rows containing the list |
Returns: | string | Output HTML, wrapped in <div>-tags with a class attribute |
@see pi_list_row(), pi_list_header() |
Returns a list row. Get data from $this->internal['currentRow'];
(Dummy)
Notice: This function should ALWAYS be defined in the extension class of
the plugin since it is directly concerned with the specific layout of the
listing for your plugins purpose.
$c | integer | Row counting. Starts at 0 (zero). Used for alternating class values in the output rows. |
Returns: | string | HTML output, a table row with a class attribute set (alternative based on odd/even rows) |
Returns a list header row.
(Dummy)
Notice: This function should ALWAYS be defined in the extension class of
the plugin since it is directly concerned with the specific layout of the
listing for your plugins purpose.
Returns: | string | HTML output, a table row with a class attribute set |
Returns a class-name prefixed with $this->prefixId and with all underscores substituted to dashes (-)
$class | string | The class name (or the END of it since it will be prefixed by $this->prefixId.'-') |
Returns: | string | The combined class name (with the correct prefix) |
Returns the class-attribute with the correctly prefixed classname
Using pi_getClassName()
$class | string | The class name (suffix) |
Returns: | string | A "class" attribute with value and a single space char before it. |
@see pi_getClassName() |
Sets CSS style-data for the $class-suffix (prefixed by pi_getClassName())
$class | string | $class: Class suffix, see pi_getClassName |
$data | string | $data: CSS data |
$selector='' | string | If $selector is set to any CSS selector, eg 'P' or 'H1' or 'TABLE' then the style $data will regard those HTML-elements only |
Returns: | void | |
@depreciated I think this function should not be used (and probably isn't used anywhere). It was a part of a concept which was left behind quite quickly. | ||
@private |
Wraps the input string in a <div> tag with the class attribute set to the prefixId.
All content returned from your plugins should be returned through this function
so all content from your plugin is encapsulated in a <div>-tag nicely
identifying the content of your plugin.
$str | string | HTML content to wrap in the div-tags with the "main class" of the plugin |
Returns: | string | HTML content wrapped, ready to return to the parent object. |
Returns the Backend User edit panel for the $row from $tablename
$row='' | array | Record array. |
$tablename='' | string | Table name |
$label='' | string | A label to show with the panel. |
$conf=Array() | array | TypoScript parameters to pass along to the EDITPANEL content Object that gets rendered. The property "allow" WILL get overridden/set though. |
Returns: | string | Returns false/blank if no BE User login and of course if the panel is not shown for other reasons. Otherwise the HTML for the panel (a table). |
@see tslib_cObj::EDITPANEL() |
Adds edit-icons to the input content.
tslib_cObj::editIcons used for rendering
$content | string | HTML content to add icons to. The icons will be put right after the last content part in the string (that means before the ending series of HTML tags) |
$fields | string | The list of fields to edit when the icon is clicked. |
$title='' | string | Title for the edit icon. |
$row='' | array | Table record row |
$tablename='' | string | Table name |
Returns: | string | The processed content |
@see tslib_cObj::editIcons() |
Returns the localized label of the LOCAL_LANG key, $key
Notice that for debugging purposes prefixes for the output values can be
set with the internal vars ->LLtestPrefixAlt and ->LLtestPrefix
$key | string | The key from the LOCAL_LANG array for which to return the value. |
$alt='' | string | Alternative string to return IF no value is found set for the key, neither for the local language nor the default. |
Returns: | string | The value from LOCAL_LANG. |
Loads
local-language values by looking for a "locallang.php" file in the plugin
class directory ($this->scriptRelPath) and if found includes it.
Also locallang values set in the TypoScript property "_LOCAL_LANG" are merged onto the values found in the "locallang.php" file.
Returns: | void |
Makes
a standard query for listing of records based on standard input vars from
the 'browser' ($this->internal['results_at_a_time'] and $this->piVars['pointer'])
and 'searchbox' ($this->piVars['sword'] and $this->internal['searchFieldList'])
Set $count to 1 if you wish to get a count(*) query for selecting the number of results.
Notice that the query will use $this->conf['pidList'] and $this->conf['recursive']
to generate a PID list within which to search for records.
$table | string | The table name to make the query for. |
$count=0 | boolean | If set, you will get a "count(*)" query back instead of field selecting |
$addWhere='' | string | Additional WHERE clauses (should be starting with " AND ....") |
$mm_cat='' | mixed | If an array, then it must contain the keys "table", "mmtable" and (optionally) "catUidList" defining a table to make a MM-relation to in the query (based on fields uid_local and uid_foreign). If not array, the query will be a plain query looking up data in only one table. |
$groupBy='' | string | If set, this is added as a " GROUP BY ...." part of the query. |
$orderBy='' | string | If set, this is added as a " ORDER BY ...." part of the query. The default is that an ORDER BY clause is made based on $this->internal['orderBy'] and $this->internal['descFlag'] where the orderBy field must be found in $this->internal['orderByList'] |
$query='' | string | If set, this is taken as the first part of the query instead of what is created internally. Basically this should be a query starting with "FROM [table] WHERE ... AND ...". The $addWhere clauses and all the other stuff is still added. Only the tables and PID selecting clauses are bypassed |
Returns: | string | The query build. |
Returns the row $uid from $table
(Simply calling $GLOBALS['TSFE']->sys_page->checkRecord())
$table | string | The table name |
$uid | integer | The uid of the record from the table |
$checkPage=0 | boolean | If $checkPage is set, it's required that the page on which the record resides is accessible |
Returns: | array | If record is found, an array. Otherwise false. |
Returns a commalist of page ids for a query (eg. 'WHERE pid IN (...)')
$pid_list | string | $pid_list is a comma list of page ids (if empty current page is used) |
$recursive=0 | integer | $recursive is an integer >=0 telling how deep to dig for pids under each entry in $pid_list |
Returns: | string | List of PID values (comma separated) |
Having a comma list of fields ($fieldList) this is prepended with the $table.'.' name
$table | string | Table name to prepend |
$fieldList | string | List of fields where each element will be prepended with the table name given. |
Returns: | string | List of fields processed. |
Will select all records from the "category table", $table, and return them in an array.
$table | string | The name of the category table to select from. |
$pid | integer | The page from where to select the category records. |
$addWhere='' | string | Additional where clauses (basically the end of the query - could include a ORDER BY clause) |
Returns: | array | The array with the category records in. |
Returns
true if the piVars array has ONLY those fields entered that is set in the
$fList (commalist) AND if none of those fields value is greater than $lowerThan
field if they are integers.
Notice that this function will only work as long as values are integers.
$fList | string | List of fields (keys from piVars) to evaluate on |
$lowerThan=-1 | integer | Limit for the values. |
Returns: | boolean | Returns true (1) if conditions are met. |
Returns
true if the array $inArray contains only values allowed to be cached based
on the configuration in $this->pi_autoCacheFields
Used by ->pi_linkTP_keepPIvars
This is an advanced form of evaluation of whether a URL should be cached or not.
$inArray | array | An array with piVars values to evaluate |
Returns: | boolean | Returns true (1) if conditions are met. |
@see pi_linkTP_keepPIvars() |
Will
process the input string with the parseFunc function from tslib_cObj based
on configuration set in "lib.parseFunc_RTE" in the current TypoScript template.
This is useful for rendering of content in RTE fields where the transformation mode is set to "ts_css" or so.
Notice that this requires the use of "css_styled_content" to work right.
$str | string | The input text string to process |
Returns: | string | The processed string |
@see tslib_cObj::parseFunc() |
$T3FlexForm_array | [type] | $T3FlexForm_array: ... |
$fieldName | [type] | $fieldName: ... |
$sheet='sDEF' | [type] | $sheet: ... |
$lang='lDEF' | [type] | $lang: ... |
$value='vDEF' | [type] | $value: ... |
Returns: | [type] | ... |
[Describe function...]
$sheetArray | [type] | $sheetArray: ... |
$fieldNameArr | [type] | $fieldNameArr: ... |
$value | [type] | $value: ... |
Returns: | [type] | ... |