Adds an object.
void
add
(mixed $object, [boolean $id_as_name = false])
-
mixed
$object: The object to add (string or DataTreeObject).
-
boolean
$id_as_name: Whether the object ID is to be used as object name. Used in situations where there is no available unique input for object name.
Redefinition of:
- DataTree::add()
- Adds an object.
Builds an attribute query. Here is an example $criteria array:
$criteria['OR'] = array(
array('AND' => array(
array('field' => 'name',
'op' => '=',
'test' => 'foo'),
array('field' => 'key',
'op' => '=',
'test' => 'abc'))),
array('AND' => array(
array('field' => 'name',
'op' => '=',
'test' => 'bar'),
array('field' => 'key',
'op' => '=',
'test' => 'xyz'))));
This would fetch all object ids where attribute name is "foo" AND key is "abc", OR "bar" AND "xyz".
array
buildAttributeQuery
(array $criteria, [string $parent = DATATREE_ROOT], [boolean $allLevels = true], [string $restrict = 'name'], [integer $operation = DATATREE_BUILD_SELECT], [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
$operation: Type of query to build
-
string
$sortby_name: Attribute name to use for sorting.
-
string
$sortby_key: Attribute key to use for sorting.
-
integer
$direction: Sort direction:
- - ascending
- - descending
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.
Returns the number of all of the available values matching the given criteria. Either attribute_name or attribute_key MUST be supplied, and both MAY be supplied.
void
countValuesByAttributes
(array $criteria, [string $parent = DATATREE_ROOT], [boolean $allLevels = true], [string $restrict = 'name'], [ $key = null], [ $name = null], string $attribute_name, string $attribute_key)
-
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.
-
string
$attribute_name: The name of the attribute.
-
string
$attribute_key: The key value of the attribute.
-
$key
-
$name
Retrieves data for an object from the horde_datatree_attributes table.
array
getAttributes
(integer|array $cid, [array $keys = false])
-
integer|array
$cid: The object id to fetch, or an array of object ids.
-
array
$keys: The attributes keys 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? Defaults to all levels.
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.
Retrieves 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.
Returns a list of all groups (root nodes) of the data tree.
array
getGroups
()
Redefinition of:
- DataTree::getGroups()
- Returns a list of all groups (root nodes) of the data tree.
Returns a tree sorted by the specified attribute name and/or key.
array
getSortedTree
(string $root, [boolean $loadTree = false], [string $sortby_name = null], [string $sortby_key = null], [integer $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.
-
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::getSortedTree()
- Returns a tree sorted by the specified attribute name and/or key.
Returns a list of all of the available values of the given criteria Either attribute_name or attribute_key MUST be supplied, and both MAY be supplied.
void
getValuesByAttributes
(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], [ $key = null], [ $name = null], string $attribute_name, string $attribute_key)
-
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
-
string
$attribute_name: The name of the attribute.
-
string
$attribute_key: The key value of the attribute.
-
$key
-
$name
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.
Removes 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.
Removes 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.
Changes the order of the children of an object.
void
reorder
(string $parent, [mixed $order = null], [integer $cid = null])
-
string
$parent: The full id path of the parent object.
-
mixed
$order: If an array it specifies the new positions for all child objects. If an integer and $cid is specified, the position where the child specified by $cid is inserted. If $cid is not specified, the position gets deleted, causing the following positions to shift up.
-
integer
$cid: See $order.
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 or attributes.
void
updateData
(DataTree $object)
-
DataTree
$object: A DataTree 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.
Builds a piece of an attribute query.
array
_buildAttributeQuery
(string $glue, array $criteria, [boolean $join = false])
-
string
$glue: The glue to join the criteria (OR/AND).
-
array
$criteria: The array of criteria.
-
boolean
$join: Should we join on a clean horde_datatree_attributes table? Defaults to false.
Check for existance of an object in a backend-specific manner.
boolean
_exists
(string $object_name)
-
string
$object_name: Object name to check for.
Get an alias to horde_datatree_attributes, incrementing it if necessary.
void
_getAlias
([boolean $increment = false])
-
boolean
$increment: Increment the alias count? Defaults to no.
Look up a datatree id by name.
integer
_getId
(string $name)
Look up a datatree name by id.
string
_getName
(integer $id)
Attempts to open a connection to the SQL server.
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()