Tree which contains Nodes.

The tree is the overarching container for a set of nodes. The nodes are the actual structure within the tree. The nodes in turn can have members which are the programmer-defined objects the system is interested in 'positioning' of. Members should impliment TreeNodeMemberInterface.

package dstruct_tree
author David

 Methods

Class constructor.

__construct(array $row) 

Parameters

$row

array

Information to populate object.

Get the ID of this object.

getID() : integer

Returns

integer

Get maximum depth of nodes for this tree.

getMaxNodeDepth() : integer

Returns

integer

Get name of this object

getName(string $raw) : string

Parameters

$raw

string

HTML formatted or raw.

Returns

string

Returns all of the nodes in this tree which will accept members.

getNodesAcceptingMembers() : \TreeNodes

Useful if producing a 'flat' set of options e.g. a standard drop-down As this just deligates to a TreeNodes object, this is just in Tree class for convenience - usually just make the call to TreeNodes yourself

Returns

Get the sort order of the tree.

getSortOrder() : integer
see \setSortOrder()

Returns

integer

Load the tree by its ID.

loadByID(integer $id, array $row) : false | \Tree
Static

Parameters

$id

integer

$row

array

Data to populate object

Returns

false\TreeFalse if can't find tree with that ID

Save the object in the database.

save() 

Set the maximum depth of nodes in this tree.

setMaxNodeDepth(integer $depth) 

Parameters

$depth

integer

Exceptions

\DStructGeneralException

Set the name of the tree

setName(string $name) 

Parameters

$name

string

Set the sort order of the tree.

setSortOrder(integer $sortorder) 

Trees can be ordered and given preference in the syste. A lower number is a higher preference.

todo Define the acceptable range

Parameters

$sortorder

integer

Exceptions

\DStructGeneralException

Insert into database.

insert() 

Update in the database.

update() 

 Properties

 

$id : integer
 

$maxnodedepth : integer
 

$name : string
 

$sortorder : integer