contenido\classes\widgets\class.widgets.treeview.php
Constants
\cWidgetTreeView
It supports folding, optional gridline marks and item icons.
- Parent(s)
- \cTree < \cTreeItem
Properties

array $_attributes- Type
- array
- Inherited_from
- \cTreeItem::$$_attributes
- Inherited_from
- \cTree::$$_attributes

boolean $_collapsed- Type
- boolean
- Inherited_from
- \cTreeItem::$$_collapsed
- Inherited_from
- \cTree::$$_collapsed

array $_previous- Type
- array
- Inherited_from
- \cTreeItem::$$_previous
- Inherited_from
- \cTree::$$_previous

array $_subitems- Type
- array
- Inherited_from
- \cTreeItem::$$_subitems
- Inherited_from
- \cTree::$$_subitems

$_treeIcon- Type
- n/a
- Inherited_from
- \cTree::$$_treeIcon
Methods

_flattenArray( $sourcearray, $destarray, $lastid, $level) : void| Name | Type | Description |
|---|---|---|
| $sourcearray | ||
| $destarray | ||
| $lastid | ||
| $level |

addItem(\cTreeItem $item) : voidadds an item as a subitem to the current item
Inherited from: \cTreeItem::addItem()\cTree::addItem()| Name | Type | Description |
|---|---|---|
| $item | \cTreeItem | item item object to add |
- Access
- public

addItemToID(string $id, \cTreeItem $item) : voidadds an item to a specific ID
Inherited from: \cTreeItem::addItemToID()\cTree::addItemToID()| Name | Type | Description |
|---|---|---|
| $id | string | id ID to add the item to |
| $item | \cTreeItem | item Item to add |
- Access
- public

applyActionByItemAttribute(array $attributes, \cApiClickableAction $action) : voidApplies an action to all items with a certain attribute set.
| Name | Type | Description |
|---|---|---|
| $attributes | array | attributes Values which need to match. The array key is the attribute name. Multiple array entries are connected with "AND". |
| $action | \cApiClickableAction | action Action to apply |
- Access
- public

applyGlobalAction(\cApiClickableAction $action) : voidapplies an action to all items in the tree.
| Name | Type | Description |
|---|---|---|
| $action | \cApiClickableAction | action action object |
- Access
- public

applyItemAction(mixed $item, \cApiClickableAction $action) : voidsets an action to a specific item.
| Name | Type | Description |
|---|---|---|
| $item | mixed | item cTreeItem-Object or an id of a TreeItem-Object |
| $action | \cApiClickableAction | action |
- Access
- public

cTreeItem( $id = "", $name = "", $collapsed = false) : void| Name | Type | Description |
|---|---|---|
| $id | ||
| $name | ||
| $collapsed |

collapseBelowID(int $id, $found = false) : void| Name | Type | Description |
|---|---|---|
| $id | int | leveloffset Level offset. Ignores all expand operations below the offset. |
| $found |
- Access
- public

collapseBelowLevel(int $leveloffset) : void| Name | Type | Description |
|---|---|---|
| $leveloffset | int | leveloffset Level offset. Ignores all expand operations below the offset. |
- Access
- public

deleteAttribute(string $attributeName) : void| Name | Type | Description |
|---|---|---|
| $attributeName | string | attributeName |
- Access
- public

deleteItem(mixed $id) : \deleted| Name | Type | Description |
|---|---|---|
| $id | mixed | item object or ID to delete |
| Type | Description |
|---|---|
| \deleted | object |
- Access
- public

expandBelowID(int $id, $found = false) : void| Name | Type | Description |
|---|---|---|
| $id | int | leveloffset Level offset. Ignores all expand operations below the offset. |
| $found |
- Access
- public

expandBelowLevel(int $leveloffset) : void| Name | Type | Description |
|---|---|---|
| $leveloffset | int | leveloffset Level offset. Ignores all expand operations below the offset. |
- Access
- public

exportTree() : arrayExports a tree as an array of arrays.
Inherited from: \cTreeItem::exportTree()\cTree::exportTree()Array format: array( array("id" => "Item ID", "name" => "Item name", "level" => 1, "attributes" => array("attr_name" => "attr_value")) );
| Type | Description |
|---|---|
| array |
- Access
- public

flatTraverse(integer $level = 0) : voidflatTraverse traverses the tree starting from this item, and returning all objects as $objects in a flat array.
Inherited from: \cTreeItem::flatTraverse()\cTree::flatTraverse()| Name | Type | Description |
|---|---|---|
| $level | integer | Level to start on |

flushActionByItemAttribute(array $attributes) : voidRemoves all actions for items with specific attributes
| Name | Type | Description |
|---|---|---|
| $attributes | array | attributes Values which need to match. The array key is the attribute name. Multiple array entries are connected with "AND". |
- Access
- public

flushItemActions(mixed $item) : voidflushes all actions for a specific item
| Name | Type | Description |
|---|---|---|
| $item | mixed | item cTreeItem-Object or an id of a TreeItem-Object |
- Access
- public

getAttribute(string $attributeName) : mixed| Name | Type | Description |
|---|---|---|
| $attributeName | string | attributeName |
| Type | Description |
|---|---|
| mixed |
- Access
- public

