[ Index ] |
|
Code source de Typo3 4.1.3 |
[Code source] [Imprimer] [Statistiques]
Contains base class for creating a browsable array/page/folder tree in HTML $Id: class.t3lib_treeview.php 2155 2007-02-27 13:23:42Z masi $ Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
Author: | Kasper Skaarhoj <kasperYYYY@typo3.com> |
Poids: | 1091 lignes (32 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
t3lib_treeView:: (31 méthodes):
init()
setTreeName()
addField()
reset()
getBrowsableTree()
printTree()
PMicon()
PM_ATagWrap()
wrapTitle()
wrapIcon()
addTagAttributes()
wrapStop()
expandNext()
initializePositionSaving()
savePosition()
getRootIcon()
getIcon()
getTitleStr()
getTitleAttrib()
getId()
getJumpToParam()
getTree()
getCount()
getRootRecord()
getRecord()
getDataInit()
getDataCount()
getDataNext()
getDataFree()
setDataFromArray()
setDataFromTreeArray()
Classe: t3lib_treeView - X-Ref
Base class for creating a browsable array/page/folder tree in HTMLinit($clause='', $orderByFields='') X-Ref |
Initialize the tree class. Needs to be overwritten Will set ->fieldsArray, ->backPath and ->clause param: string record WHERE clause param: string record ORDER BY field return: void |
setTreeName($treeName='') X-Ref |
Sets the tree name which is used to identify the tree Used for JavaScript and other things param: string Default is the table name. Underscores are stripped. return: void |
addField($field,$noCheck=0) X-Ref |
Adds a fieldname to the internal array ->fieldArray param: string Field name to param: boolean If set, the fieldname will be set no matter what. Otherwise the field name must either be found as key in $TCA[$table]['columns'] or in the list ->defaultList return: void |
reset() X-Ref |
Resets the tree, recs, ids, ids_hierarchy and orig_ids_hierarchy internal variables. Use it if you need it. return: void |
getBrowsableTree() X-Ref |
Will create and return the HTML code for a browsable tree Is based on the mounts found in the internal array ->MOUNTS (set in the constructor) return: string HTML code for the browsable tree |
printTree($treeArr='') X-Ref |
Compiles the HTML code for displaying the structure found inside the ->tree array param: array "tree-array" - if blank string, the internal ->tree array is used. return: string The HTML code for the tree |
PMicon($row,$a,$c,$nextCount,$exp) X-Ref |
Generate the plus/minus icon for the browsable tree. param: array record for the entry param: integer The current entry number param: integer The total number of entries. If equal to $a, a "bottom" element is returned. param: integer The number of sub-elements to the current element. param: boolean The element was expanded to render subelements if this flag is set. return: string Image tag with the plus/minus icon. |
PM_ATagWrap($icon,$cmd,$bMark='') X-Ref |
Wrap the plus/minus icon in a link param: string HTML string to wrap, probably an image tag. param: string Command for 'PM' get var param: boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark) return: string Link-wrapped input string |
wrapTitle($title,$row,$bank=0) X-Ref |
Wrapping $title in a-tags. param: string Title string param: string Item record param: integer Bank pointer (which mount point number) return: string |
wrapIcon($icon,$row) X-Ref |
Wrapping the image tag, $icon, for the row, $row (except for mount points) param: string The image tag for the icon param: array The row for the current element return: string The processed icon input value. |
addTagAttributes($icon,$attr) X-Ref |
Adds attributes to image tag. param: string Icon image tag param: string Attributes to add, eg. ' border="0"' return: string Image tag, modified with $attr attributes added. |
wrapStop($str,$row) X-Ref |
Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set param: string Input string, like a page title for the tree param: array record row with "php_tree_stop" field return: string Modified string |
expandNext($id) X-Ref |
Returns true/false if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag. Extending parent function param: integer record id/key return: boolean |
initializePositionSaving() X-Ref |
Get stored tree structure AND updating it if needed according to incoming PM GET var. return: void |
savePosition() X-Ref |
Saves the content of ->stored (keeps track of expanded positions in the tree) $this->treeName will be used as key for BE_USER->uc[] to store it in return: void |
getRootIcon($rec) X-Ref |
Returns the root icon for a tree/mountpoint (defaults to the globe) param: array Record for root. return: string Icon image tag. |
getIcon($row) X-Ref |
Get icon for the row. If $this->iconPath and $this->iconName is set, try to get icon based on those values. param: array Item row. return: string Image tag. |
getTitleStr($row,$titleLen=30) X-Ref |
Returns the title for the input record. If blank, a "no title" labele (localized) will be returned. Do NOT htmlspecialchar the string from this function - has already been done. param: array The input row array (where the key "title" is used for the title) param: integer Title length (30) return: string The title. |
getTitleAttrib($row) X-Ref |
Returns the value for the image "title" attribute param: array The input row array (where the key "title" is used for the title) return: string The attribute value (is htmlspecialchared() already) |
getId($row) X-Ref |
Returns the id from the record (typ. uid) param: array Record array return: integer The "uid" field value. |
getJumpToParam($row) X-Ref |
Returns jump-url parameter value. param: array The record array. return: string The jump-url parameter. |
getTree($uid, $depth=999, $depthData='',$blankLineCode='',$subCSSclass='') X-Ref |
Fetches the data for the tree param: integer item id for which to select subitems (parent id) param: integer Max depth (recursivity limit) param: string HTML-code prefix for recursive calls. param: string ? (internal) param: string CSS class to use for <td> sub-elements return: integer The count of items on the level |
getCount($uid) X-Ref |
Returns the number of records having the parent id, $uid param: integer id to count subitems for return: integer |
getRootRecord($uid) X-Ref |
Returns root record for uid (<=0) param: integer uid, <= 0 (normally, this does not matter) return: array Array with title/uid keys with values of $this->title/0 (zero) |
getRecord($uid) X-Ref |
Returns the record for a uid. For tables: Looks up the record in the database. For arrays: Returns the fake record for uid id. param: integer UID to look up return: array The record |
getDataInit($parentId,$subCSSclass='') X-Ref |
Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id. For tables: This will make a database query to select all children to "parent" For arrays: This will return key to the ->dataLookup array param: integer parent item id param: string Class for sub-elements. return: mixed data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.) |
getDataCount(&$res) X-Ref |
Getting the tree data: Counting elements in resource param: mixed data handle return: integer number of items |
getDataNext(&$res,$subCSSclass='') X-Ref |
Getting the tree data: next entry param: mixed data handle param: string CSS class for sub elements (workspace related) return: array item data array OR FALSE if end of elements. |
getDataFree(&$res) X-Ref |
Getting the tree data: frees data handle param: mixed data handle return: void |
setDataFromArray(&$dataArr,$traverse=FALSE,$pid=0) X-Ref |
Used to initialize class with an array to browse. The array inputted will be traversed and an internal index for lookup is created. The keys of the input array are perceived as "uid"s of records which means that keys GLOBALLY must be unique like uids are. "uid" and "pid" "fakefields" are also set in each record. All other fields are optional. param: array The input array, see examples below in this script. param: boolean Internal, for recursion. param: integer Internal, for recursion. return: void |
setDataFromTreeArray(&$treeArr, &$treeLookupArr) X-Ref |
Sets the internal data arrays param: array Content for $this->data param: array Content for $this->dataLookup return: void |
Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |