wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
Node Class Reference
+ Inheritance diagram for Node:

Public Member Functions

 Node ($type, $oid=null)
 
 getNumChildren ($memOnly=true, $type=null)
 
 addChild (&$child, $addtype=ADDCHILD_BACK)
 
 updateParent (&$parent, $recursive=true)
 
 deleteChild ($childOID, $reallyDelete=false)
 
 loadChildren ($type, $buildDepth=BUILDDEPTH_SINGLE, $forceUpdate=false)
 
getFirstChild ($type, $values, $properties, $useRegExp=true)
 
 getChildren ()
 
 getChildrenEx ($oid, $type, $values, $properties, $useRegExp=true)
 
 sortChildren ($criteria, $recursive=false, $changeSortkey=false, $sortFunction='')
 
 sort (&$nodeList, $criteria, $recursive=false, $changeSortkey=false, $sortFunction='')
 
 filter (&$nodeList, $oid, $type, $values, $properties, $useRegExp=true)
 
 getNextSibling ()
 
 getPreviousSibling ()
 
 loadParents ($type, $forceUpdate=false)
 
 getNumParents ($memOnly=true, $type=null)
 
getParent ()
 
getFirstParent ($type, $values, $properties, $useRegExp=true)
 
getParents ()
 
 getParentsEx ($oid, $type, $values, $properties, $useRegExp=true)
 
 getDepth ()
 
 getPath ()
 
 acceptVisitor (&$visitor)
 
 setState ($state, $recursive=true)
 
 removeDuplicateOidsWithoutRole ($oids)
 
 getDisplayValue ($useDisplayType=false)
 
 getDisplayValues ($useDisplayType=false)
 
 toString ($verbose=false)
 
- Public Member Functions inherited from PersistentObject
 PersistentObject ($type, $oid=null)
 
 getType ()
 
 setType ($type)
 
 getBaseType ()
 
 getOID ()
 
 getBaseOID ()
 
 setOID ($oid)
 
 getDBID ()
 
 setDBID ($id)
 
getMapper ()
 
getDataConverter ()
 
 save ()
 
 delete ($recursive=true)
 
 getState ()
 
 setState ($state, $recursive=true)
 
 setImmutable ()
 
 getLock ()
 
duplicate ()
 
 copyValues (&$object, $dataTypes=array(), $copyPkValues=true)
 
 copyValueIntern (&$node, $valueName, $dataType, &$targetNode, $dataTypes, $valuesToIgnore)
 
 clearValues ($dataTypes=array())
 
 clearValueIntern (&$node, $valueName, $dataType, $dataTypes)
 
 updateOID ()
 
 afterCreate ()
 
 beforeInsert ()
 
 afterInsert ()
 
 afterLoad ()
 
 beforeUpdate ()
 
 afterUpdate ()
 
 beforeDelete ()
 
 afterDelete ()
 
 hasValue ($name, $type=null)
 
 getValue ($name, $type=null)
 
 removeValue ($name, $type=null)
 
 getUnconvertedValue ($name, $type=null)
 
 getConvertedValue ($name, $type=null)
 
 getValueTypes ($name)
 
 validateValues ()
 
 validateValueIntern (&$node, $valueName, $dataType, &$errorMsg)
 
 validateValue ($name, $value, $type=null)
 
 validateValueAgainstRestrictions ($name, $value, $type=null)
 
 setValue ($name, $value, $type=null, $forceSet=false)
 
 getValueProperties ($name, $type=null)
 
 setValueProperties ($name, $properties, $type=null)
 
 getValueProperty ($name, $property, $type=null)
 
 setValueProperty ($name, $property, $value, $type=null)
 
 getValueNames ($type=null)
 
 getDataTypes ()
 
 getProperty ($name)
 
 setProperty ($name, $value)
 
 getPropertyNames ()
 
 addChangeListener (&$listener)
 
 removeChangeListener (&$listener)
 
 propagateValueChange ($name, $type, $oldValue, $newValue)
 
 propagatePropertyChange ($name, $oldValue, $newValue)
 
 propagateStateChange ($oldValue, $newValue)
 
 getObjectDisplayName ()
 
 getObjectDescription ()
 
 getDisplayValue ()
 
 getValueDisplayName ($name, $type=null)
 
 getValueDescription ($name, $type=null)
 
 toString ($verbose=false)
 
 isIndexInSearch ()
 
- Public Member Functions inherited from Storable
 getClassDefinitionFiles ()
 
 loadFromSession ()
 
 saveToSession ()
 

Public Attributes

 $_children = array()
 
 $_parents = array()
 
 $_depth = -1
 
 $_path = ''
 
- Public Attributes inherited from PersistentObject
 $_oid = null
 
 $_type = ''
 
 $_data = array()
 
 $_properties = array()
 
 $_state = STATE_CLEAN
 
 $_isImmutable = false
 
 $_changeListeners = array()
 

Detailed Description

Node is the basic component for building trees (although a Node can have one than more parents). The Node class implements the 'Composite Pattern', so no special tree class is required, all interaction is performed using the Node interface. Subclasses for specialized Nodes must implement this interface so that clients don't have to know about special Node classes. Use the methods addChild(), deleteChild() to build/modify trees.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 118 of file class.Node.php.

Member Function Documentation

Node::Node (   $type,
  $oid = null 
)

Constructor.

Parameters
typeThe Nodes type.
oidThe Nodes oid (, optional will be calculated if not given or not valid).

Definition at line 130 of file class.Node.php.

References PersistentObject\PersistentObject().

+ Here is the call graph for this function:

Node::getNumChildren (   $memOnly = true,
  $type = null 
)

Get the number of children of the Node.

Parameters
memOnlyTrue/False wether to only get the number of loaded children or all children [default: true].
typeThe type of children to check (maybe null to check all children) [default: null].
Returns
The number of children.

Definition at line 140 of file class.Node.php.

References $_children, PersistenceFacade\getOIDParameter(), PersistentObject\getProperty(), and PersistentObject\getType().

Referenced by toString().

+ Here is the call graph for this function:

Node::addChild ( $child,
  $addtype = ADDCHILD_BACK 
)

Add a Node to the Nodes childrenlist.

Parameters
childThe Node to add.
addtypeOne of the ADDCHILD constants or any number >= 0 (if the number is greater than the number of children the effect is the same as ADDCHILD_BACK).

Definition at line 166 of file class.Node.php.

References $_children, ADDCHILD_BACK, ADDCHILD_FRONT, ArrayUtil\array_insert(), and WCMFException\throwEx().

Referenced by User\addRole(), AssociateController\executeKernel(), and loadChildren().

+ Here is the call graph for this function:

Node::updateParent ( $parent,
  $recursive = true 
)

Set a given parent. Works recursively.

Attention
Internal use only.
Parameters
parentA reference to the Node to set the parent to.
recursiveApply function on all subsequent Nodes or not.

Definition at line 195 of file class.Node.php.

References $_parents, ArrayUtil\array_insert(), PersistentObject\getOID(), setState(), and STATE_DIRTY.

+ Here is the call graph for this function:

Node::deleteChild (   $childOID,
  $reallyDelete = false 
)

Delete a Node's child.

Parameters
childOIDThe object id of the child Node to delete.
reallyDeleteTrue/false [default: false]. (if reallyDelete==false mark it and it's descendants as deleted).

Definition at line 223 of file class.Node.php.

References ArrayUtil\array_remove(), PersistentObject\getOID(), and STATE_DELETED.

Referenced by loadChildren(), and User\removeRole().

+ Here is the call graph for this function:

Node::loadChildren (   $type,
  $buildDepth = BUILDDEPTH_SINGLE,
  $forceUpdate = false 
)

Load the children of a given type and add them. If all children should be loaded, set the type parameter to null.

Parameters
typeThe type of children to load (maybe null, to load all children)
buildDepthOne of the BUILDDEPTH constants or a number describing the number of generations to build [default: BUILDDEPTH_SINGLE)]
forceUpdateTrue/False wether to reload already loaded children even if they are already loaded [default: false]
Note
This method relies on the property childoids, that should be set by the mapper, when loading the node

Definition at line 255 of file class.Node.php.

References addChild(), deleteChild(), PersistenceFacade\getInstance(), PersistentObject\getOID(), PersistenceFacade\getOIDParameter(), PersistentObject\getProperty(), and PersistenceFacade\isValidOID().

Referenced by User\getRoles().

+ Here is the call graph for this function:

& Node::getFirstChild (   $type,
  $values,
  $properties,
  $useRegExp = true 
)

Get the first child that matches given conditions.

Parameters
typeThe type that the child should match [maybe null].
valuesAn assoziative array holding key value pairs that the child values should match [maybe null].
propertiesAn assoziative array holding key value pairs that the child properties should match [maybe null].
useRegExpTrue/False wether to interpret the given values/properties as regular expressions or not [default:true]
Returns
An reference to the first child that matched or null.

Definition at line 296 of file class.Node.php.

References getChildrenEx().

+ Here is the call graph for this function:

Node::getChildren ( )

Get the Node's children.

Returns
An Array holding references to the children.

Definition at line 308 of file class.Node.php.

Referenced by toString().

Node::getChildrenEx (   $oid,
  $type,
  $values,
  $properties,
  $useRegExp = true 
)

Get the children that match given conditions.

Parameters
oidThe object id that the children should match [maybe null].
typeThe type that the children should match [maybe null].
valuesAn assoziative array holding key value pairs that the children values should match [maybe null].
propertiesAn assoziative array holding key value pairs that the children properties should match [maybe null].
useRegExpTrue/False wether to interpret the given values/properties as regular expressions or not [default:true]
Returns
An Array holding references to the children that matched.

Definition at line 325 of file class.Node.php.

References filter().

Referenced by getFirstChild(), and User\getRoles().

+ Here is the call graph for this function:

Node::sortChildren (   $criteria,
  $recursive = false,
  $changeSortkey = false,
  $sortFunction = '' 
)

Sort children by a given criteria.

Parameters
criteriaAn assoziative array of criteria - SORTTYPE constant pairs OR a single criteria string. possible criteria: OID, TYPE or any value/property name (e.g. array(OID => SORTTYPE_ASC, 'sortkey' => SORTTYPE_DESC) OR 'sortkey')
Note
If criteria is only a string we will sort by this criteria with SORTTYPE_ASC
Parameters
recursiveTrue/False whether the descendants of the children schould be sorted too (default: false)
changeSortkeyTrue/False whether the sortkey should be changed according to the new order (default: false)
sortFunctionThe name of a global compare function to use. If given criteria will be ignored (default: "")

Definition at line 339 of file class.Node.php.

References sort().

Referenced by sort().

+ Here is the call graph for this function:

Node::sort ( $nodeList,
  $criteria,
  $recursive = false,
  $changeSortkey = false,
  $sortFunction = '' 
)

Sort Node list by a given criteria.

Note
static method
Parameters
nodeListA reference to an array of Nodes
criteriaAn assoziative array of criteria - SORTTYPE constant pairs OR a single criteria string. possible criteria: OID, TYPE or any value/property name (e.g. array(OID => SORTTYPE_ASC, 'sortkey' => SORTTYPE_DESC) OR 'sortkey')
Note
If criteria is only a string we will sort by this criteria with SORTTYPE_ASC
Parameters
recursiveTrue/False whether the descendants of the children schould be sorted too (default: false)
changeSortkeyTrue/False whether the sortkey should be changed according to the new order (default: false)
sortFunctionThe name of a global compare function to use. If given criteria will be ignored (default: "")
Returns
The sorted array of Nodes

