wCMF
3.6
|
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) | |
![]() | |
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 () | |
![]() | |
getClassDefinitionFiles () | |
loadFromSession () | |
saveToSession () | |
Public Attributes | |
$_children = array() | |
$_parents = array() | |
$_depth = -1 | |
$_path = '' | |
![]() | |
$_oid = null | |
$_type = '' | |
$_data = array() | |
$_properties = array() | |
$_state = STATE_CLEAN | |
$_isImmutable = false | |
$_changeListeners = array() | |
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.
Definition at line 118 of file class.Node.php.
Node::Node | ( | $type, | |
$oid = null |
|||
) |
Constructor.
type | The Nodes type. |
oid | The Nodes oid (, optional will be calculated if not given or not valid). |
Definition at line 130 of file class.Node.php.
References PersistentObject\PersistentObject().
Node::getNumChildren | ( | $memOnly = true , |
|
$type = null |
|||
) |
Get the number of children of the Node.
memOnly | True/False wether to only get the number of loaded children or all children [default: true]. |
type | The type of children to check (maybe null to check all children) [default: null]. |
Definition at line 140 of file class.Node.php.
References $_children, PersistenceFacade\getOIDParameter(), PersistentObject\getProperty(), and PersistentObject\getType().
Referenced by toString().
Node::addChild | ( | & | $child, |
$addtype = ADDCHILD_BACK |
|||
) |
Add a Node to the Nodes childrenlist.
child | The Node to add. |
addtype | One 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().
Node::updateParent | ( | & | $parent, |
$recursive = true |
|||
) |
Set a given parent. Works recursively.
parent | A reference to the Node to set the parent to. |
recursive | Apply 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.
Node::deleteChild | ( | $childOID, | |
$reallyDelete = false |
|||
) |
Delete a Node's child.
childOID | The object id of the child Node to delete. |
reallyDelete | True/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().
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.
type | The type of children to load (maybe null, to load all children) |
buildDepth | One of the BUILDDEPTH constants or a number describing the number of generations to build [default: BUILDDEPTH_SINGLE)] |
forceUpdate | True/False wether to reload already loaded children even if they are already loaded [default: false] |
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().
& Node::getFirstChild | ( | $type, | |
$values, | |||
$properties, | |||
$useRegExp = true |
|||
) |
Get the first child that matches given conditions.
type | The type that the child should match [maybe null]. |
values | An assoziative array holding key value pairs that the child values should match [maybe null]. |
properties | An assoziative array holding key value pairs that the child properties should match [maybe null]. |
useRegExp | True/False wether to interpret the given values/properties as regular expressions or not [default:true] |
Definition at line 296 of file class.Node.php.
References getChildrenEx().
Node::getChildren | ( | ) |
Get the Node's 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.
oid | The object id that the children should match [maybe null]. |
type | The type that the children should match [maybe null]. |
values | An assoziative array holding key value pairs that the children values should match [maybe null]. |
properties | An assoziative array holding key value pairs that the children properties should match [maybe null]. |
useRegExp | True/False wether to interpret the given values/properties as regular expressions or not [default:true] |
Definition at line 325 of file class.Node.php.
References filter().
Referenced by getFirstChild(), and User\getRoles().
Node::sortChildren | ( | $criteria, | |
$recursive = false , |
|||
$changeSortkey = false , |
|||
$sortFunction = '' |
|||
) |
Sort children by a given criteria.
criteria | An 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') |
recursive | True/False whether the descendants of the children schould be sorted too (default: false) |
changeSortkey | True/False whether the sortkey should be changed according to the new order (default: false) |
sortFunction | The 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().
Node::sort | ( | & | $nodeList, |
$criteria, | |||
$recursive = false , |
|||
$changeSortkey = false , |
|||
$sortFunction = '' |
|||
) |
Sort Node list by a given criteria.
nodeList | A reference to an array of Nodes |
criteria | An 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') |
recursive | True/False whether the descendants of the children schould be sorted too (default: false) |
changeSortkey | True/False whether the sortkey should be changed according to the new order (default: false) |
sortFunction | The name of a global compare function to use. If given criteria will be ignored (default: "") |
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().
Node::filter | ( | & | $nodeList, |
$oid, | |||
$type, | |||
$values, | |||
$properties, | |||
$useRegExp = true |
|||
) |
Get Nodes that match given conditions from a list.
nodeList | An reference to an array of nodes to filter. |
oid | The object id that the Nodes should match [maybe null]. |
type | The type that the Nodes should match [maybe null]. |
values | An assoziative array holding key value pairs that the Node values should match [values are interpreted as regular expression, parameter maybe null]. |
properties | An assoziative array holding key value pairs that the Node properties should match [values are interpreted as regular expression, parameter maybe null]. |
useRegExp | True/False wether to interpret the given values/properties as regular expressions or not [default:true] |
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().
Node::getNextSibling | ( | ) |
Get the next sibling of the Node.
Definition at line 455 of file class.Node.php.
References PersistentObject\getOID(), and getParent().
Node::getPreviousSibling | ( | ) |
Get the previous sibling of the Node.
Definition at line 479 of file class.Node.php.
References PersistentObject\getOID(), and getParent().
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.
type | The type of parents to load (maybe null, to load all children) |
forceUpdate | True/False wether to reload already loaded parents even if they are already loaded [default: false] |
Definition at line 506 of file class.Node.php.
References BUILDDEPTH_SINGLE, PersistenceFacade\getInstance(), PersistentObject\getOID(), PersistenceFacade\getOIDParameter(), getParentsEx(), PersistentObject\getProperty(), and PersistenceFacade\isValidOID().
Node::getNumParents | ( | $memOnly = true , |
|
$type = null |
|||
) |
Get the number of parents of the Node.
memOnly | True/False wether to only get the number of loaded parents or all parents [default: true]. |
type | The type of parents to check (maybe null to check all parents) [default: null]. |
Definition at line 549 of file class.Node.php.
References $_parents, PersistenceFacade\getOIDParameter(), PersistentObject\getProperty(), and PersistentObject\getType().
Referenced by toString().
& Node::getParent | ( | ) |
Get the Nodes parent. This method exists for compatibility with previous versions. It returns the first 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.
type | The type that the parent should match [maybe null]. |
values | An assoziative array holding key value pairs that the parent values should match [maybe null]. |
properties | An assoziative array holding key value pairs that the parent properties should match [maybe null]. |
useRegExp | True/False wether to interpret the given values/properties as regular expressions or not [default:true] |
Definition at line 589 of file class.Node.php.
References getParentsEx().
& Node::getParents | ( | ) |
Get 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.
oid | The object id that the parent should match [maybe null]. |
type | The type that the parents should match [maybe null]. |
values | An assoziative array holding key value pairs that the parent values should match [maybe null]. |
properties | An assoziative array holding key value pairs that the parent properties should match [maybe null]. |
useRegExp | True/False wether to interpret the given values/properties as regular expressions or not [default:true] |
Definition at line 618 of file class.Node.php.
References filter().
Referenced by getFirstParent(), NMUserRoleBase\getRoleRDBParents(), NMUserRoleBase\getUserRDBParents(), LocktableBase\getUserRDBParents(), and loadParents().
Node::getDepth | ( | ) |
Get the Nodes depth.
Definition at line 626 of file class.Node.php.
References $_depth, and getParent().
Node::getPath | ( | ) |
Get the Nodes path (to root).
Definition at line 641 of file class.Node.php.
References $_path, getParent(), and PersistentObject\getType().
Node::acceptVisitor | ( | & | $visitor | ) |
Accept a Visitor. For use with the 'Visitor Pattern'.
visitor | The Visitor. |
Definition at line 656 of file class.Node.php.
Node::setState | ( | $state, | |
$recursive = true |
|||
) |
Set the state of the node.
state | The state to set. |
recursive | True/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.
oids | The array of object ids to filter |
Definition at line 678 of file class.Node.php.
References PersistenceFacade\getBaseOID().
Node::getDisplayValue | ( | $useDisplayType = false | ) |
Output
Definition at line 719 of file class.Node.php.
References NodeUtil\getDisplayValue().
Node::getDisplayValues | ( | $useDisplayType = false | ) |
Delegates to NodeUtil::getDisplayValues
Definition at line 726 of file class.Node.php.
References NodeUtil\getDisplayValues().
Node::toString | ( | $verbose = false | ) |
Get a string representation of the Node.
verbose | True to get a verbose output [default: false] |
Definition at line 735 of file class.Node.php.
References getChildren(), getNumChildren(), getNumParents(), PersistentObject\getOID(), and getParents().
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().