contenido\classes\tree\class.ctreeitem.php
Description: Logical cTreeItem
Requirements:
- Author
- Bjoern Behrens
- 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 2006-10-05 $Id: class.ctreeitem.php,v 1.6 2006-10-05 23:45:30 bjoern.behrens Exp $ }}
- Package
- Contenido Backend classes
- Version
- 1.12
\cTreeItem
- Children
- \cTree
Properties
Methods


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


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


addItemToID(string $id, \cTreeItem $item) : void
adds an item to a specific ID
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
deletes an attribute
Name | Type | Description |
---|---|---|
$attributeName | string | attributeName |
- Access
- public


deleteItem(mixed $id) : \deleted
deletes a subitem
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() : array
Exports a tree as an array of arrays.
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) : void
flatTraverse traverses the tree starting from this item, and returning all objects as $objects in a flat array.
Name | Type | Description |
---|---|---|
$level | integer | Level to start on |


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


getCollapsedList(array $list) : void
getCollapsedList Returns all items (as ID array) which are collapsed.
Name | Type | Description |
---|---|---|
$list | array | Contains the list with all collapsed items |


getExpandedList(array $list) : void
getExpandedList Returns all items (as ID array) which are expanded.
Name | Type | Description |
---|---|---|
$list | array | Contains the list with all expanded items |


getItemByID(string $id) : \cTreeItem
Retrieves a specific item by its ID.
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) : void
Imports a table from an array of arrays.
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
moves an item to another object
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
sets a custom attribute for this TreeItem
Name | Type | Description |
---|---|---|
$attributeName | string | attributeName |
$attributeValue | array | attributeValue The value(s) of the attribute |
- Access
- public


setAttributes(string $aAttributeArray) : void
sets a bunch of attributes
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
setName sets the Name for this item.
Name | Type | Description |
---|---|---|
$name | string | New name for this item |
Type | Description |
---|---|
\none |


setPayloadObject(object $payload) : void
sets a payload object for later reference
Name | Type | Description |
---|---|---|
$payload | object | payload The object to payload |
- Access
- public


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