Definition at line 356 of file class.Node.php.

References $g_sortCriteria, DATATYPE_IGNORE, sortChildren(), and SORTTYPE_ASC.

Referenced by TreeViewController\executeKernel(), AsyncPagingController\modifyModel(), NodeUtil\setSortProperties(), SortController\sortAll(), and sortChildren().

+ Here is the call graph for this function:

Node::filter ( $nodeList,
  $oid,
  $type,
  $values,
  $properties,
  $useRegExp = true 
)

Get Nodes that match given conditions from a list.

Parameters
nodeListAn reference to an array of nodes to filter.
oidThe object id that the Nodes should match [maybe null].
typeThe type that the Nodes should match [maybe null].
valuesAn assoziative array holding key value pairs that the Node values should match [values are interpreted as regular expression, parameter maybe null].
propertiesAn assoziative array holding key value pairs that the Node properties should match [values are interpreted as regular expression, parameter maybe null].
useRegExpTrue/False wether to interpret the given values/properties as regular expressions or not [default:true]
Returns
An Array holding references to the Nodes that matched.

Definition at line 401 of file class.Node.php.

References StringUtil\getDump(), WCMFException\getStackTrace(), and Log\warn().

Referenced by RoleRDBBase\getChildrenEx(), UserRDBBase\getChildrenEx(), getChildrenEx(), and getParentsEx().

+ Here is the call graph for this function:

Node::getNextSibling ( )

Get the next sibling of the Node.

Returns
The next sibling of the node or NULL if it does not exists.

Definition at line 455 of file class.Node.php.

References PersistentObject\getOID(), and getParent().

+ Here is the call graph for this function:

Node::getPreviousSibling ( )

Get the previous sibling of the Node.

Returns
The previous sibling of the node or NULL if it does not exists.

Definition at line 479 of file class.Node.php.

References PersistentObject\getOID(), and getParent().

+ Here is the call graph for this function:

Node::loadParents (   $type,
  $forceUpdate = false 
)

Load the parents of a given type and add them. If all parents should be loaded, set the type parameter to null.

Parameters
typeThe type of parents to load (maybe null, to load all children)
forceUpdateTrue/False wether to reload already loaded parents even if they are already loaded [default: false]
Note
This method relies on the property childoids, that should be set by the mapper, when loading the node

Definition at line 506 of file class.Node.php.

References BUILDDEPTH_SINGLE, PersistenceFacade\getInstance(), PersistentObject\getOID(), PersistenceFacade\getOIDParameter(), getParentsEx(), PersistentObject\getProperty(), and PersistenceFacade\isValidOID().

+ Here is the call graph for this function:

Node::getNumParents (   $memOnly = true,
  $type = null 
)

Get the number of parents of the Node.

Parameters
memOnlyTrue/False wether to only get the number of loaded parents or all parents [default: true].
typeThe type of parents to check (maybe null to check all parents) [default: null].
Returns
The number of parents.

Definition at line 549 of file class.Node.php.

References $_parents, PersistenceFacade\getOIDParameter(), PersistentObject\getProperty(), and PersistentObject\getType().

Referenced by toString().

+ Here is the call graph for this function:

& Node::getParent ( )

Get the Nodes parent. This method exists for compatibility with previous versions. It returns the first parent.

Returns
A reference to the Nodes parent.

Definition at line 574 of file class.Node.php.

Referenced by getDepth(), getNextSibling(), getPath(), and getPreviousSibling().

& Node::getFirstParent (   $type,
  $values,
  $properties,
  $useRegExp = true 
)

Get the first parent that matches given conditions.

