contenido\classes\tree\class.ctree.php
Description: logical cTree
Requirements:
- Author
- Timo Hummel
- Con_php_req
- 5.0
- Copyright
- four for business AG
- License
- http://www.contenido.org/license/LIZENZ.txt
- Link
- http://www.4fb.de
- Link
- {@internal created 2004-08-04 $Id: class.ctree.php,v 1.2 2004/08/04 07:56:19 timo.hummel Exp $ }}
- Package
- Contenido Backend classes
- Version
- 1.12
\cTree
- Parent(s)
- \cTreeItem
- Children
- \cWidgetTreeView
Properties
Methods

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

addItem(\cTreeItem $item) : void| Name | Type | Description |
|---|---|---|
| $item | \cTreeItem | item item object to add |
- Access
- public

addItemToID(string $id, \cTreeItem $item) : void| Name | Type | Description |
|---|---|---|
| $id | string | id ID to add the item to |
| $item | \cTreeItem | item Item to add |
- 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() : arrayArray 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()| Name | Type | Description |
|---|---|---|
| $level | integer | Level to start on |

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()| 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()| Name | Type | Description |
|---|---|---|
| $list | array | Contains the list with all expanded items |

getItemByID(string $id) : \cTreeItemNote 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 |

importStructuredArray( $array) : void| Name | Type | Description |
|---|---|---|
| $array |

importTable(array $flat_array) : voidArray 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

setAttribute(string $attributeName, array $attributeValue) : void| Name | Type | Description |
|---|---|---|
| $attributeName | string | attributeName |
| $attributeValue | array | attributeValue The value(s) of the attribute |
- Access
- public

setAttributes(string $aAttributeArray) : void| 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

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

setPayloadObject(object $payload) : void| Name | Type | Description |
|---|---|---|
| $payload | object | payload The object to payload |
- Access
- public

setTreeName(string $name) : voidsets a new name for the tree.
| 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()| Name | Type | Description |
|---|---|---|
| $objects | object | all found objects |
| $level | integer | Level to start on |