[ Index ] |
|
Code source de Horde 3.1.3 |
[Code source] [Imprimer] [Statistiques]
List every object in an array, similar to PEAR/html/menu.php.
Poids: | 1611 lignes (51 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
DataTree:: (47 méthodes):
DataTree()
getParam()
remove()
removeUserData()
move()
rename()
reorder()
_reorder()
setOrder()
_defineObjectClass()
getObject()
getObjectById()
getObjects()
get()
count()
sortHash()
getById()
getGroups()
getData()
set()
_extractOneLevel()
_extractAllLevelTree()
_extractAllLevelList()
getParent()
getParentById()
getParents()
getParentList()
getParentIdString()
getNumberOfChildren()
exists()
getName()
getId()
getOrder()
encodeName()
getShortName()
getSortedTree()
add()
_add()
getAttributes()
countByAttributes()
getByAttributes()
sortByAttributes()
updateData()
_cmp()
_cmpSorted()
factory()
singleton()
DataTreeObject:: (15 méthodes):
DataTreeObject()
setDataTree()
getName()
setName()
getShortName()
getId()
getData()
setData()
setOrder()
getParent()
getChild()
save()
delete()
get()
set()
DataTree($params = null) X-Ref |
Constructor. param: array $params A hash containing any additional configuration or |
getParam($param) X-Ref |
Returns a parameter of this DataTree instance. param: string $param The parameter to return. return: mixed The parameter's value or null if it doesn't exist. |
remove($object, $force = false) X-Ref |
Removes an object. param: string $object The object to remove. param: $force Force removal of every child object? |
removeUserData($user) X-Ref |
Removes all DataTree objects owned by a certain user. param: string $user A user name. |
move($object, $newparent = null) X-Ref |
Move an object to a new parent. param: mixed $object The object to move. param: string $newparent The new parent object. Defaults to the root. |
rename($old_object, $new_object_name) X-Ref |
Change an object's name. param: mixed $old_object The old object. param: string $new_object_name The new object name. |
reorder($parents, $order = null, $cid = null) X-Ref |
Changes the order of the children of an object. param: string $parent The full id path of the parent object. param: mixed $order If an array it specifies the new positions for param: integer $cid See $order. |
_reorder($pid, $order = null, $cid = null) X-Ref |
Change order of children of an object. param: string $pid The parent object id string path. param: mixed $order Specific new order position or an array containing param: integer $cid If provided indicates insertion of a new child to |
setOrder($id, $order) X-Ref |
Explicitly set the order for a datatree object. param: integer $id The datatree object id to change. param: integer $order The new order. |
_defineObjectClass($attributes) X-Ref |
Dynamically determines the object class. param: array $attributes The set of attributes that contain the class |
getObject($object, $class = 'DataTreeObject') X-Ref |
Returns a DataTreeObject (or subclass) object of the data in the object defined by $object. param: string $object The object to fetch: 'parent:sub-parent:name'. param: string $class Subclass of DataTreeObject to use. Defaults to |
getObjectById($id, $class = 'DataTreeObject') X-Ref |
Returns a DataTreeObject (or subclass) object of the data in the object with the ID $id. param: integer $id An object id. param: string $class Subclass of DataTreeObject to use. Defaults to |
getObjects($ids, $class = 'DataTreeObject') X-Ref |
Returns an array of DataTreeObject (or subclass) objects corresponding to the objects in $ids, with the object names as the keys of the array. param: array $ids An array of object ids. param: string $class Subclass of DataTreeObject to use. Defaults to |
get($format, $startleaf = DATATREE_ROOT, $reload = false,$rootname = DATATREE_ROOT, $maxdepth = -1, $loadTree = false,$sortby_name = null, $sortby_key = null, $direction = 0) X-Ref |
Export a list of objects. param: constant $format Format of the export param: string $startleaf The name of the leaf from which we start param: boolean $reload Re-load the requested chunk? Defaults to param: string $rootname The label to use for the root element. param: integer $maxdepth The maximum number of levels to return. param: boolean $loadTree Load a tree starting at $root, or just the param: string $sortby_name Attribute name to use for sorting. param: string $sortby_key Attribute key to use for sorting. param: integer $direction Sort direction: return: mixed The tree representation of the objects, or a PEAR_Error |
count($startleaf = DATATREE_ROOT) X-Ref |
Counts objects. param: string $startleaf The name of the leaf from which we start return: integer The number of the objects below $startleaf. |
sortHash($root, $sortby_name = null, $sortby_key = null,$direction = 0) X-Ref |
Create attribute sort hash param: string $root The name of the leaf from which we start param: string $sortby_name Attribute name to use for sorting. param: string $sortby_key Attribute key to use for sorting. param: integer $direction Sort direction: return: string The sort hash |
getById($format, $startleaf = DATATREE_ROOT, $reload = false,$rootname = DATATREE_ROOT, $maxdepth = -1) X-Ref |
Export a list of objects just like get() above, but uses an object id to fetch the list of objects. param: constant $format Format of the export. param: string $startleaf The id of the leaf from which we start the param: boolean $reload Reload the requested chunk? Defaults to param: string $rootname The label to use for the root element. param: integer $maxdepth The maximum number of levels to return return: mixed The tree representation of the objects, or a PEAR_Error |
getGroups() X-Ref |
Returns a list of all groups (root nodes) of the data tree. return: array The the group IDs |
getData($cid) X-Ref |
Retrieve data for an object from the datatree_data field. param: integer $cid The object id to fetch, or an array of object ids. |
set($data, $charset = null) X-Ref |
Import a list of objects. Used by drivers to populate the internal $_data array. param: array $data The data to import. param: string $charset The charset to convert the object name from. |
_extractOneLevel($leaf = DATATREE_ROOT) X-Ref |
Extract one level of data for a parent leaf, sorted first by their order and then by name. This function is a way to get a collection of $leaf's children. param: string $leaf Name of the parent from which to start. return: array |
_extractAllLevelTree(&$out, $parent = DATATREE_ROOT, $maxdepth = -1) X-Ref |
Extract all levels of data, starting from a given parent leaf in the datatree. param: array $out This is an iterating function, so $out is param: string $parent The name of the parent from which to begin. param: integer $maxdepth Max of levels of depth to check. |
_extractAllLevelList(&$out, $parent = DATATREE_ROOT, $maxdepth = -1) X-Ref |
Extract all levels of data, starting from any parent in the tree. Returned array format: array(parent => array(child => true)) param: array $out This is an iterating function, so $out is param: string $parent The name of the parent from which to begin. param: integer $maxdepth Max number of levels of depth to check. |
getParent($child) X-Ref |
Returns a child's direct parent ID. param: mixed $child Either the object, an array containing the return: integer The unique ID of the parent. |
getParentById($childId) X-Ref |
Get a $child's direct parent ID. param: integer $childId Get the parent of this object. return: integer The unique ID of the parent. |
getParents($child, $getids = false) X-Ref |
Get a list of parents all the way up to the root object for $child. param: mixed $child The name of the child param: boolean $getids If true, return parent IDs; otherwise, return return: array [child] [parent] in a tree format. |
getParentList($childId, $parents = array() X-Ref |
Get a list of parents all the way up to the root object for $child. param: integer $childId The id of the child. param: array $parents The array, as we build it up. return: array A flat list of all of the parents of $child, |
getParentIdString($object) X-Ref |
Get a parent ID string (id:cid format) for the specified object. param: mixed $object The object to return a parent string for. return: string|PEAR_Error The ID "path" to the parent object or |
getNumberOfChildren($parent = DATATREE_ROOT) X-Ref |
Get the number of children an object has, only counting immediate children, not grandchildren, etc. param: mixed $parent Either the object or the name for which to count return: integer |
exists($object) X-Ref |
Check if an object exists or not. The root element DATATREE_ROOT always exists. param: mixed $object The name of the object. return: boolean True if the object exists, false otherwise. |
getName($id) X-Ref |
Get the name of an object from its id. param: integer $id The id for which to look up the name. return: string |
getId($name) X-Ref |
Get the id of an object from its name. param: mixed $name Either the object, an array containing the return: string |
getOrder($child) X-Ref |
Get the order position of an object. param: mixed $child Either the object or the name. return: mixed The object's order position or a PEAR error on failure. |
encodeName($name) X-Ref |
Replace all occurences of ':' in an object name with '.'. param: string $name The name of the object. return: string The encoded name. |
getShortName($name) X-Ref |
Get the short name of an object, returns only the last portion of the full name. For display purposes only. param: string $name The name of the object. return: string The object's short name. |
getSortedTree($root, $loadTree = false, $sortby_name = null,$sortby_key = null, $direction = 0) X-Ref |
Returns a tree sorted by the specified attribute name and/or key. param: string $root Which portion of the tree to sort. param: boolean $loadTree Sort the tree starting at $root, or just the param: string $sortby_name Attribute name to use for sorting. param: string $sortby_key Attribute key to use for sorting. param: integer $direction Sort direction: |
add($object, $id_as_name = false) X-Ref |
Adds an object. param: mixed $object The object to add (string or param: boolean $id_as_name True or false to indicate if object ID is to |
_add($name, $id, $pid, $order = '') X-Ref |
Add an object. param: string $name The short object name. param: integer $id The new object's unique ID. param: integer $pid The unique ID of the object's parent. param: integer $order The ordering data for the object. |
getAttributes($cid) X-Ref |
Retrieve data for an object from the horde_datatree_attributes table. param: integer | array $cid The object id to fetch, return: array A hash of attributes, or a multi-level hash |
countByAttributes($criteria, $parent = DATATREE_ROOT,$allLevels = true, $restrict = 'name') X-Ref |
Returns the number of objects matching a set of attribute criteria. param: array $criteria The array of criteria. param: string $parent The parent node to start searching from. param: boolean $allLevels Return all levels, or just the direct param: string $restrict Only return attributes with the same |
getByAttributes($criteria, $parent = DATATREE_ROOT,$allLevels = true, $restrict = 'name', $from = 0,$count = 0, $sortby_name = null,$sortby_key = null, $direction = 0) X-Ref |
Returns a set of object ids based on a set of attribute criteria. param: array $criteria The array of criteria. param: string $parent The parent node to start searching from. param: boolean $allLevels Return all levels, or just the direct param: string $restrict Only return attributes with the same param: integer $from The object to start to fetching param: integer $count The number of objects to fetch param: string $sortby_name Attribute name to use for sorting. param: string $sortby_key Attribute key to use for sorting. param: integer $direction Sort direction: |
sortByAttributes($unordered_ids, $sortby_name = null,$sortby_key = null, $direction = 0) X-Ref |
Sorts IDs by attribute values. IDs without attributes will be added to the end of the sorted list. param: array $unordered_ids Array of ids to sort. param: array $sortby_name Attribute name to use for sorting. param: array $sortby_key Attribute key to use for sorting. param: array $direction Sort direction: return: array Sorted ids. |
updateData($object) X-Ref |
Update the data in an object. Does not change the object's parent or name, just serialized data or attributes. param: DataTree $object A DataTree object. |
_cmp($a, $b) X-Ref |
Sort two objects by their order field, and if that is the same, alphabetically (case insensitive) by name. You never call this function; it's used in uasort() calls. Do NOT use usort(); you'll lose key => value associations. param: array $a The first object param: array $b The second object return: integer 1 if $a should be first, |
_cmpSorted($a, $b) X-Ref |
Sorts two objects by their sorter hash field. You never call this function; it's used in uasort() calls. Do NOT use usort(); you'll lose key => value associations. param: array $a The first object param: array $b The second object return: integer 1 if $a should be first, |
factory($driver, $params = null) X-Ref |
Attempts to return a concrete DataTree instance based on $driver. param: mixed $driver The type of concrete DataTree subclass to return. param: array $params A hash containing any additional configuration or return: DataTree The newly created concrete DataTree instance, or false |
singleton($driver, $params = null) X-Ref |
Attempts to return a reference to a concrete DataTree instance based on $driver. It will only create a new instance if no DataTree instance with the same parameters currently exists. This should be used if multiple DataTree sources (and, thus, multiple DataTree instances) are required. This method must be invoked as: $var = &DataTree::singleton(); param: mixed $driver Type of concrete DataTree subclass to return, param: array $params A hash containing any additional configuration or return: DataTree The concrete DataTree reference, or false on an error. |
Classe: DataTreeObject - X-Ref
Class that can be extended to save arbitrary information as part of a storedDataTreeObject($name) X-Ref |
DataTreeObject constructor. Just sets the $name parameter. param: string $name The object name. |
setDataTree(&$datatree) X-Ref |
Sets the {@link DataTree} instance used to retrieve this object. param: DataTree $datatree A {@link DataTree} instance. |
getName() X-Ref |
Gets the name of this object. return: string The object name. |
setName($name) X-Ref |
Sets the name of this object. NOTE: Use with caution. This may throw out of sync the cached datatree tables if not used properly. param: string $name The name to set this object's name to. |
getShortName() X-Ref |
Gets the short name of this object. For display purposes only. return: string The object's short name. |
getId() X-Ref |
Gets the ID of this object. return: string The object's ID. |
getData() X-Ref |
Gets the data array. return: array The internal data array. |
setData($data) X-Ref |
Sets the data array. param: array The data array to store internally. |
setOrder($order) X-Ref |
Sets the order of this object in its object collection. param: integer $order |
getParent($class = 'DataTreeObject') X-Ref |
Returns this object's parent. param: string $class Subclass of DataTreeObject to use. Defaults to return: DataTreeObject This object's parent |
getChild($name, $autocreate = true) X-Ref |
Returns a child of this object. param: string $name The child's name. param: boolean $autocreate If true and no child with the given name |
save() X-Ref |
Saves any changes to this object to the backend permanently. New objects are added instead. return: boolean|PEAR_Error PEAR_Error on failure. |
delete() X-Ref |
Delete this object from the backend permanently. return: boolean|PEAR_Error PEAR_Error on failure. |
get($attribute) X-Ref |
Gets one of the attributes of the object, or null if it isn't defined. param: string $attribute The attribute to get. return: mixed The value of the attribute, or null. |
set($attribute, $value) X-Ref |
Sets one of the attributes of the object. param: string $attribute The attribute to set. param: mixed $value The value for $attribute. |
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |