[ Index ] |
|
Code source de CMS made simple 1.0.5 |
[Code source] [Imprimer] [Statistiques]
(pas de description)
Poids: | 1045 lignes (30 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
Tree:: (15 méthodes):
Tree()
getRootNode()
getChildrenCount()
getNodeByID()
sureGetNodeByID()
getNodeByAlias()
sureGetNodeByAlias()
getNodeByHierarchy()
hasChildren()
getChildren()
getFlatList()
getFlattenedChildren()
findNodeByTag()
createFromList()
merge()
Tree_Node:: (23 méthodes):
Tree_Node()
getContent()
setTag()
getTag()
setUID()
getUID()
prevSibling()
nextSibling()
getSiblingCount()
remove()
setTree()
getTree()
setParent()
getParent()
getParentNode()
hasChildren()
getChildren()
getChildrenCount()
depth()
getLevel()
isChildOf()
moveTo()
copyTo()
Tree_NodeCollection:: (13 méthodes):
Tree_NodeCollection()
addNode()
firstNode()
lastNode()
removeNodeAt()
removeNode()
indexOf()
getNodeCount()
getFlatList()
traverse()
search()
moveTo()
copyTo()
Tree() X-Ref |
Constructor |
getRootNode() X-Ref |
Pas de description |
getChildrenCount() X-Ref |
Pas de description |
getNodeByID($id) X-Ref |
Pas de description |
sureGetNodeByID($id) X-Ref |
Pas de description |
getNodeByAlias($alias) X-Ref |
Pas de description |
sureGetNodeByAlias($alias) X-Ref |
Pas de description |
getNodeByHierarchy($position) X-Ref |
Pas de description |
hasChildren() X-Ref |
Returns true/false as to whether this node has any child nodes or not. return: bool Any child nodes or not |
getChildren() X-Ref |
Returns all the child nodes for this node. return: array All of the child nodes |
getFlatList() X-Ref |
Pas de description |
getFlattenedChildren() X-Ref |
Pas de description |
findNodeByTag($tagname, &$col) X-Ref |
Returns a node anywhere in the tree given a tag name. A null is returned if the node isn't found. return: object The found node |
createFromList($data, $separator = '/') X-Ref |
Creates a tree structure from a list of items. Items must be separated using the supplied separator. Eg: array('foo', 'foo/bar', 'foo/bar/jello', 'foo/bar/jello2', 'foo/bar2/jello') Would create a structure thus: foo +-bar | +-jello | +-jello2 +-bar2 +-jello Example code: $list = array('Foo/Bar/blaat', 'Foo', 'Foo/Bar', 'Foo/Bar/Jello', 'Foo/Bar/Jello2', 'Foo/Bar2/Jello/Jello2'); $tree = Tree::createFromList($list); param: array $data The list as an indexed array param: string $separator The separator to use return: object A tree structure (Tree object) |
merge(&$tree) X-Ref |
Merges two or more tree structures into one. Can take either Tree objects or Tree_Node objects as arguments to merge. This merge simply means the nodes from the second+ argument(s) are added to the first. param: object $tree The Tree/Tree_Node object to merge subsequent param: ... Any number of Tree or Tree_Node objects to be merged return: object Resulting merged Tree/Tree_Node object |
Tree_Node($tag = null) X-Ref |
Constructor param: mixed $tag The data that this node represents |
getContent() X-Ref |
Gets the underlying content of this node |
setTag($tag) X-Ref |
Sets the tag data param: mixed $tag The data to set the tag to |
getTag() X-Ref |
Returns the tag data return: mixed The tag data |
setUID(&$uid) X-Ref |
Sets the nodes UID param: integer $uid The UID |
getUID() X-Ref |
Returns the node UID return: integer The UID |
prevSibling() X-Ref |
Returns the previous child node in the parents node array, or null if this node is the first. return: object A reference to the previous node in the parent |
nextSibling() X-Ref |
Returns the next child node in the parents node array, or null if this node is the last. return: object A reference to the next node in the parent |
getSiblingCount() X-Ref |
Pas de description |
remove() X-Ref |
Removes this node from its' parent. If this node has no parent (ie its not been added to a Tree or Tree_Node object) then this method will do nothing. |
setTree(&$tree) X-Ref |
Sets the master Tree object for this node. param: object $tree The Tree object reference |
getTree() X-Ref |
Returns the tree object which this node is attached to (if any). return: object The encompassing Tree object |
setParent(&$node) X-Ref |
Sets the parent node of the node. param: object $node The parent node |
getParent() X-Ref |
Returns the parent node if any return: object The parent Tree_Node object |
getParentNode() X-Ref |
Returns the parent node if any -- backwards compatible with the old hierarchy manager code. return: object The parent Tree_Node object |
hasChildren() X-Ref |
Returns true/false as to whether this node has any child nodes or not. return: bool Any child nodes or not |
getChildren() X-Ref |
Returns all the child nodes for this node. return: array All of the child nodes |
getChildrenCount() X-Ref |
Pas de description |
depth() X-Ref |
Returns the depth in the tree of this node This is a zero based indicator, so root nodes will have a depth of 0 (zero). return: integer The depth of the node |
getLevel() X-Ref |
Returns the depth in the tree. This is to make this backwards compatible with the old hierarchy manager. return: integer The depth of the node. |
isChildOf($parent) X-Ref |
Returns true/false as to whether this node is a child of the given node. param: object $parent The suspected parent Tree_Node object return: bool Whether this node is a child of the suspected parent |
moveTo(&$newParent) X-Ref |
Moves this node to a new parent. All child nodes will be retained. param: object $newParent The new parent Tree_Node or Tree object |
copyTo(&$newParent) X-Ref |
Copies this node to a new parent. This copies the node to the new parent node/tree and all its child nodes (ie a deep copy). Technically, new nodes are created with copies of the tag data, since this is for all intents and purposes the only thing that needs copying. param: object $newParent The new parent Tree_Node or Tree object return: object The new node |
Classe: Tree_NodeCollection - X-Ref
A class to represent a collection of child nodesTree_NodeCollection(&$container) X-Ref |
Constructor |
addNode(&$node) X-Ref |
Adds a node to this node param: object $node The Tree_Node object return: object A reference to the new node inside the tree |
firstNode() X-Ref |
Returns the first node in this particular collection return: object The first node. NULL if no nodes. |
lastNode() X-Ref |
Returns the last node in this particular collection return: object The last node. NULL if no nodes. |
removeNodeAt($index) X-Ref |
Removes a node from the child nodes array at the specified (zero based) index. return: object The node that was removed, or null |
removeNode(&$node, $search = false) X-Ref |
Removes a node from the child nodes array by using the unique ID stored in each instance param: object $node The node to remove param: bool $search Whether to search child nodes return: bool True/False |
indexOf($node) X-Ref |
Returns the index in the nodes array at which the given node resides. Used in the prev/next Sibling methods. param: object $node The node to return the index of return: integer The index of the node or null if |
getNodeCount($search = false) X-Ref |
Returns the number of child nodes in this node/tree. Optionally searches the tree and returns the cumulative count. param: bool $search Search tree for nodecount too return: integer The number of nodes found |
getFlatList() X-Ref |
Returns a flat list of the node collection. This array contains references to the nodes. return: array Flat list of the nodes from top to bottom, left to right. |
traverse($function) X-Ref |
Traverses the node collection applying a function to each and every node. The function name given (though this can be anything you can supply to call_user_func(), not just a name) should take a single argument which is the node object (Tree_Node class). You can then access the nodes data by using the getTag() method. The traversal goes from top to bottom, left to right (ie same order as what you get from getFlatList()). ** The node is passed by reference to the function! ** param: callback $function The callback function to use |
search(&$data, $strict = false) X-Ref |
Searches the node collection for a node with a tag matching what you supply. This is a simply "tag == your data" comparison, (=== if strict option is applied) and more advanced comparisons can be made using the traverse() method. This function returns null if nothing is found, and a reference to the first found node if a match is made. param: mixed $data Data to try to find and match param: mixed $strict Whether to use === or simply == to compare return: mixed Null if no match, a reference to the first found node |
moveTo(&$newParent) X-Ref |
Moves the nodes in this collection (not the collection itself) to the given new parent. param: object $newParent The new parent Tree_Node or Tree object |
copyTo(&$newParent) X-Ref |
Copies the nodes in this collection (not the collection itself) to the given new parent. param: object $newParent The new parent Tree_Node or Tree object |
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |