TYPO3 API  SVNRelease
Public Member Functions | Public Attributes
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= '', $subCSSclass= '')
 getCount ($uid)
 getRootRecord ($uid)
 getRecord ($uid)
 getDataInit ($parentId, $subCSSclass= '')
 getDataCount (&$res)
 getDataNext (&$res, $subCSSclass= '')
 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'
 $showDefaultTitleAttribute = FALSE
 $highlightPagesWithVersions = TRUE
 $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()
 $orig_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 101 of file class.t3lib_treeview.php.


Member Function Documentation

t3lib_treeView::addField ( field,
noCheck = 0 
)

Adds a fieldname to the internal array ->fieldArray

Parameters:
stringField name to
booleanIf 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 300 of file class.t3lib_treeview.php.

References $TCA, and t3lib_div\inList().

t3lib_treeView::addTagAttributes ( icon,
attr 
)

Adds attributes to image tag.

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

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

Referenced by t3lib_folderTree\wrapIcon(), t3lib_browseTree\wrapIcon(), localPageTree\wrapIcon(), printAllPageTree\wrapIcon(), and localFolderTree\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:
integerrecord id/key
Returns:
boolean private
See also:
t3lib_pageTree::expandNext()

Reimplemented in t3lib_pageTree, and localPageTree.

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

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 webPageTree, filelistFolderTree, and t3lib_folderTree.

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

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

t3lib_treeView::getCount ( uid)

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

Parameters:
integerid to count subitems for
Returns:
integer private

Reimplemented in t3lib_folderTree.

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

References $GLOBALS, $res, t3lib_BEfunc\deleteClause(), and t3lib_BEfunc\versioningPlaceholderClause().

t3lib_treeView::getDataCount ( &$  res)

Getting the tree data: Counting elements in resource

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

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

References $GLOBALS, and $res.

t3lib_treeView::getDataFree ( &$  res)

Getting the tree data: frees data handle

Parameters:
mixeddata handle
Returns:
void private

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

References $GLOBALS, and $res.

t3lib_treeView::getDataInit ( parentId,
subCSSclass = '' 
)

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:
integerparent item id
stringClass for sub-elements.
Returns:
mixed data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.) private

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

References $GLOBALS, $res, t3lib_BEfunc\deleteClause(), and t3lib_BEfunc\versioningPlaceholderClause().

t3lib_treeView::getDataNext ( &$  res,
subCSSclass = '' 
)

Getting the tree data: next entry

Parameters:
mixeddata handle
stringCSS class for sub elements (workspace related)
Returns:
array item data array OR FALSE if end of elements. private
See also:
getDataInit()

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

References $GLOBALS, $res, $row, t3lib_BEfunc\countVersionsOfRecordsOnPage(), and t3lib_BEfunc\workspaceOL().

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:
arrayItem row.
Returns:
string Image tag.

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

Referenced by getBrowsableTree().

t3lib_treeView::getId ( row)

Returns the id from the record (typ. uid)

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

Reimplemented in t3lib_folderTree.

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

Referenced by printTree(), t3lib_browseTree\wrapIcon(), and wrapTitle().

t3lib_treeView::getJumpToParam ( row)

Returns jump-url parameter value.

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

Reimplemented in t3lib_folderTree.

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

Referenced by 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:
integerUID to look up
Returns:
array The record

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

References t3lib_BEfunc\getRecordWSOL().

Referenced by getBrowsableTree().

t3lib_treeView::getRootIcon ( rec)

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

Parameters:
arrayRecord for root.
Returns:
string Icon image tag.

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

Referenced by getBrowsableTree().

t3lib_treeView::getRootRecord ( uid)

Returns root record for uid (<=0)

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

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

Referenced by getBrowsableTree().

t3lib_treeView::getTitleAttrib ( row)

Returns the value for the image "title" attribute

Parameters:
arrayThe 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.

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

Referenced by t3lib_folderTree\wrapIcon().

t3lib_treeView::getTitleStr ( row,
titleLen = 30 
)

Returns the title for the input record. If blank, a "no title" label (localized) will be returned. Do NOT htmlspecialchar the string from this function - has already been done.

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

Reimplemented in t3lib_folderTree, and t3lib_browseTree.

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

Referenced by printTree().

t3lib_treeView::getTree ( uid,
depth = 999,
depthData = '',
blankLineCode = '',
subCSSclass = '' 
)

Fetches the data for the tree

Parameters:
integeritem id for which to select subitems (parent id)
integerMax depth (recursivity limit)
stringHTML-code prefix for recursive calls.
string? (internal)
stringCSS class to use for

sub-elements

Returns:
integer The count of items on the level

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

References $row.

Referenced by localPageTree\ext_tree(), and getBrowsableTree().

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

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

Parameters:
stringrecord WHERE clause
stringrecord ORDER BY field
Returns:
void

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

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

Referenced by localFolderTree\localFolderTree(), and t3lib_folderTree\t3lib_folderTree().

t3lib_treeView::initializePositionSaving ( )

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

Returns:
void private

Reimplemented in localFolderTree, t3lib_folderTree, localPageTree, and t3lib_pageTree.

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

Referenced by getBrowsableTree().

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

Wrap the plus/minus icon in a link

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

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

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

Referenced by getBrowsableTree(), and PMicon().

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

Generate the plus/minus icon for the browsable tree.

Parameters:
arrayrecord for the entry
integerThe current entry number
integerThe total number of entries. If equal to $a, a "bottom" element is returned.
integerThe number of sub-elements to the current element.
booleanThe 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 webPageTree, filelistFolderTree, and t3lib_pageTree.

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

References $row, PM_ATagWrap(), and t3lib_iconWorks\skinImg().

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 localFolderTree, localPageTree, webPageTree, tx_rtehtmlarea_folderTree, filelistFolderTree, tx_rtehtmlarea_image_folderTree, and tx_rtehtmlarea_pageTree.

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

References getId(), getTitleStr(), and wrapTitle().

Referenced by getBrowsableTree().

t3lib_treeView::reset ( )

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

Returns:
void

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

Referenced by localPageTree\ext_tree(), and getBrowsableTree().

t3lib_treeView::savePosition ( )

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

Returns:
void private

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

t3lib_treeView::setDataFromArray ( &$  dataArr,
traverse = FALSE,
pid = 0 
)

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.

Parameters:
arrayThe input array, see examples below in this script.
booleanInternal, for recursion.
integerInternal, for recursion.
Returns:
void

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

References $pid.

t3lib_treeView::setDataFromTreeArray ( &$  treeArr,
&$  treeLookupArr 
)

Sets the internal data arrays

Parameters:
arrayContent for $this->data
arrayContent for $this->dataLookup
Returns:
void

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

t3lib_treeView::setTreeName ( treeName = '')

Sets the tree name which is used to identify the tree Used for JavaScript and other things

Parameters:
stringDefault is the table name. Underscores are stripped.
Returns:
void

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

References $treeName.

Referenced by t3lib_browseTree\init(), and init().

t3lib_treeView::wrapIcon ( icon,
row 
)

Wrapping the image tag, $icon, for the row, $row (except for mount points)

Parameters:
stringThe image tag for the icon
arrayThe row for the current element
Returns:
string The processed icon input value. private

Reimplemented in localFolderTree, localPageTree, printAllPageTree, localPageTree, localPageTree, t3lib_browseTree, localPageTree, t3lib_folderTree, and localPageTree.

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

t3lib_treeView::wrapStop ( str,
row 
)

Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set

Parameters:
stringInput string, like a page title for the tree
arrayrecord row with "php_tree_stop" field
Returns:
string Modified string private

Reimplemented in t3lib_browseTree, and webPageTree.

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

t3lib_treeView::wrapTitle ( title,
row,
bank = 0 
)

Wrapping $title in a-tags.

Parameters:
stringTitle string
stringItem record
integerBank pointer (which mount point number)
Returns:
string private

Reimplemented in TBE_PageTree, localPageTree, webPageTree, t3lib_folderTree, and filelistFolderTree.

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

References $row, getId(), and getJumpToParam().

Referenced by printTree().


Member Data Documentation

t3lib_treeView::$addSelfId = 0

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

