Add an object. Part of the DataTree API that must be overridden by subclasses.
void
add
( $object, mixed $fullname)
-
mixed
$fullname: The object to add (string or DataTreeObject).
-
$object
Redefinition of:
- DataTree::add()
- Adds an object.
Returns the number of objects matching a set of attribute criteria.
void
countByAttributes
(array $criteria, [string $parent = DATATREE_ROOT], [boolean $allLevels = true], [string $restrict = 'name'])
-
array
$criteria: The array of criteria.
-
string
$parent: The parent node to start searching from.
-
boolean
$allLevels: Return all levels, or just the direct children of $parent? Defaults to all levels.
-
string
$restrict: Only return attributes with the same attribute_name or attribute_id.
Redefinition of:
- DataTree::countByAttributes()
- Returns the number of objects matching a set of attribute criteria.
Retrieve data for an object.
void
getAttributes
(integer $cid)
-
integer
$cid: The object id to fetch.
Redefinition of:
- DataTree::getAttributes()
- Retrieve data for an object from the horde_datatree_attributes table.
Returns a list of all of the available values of the given attribute name/key combination. Either attribute_name or attribute_key MUST be supplied, and both MAY be supplied.
array
getAttributeValues
([string $attribute_name = null], [string $attribute_key = null], [string $parent = DATATREE_ROOT], [boolean $allLevels = true])
-
string
$attribute_name: The name of the attribute.
-
string
$attribute_key: The key value of the attribute.
-
string
$parent: The parent node to start searching from.
-
boolean
$allLevels: Return all levels, or just the direct children of $parent?
Returns a set of object ids based on a set of attribute criteria.
void
getByAttributes
(array $criteria, [string $parent = DATATREE_ROOT], [boolean $allLevels = true], [string $restrict = 'name'], [integer $from = 0], [integer $count = 0], [string $sortby_name = null], [string $sortby_key = null], [integer $direction = 0])
-
array
$criteria: The array of criteria.
-
string
$parent: The parent node to start searching from.
-
boolean
$allLevels: Return all levels, or just the direct children of $parent? Defaults to all levels.
-
string
$restrict: Only return attributes with the same attribute_name or attribute_id.
-
integer
$from: The object to start to fetching
-
integer
$count: The number of objects to fetch
-
string
$sortby_name: Attribute name to use for sorting.
-
string
$sortby_key: Attribute key to use for sorting.
-
integer
$direction: Sort direction:
- - ascending
- - descending
Redefinition of:
- DataTree::getByAttributes()
- Returns a set of object ids based on a set of attribute criteria.
Retrieve data for an object from the datatree_data field.
void
getData
(integer $cid)
-
integer
$cid: The object id to fetch, or an array of object ids.
Redefinition of:
- DataTree::getData()
- Retrieve data for an object from the datatree_data field.
Get a tree sorted by the specified attribute name and/or key.
array
getSortedTree
(string $root, [boolean $loadTree = false], [array $sortby_name = null], [array $sortby_key = null], [array $direction = 0])
-
string
$root: Which portion of the tree to sort. Defaults to all of it.
-
boolean
$loadTree: Sort the tree starting at $root, or just the requested level and direct parents? Defaults to single level.
-
array
$sortby_name: Attribute name to use for sorting.
-
array
$sortby_key: Attribute key to use for sorting.
-
array
$direction: Sort direction:
- - ascending
- - descending
Redefinition of:
- DataTree::getSortedTree()
- Returns a tree sorted by the specified attribute name and/or key.
Move an object to a new parent.
void
move
(mixed $object, [string $newparent = null])
-
mixed
$object: The object to move.
-
string
$newparent: The new parent object. Defaults to the root.
Redefinition of:
- DataTree::move()
- Move an object to a new parent.
Removes an object.
void
remove
(mixed $object, [boolean $force = false])
-
mixed
$object: The object to remove.
-
boolean
$force: Force removal of every child object?
Redefinition of:
- DataTree::remove()
- Removes an object.
Remove one or more objects by id. This function does *not* do
the validation, reordering, etc. that remove() does. If you need to check for children, re-do ordering, etc., then you must remove() objects one-by-one. This is for code that knows it's dealing with single (non-parented) objects and needs to delete a batch of them quickly.
void
removeByIds
(array $ids)
-
array
$ids: The objects to remove.
Remove one or more objects by name. This function does *not* do
the validation, reordering, etc. that remove() does. If you need to check for children, re-do ordering, etc., then you must remove() objects one-by-one. This is for code that knows it's dealing with single (non-parented) objects and needs to delete a batch of them quickly.
void
removeByNames
(array $names)
-
array
$names: The objects to remove.
Change an object's name.
void
rename
(mixed $old_object, string $new_object_name)
-
mixed
$old_object: The old object.
-
string
$new_object_name: The new object name.
Redefinition of:
- DataTree::rename()
- Change an object's name.
Change order of the children of an object.
void
reorder
(string $parents, [mixed $order = null], [integer $cid = null])
-
string
$parents: The parent id string path.
-
mixed
$order: A specific new order position or an array containing the new positions for the given $parents object.
-
integer
$cid: If provided indicates insertion of a new child to the object, and will be used to avoid incrementing it when shifting up all other children's order. If not provided indicates deletion, hence shift all other positions down one.
Redefinition of:
- DataTree::reorder()
- Changes the order of the children of an object.
Explicitly set the order for a datatree object.
void
setOrder
(integer $id, integer $order)
-
integer
$id: The datatree object id to change.
-
integer
$order: The new order.
Redefinition of:
- DataTree::setOrder()
- Explicitly set the order for a datatree object.
Sorts IDs by attribute values. IDs without attributes will be added to the end of the sorted list.
array
sortByAttributes
(array $unordered_ids, [array $sortby_name = null], [array $sortby_key = null], [array $direction = 0])
-
array
$unordered_ids: Array of ids to sort.
-
array
$sortby_name: Attribute name to use for sorting.
-
array
$sortby_key: Attribute key to use for sorting.
-
array
$direction: Sort direction:
- - ascending
- - descending
Redefinition of:
- DataTree::sortByAttributes()
- Sorts IDs by attribute values. IDs without attributes will be added to the end of the sorted list.
Update the data in an object. Does not change the object's parent or name, just serialized data.
void
updateData
(string $object)
-
string
$object: The object.
Redefinition of:
- DataTree::updateData()
- Update the data in an object. Does not change the object's parent or name, just serialized data or attributes.
Check for existance of an object in a backend-specific manner.
boolean
_exists
(string $object_name)
-
string
$object_name: Object name to check for.
Look up a datatree id by name.
integer
_getId
(string $name)
Look up a datatree name by id.
string
_getName
(integer $id)
Init the object.
boolean
_init
()
Inherited Methods
Inherited From DataTree
DataTree::DataTree()
DataTree::add()
DataTree::count()
DataTree::countByAttributes()
DataTree::encodeName()
DataTree::exists()
DataTree::factory()
DataTree::get()
DataTree::getAttributes()
DataTree::getByAttributes()
DataTree::getById()
DataTree::getData()
DataTree::getGroups()
DataTree::getId()
DataTree::getName()
DataTree::getNumberOfChildren()
DataTree::getObject()
DataTree::getObjectById()
DataTree::getObjects()
DataTree::getOrder()
DataTree::getParam()
DataTree::getParent()
DataTree::getParentById()
DataTree::getParentIdString()
DataTree::getParentList()
DataTree::getParents()
DataTree::getShortName()
DataTree::getSortedTree()
DataTree::move()
DataTree::remove()
DataTree::removeUserData()
DataTree::rename()
DataTree::reorder()
DataTree::set()
DataTree::setOrder()
DataTree::singleton()
DataTree::sortByAttributes()
DataTree::sortHash()
DataTree::updateData()
DataTree::_add()
DataTree::_cmp()
DataTree::_cmpSorted()
DataTree::_defineObjectClass()
DataTree::_extractOneLevel()
DataTree::_reorder()