Class: DB_NestedSet
Source Location: /DB_NestedSet-1.3.4/NestedSet.php
DB_NestedSet is a class for handling nested sets
Author(s):
Version:
|
|
|
Child classes:
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
addListener [line 1978]
string addListener(
string
$event,
&$listener, string
$listener)
|
|
Add an event listener Adds an event listener and returns an ID for it
Parameters:
apiVersion [line 2032]
convertTreeModel [line 2366]
bool convertTreeModel(
&$orig,
&$copy, [integer
$_parent = false], object
$)
|
|
Convert a <1.3 tree into a 1.3 tree format This will convert the tree into a format needed for some new features in 1.3. Your <1.3 tree will still work without converting but some new features like preorder sorting won't work as expected. Usage:
- Create a new node table (tb_nodes2) from the current node table (tb_nodes1) (only copy the structure).
- Create a nested set instance of the 'old' set (NeSe1) and one of the new set (NeSe2)
- Now you have 2 identical objects where only node_table differs
- Call DB_NestedSet::convertTreeModel(&$orig, &$copy);
- After that you have a cleaned up copy of tb_nodes1 inside tb_nodes2
Parameters:
createLeftNode [line 1157]
mixed createLeftNode(
int
$id, array
$values, bool
$returnID)
|
|
Creates a node before a given node +-- root1
|
+-\ root2
| |
| |-- subnode2 [new]
| |-- subnode1 [target]
| |-- subnode3
|
+-- root3
Parameters:
createRightNode [line 1260]
mixed createRightNode(
int
$id, array
$values, bool
$returnID)
|
|
Creates a node after a given node +-- root1
|
+-\ root2
| |
| |-- subnode1 [target]
| |-- subnode2 [new]
| |-- subnode3
|
+-- root3
Parameters:
createRootNode [line 941]
mixed createRootNode(
array
$values, [integer
$id = false], [bool
$first = false], [string
$pos = NESE_MOVE_AFTER])
|
|
Creates a new root node. If no id is specified then it is either added to the beginning/end of the tree based on the $pos. Optionally it deletes the whole tree and creates one initial rootnode +-- root1 [target]
|
+-- root2 [new]
|
+-- root3
Parameters:
createSubNode [line 1055]
mixed createSubNode(
integer
$id, array
$values)
|
|
Creates a subnode +-- root1
|
+-\ root2 [target]
| |
| |-- subnode1 [new]
|
+-- root3
Parameters:
deleteNode [line 1348]
bool deleteNode(
int
$id)
|
|
Deletes a node
Parameters:
factory [line 337]
object The &factory(
string
$driver, string
$dsn, [array
$params = array()])
|
|
Handles the returning of a concrete instance of DB_NestedSet based on the driver. If the class given by $driver allready exists it will be used. If not the driver will be searched inside the default path ./NestedSet/
Parameters:
getAllNodes [line 367]
mixed getAllNodes(
[bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()])
|
|
Fetch the whole NestedSet
Parameters:
getBranch [line 469]
mixed getBranch(
int
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()])
|
|
Fetch the whole branch where a given node id is in
Parameters:
getChildren [line 681]
mixed getChildren(
int
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [bool
$forceNorder = false], [array
$addSQL = array()])
|
|
Fetch the children _one level_ after of a node given by id
Parameters:
getParent [line 603]
mixed getParent(
int
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()], [
$useDB = true])
|
|
Fetch the immediate parent of a node given by id
Parameters:
getParents [line 541]
mixed getParents(
int
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()])
|
|
Fetch the parents of a node given by id
Parameters:
getRootNodes [line 422]
mixed getRootNodes(
[bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()])
|
|
Fetches the first level (the rootnodes) of the NestedSet
Parameters:
getSiblings [line 650]
mixed getSiblings(
int
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()])
|
|
Fetch all siblings of the node given by id Important: The node given by ID will also be returned Do a unset($array[$id]) on the result if you don't want that
Parameters:
getSubBranch [line 737]
mixed getSubBranch(
string
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [array
$addSQL = array()])
|
|
Fetch all the children of a node given by id getChildren only queries the immediate children getSubBranch returns all nodes below the given node
Parameters:
isParent [line 877]
bool isParent(
mixed
$parent, mixed
$child)
|
|
See if a given node is a parent of another given node A node is considered to be a parent if it resides above the child So it doesn't mean that the node has to be an immediate parent. To get this information simply compare the levels of the two nodes after you know that you have a parent relation.
Parameters:
moveTree [line 1481]
int moveTree(
int
$id,
$targetid, constant
$pos, [bool
$copy = false], int
$target)
|
|
Wrapper for node moving and copying
Parameters:
pickNode [line 816]
mixed pickNode(
int
$id, [bool
$keepAsArray = false], [bool
$aliasFields = true], [string
$idfield = 'id'], [array
$addSQL = array()])
|
|
Fetch the data of a node with the given id
Parameters:
removeListener [line 1996]
bool removeListener(
string
$event, string
$listenerID)
|
|
Removes an event listener Removes the event listener with the given ID
Parameters:
setAttr [line 2049]
bool setAttr(
array
$attr)
|
|
Sets an object attribute
Parameters:
setDbOption [line 2103]
void setDbOption(
$option,
$val)
|
|
Sets a db option. Example, setting the sequence table format
Parameters:
setsortMode [line 2085]
Current setsortMode(
[constant
$sortMode = false])
|
|
This enables you to set specific options for each output method
Parameters:
testLock [line 2113]
Tests if a database lock is set
triggerEvent [line 2015]
bool triggerEvent(
string
$event,
&$node, [array
$eparams = false], object
$)
|
|
Triggers and event an calls the event listeners
Parameters:
updateNode [line 1427]
bool updateNode(
int
$id, array
$values, [
$_internal = false], bool
$_intermal)
|
|
Changes the payload of a node
Parameters:
Documentation generated on Mon, 11 Mar 2019 10:14:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|