Tree Class Reference

Public Member Functions

 Tree ($table, $leftCol= 'left', $rightCol= 'right', $deepCol= 'deep', $treeCol= '')
 newRoot ($tree="", $values="")
 newFirstChild ($id, $values="")
 newLastChild ($id, $values="")
 newPrevBrother ($id, $values="")
 newNextBrother ($id, $values="")
 deleteNode ($id)
 _addNode ($node, $values="")
 _shiftPositions ($from, $delta, $tree)
 getPosition ($id)
 getChildren ($id, $direct=FALSE)
 countChildren ($id, $direct=FALSE)
 printTree ($id, $attributes="")

Data Fields

 $table
 $leftCol
 $rightCol
 $deepCol
 $treeCol

Detailed Description

Definition at line 19 of file class.tree.php.


Member Function Documentation

_addNode ( node,
values = "" 
)
Author:
Fragile <pir@cerdecam.be> private

Definition at line 197 of file class.tree.php.

_shiftPositions ( from,
delta,
tree 
)
Author:
Fragile <pir@cerdecam.be> private

Definition at line 218 of file class.tree.php.

countChildren ( id,
direct = FALSE 
)

Count number of children a node has. $direct param specifies if we count only direct children or direct children and all their children

Parameters:
int $id id of the node we want to count children
boolean $direct if true we only count direct children, if false we count all children
Returns:
int number of children
Author:
Fragile <pir@cerdecam.be> public

Definition at line 306 of file class.tree.php.

deleteNode ( id  ) 

delete a node and all its children

Parameters:
int $id
Author:
Fragile <pir@cerdecam.be> public

Definition at line 169 of file class.tree.php.

getChildren ( id,
direct = FALSE 
)
Author:
Fragile <pir@cerdecam.be> public

Definition at line 278 of file class.tree.php.

getPosition ( id  ) 

Get the left, right and deep attributes of a node

Parameters:
$id id of the node
Returns:
array $left, $right and $deep attributes of the father
Author:
Fragile <pir@cerdecam.be> public required by makeRoom function

Definition at line 246 of file class.tree.php.

newFirstChild ( id,
values = "" 
)

create a node that will be the first child of node $id

Parameters:
int $id id of the parent node
Returns:
int id of the inserted node _shiftPositions _addNode
Author:
Fragile <pir@cerdecam.be> public

Definition at line 81 of file class.tree.php.

newLastChild ( id,
values = "" 
)

create a node that will be the last child of node $id

Parameters:
$id id of the parent node
Returns:
int id of the inserted node _shiftPositions _addNode
Author:
Fragile <pir@cerdecam.be> public

Definition at line 103 of file class.tree.php.

newNextBrother ( id,
values = "" 
)

create a node that will be the next brother of node $id

Parameters:
$id id of the brother node
Returns:
int id of the inserted node _shiftPositions _addNode
Author:
Fragile <pir@cerdecam.be> public

Definition at line 149 of file class.tree.php.

newPrevBrother ( id,
values = "" 
)

create a node that will be the previous brother of node $id

Parameters:
$id id of the brother node
Returns:
int id of the inserted node Tree::_shiftPositions Tree::_addNode
Author:
Fragile <pir@cerdecam.be> public

Definition at line 126 of file class.tree.php.

newRoot ( tree = "",
values = "" 
)

create root node

Returns:
int id of the inserted node _addNode
Author:
Fragile <pir@cerdecam.be> public

Definition at line 61 of file class.tree.php.

printTree ( id,
attributes = "" 
)

Display the tree that has '$id' as root

Parameters:
$id id of the root of the tree to display
Author:
Fragile <pir@cerdecam.be> public required by makeRoom function

Definition at line 340 of file class.tree.php.

Tree ( table,
leftCol = 'left',
rightCol = 'right',
deepCol = 'deep',
treeCol = '' 
)

constructor, build a tree object

Parameters:
string $table name of the sql table containing the tree nodes
string $leftCol name of the 'left' column in $table
string $rightCol name of the 'right' column in $table
string $deepCol name of the 'deep' column in $table
Author:
Fragile <pir@cerdecam.be> public

Definition at line 44 of file class.tree.php.


Field Documentation

$deepCol

Definition at line 28 of file class.tree.php.

$leftCol

Definition at line 24 of file class.tree.php.

$rightCol

Definition at line 26 of file class.tree.php.

$table

Definition at line 22 of file class.tree.php.

$treeCol

Definition at line 32 of file class.tree.php.


The documentation for this class was generated from the following file:
Generated on Tue Jun 8 12:28:40 2010 for Claroline API by  doxygen 1.6.3