t3lib_treeView::$backPath

Back path for icons

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

t3lib_treeView::$bank = 0

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

t3lib_treeView::$BE_USER = ''

Reimplemented in localFolderTree, and localPageTree.

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

Referenced by tx_rtehtmlarea_select_image\main_rte().

t3lib_treeView::$buffer_idH = array()

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

t3lib_treeView::$clause = ''

WHERE clause used for selecting records for the tree. Is set by function init. Only makes sense when $this->table is set.

See also:
init()

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

Referenced by localPageTree\ext_tree(), t3lib_browseTree\init(), t3lib_pageTree\init(), and init().

t3lib_treeView::$data = FALSE
t3lib_treeView::$dataLookup = FALSE

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

t3lib_treeView::$defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate,cruser_id'

List of other fields which are ALLOWED to set (here, based on the "pages" table!)

See also:
addField()

Reimplemented in t3lib_pageTree.

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

t3lib_treeView::$domIdPrefix = 'row'

A prefix for table cell id's which will be wrapped around an item. Can be used for highlighting by JavaScript. Needs to be unique if multiple trees are on one HTML page.

See also:
printTree()

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

t3lib_treeView::$expandAll = 0

Reimplemented in printAllFolderTree, localFolderTree, printAllPageTree, and localPageTree.

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

t3lib_treeView::$expandFirst = 0

Reimplemented in printAllFolderTree, localFolderTree, printAllPageTree, and localPageTree.

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

t3lib_treeView::$ext_IconMode = FALSE
t3lib_treeView::$fieldArray = array('uid', 'title')

Default set of fields selected from the tree table. Make SURE that these fields names listed herein are actually possible to select from $this->table (if that variable is set to a TCA table name)

See also:
addField()

Reimplemented in t3lib_pageTree.

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

t3lib_treeView::$highlightPagesWithVersions = TRUE

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

t3lib_treeView::$iconName = 'default.gif'

Icon file name for item icons.

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

t3lib_treeView::$iconPath = ''

Icon file path.

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

t3lib_treeView::$ids = array()

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

t3lib_treeView::$ids_hierarchy = array()

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

t3lib_treeView::$makeHTML = 1

If true, HTML code is also accumulated in ->tree array during rendering of the tree. If 2, then also the icon prefix code (depthData) is stored

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

t3lib_treeView::$MOUNTS = ''

Needs to be initialized with e.g. $GLOBALS['WEBMOUNTS'] Default setting in init() is 0 => 0 The keys are mount-ids (can be anything basically) and the values are the ID of the root element (COULD be zero or anything else. For pages that would be the uid of the page, zero for the pagetree root.)

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

t3lib_treeView::$orderByFields = ''

Field for ORDER BY. Is set by function init. Only makes sense when $this->table is set.

See also:
init()

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

Referenced by init().

t3lib_treeView::$orig_ids_hierarchy = array()

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

t3lib_treeView::$parentField = 'pid'

Defines the field of $table which is the parent id field (like pid for table pages).

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

t3lib_treeView::$recs = array()

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

t3lib_treeView::$setRecs = 0

If true, records as selected will be stored internally in the ->recs array

Reimplemented in t3lib_pageTree.

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

t3lib_treeView::$showDefaultTitleAttribute = FALSE

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

t3lib_treeView::$specUIDmap = array()

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

t3lib_treeView::$stored = array()

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

t3lib_treeView::$subLevelID = '_SUB_LEVEL'

Sets the associative array key which identifies a new sublevel if arrays are used for trees. This value has formerly been "subLevel" and "--sublevel--"

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

t3lib_treeView::$table = ''

Database table to get the tree data from. Leave blank if data comes from an array.

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

t3lib_treeView::$thisScript = ''

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

t3lib_treeView::$title = 'no title'
t3lib_treeView::$titleAttrib = 'title'

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

t3lib_treeView::$tree = array()

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

t3lib_treeView::$treeName = ''

Unique name for the tree. Used as key for storing the tree into the BE users settings. Used as key to pass parameters in links. MUST NOT contain underscore chars. etc.

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

Referenced by setTreeName().


The documentation for this class was generated from the following file: