interface tree_interface
Methods
array |
insert(array $additional_data)
Inserts an item into the database table and into the tree. |
|
array |
delete(int $item_id)
Delete an item from the tree and from the database table |
|
bool |
move(int $item_id, int $delta)
Move an item by a given delta |
|
bool |
move_down(int $item_id)
Move an item down by 1 |
|
bool |
move_up(int $item_id)
Move an item up by 1 |
|
bool |
move_children(int $current_parent_id, int $new_parent_id)
Moves all children of one item to another item |
|
bool |
change_parent(int $item_id, int $new_parent_id)
Change parent item |
|
array |
get_path_and_subtree_data(int $item_id, bool $order_asc, bool $include_item)
Get all items that are either ancestors or descendants of the item |
|
array |
get_path_data(int $item_id, bool $order_asc, bool $include_item)
Get all of the item's ancestors |
|
array |
get_subtree_data(int $item_id, bool $order_asc, bool $include_item)
Get all of the item's descendants |
Details
at line 24
public array
insert(array $additional_data)
Inserts an item into the database table and into the tree.
at line 34
public array
delete(int $item_id)
Delete an item from the tree and from the database table
Also deletes the subtree from the tree and from the database table
at line 47
public bool
move(int $item_id, int $delta)
Move an item by a given delta
An item is only moved up/down within the same parent. If the delta is larger then the number of children, the item is moved to the top/bottom of the list of children within this parent.
at line 55
public bool
move_down(int $item_id)
Move an item down by 1
at line 63
public bool
move_up(int $item_id)
Move an item up by 1
at line 75
public bool
move_children(int $current_parent_id, int $new_parent_id)
Moves all children of one item to another item
If the new parent already has children, the new children are appended to the list.
at line 86
public bool
change_parent(int $item_id, int $new_parent_id)
Change parent item
Moves the item to the bottom of the new \parent's list of children
at line 97
public array
get_path_and_subtree_data(int $item_id, bool $order_asc, bool $include_item)
Get all items that are either ancestors or descendants of the item
at line 108
public array
get_path_data(int $item_id, bool $order_asc, bool $include_item)
Get all of the item's ancestors
at line 119
public array
get_subtree_data(int $item_id, bool $order_asc, bool $include_item)
Get all of the item's descendants