Parameters
typeThe type that the parent should match [maybe null].
valuesAn assoziative array holding key value pairs that the parent values should match [maybe null].
propertiesAn assoziative array holding key value pairs that the parent properties should match [maybe null].
useRegExpTrue/False wether to interpret the given values/properties as regular expressions or not [default:true]
Returns
An reference to the first parent that matched or null.

Definition at line 589 of file class.Node.php.

References getParentsEx().

+ Here is the call graph for this function:

& Node::getParents ( )

Get the Nodes parents.

Returns
An array of references to the Nodes parents.

Definition at line 601 of file class.Node.php.

Referenced by toString().

Node::getParentsEx (   $oid,
  $type,
  $values,
  $properties,
  $useRegExp = true 
)

Get the parents that match given conditions.

Parameters
oidThe object id that the parent should match [maybe null].
typeThe type that the parents should match [maybe null].
valuesAn assoziative array holding key value pairs that the parent values should match [maybe null].
propertiesAn assoziative array holding key value pairs that the parent properties should match [maybe null].
useRegExpTrue/False wether to interpret the given values/properties as regular expressions or not [default:true]
Returns
An Array holding references to the parents that matched.

Definition at line 618 of file class.Node.php.

References filter().

Referenced by getFirstParent(), NMUserRoleBase\getRoleRDBParents(), NMUserRoleBase\getUserRDBParents(), LocktableBase\getUserRDBParents(), and loadParents().

+ Here is the call graph for this function:

Node::getDepth ( )

Get the Nodes depth.

Returns
The number of parents of the Node.

Definition at line 626 of file class.Node.php.

References $_depth, and getParent().

+ Here is the call graph for this function:

Node::getPath ( )

Get the Nodes path (to root).

Returns
The Node path.

Definition at line 641 of file class.Node.php.

References $_path, getParent(), and PersistentObject\getType().

+ Here is the call graph for this function:

Node::acceptVisitor ( $visitor)

Accept a Visitor. For use with the 'Visitor Pattern'.

Parameters
visitorThe Visitor.

Definition at line 656 of file class.Node.php.

Node::setState (   $state,
  $recursive = true 
)

Set the state of the node.

Parameters
stateThe state to set.
recursiveTrue/False [Default: True]

Definition at line 665 of file class.Node.php.

Referenced by updateParent().

Node::removeDuplicateOidsWithoutRole (   $oids)

Remove all object ids from a list of object ids, that don't have a role, but also exist as an object id with a specified role.

Parameters
oidsThe array of object ids to filter
Returns
Array

Definition at line 678 of file class.Node.php.

References PersistenceFacade\getBaseOID().

+ Here is the call graph for this function:

Node::getDisplayValue (   $useDisplayType = false)

Output

See Also
PersistentObject::getDisplayValue() Delegates to NodeUtil::getDisplayValue

Definition at line 719 of file class.Node.php.

References NodeUtil\getDisplayValue().

+ Here is the call graph for this function:

Node::getDisplayValues (   $useDisplayType = false)

Delegates to NodeUtil::getDisplayValues

Definition at line 726 of file class.Node.php.

References NodeUtil\getDisplayValues().

+ Here is the call graph for this function:

Node::toString (   $verbose = false)

Get a string representation of the Node.

Parameters
verboseTrue to get a verbose output [default: false]
Returns
The string representation of the Node.

Definition at line 735 of file class.Node.php.

References getChildren(), getNumChildren(), getNumParents(), PersistentObject\getOID(), and getParents().

+ Here is the call graph for this function:

Member Data Documentation

Node::$_children = array()

Definition at line 120 of file class.Node.php.

Referenced by addChild(), and getNumChildren().

Node::$_parents = array()

Definition at line 121 of file class.Node.php.

Referenced by getNumParents(), and updateParent().

Node::$_depth = -1

Definition at line 122 of file class.Node.php.

Referenced by getDepth().

Node::$_path = ''

Definition at line 123 of file class.Node.php.

Referenced by getPath().


The documentation for this class was generated from the following file: