| [ Index ] |
|
Code source de Typo3 4.1.3 |
[Code source] [Imprimer] [Statistiques]
This script contains the parent class, 'pibase', providing an API with the most basic methods for frontend plugins $Id: class.tslib_pibase.php 1930 2007-01-23 22:43:06Z mundaun $ Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj XHTML compliant
| Author: | Kasper Skaarhoj <kasperYYYY@typo3.com> |
| Poids: | 1383 lignes (59 kb) |
| Inclus ou requis: | 0 fois |
| Référencé: | 0 fois |
| Nécessite: | 0 fichiers |
tslib_pibase:: (35 méthodes):
tslib_pibase()
pi_setPiVarDefaults()
pi_getPageLink()
pi_linkToPage()
pi_linkTP()
pi_linkTP_keepPIvars()
pi_linkTP_keepPIvars_url()
pi_list_linkSingle()
pi_openAtagHrefInJSwindow()
pi_list_browseresults()
pi_list_searchBox()
pi_list_modeSelector()
pi_list_makelist()
pi_list_row()
pi_list_header()
pi_getClassName()
pi_classParam()
pi_setClassStyle()
pi_wrapInBaseClass()
pi_getEditPanel()
pi_getEditIcon()
pi_getLL()
pi_loadLL()
pi_list_query()
pi_exec_query()
pi_getRecord()
pi_getPidList()
pi_prependFieldsWithTable()
pi_getCategoryTableContents()
pi_isOnlyFields()
pi_autoCache()
pi_RTEcssText()
pi_initPIflexForm()
pi_getFFvalue()
pi_getFFvalueFromSheetArray()
Classe: tslib_pibase - X-Ref
Base class for frontend plugins| tslib_pibase() X-Ref |
| 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. return: void |
| pi_setPiVarDefaults() X-Ref |
| If internal TypoScript property "_DEFAULT_PI_VARS." is set then it will merge the current $this->piVars array onto these default values. return: void |
| pi_getPageLink($id,$target='',$urlParameters=array() X-Ref |
| 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() param: integer Page id param: string Target value to use. Affects the &type-value of the URL, defaults to current. param: array Additional URL parameters to set (key/value pairs) return: string The resulting URL |
| pi_linkToPage($str,$id,$target='',$urlParameters=array() X-Ref |
| 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_linkToPage('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) param: string The content string to wrap in <a> tags param: integer Page id param: string Target value to use. Affects the &type-value of the URL, defaults to current. param: array Additional URL parameters to set (key/value pairs) return: string The input string wrapped in <a> tags with the URL and target set. |
| pi_linkTP($str,$urlParameters=array() X-Ref |
| 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. param: string The content string to wrap in <a> tags param: 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. param: boolean If $cache is set (0/1), 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. param: integer Alternative page ID for the link. (By default this function links to the SAME page!) return: string The input string wrapped in <a> tags |
| pi_linkTP_keepPIvars($str,$overrulePIvars=array() X-Ref |
| 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. param: string The content string to wrap in <a> tags param: 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) param: 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. param: 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[]" param: integer Alternative page ID for the link. (By default this function links to the SAME page!) return: string The input string wrapped in <a> tags |
| pi_linkTP_keepPIvars_url($overrulePIvars=array() X-Ref |
| 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. param: array See pi_linkTP_keepPIvars param: boolean See pi_linkTP_keepPIvars param: boolean See pi_linkTP_keepPIvars param: integer See pi_linkTP_keepPIvars return: string The URL ($this->cObj->lastTypoLinkUrl) |
| pi_list_linkSingle($str,$uid,$cache=FALSE,$mergeArr=array() X-Ref |
| Wraps the $str in a link to a single display of the record (using piVars[showUid]) Uses pi_linkTP for the linking param: string The content string to wrap in <a> tags param: integer UID of the record for which to display details (basically this will become the value of [showUid] param: boolean See pi_linkTP_keepPIvars param: array Array of values to override in the current piVars. Same as $overrulePIvars in pi_linkTP_keepPIvars param: boolean If true, only the URL is returned, not a full link param: integer Alternative page ID for the link. (By default this function links to the SAME page!) return: string The input string wrapped in <a> tags |
| pi_openAtagHrefInJSwindow($str,$winName='',$winParams='width=670,height=500,status=0,menubar=0,scrollbars=1,resizable=1') X-Ref |
| 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 param: 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. param: string Window name for the pop-up window param: string Window parameters, see the default list for inspiration return: string The processed input string, modified IF a <a> tag was found |
| pi_list_browseresults($showResultCount=1, $tableParams='', $wrapArr=array() X-Ref |
| 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. Can be overwritten with another string ($pointerName) to make it possible to have more than one pagebrowser on a page) 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. Using $this->internal['dontLinkActivePage'] as switch if the active (current) page should be displayed as pure text or as a link to itself Using $this->internal['showFirstLast'] as switch if the two links named "<< First" and "LAST >>" will be shown and point to the first or last page. Using $this->internal['pagefloat']: this defines were the current page is shown in the list of pages in the Pagebrowser. If this var is an integer it will be interpreted as position in the list of pages. If its value is the keyword "center" the current page will be shown in the middle of the pagelist. Using $this->internal['showRange']: this var switches the display of the pagelinks from pagenumbers to ranges f.e.: 1-5 6-10 11-15... instead of 1 2 3... Using $this->pi_isOnlyFields: this holds a comma-separated list of fieldnames which - if they are among the GETvars - will not disable caching for the page with pagebrowser. The third parameter is an array with several wraps for the parts of the pagebrowser. The following elements will be recognized: disabledLinkWrap, inactiveLinkWrap, activeLinkWrap, browseLinksWrap, showResultsWrap, showResultsNumbersWrap, browseBoxWrap. If $wrapArr['showResultsNumbersWrap'] is set, the formatting string is expected to hold template markers (###FROM###, ###TO###, ###OUT_OF###, ###FROM_TO###, ###CURRENT_PAGE###, ###TOTAL_PAGES###) otherwise the formatting string is expected to hold sprintf-markers (%s) for from, to, outof (in that sequence) param: integer determines how the results of the pagerowser will be shown. See description below param: string Attributes for the table tag which is wrapped around the table cells containing the browse links param: array Array with elements to overwrite the default $wrapper-array. param: string varname for the pointer. param: boolean enable htmlspecialchars() for the pi_getLL function (set this to FALSE if you want f.e use images instead of text for links like 'previous' and 'next'). return: string Output HTML-Table, wrapped in <div>-tags with a class attribute (if $wrapArr is not passed, |
| pi_list_searchBox($tableParams='') X-Ref |
| 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 param: string Attributes for the table tag which is wrapped around the table cells containing the search box return: string Output HTML, wrapped in <div>-tags with a class attribute |
| pi_list_modeSelector($items=array() X-Ref |
| Returns a mode selector; a little menu in a table normally put in the top of the page/list. param: array Key/Value pairs for the menu; keys are the piVars[mode] values and the "values" are the labels for them. param: string Attributes for the table tag which is wrapped around the table cells containing the menu return: string Output HTML, wrapped in <div>-tags with a class attribute |
| pi_list_makelist($res,$tableParams='') X-Ref |
| Returns the list of items based on the input SQL 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. param: pointer Result pointer to a SQL result which can be traversed. param: string Attributes for the table tag which is wrapped around the table rows containing the list return: string Output HTML, wrapped in <div>-tags with a class attribute |
| pi_list_row($c) X-Ref |
| 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. param: integer Row counting. Starts at 0 (zero). Used for alternating class values in the output rows. return: string HTML output, a table row with a class attribute set (alternative based on odd/even rows) |
| pi_list_header() X-Ref |
| 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. return: string HTML output, a table row with a class attribute set |
| pi_getClassName($class) X-Ref |
| Returns a class-name prefixed with $this->prefixId and with all underscores substituted to dashes (-) param: string The class name (or the END of it since it will be prefixed by $this->prefixId.'-') return: string The combined class name (with the correct prefix) |
| pi_classParam($class, $addClasses='') X-Ref |
| Returns the class-attribute with the correctly prefixed classname Using pi_getClassName() param: string The class name(s) (suffix) - separate multiple classes with commas param: string Additional class names which should not be prefixed - separate multiple classes with commas return: string A "class" attribute with value and a single space char before it. |
| pi_setClassStyle($class,$data,$selector='') X-Ref |
| Sets CSS style-data for the $class-suffix (prefixed by pi_getClassName()) param: string $class: Class suffix, see pi_getClassName param: string $data: CSS data param: 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 return: void |
| pi_wrapInBaseClass($str) X-Ref |
| 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. param: string HTML content to wrap in the div-tags with the "main class" of the plugin return: string HTML content wrapped, ready to return to the parent object. |
| pi_getEditPanel($row='',$tablename='',$label='',$conf=Array() X-Ref |
| Returns the Backend User edit panel for the $row from $tablename param: array Record array. param: string Table name param: string A label to show with the panel. param: array TypoScript parameters to pass along to the EDITPANEL content Object that gets rendered. The property "allow" WILL get overridden/set though. return: 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). |
| pi_getEditIcon($content,$fields,$title='',$row='',$tablename='',$oConf=array() X-Ref |
| Adds edit-icons to the input content. tslib_cObj::editIcons used for rendering param: 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) param: string The list of fields to edit when the icon is clicked. param: string Title for the edit icon. param: array Table record row param: string Table name param: array Conf array return: string The processed content |
| pi_getLL($key,$alt='',$hsc=FALSE) X-Ref |
| 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 param: string The key from the LOCAL_LANG array for which to return the value. param: string Alternative string to return IF no value is found set for the key, neither for the local language nor the default. param: boolean If true, the output label is passed through htmlspecialchars() return: string The value from LOCAL_LANG. |
| pi_loadLL() X-Ref |
| 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. return: void |
| pi_list_query($table,$count=0,$addWhere='',$mm_cat='',$groupBy='',$orderBy='',$query='',$returnQueryArray=FALSE) X-Ref |
| 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. param: string See pi_exec_query() param: boolean See pi_exec_query() param: string See pi_exec_query() param: mixed See pi_exec_query() param: string See pi_exec_query() param: string See pi_exec_query() param: string See pi_exec_query() param: boolean If set, the function will return the query not as a string but array with the various parts. return: mixed The query build. |
| pi_exec_query($table,$count=0,$addWhere='',$mm_cat='',$groupBy='',$orderBy='',$query='') X-Ref |
| Executes a standard SELECT 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. param: string The table name to make the query for. param: boolean If set, you will get a "count(*)" query back instead of field selecting param: string Additional WHERE clauses (should be starting with " AND ....") param: 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. param: string If set, this is added as a " GROUP BY ...." part of the query. param: 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'] param: 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. May be deprecated in the future! return: pointer SQL result pointer |
| pi_getRecord($table,$uid,$checkPage=0) X-Ref |
| Returns the row $uid from $table (Simply calling $GLOBALS['TSFE']->sys_page->checkRecord()) param: string The table name param: integer The uid of the record from the table param: boolean If $checkPage is set, it's required that the page on which the record resides is accessible return: array If record is found, an array. Otherwise false. |
| pi_getPidList($pid_list,$recursive=0) X-Ref |
| Returns a commalist of page ids for a query (eg. 'WHERE pid IN (...)') param: string $pid_list is a comma list of page ids (if empty current page is used) param: integer $recursive is an integer >=0 telling how deep to dig for pids under each entry in $pid_list return: string List of PID values (comma separated) |
| pi_prependFieldsWithTable($table,$fieldList) X-Ref |
| Having a comma list of fields ($fieldList) this is prepended with the $table.'.' name param: string Table name to prepend param: string List of fields where each element will be prepended with the table name given. return: string List of fields processed. |
| pi_getCategoryTableContents($table,$pid,$whereClause='',$groupBy='',$orderBy='',$limit='') X-Ref |
| Will select all records from the "category table", $table, and return them in an array. param: string The name of the category table to select from. param: integer The page from where to select the category records. param: string Optional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT! param: string Optional GROUP BY field(s), if none, supply blank string. param: string Optional ORDER BY field(s), if none, supply blank string. param: string Optional LIMIT value ([begin,]max), if none, supply blank string. return: array The array with the category records in. |
| pi_isOnlyFields($fList,$lowerThan=-1) X-Ref |
| 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. param: string List of fields (keys from piVars) to evaluate on param: integer Limit for the values. return: boolean Returns true (1) if conditions are met. |
| pi_autoCache($inArray) X-Ref |
| 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. param: array An array with piVars values to evaluate return: boolean Returns true (1) if conditions are met. |
| pi_RTEcssText($str) X-Ref |
| 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. param: string The input text string to process return: string The processed string |
| pi_initPIflexForm($field='pi_flexform') X-Ref |
| Converts $this->cObj->data['pi_flexform'] from XML string to flexForm array. param: string Field name to convert return: void |
| pi_getFFvalue($T3FlexForm_array,$fieldName,$sheet='sDEF',$lang='lDEF',$value='vDEF') X-Ref |
| Return value from somewhere inside a FlexForm structure param: array FlexForm data param: string Field name to extract. Can be given like "test/el/2/test/el/field_templateObject" where each part will dig a level deeper in the FlexForm data. param: string Sheet pointer, eg. "sDEF" param: string Language pointer, eg. "lDEF" param: string Value pointer, eg. "vDEF" return: string The content. |
| pi_getFFvalueFromSheetArray($sheetArray,$fieldNameArr,$value) X-Ref |
| Returns part of $sheetArray pointed to by the keys in $fieldNameArray param: array Multidimensiona array, typically FlexForm contents param: array Array where each value points to a key in the FlexForms content - the input array will have the value returned pointed to by these keys. All integer keys will not take their integer counterparts, but rather traverse the current position in the array an return element number X (whether this is right behavior is not settled yet...) param: string Value for outermost key, typ. "vDEF" depending on language. return: mixed The value, typ. string. |
| Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
|