getCollapsedList(array $list) : voidgetCollapsedList Returns all items (as ID array) which are collapsed.
Inherited from: \cTreeItem::getCollapsedList()\cTree::getCollapsedList()| Name | Type | Description |
|---|---|---|
| $list | array | Contains the list with all collapsed items |

getExpandedList(array $list) : voidgetExpandedList Returns all items (as ID array) which are expanded.
Inherited from: \cTreeItem::getExpandedList()\cTree::getExpandedList()| Name | Type | Description |
|---|---|---|
| $list | array | Contains the list with all expanded items |

getItemByID(string $id) : \cTreeItemRetrieves a specific item by its ID.
Inherited from: \cTreeItem::getItemByID()\cTree::getItemByID()Note that this function traverses all subitems to find the correct item.
| Name | Type | Description |
|---|---|---|
| $id | string | id ID to retrieve |
| Type | Description |
|---|---|
| \cTreeItem |
- Access
- public

hasAttribute( $attributeName, $bRecursive = false) : void| Name | Type | Description |
|---|---|---|
| $attributeName | ||
| $bRecursive |

importTable(array $flat_array) : voidImports a table from an array of arrays.
Inherited from: \cTreeItem::importTable()\cTree::importTable()Array format: array( array("id" => "Item ID", "name" => "Item name", "level" => 1, "collapsed" => true|false, "attributes" => array("attr_name" => "attr_value")) );
The entries "collapsed" and "attributes" are optional!
| Name | Type | Description |
|---|---|---|
| $flat_array | array | flat_array See above |
- Access
- public

moveItem(\cTreeItem $targetItem, mixed $itemToMove) : void| Name | Type | Description |
|---|---|---|
| $targetItem | \cTreeItem | targetItem Item to move the subitem to |
| $itemToMove | mixed | itemToMove cTreeItem-Object or id of object to move |
- Access
- public

removeActionByItemAttribute(array $attributes, \cApiClickableAction $action) : voidRemoves an action from all items with a certain attribute set.
| Name | Type | Description |
|---|---|---|
| $attributes | array | attributes Values which need to match. The array key is the attribute name. Multiple array entries are connected with "AND". |
| $action | \cApiClickableAction | action Action to remove |
- Access
- public

removeGlobalAction(\cApiClickableAction $action) : voidremoves the action from all treeitems.
| Name | Type | Description |
|---|---|---|
| $action | \cApiClickableAction | action Removes the action from the global context. |
- Access
- public

removeItemAction(mixed $item, \cApiClickableAction $action) : voidunsets an action from a specific item.
Note that you can unset global actions using this method!
| Name | Type | Description |
|---|---|---|
| $item | mixed | item cTreeItem-Object or an id of a TreeItem-Object |
| $action | \cApiClickableAction | action Action to unset |
- Access
- public

setAttribute(string $attributeName, array $attributeValue) : voidsets a custom attribute for this TreeItem
Inherited from: \cTreeItem::setAttribute()\cTree::setAttribute()| Name | Type | Description |
|---|---|---|
| $attributeName | string | attributeName |
| $attributeValue | array | attributeValue The value(s) of the attribute |
- Access
- public

setAttributes(string $aAttributeArray) : voidsets a bunch of attributes
Inherited from: \cTreeItem::setAttributes()\cTree::setAttributes()| Name | Type | Description |
|---|---|---|
| $aAttributeArray | string | attributeName |
- Access
- public

setCollapsed(mixed $id) : void| Name | Type | Description |
|---|---|---|
| $id | mixed | collapse ID to collapse or an array with items to collapse |
- Access
- public

setExpanded(mixed $id) : void| Name | Type | Description |
|---|---|---|
| $id | mixed | expand ID of item to expand or array of item ID's to expand |
- Access
- public

setGridlineMode(int $mode) : void| Name | Type | Description |
|---|---|---|
| $mode | int | mode Sets the gridline mode to one of the following values: TREEVIEW_GRIDLINE_SOLID TREEVIEW_GRIDLINE_DASHED TREEVIEW_GRIDLINE_DOTTED TREEVIEW_GRIDLINE_NONE |
- Access
- public

setName(string $name) : \none| Name | Type | Description |
|---|---|---|
| $name | string | New name for this item |
| Type | Description |
|---|---|
| \none |

setPayloadObject(object $payload) : voidsets a payload object for later reference
Inherited from: \cTreeItem::setPayloadObject()\cTree::setPayloadObject()| Name | Type | Description |
|---|---|---|
| $payload | object | payload The object to payload |
- Access
- public

setTreeName(string $name) : void| Name | Type | Description |
|---|---|---|
| $name | string | name Name of the tree |
- Access
- public

traverse(object $objects, integer $level = 0) : voidtraverse traverses the tree starting from this item, and returning all objects as $objects in a nested array.
Inherited from: \cTreeItem::traverse()\cTree::traverse()| Name | Type | Description |
|---|---|---|
| $objects | object | all found objects |
| $level | integer | Level to start on |

unsetPayloadObject() : objectunsets a payload object
Inherited from: \cTreeItem::unsetPayloadObject()\cTree::unsetPayloadObject()| Type | Description |
|---|---|
| object |
- Access
- public