contenido\classes\tree\class.ctreeitem.php

Show: PublicProtectedPrivateinherited
Table of Contents
Project: Contenido Content Management System

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

Package: Default
class cTreeItem
Children
\cTree

Properties

>VPropertypublicarray $_attributes
Contains custom entries
Details
Type
array
>VPropertypublicboolean $_collapsed
Determinates if this tree item is collapsed
Details
Type
boolean
>VPropertypublicstring $_id
ID for this item
Details
Type
string
>VPropertypublicinteger $_level
Contains the level of this item
Details
Type
integer
>VPropertypublicstring $_name
Name for this item
Details
Type
string
>VPropertypublicarray $_next
Contains the next item
Details
Type
array
>VPropertypublicarray $_parent
Contains the parent of this item
Details
Type
array
>VPropertypublicarray $_previous
Contains the previous item
Details
Type
array
>VPropertypublicarray $_subitems
Sub Items for this tree item
Details
Type
array

Methods

methodpublic_flattenArray( $sourcearray,  $destarray,  $lastid,  $level) : void

Parameters
NameTypeDescription
$sourcearray
$destarray
$lastid
$level
methodpublicaddItem(\cTreeItem $item) : void

adds an item as a subitem to the current item

Parameters
NameTypeDescription
$item\cTreeItem

item item object to add

Details
Access
public  
methodpublicaddItemToID(string $id, \cTreeItem $item) : void

adds an item to a specific ID

Parameters
NameTypeDescription
$idstring

id ID to add the item to

$item\cTreeItem

item Item to add

Details
Access
public  
methodpubliccTreeItem( $id = "",  $name = "",  $collapsed = false) : void

Parameters
NameTypeDescription
$id
$name
$collapsed
methodpubliccollapseBelowID(int $id,  $found = false) : void

Parameters
NameTypeDescription
$idint

leveloffset Level offset. Ignores all expand operations below the offset.

$found
Details
Access
public  
methodpubliccollapseBelowLevel(int $leveloffset) : void

Parameters
NameTypeDescription
$leveloffsetint

leveloffset Level offset. Ignores all expand operations below the offset.

Details
Access
public  
methodpublicdeleteAttribute(string $attributeName) : void

deletes an attribute

Parameters
NameTypeDescription
$attributeNamestring

attributeName

Details
Access
public  
methodpublicdeleteItem(mixed $id) : \deleted

deletes a subitem

Parameters
NameTypeDescription
$idmixed

item object or ID to delete

Returns
TypeDescription
\deletedobject
Details
Access
public  
methodpublicexpandBelowID(int $id,  $found = false) : void

Parameters
NameTypeDescription
$idint

leveloffset Level offset. Ignores all expand operations below the offset.

$found
Details
Access
public  
methodpublicexpandBelowLevel(int $leveloffset) : void

Parameters
NameTypeDescription
$leveloffsetint

leveloffset Level offset. Ignores all expand operations below the offset.

Details
Access
public  
methodpublicexportTree() : 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")) );

Returns
TypeDescription
array
Details
Access
public  
methodpublicflatTraverse(integer $level = 0) : void

flatTraverse traverses the tree starting from this item, and returning all objects as $objects in a flat array.

Parameters
NameTypeDescription
$levelinteger

Level to start on

methodpublicgetAttribute(string $attributeName) : mixed

returns an attribute

Parameters
NameTypeDescription
$attributeNamestring

attributeName

Returns
TypeDescription
mixed
Details
Access
public  
methodpublicgetCollapsedList(array $list) : void

getCollapsedList Returns all items (as ID array) which are collapsed.

Parameters
NameTypeDescription
$listarray

Contains the list with all collapsed items

methodpublicgetExpandedList(array $list) : void

getExpandedList Returns all items (as ID array) which are expanded.

Parameters
NameTypeDescription
$listarray

Contains the list with all expanded items

methodpublicgetItemByID(string $id) : \cTreeItem

Retrieves a specific item by its ID.

Note that this function traverses all subitems to find the correct item.

Parameters
NameTypeDescription
$idstring

id ID to retrieve

Returns
TypeDescription
\cTreeItem
Details
Access
public  
methodpublichasAttribute( $attributeName,  $bRecursive = false) : void

Parameters
NameTypeDescription
$attributeName
$bRecursive
methodpublicimportStructuredArray( $array) : void

Parameters
NameTypeDescription
$array
methodpublicimportTable(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!

Parameters
NameTypeDescription
$flat_arrayarray

flat_array See above

Details
Access
public  
methodpublicmoveItem(\cTreeItem $targetItem, mixed $itemToMove) : void

moves an item to another object

Parameters
NameTypeDescription
$targetItem\cTreeItem

targetItem Item to move the subitem to

$itemToMovemixed

itemToMove cTreeItem-Object or id of object to move

Details
Access
public  
methodpublicsetAttribute(string $attributeName, array $attributeValue) : void

sets a custom attribute for this TreeItem

Parameters
NameTypeDescription
$attributeNamestring

attributeName

$attributeValuearray

attributeValue The value(s) of the attribute

Details
Access
public  
methodpublicsetAttributes(string $aAttributeArray) : void

sets a bunch of attributes

Parameters
NameTypeDescription
$aAttributeArraystring

attributeName

Details
Access
public  
methodpublicsetCollapsed(mixed $id) : void

Parameters
NameTypeDescription
$idmixed

collapse ID to collapse or an array with items to collapse

Details
Access
public  
methodpublicsetExpanded(mixed $id) : void

Parameters
NameTypeDescription
$idmixed

expand ID of item to expand or array of item ID's to expand

Details
Access
public  
methodpublicsetName(string $name) : \none

setName sets the Name for this item.

Parameters
NameTypeDescription
$namestring

New name for this item

Returns
TypeDescription
\none
methodpublicsetPayloadObject(object $payload) : void

sets a payload object for later reference

Parameters
NameTypeDescription
$payloadobject

payload The object to payload

Details
Access
public  
methodpublictraverse(object $objects, integer $level = 0) : void

traverse traverses the tree starting from this item, and returning all objects as $objects in a nested array.

Parameters
NameTypeDescription
$objectsobject

all found objects

$levelinteger

Level to start on

methodpublicunsetPayloadObject() : object

unsets a payload object

Returns
TypeDescription
object
Details
Access
public  
Documentation was generated by phpDocumentor 2.0.0a12.