[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

/phpbb/tree/ -> nestedset.php (summary)

This file is part of the phpBB Forum Software package.

Copyright: (c) phpBB Limited
License: GNU General Public License, version 2 (GPL-2.0)
File Size: 875 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 22 functions

  __construct()
  get_sql_where()
  acquire_lock()
  insert()
  add_item_to_nestedset()
  remove_item_from_nestedset()
  delete()
  move()
  move_down()
  move_up()
  move_children()
  change_parent()
  get_path_and_subtree_data()
  get_path_data()
  get_subtree_data()
  get_set_of_nodes_data()
  get_path_basic_data()
  get_all_tree_data()
  remove_subset()
  prepare_adding_subset()
  reset_nestedset_values()
  regenerate_left_right_ids()

Functions
Functions that are not part of a class:

__construct(\phpbb\db\driver\driver_interface $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array()   X-Ref
Construct

param: \phpbb\db\driver\driver_interface    $db        Database connection
param: \phpbb\lock\db        $lock    Lock class used to lock the table when moving forums around
param: string            $table_name            Table name
param: string            $message_prefix        Prefix for the messages thrown by exceptions
param: string            $sql_where            Additional SQL restrictions for the queries
param: array            $item_basic_data    Array with basic item data that is stored in item_parents
param: array            $columns            Array with column names to overwrite

get_sql_where($operator = 'AND', $column_prefix = '')   X-Ref
Returns additional sql where restrictions

param: string        $operator        SQL operator that needs to be prepended to sql_where,
param: string        $column_prefix    Prefix that needs to be prepended to column names
return: string        Returns additional where statements to narrow down the tree,

acquire_lock()   X-Ref
Acquires a lock on the item table

return: bool    True if the lock was acquired, false if it has been acquired previously

insert(array $additional_data)   X-Ref
{@inheritdoc}


add_item_to_nestedset($item_id)   X-Ref
Add an item which already has a database row at the end of the tree

param: int    $item_id    The item to be added
return: array        Array with updated data, if the item was added successfully

remove_item_from_nestedset($item_id)   X-Ref
Remove an item from the tree without deleting it from the database

Also removes all subitems from the tree without deleting them from the database either

param: int    $item_id    The item to be deleted
return: array        Item ids that have been removed

delete($item_id)   X-Ref
{@inheritdoc}


move($item_id, $delta)   X-Ref
{@inheritdoc}


move_down($item_id)   X-Ref
{@inheritdoc}


move_up($item_id)   X-Ref
{@inheritdoc}


move_children($current_parent_id, $new_parent_id)   X-Ref
{@inheritdoc}


change_parent($item_id, $new_parent_id)   X-Ref
{@inheritdoc}


get_path_and_subtree_data($item_id, $order_asc = true, $include_item = true)   X-Ref
{@inheritdoc}


get_path_data($item_id, $order_asc = true, $include_item = true)   X-Ref
{@inheritdoc}


get_subtree_data($item_id, $order_asc = true, $include_item = true)   X-Ref
{@inheritdoc}


get_set_of_nodes_data($item_id, $condition, $order_asc = true, $include_item = true)   X-Ref
Get items that are related to the given item by the condition

param: int        $item_id        Id of the item to retrieve the node set from
param: string        $condition        Query string restricting the item list
param: bool        $order_asc        Order the items ascending by their left_id
param: bool        $include_item    Should the item matching the given item id be included in the list as well
return: array            Array of items (containing all columns from the item table)

get_path_basic_data(array $item)   X-Ref
Get basic data of all parent items

Basic data is defined in the $item_basic_data property.
Data is cached in the item_parents column in the item table

param: array    $item        The item to get the path from
return: array            Array of items (containing basic columns from the item table)

get_all_tree_data($order_asc = true)   X-Ref
Get all items from the tree

param: bool        $order_asc        Order the items ascending by their left_id
return: array            Array of items (containing all columns from the item table)

remove_subset(array $subset_items, array $bounding_item, $set_subset_zero = true)   X-Ref
Remove a subset from the nested set

param: array    $subset_items        Subset of items to remove
param: array    $bounding_item        Item containing the right bound of the subset
param: bool    $set_subset_zero    Should the parent, left and right id of the items be set to 0, or kept unchanged?
return: null

prepare_adding_subset(array $subset_items, array $new_parent)   X-Ref
Prepare adding a subset to the nested set

param: array    $subset_items        Subset of items to add
param: array    $new_parent    Item containing the right bound of the new parent
return: int        New right id of the parent item

reset_nestedset_values(array $item)   X-Ref
Resets values required for the nested set system

param: array    $item        Original item data
return: array        Original item data + nested set defaults

regenerate_left_right_ids($new_id, $parent_id = 0, $reset_ids = false)   X-Ref
Regenerate left/right ids from parent/child relationship

This method regenerates the left/right ids for the tree based on
the parent/child relations. This function executes three queries per
item, so it should only be called, when the set has one of the following
problems:
- The set has a duplicated value inside the left/right id chain
- The set has a missing value inside the left/right id chain
- The set has items that do not have a left/right id set

When regenerating the items, the items are sorted by parent id and their
current left id, so the current child/parent relationships are kept
and running the function on a working set will not change the order.

param: int    $new_id        First left_id to be used (should start with 1)
param: int    $parent_id    parent_id of the current set (default = 0)
param: bool    $reset_ids    Should we reset all left_id/right_id on the first call?
return: int        $new_id        The next left_id/right_id that should be used



Generated: Tue Apr 7 19:42:26 2020 Cross-referenced by PHPXref 0.7.1