A tree class that allows backward compatibility (somewhat) to the old Tree class used in CMSMS versions prior to 1.9, and provides content retrieval abilities, with interface into the content cache.
package |
CMS |
---|---|
license |
GPL |
author |
Robert Campbell |
copyright |
Copyright (c) 2010, Robert Campbell calguy1000@cmsmadesimple.org |
since | 1.9 |
find_by_tag(string $tag_name, mixed $value, boolean $case_insensitive = FALSE) : \cms_tree
string
$tag_nameThe tag name to search for
mixed
$valueThe tag value to search for
boolean
$case_insensitiveWether the value should be treated as case insensitive.
or null on failure.
sureGetNodeById(integer $id) : \cms_content_tree
getNodeById(integer $id) : \cms_content_tree
sureGetNodeByAlias(string $alias) : \cms_content_tree
getNodeByAlias(string $alias) : \cms_content_tree
getNodeByHierarchy(string $position) : \cms_content_tree
hasChildren() : boolean
A backwards compatibility method.
boolean
setTag(string $key, mixed $value)
A backwards compatibility method
string
$keyThe tag name/key
mixed
$valueThe tag value
getId() : integer
A backwards compatibility method
integer
The node id.
getTag(string $key = 'id') : mixed
A backwards compatibility method
string
$keyTag name/key
mixed
Node value.
getParentNode() : \cms_tree
addNode(\cms_content_tree &$node)
getContent(boolean $deep = false, boolean $loadsiblings = true, boolean $loadall = false)
This method will return the content object associated with this node, loading it if necessary, and placing it in the cache for subsequent requests.
boolean
$deepload all child proeprties for the content object if loading is required.
boolean
$loadsiblingsload all the siblings for the selected content object at the same time (a preformance optimization)
boolean
$loadallIf loading siblings, include inactive/disabled pages.
getChildrenCount() : integer
A backwards compatibility function
integer
getSiblingCount() : integer
A backwards compatibility function
integer
getLevel() : integer
A backwards compatibility function
integer
getChildren(boolean $deep = false, boolean $all = false, boolean $loadcontent = true) : Array
This method will retrieve a list of the children of this node, loading their content objects at the same time (as a preformance enhancement).
This method takes advantage of the content cache.
boolean
$deepOptionally load the properties of the children (only used when loadcontent is true)
boolean
$allLoad all children, including inactive/disabled ones (only used when loadcontent is true)
boolean
$loadcontentLoad content objects for children
Array
of cms_tree objects.
getFlatList() : Array
Array
of cms_tree nodes.
isContentCached() : boolean
boolean
_getPeerIndex() : string
string
getHierarchy() : string
string
__construct(string $key = '', mixed $value = '')
string
$keyAn optional key for a tag
mixed
$valueAn optional value for the tag.
has_children() : boolean
boolean
set_tag(string $key, mixed $value)
string
$keyTag name
mixed
$valueTag value
get_tag(string $key) : mixed
string
$keyThe tag name
mixed
The tag value, or null
remove_node(\cms_tree &$node, boolean $search_children = false) : boolean
Search through the children of this node (and optionally recursively through the tree) for the specified node. If found, remove it.
Use this method with caution, as it is very easy to break your tree, corrupt memory and have tree nodes hanging out there with no parents.
\cms_tree
$nodeReference to the node to be removed.
boolean
$search_childrenWether to recursively search children.
boolean
remove() : boolean
This is a convenience method that calls remove_node on the current object.
boolean
get_parent() : \cms_tree
getParent() : \cms_tree
add_node(\cms_tree &$node)
count_children() : integer
integer
count_siblings() : integer
integer
count_nodes() : integer
integer
get_level() : integer
This method counts all of the parents in the tree until there are no more parents.
integer
get_children() : \an
\an
array of cms_tree objects, or null if there are no children.