2013-04-16 23:07:48 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
2013-04-25 22:39:24 +02:00
|
|
|
* @package tree
|
2013-04-16 23:07:48 +02:00
|
|
|
* @copyright (c) 2013 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2013-04-25 17:04:37 +02:00
|
|
|
interface phpbb_tree_interface
|
2013-04-16 23:07:48 +02:00
|
|
|
{
|
|
|
|
/**
|
2013-04-26 08:42:44 +02:00
|
|
|
* Inserts an item into the database table and into the tree.
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-18 00:13:19 +02:00
|
|
|
* @param array $item The item to be added
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return array Array with item data as set in the database
|
|
|
|
*/
|
|
|
|
public function insert(array $additional_data);
|
|
|
|
|
|
|
|
/**
|
2013-04-26 08:42:44 +02:00
|
|
|
* Delete an item from the tree and from the database table
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-30 10:32:01 +02:00
|
|
|
* Also deletes the subtree from the tree and from the database table
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-19 16:19:01 +02:00
|
|
|
* @param int $item_id The item to be deleted
|
|
|
|
* @return array Item ids that have been deleted
|
2013-04-16 23:07:48 +02:00
|
|
|
*/
|
2013-04-30 10:32:01 +02:00
|
|
|
public function delete($item_id);
|
2013-04-16 23:07:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move an item by a given delta
|
|
|
|
*
|
2013-04-25 13:09:00 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2013-04-19 21:07:42 +02:00
|
|
|
* @param int $item_id The item to be moved
|
|
|
|
* @param int $delta Number of steps to move this item, < 0 => down, > 0 => up
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return bool True if the item was moved
|
|
|
|
*/
|
2013-04-19 21:07:42 +02:00
|
|
|
public function move($item_id, $delta);
|
2013-04-16 23:07:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move an item down by 1
|
|
|
|
*
|
2013-04-19 21:07:42 +02:00
|
|
|
* @param int $item_id The item to be moved
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return bool True if the item was moved
|
|
|
|
*/
|
2013-04-19 21:07:42 +02:00
|
|
|
public function move_down($item_id);
|
2013-04-16 23:07:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move an item up by 1
|
|
|
|
*
|
2013-04-19 21:07:42 +02:00
|
|
|
* @param int $item_id The item to be moved
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return bool True if the item was moved
|
|
|
|
*/
|
2013-04-19 21:07:42 +02:00
|
|
|
public function move_up($item_id);
|
2013-04-16 23:07:48 +02:00
|
|
|
|
|
|
|
/**
|
2013-04-30 14:12:45 +02:00
|
|
|
* Moves all children of one item to another item
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-30 14:12:45 +02:00
|
|
|
* If the new parent already has children, the new children are appended
|
2013-04-25 13:44:52 +02:00
|
|
|
* to the list.
|
|
|
|
*
|
2013-04-19 21:07:42 +02:00
|
|
|
* @param int $current_parent_id The current parent item
|
|
|
|
* @param int $new_parent_id The new parent item
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return bool True if any items where moved
|
|
|
|
*/
|
2013-04-19 21:07:42 +02:00
|
|
|
public function move_children($current_parent_id, $new_parent_id);
|
2013-04-16 23:07:48 +02:00
|
|
|
|
|
|
|
/**
|
2013-04-25 13:48:19 +02:00
|
|
|
* Change parent item
|
|
|
|
*
|
2013-04-30 14:12:45 +02:00
|
|
|
* Moves the item to the bottom of the new parent's list of children
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-19 21:07:42 +02:00
|
|
|
* @param int $item_id The item to be moved
|
|
|
|
* @param int $new_parent_id The new parent item
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return bool True if the parent was set successfully
|
|
|
|
*/
|
2013-04-30 10:32:01 +02:00
|
|
|
public function change_parent($item_id, $new_parent_id);
|
2013-04-16 23:07:48 +02:00
|
|
|
|
|
|
|
/**
|
2013-04-30 14:12:45 +02:00
|
|
|
* Get all items that are either ancestors or descendants of the item
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-30 18:24:54 +02:00
|
|
|
* @param int $item_id The item id the ancestors/descendants should be retrieved from
|
|
|
|
* @param bool $order_asc Order the items ascendingly (most outer ancestor first)
|
2013-04-30 18:13:32 +02:00
|
|
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
2013-04-25 14:05:41 +02:00
|
|
|
* @return array Array of items (containing all columns from the item table)
|
|
|
|
* ID => Item data
|
|
|
|
*/
|
2013-04-30 13:54:50 +02:00
|
|
|
public function get_path_and_subtree_data($item_id, $order_asc, $include_item);
|
2013-04-25 14:05:41 +02:00
|
|
|
|
|
|
|
/**
|
2013-04-30 18:24:54 +02:00
|
|
|
* Get all of the item's ancestors
|
2013-04-16 23:07:48 +02:00
|
|
|
*
|
2013-04-30 18:24:54 +02:00
|
|
|
* @param int $item_id The item id the ancestors should be retrieved from
|
|
|
|
* @param bool $order_asc Order the items ascendingly (most outer ancestor first)
|
2013-04-30 18:13:32 +02:00
|
|
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
2013-04-16 23:07:48 +02:00
|
|
|
* @return array Array of items (containing all columns from the item table)
|
|
|
|
* ID => Item data
|
|
|
|
*/
|
2013-04-30 13:54:50 +02:00
|
|
|
public function get_path_data($item_id, $order_asc, $include_item);
|
2013-04-25 14:05:41 +02:00
|
|
|
|
|
|
|
/**
|
2013-04-30 18:24:54 +02:00
|
|
|
* Get all of the item's descendants
|
2013-04-25 14:05:41 +02:00
|
|
|
*
|
2013-04-30 18:24:54 +02:00
|
|
|
* @param int $item_id The item id the descendants should be retrieved from
|
|
|
|
* @param bool $order_asc Order the items ascendingly
|
2013-04-30 18:13:32 +02:00
|
|
|
* @param bool $include_item Should the item matching the given item id be included in the list as well
|
2013-04-25 14:05:41 +02:00
|
|
|
* @return array Array of items (containing all columns from the item table)
|
|
|
|
* ID => Item data
|
|
|
|
*/
|
2013-04-30 13:54:50 +02:00
|
|
|
public function get_subtree_data($item_id, $order_asc, $include_item);
|
2013-04-16 23:07:48 +02:00
|
|
|
}
|