ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilDBUpdate4963 Class Reference

Class ilDBUpdate4950. More...

+ Collaboration diagram for ilDBUpdate4963:

Static Public Member Functions

static renumberBookmarkTree ()
 Wrapper for renumber. More...
 

Static Private Member Functions

static __renumber ($node_id=1, $i=1)
 This method is private. More...
 
static getChildIds ($a_node)
 Get node child ids @global type $ilDB. More...
 

Static Private Attributes

static $table_tree
 
static $tree_id
 
static $gap
 

Detailed Description

Class ilDBUpdate4950.

Definition at line 7 of file class.ilDBUpdate4963.php.

Member Function Documentation

◆ __renumber()

static ilDBUpdate4963::__renumber (   $node_id = 1,
  $i = 1 
)
staticprivate

This method is private.

Always call ilTree->renumber() since it locks the tree table renumber left/right values and close the gaps in numbers (recursive) @access private

Parameters
integernode_id where to start (usually the root node)
integerfirst left value of start node (usually 1)
Returns
integer current left value of recursive call

Definition at line 52 of file class.ilDBUpdate4963.php.

53 {
54 global $ilDB;
55
56 $query = 'UPDATE '.self::$table_tree.' SET lft = %s WHERE child = %s AND tree = %s';
57 $res = $ilDB->manipulateF($query,array('integer','integer','integer'),array(
58 $i,
59 $node_id,
60 self::$tree_id));
61
62 // to much dependencies
63 //$childs = $this->getChilds($node_id);
64 $childs = self::getChildIds($node_id);
65
66 foreach ($childs as $child)
67 {
68 $i = self::__renumber($child,$i+1);
69 }
70 $i++;
71
72 // Insert a gap at the end of node, if the node has children
73 if (count($childs) > 0)
74 {
75 $i += self::$gap * 2;
76 }
77
78
79 $query = 'UPDATE '.self::$table_tree.' SET rgt = %s WHERE child = %s AND tree = %s';
80 $res = $ilDB->manipulateF($query,array('integer','integer', 'integer'),array(
81 $i,
82 $node_id,
83 self::$tree_id));
84 return $i;
85 }
static getChildIds($a_node)
Get node child ids @global type $ilDB.
static __renumber($node_id=1, $i=1)
This method is private.
global $ilDB

References $ilDB, $query, $res, __renumber(), and getChildIds().

Referenced by __renumber(), and renumberBookmarkTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildIds()

static ilDBUpdate4963::getChildIds (   $a_node)
staticprivate

Get node child ids @global type $ilDB.

Parameters
type$a_node
Returns
type

Definition at line 93 of file class.ilDBUpdate4963.php.

94 {
95 global $ilDB;
96
97 $query = 'SELECT * FROM '.self::$table_tree .
98 ' WHERE parent = '.$ilDB->quote($a_node,'integer').' '.
99 'AND tree = '.$ilDB->quote(self::$tree_id,'integer');
100 $res = $ilDB->query($query);
101
102 $childs = array();
103 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
104 {
105 $childs[] = $row->child;
106 }
107 return $childs;
108 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __renumber().

+ Here is the caller graph for this function:

◆ renumberBookmarkTree()

static ilDBUpdate4963::renumberBookmarkTree ( )
static

Wrapper for renumber.

This method locks the table tree (recursive) @access public

Parameters
integernode_id where to start (usually the root node)
integerfirst left value of start node (usually 1)
Returns
integer current left value of recursive call

Definition at line 22 of file class.ilDBUpdate4963.php.

23 {
24 global $ilDB;
25
26 self::$table_tree = "bookmark_tree";
27 self::$gap = 0;
28
29 $query = 'SELECT tree FROM '.self::$table_tree .
30 ' GROUP BY tree';
31 $res = $ilDB->query($query);
32
33 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
34 {
35 self::$tree_id = $row->tree;
37 }
38
39
40 }

References $ilDB, $query, $res, $row, __renumber(), and ilDBConstants\FETCHMODE_OBJECT.

+ Here is the call graph for this function:

Field Documentation

◆ $gap

ilDBUpdate4963::$gap
staticprivate

Definition at line 12 of file class.ilDBUpdate4963.php.

◆ $table_tree

ilDBUpdate4963::$table_tree
staticprivate

Definition at line 10 of file class.ilDBUpdate4963.php.

◆ $tree_id

ilDBUpdate4963::$tree_id
staticprivate

Definition at line 11 of file class.ilDBUpdate4963.php.


The documentation for this class was generated from the following file: