Documentation TYPO3 par Ameos

t3lib_treeView Class Reference

Inheritance diagram for t3lib_treeView:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 init ($clause='', $orderByFields='')
 setTreeName ($treeName='')
 addField ($field, $noCheck=0)
 reset ()
 getBrowsableTree ()
 printTree ($treeArr='')
 PMicon ($row, $a, $c, $nextCount, $exp)
 PM_ATagWrap ($icon, $cmd, $bMark='')
 wrapTitle ($title, $row, $bank=0)
 wrapIcon ($icon, $row)
 addTagAttributes ($icon, $attr)
 wrapStop ($str, $row)
 expandNext ($id)
 initializePositionSaving ()
 savePosition ()
 getRootIcon ($rec)
 getIcon ($row)
 getTitleStr ($row, $titleLen=30)
 getTitleAttrib ($row)
 getId ($row)
 getJumpToParam ($row)
 getTree ($uid, $depth=999, $depthData='', $blankLineCode='')
 getCount ($uid)
 getRootRecord ($uid)
 getRecord ($uid)
 getDataInit ($parentId)
 getDataCount (&$res)
 getDataNext (&$res)
 getDataFree (&$res)
 setDataFromArray (&$dataArr, $traverse=FALSE, $pid=0)
 setDataFromTreeArray (&$treeArr, &$treeLookupArr)
 init ($clause='', $orderByFields='')
 setTreeName ($treeName='')
 addField ($field, $noCheck=0)
 reset ()
 getBrowsableTree ()
 printTree ($treeArr='')
 PMicon ($row, $a, $c, $nextCount, $exp)
 PM_ATagWrap ($icon, $cmd, $bMark='')
 wrapTitle ($title, $row, $bank=0)
 wrapIcon ($icon, $row)
 addTagAttributes ($icon, $attr)
 wrapStop ($str, $row)
 expandNext ($id)
 initializePositionSaving ()
 savePosition ()
 getRootIcon ($rec)
 getIcon ($row)
 getTitleStr ($row, $titleLen=30)
 getTitleAttrib ($row)
 getId ($row)
 getJumpToParam ($row)
 getTree ($uid, $depth=999, $depthData='', $blankLineCode='')
 getCount ($uid)
 getRootRecord ($uid)
 getRecord ($uid)
 getDataInit ($parentId)
 getDataCount (&$res)
 getDataNext (&$res)
 getDataFree (&$res)
 setDataFromArray (&$dataArr, $traverse=FALSE, $pid=0)
 setDataFromTreeArray (&$treeArr, &$treeLookupArr)

Public Attributes

 $expandFirst = 0
 $expandAll = 0
 $thisScript = ''
 $titleAttrib = 'title'
 $ext_IconMode = false
 $addSelfId = 0
 $title = 'no title'
 $BE_USER = ''
 $MOUNTS = ''
 $table = ''
 $parentField = 'pid'
 $clause = ''
 $orderByFields = ''
 $fieldArray = Array('uid','title')
 $defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate,cruser_id'
 $treeName = ''
 $domIdPrefix = 'row'
 $backPath
 $iconPath = ''
 $iconName = 'default.gif'
 $makeHTML = 1
 $setRecs = 0
 $subLevelID = '_SUB_LEVEL'
 $ids = Array()
 $ids_hierarchy = array()
 $buffer_idH = array()
 $specUIDmap = array()
 $data = false
 $dataLookup = false
 $tree = Array()
 $stored = array()
 $bank = 0
 $recs = array()

Detailed Description

Definition at line 115 of file class.t3lib_treeview.php.


Member Function Documentation

t3lib_treeView::addField field,
noCheck = 0
 

Adds a fieldname to the internal array ->fieldArray

Parameters:
string Field name to
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
Returns:
void

Definition at line 312 of file class.t3lib_treeview.php.

References t3lib_div::inList().

t3lib_treeView::addField field,
noCheck = 0
 

Adds a fieldname to the internal array ->fieldArray

Parameters:
string Field name to
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
Returns:
void

Definition at line 312 of file class.t3lib_treeview.php.

References t3lib_div::inList().

t3lib_treeView::addTagAttributes icon,
attr
 

Adds attributes to image tag.

Parameters:
string Icon image tag
string Attributes to add, eg. ' border="0"'
Returns:
string Image tag, modified with $attr attributes added.

Definition at line 528 of file class.t3lib_treeview.php.

t3lib_treeView::addTagAttributes icon,
attr
 

Adds attributes to image tag.

Parameters:
string Icon image tag
string Attributes to add, eg. ' border="0"'
Returns:
string Image tag, modified with $attr attributes added.

Definition at line 528 of file class.t3lib_treeview.php.

Referenced by t3lib_folderTree::wrapIcon(), t3lib_browseTree::wrapIcon(), localFolderTree::wrapIcon(), printAllPageTree::wrapIcon(), and localPageTree::wrapIcon().

t3lib_treeView::expandNext id  ) 
 

Returns true/false if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag. Extending parent function

Parameters:
integer record id/key
Returns:
boolean private
See also:
t3lib_pageTree::expandNext()

Reimplemented in t3lib_pageTree, localPageTree, and t3lib_pageTree.

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

t3lib_treeView::expandNext id  ) 
 

Returns true/false if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag. Extending parent function

Parameters:
integer record id/key
Returns:
boolean private
See also:
t3lib_pageTree::expandNext()

Reimplemented in t3lib_pageTree, localPageTree, and t3lib_pageTree.

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

Referenced by t3lib_folderTree::getFolderTree(), and getTree().

t3lib_treeView::getBrowsableTree  ) 
 

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)

Returns:
string HTML code for the browsable tree

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 346 of file class.t3lib_treeview.php.

References getIcon(), getRecord(), getRootIcon(), getRootRecord(), getTree(), initializePositionSaving(), PM_ATagWrap(), printTree(), and reset().

t3lib_treeView::getBrowsableTree  ) 
 

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)

Returns:
string HTML code for the browsable tree

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 346 of file class.t3lib_treeview.php.

References getIcon(), getRecord(), getRootIcon(), getRootRecord(), getTree(), initializePositionSaving(), PM_ATagWrap(), printTree(), and reset().

t3lib_treeView::getCount uid  ) 
 

Returns the number of records having the parent id, $uid

Parameters:
integer id to count subitems for
Returns:
integer private

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 828 of file class.t3lib_treeview.php.

References t3lib_BEfunc::deleteClause(), getDataCount(), and getDataInit().

t3lib_treeView::getCount uid  ) 
 

Returns the number of records having the parent id, $uid

Parameters:
integer id to count subitems for
Returns:
integer private

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 828 of file class.t3lib_treeview.php.

References t3lib_BEfunc::deleteClause(), getDataCount(), and getDataInit().

Referenced by getTree().

t3lib_treeView::getDataCount &$  res  ) 
 

Getting the tree data: Counting elements in resource

Parameters:
mixed data handle
Returns:
integer number of items private
See also:
getDataInit()

Definition at line 915 of file class.t3lib_treeview.php.

t3lib_treeView::getDataCount &$  res  ) 
 

Getting the tree data: Counting elements in resource

Parameters:
mixed data handle
Returns:
integer number of items private
See also:
getDataInit()

Definition at line 915 of file class.t3lib_treeview.php.

Referenced by getCount(), and getTree().

t3lib_treeView::getDataFree &$  res  ) 
 

Getting the tree data: frees data handle

Parameters:
mixed data handle
Returns:
void private

Definition at line 960 of file class.t3lib_treeview.php.

t3lib_treeView::getDataFree &$  res  ) 
 

Getting the tree data: frees data handle

Parameters:
mixed data handle
Returns:
void private

Definition at line 960 of file class.t3lib_treeview.php.

Referenced by getTree().

t3lib_treeView::getDataInit parentId  ) 
 

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

Parameters:
integer parent item id
Returns:
mixed data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.) private

Definition at line 885 of file class.t3lib_treeview.php.

References t3lib_BEfunc::deleteClause(), and reset().

t3lib_treeView::getDataInit parentId  ) 
 

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

Parameters:
integer parent item id
Returns:
mixed data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.) private

Definition at line 885 of file class.t3lib_treeview.php.

References t3lib_BEfunc::deleteClause(), and reset().

Referenced by getCount(), and getTree().

t3lib_treeView::getDataNext &$  res  ) 
 

Getting the tree data: next entry

Parameters:
mixed data handle
Returns:
array item data array OR FALSE if end of elements. private
See also:
getDataInit()

Definition at line 932 of file class.t3lib_treeview.php.

t3lib_treeView::getDataNext &$  res  ) 
 

Getting the tree data: next entry

Parameters:
mixed data handle
Returns:
array item data array OR FALSE if end of elements. private
See also:
getDataInit()

Definition at line 932 of file class.t3lib_treeview.php.

Referenced by getTree().

t3lib_treeView::getIcon row  ) 
 

Get icon for the row. If $this->iconPath and $this->iconName is set, try to get icon based on those values.

Parameters:
array Item row.
Returns:
string Image tag.

Definition at line 647 of file class.t3lib_treeview.php.

References t3lib_iconWorks::getIconImage(), and wrapIcon().

t3lib_treeView::getIcon row  ) 
 

Get icon for the row. If $this->iconPath and $this->iconName is set, try to get icon based on those values.

Parameters:
array Item row.
Returns:
string Image tag.

Definition at line 647 of file class.t3lib_treeview.php.

References t3lib_iconWorks::getIconImage(), and wrapIcon().

Referenced by getBrowsableTree(), and getTree().

t3lib_treeView::getId row  ) 
 

Returns the id from the record (typ. uid)

Parameters:
array Record array
Returns:
integer The "uid" field value.

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 688 of file class.t3lib_treeview.php.

t3lib_treeView::getId row  ) 
 

Returns the id from the record (typ. uid)

Parameters:
array Record array
Returns:
integer The "uid" field value.

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 688 of file class.t3lib_treeview.php.

Referenced by getJumpToParam(), and t3lib_browseTree::wrapIcon().

t3lib_treeView::getJumpToParam row  ) 
 

Returns jump-url parameter value.

Parameters:
array The record array.
Returns:
string The jump-url parameter.

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 698 of file class.t3lib_treeview.php.

References getId().

t3lib_treeView::getJumpToParam row  ) 
 

Returns jump-url parameter value.

Parameters:
array The record array.
Returns:
string The jump-url parameter.

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 698 of file class.t3lib_treeview.php.

References getId().

Referenced by localPageTree::wrapIcon(), t3lib_browseTree::wrapIcon(), and wrapTitle().

t3lib_treeView::getRecord uid  ) 
 

Returns the record for a uid. For tables: Looks up the record in the database. For arrays: Returns the fake record for uid id.

Parameters:
integer UID to look up
Returns:
array The record

Definition at line 868 of file class.t3lib_treeview.php.

t3lib_treeView::getRecord uid  ) 
 

Returns the record for a uid. For tables: Looks up the record in the database. For arrays: Returns the fake record for uid id.

Parameters:
integer UID to look up
Returns:
array The record

Definition at line 868 of file class.t3lib_treeview.php.

Referenced by getBrowsableTree().

t3lib_treeView::getRootIcon rec  ) 
 

Returns the root icon for a tree/mountpoint (defaults to the globe)

Parameters:
array Record for root.
Returns:
string Icon image tag.

Definition at line 634 of file class.t3lib_treeview.php.

References t3lib_iconWorks::skinImg(), and wrapIcon().

t3lib_treeView::getRootIcon rec  ) 
 

Returns the root icon for a tree/mountpoint (defaults to the globe)

Parameters:
array Record for root.
Returns:
string Icon image tag.

Definition at line 634 of file class.t3lib_treeview.php.

References t3lib_iconWorks::skinImg(), and wrapIcon().

Referenced by getBrowsableTree().

t3lib_treeView::getRootRecord uid  ) 
 

Returns root record for uid (<=0)

Parameters:
integer uid, <= 0 (normally, this does not matter)
Returns:
array Array with title/uid keys with values of $this->title/0 (zero)

Definition at line 855 of file class.t3lib_treeview.php.

t3lib_treeView::getRootRecord uid  ) 
 

Returns root record for uid (<=0)

Parameters:
integer uid, <= 0 (normally, this does not matter)
Returns:
array Array with title/uid keys with values of $this->title/0 (zero)

Definition at line 855 of file class.t3lib_treeview.php.

Referenced by getBrowsableTree().

t3lib_treeView::getTitleAttrib row  ) 
 

Returns the value for the image "title" attribute

Parameters:
array The input row array (where the key "title" is used for the title)
Returns:
string The attribute value (is htmlspecialchared() already)
See also:
wrapIcon()

Reimplemented in t3lib_browseTree, and t3lib_browseTree.

Definition at line 678 of file class.t3lib_treeview.php.

t3lib_treeView::getTitleAttrib row  ) 
 

Returns the value for the image "title" attribute

Parameters:
array The input row array (where the key "title" is used for the title)
Returns:
string The attribute value (is htmlspecialchared() already)
See also:
wrapIcon()

Reimplemented in t3lib_browseTree, and t3lib_browseTree.

Definition at line 678 of file class.t3lib_treeview.php.

t3lib_treeView::getTitleStr row,
titleLen = 30
 

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.

Parameters:
array The input row array (where the key "title" is used for the title)
integer Title length (30)
Returns:
string The title.

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 666 of file class.t3lib_treeview.php.

References $title, and t3lib_div::fixed_lgd_cs().

t3lib_treeView::getTitleStr row,
titleLen = 30
 

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.

Parameters:
array The input row array (where the key "title" is used for the title)
integer Title length (30)
Returns:
string The title.

Reimplemented in t3lib_folderTree, and t3lib_folderTree.

Definition at line 666 of file class.t3lib_treeview.php.

References $title, and t3lib_div::fixed_lgd_cs().

Referenced by printTree().

t3lib_treeView::getTree uid,
depth = 999,
depthData = '',
blankLineCode = ''
 

Fetches the data for the tree

Parameters:
integer item id for which to select subitems (parent id)
integer Max depth (recursivity limit)
string HTML-code prefix for recursive calls.
string ? (internal)
Returns:
integer The count of items on the level

Definition at line 731 of file class.t3lib_treeview.php.

References expandNext(), getCount(), getDataCount(), getDataFree(), getDataInit(), getDataNext(), getIcon(), getTree(), t3lib_iconWorks::skinImg(), and wrapStop().

t3lib_treeView::getTree uid,
depth = 999,
depthData = '',
blankLineCode = ''
 

Fetches the data for the tree

Parameters:
integer item id for which to select subitems (parent id)
integer Max depth (recursivity limit)
string HTML-code prefix for recursive calls.
string ? (internal)
Returns:
integer The count of items on the level

Definition at line 731 of file class.t3lib_treeview.php.

References expandNext(), getCount(), getDataCount(), getDataFree(), getDataInit(), getDataNext(), getIcon(), t3lib_iconWorks::skinImg(), and wrapStop().

Referenced by localPageTree::ext_tree(), getBrowsableTree(), and getTree().

t3lib_treeView::init clause = '',
orderByFields = ''
 

Initialize the tree class. Needs to be overwritten Will set ->fieldsArray, ->backPath and ->clause

Parameters:
string record WHERE clause
string record ORDER BY field
Returns:
void

Definition at line 267 of file class.t3lib_treeview.php.

References $clause, $orderByFields, t3lib_div::loadTCA(), and setTreeName().

t3lib_treeView::init clause = '',
orderByFields = ''
 

Initialize the tree class. Needs to be overwritten Will set ->fieldsArray, ->backPath and ->clause

Parameters:
string record WHERE clause
string record ORDER BY field
Returns:
void

Definition at line 267 of file class.t3lib_treeview.php.

References $clause, $orderByFields, t3lib_div::loadTCA(), and setTreeName().

Referenced by localFolderTree::localFolderTree().

t3lib_treeView::initializePositionSaving  ) 
 

Get stored tree structure AND updating it if needed according to incoming PM GET var.

Returns:
void private

Reimplemented in t3lib_folderTree, t3lib_pageTree, localPageTree, localFolderTree, t3lib_folderTree, and t3lib_pageTree.

Definition at line 578 of file class.t3lib_treeview.php.

References t3lib_div::_GP(), and savePosition().

t3lib_treeView::initializePositionSaving  ) 
 

Get stored tree structure AND updating it if needed according to incoming PM GET var.

Returns:
void private

Reimplemented in t3lib_folderTree, t3lib_pageTree, localPageTree, localFolderTree, t3lib_folderTree, and t3lib_pageTree.

Definition at line 578 of file class.t3lib_treeview.php.

References t3lib_div::_GP(), and savePosition().

Referenced by getBrowsableTree().

t3lib_treeView::PM_ATagWrap icon,
cmd,
bMark = ''
 

Wrap the plus/minus icon in a link

Parameters:
string HTML string to wrap, probably an image tag.
string Command for 'PM' get var
boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
Returns:
string Link-wrapped input string private

Reimplemented in localPageTree, localFolderTree, localPageTree, printAllPageTree, localFolderTree, printAllFolderTree, localPageTree, and localFolderTree.

Definition at line 482 of file class.t3lib_treeview.php.

t3lib_treeView::PM_ATagWrap icon,
cmd,
bMark = ''
 

Wrap the plus/minus icon in a link

Parameters:
string HTML string to wrap, probably an image tag.
string Command for 'PM' get var
boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
Returns:
string Link-wrapped input string private

Reimplemented in localPageTree, localFolderTree, localPageTree, printAllPageTree, localFolderTree, printAllFolderTree, localPageTree, and localFolderTree.

Definition at line 482 of file class.t3lib_treeview.php.

Referenced by getBrowsableTree(), t3lib_folderTree::getBrowsableTree(), and PMicon().

t3lib_treeView::PMicon row,
a,
c,
nextCount,
exp
 

Generate the plus/minus icon for the browsable tree.

Parameters:
array record for the entry
integer The current entry number
integer The total number of entries. If equal to $a, a "bottom" element is returned.
integer The number of sub-elements to the current element.
boolean The element was expanded to render subelements if this flag is set.
Returns:
string Image tag with the plus/minus icon. private
See also:
t3lib_pageTree::PMicon()

Reimplemented in t3lib_pageTree, and t3lib_pageTree.

Definition at line 460 of file class.t3lib_treeview.php.

References PM_ATagWrap().

t3lib_treeView::PMicon row,
a,
c,
nextCount,
exp
 

Generate the plus/minus icon for the browsable tree.

Parameters:
array record for the entry
integer The current entry number
integer The total number of entries. If equal to $a, a "bottom" element is returned.
integer The number of sub-elements to the current element.
boolean The element was expanded to render subelements if this flag is set.
Returns:
string Image tag with the plus/minus icon. private
See also:
t3lib_pageTree::PMicon()

Reimplemented in t3lib_pageTree, and t3lib_pageTree.

Definition at line 460 of file class.t3lib_treeview.php.

References PM_ATagWrap().

t3lib_treeView::printTree treeArr = ''  ) 
 

Compiles the HTML code for displaying the structure found inside the ->tree array

Parameters:
array "tree-array" - if blank string, the internal ->tree array is used.
Returns:
string The HTML code for the tree

Reimplemented in localPageTree, localFolderTree, and localFolderTree.

Definition at line 407 of file class.t3lib_treeview.php.

References getTitleStr(), and wrapTitle().

t3lib_treeView::printTree treeArr = ''  ) 
 

Compiles the HTML code for displaying the structure found inside the ->tree array

Parameters:
array "tree-array" - if blank string, the internal ->tree array is used.
Returns:
string The HTML code for the tree

Reimplemented in localPageTree, localFolderTree, and localFolderTree.

Definition at line 407 of file class.t3lib_treeview.php.

References getTitleStr(), and wrapTitle().

Referenced by getBrowsableTree(), and t3lib_folderTree::getBrowsableTree().

t3lib_treeView::reset  ) 
 

Resets the tree, recs, ids, and ids_hierarchy internal variables. Use it if you need it.

Returns:
void

Definition at line 326 of file class.t3lib_treeview.php.

t3lib_treeView::reset  )