ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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) 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 48 of file class.ilDBUpdate4963.php.

References $i, $ilDB, $query, $res, and array.

49  {
50  global $ilDB;
51 
52  $query = 'UPDATE ' . self::$table_tree . ' SET lft = %s WHERE child = %s AND tree = %s';
53  $res = $ilDB->manipulateF($query, array('integer','integer','integer'), array(
54  $i,
55  $node_id,
56  self::$tree_id));
57 
58  // to much dependencies
59  //$childs = $this->getChilds($node_id);
60  $childs = self::getChildIds($node_id);
61 
62  foreach ($childs as $child) {
63  $i = self::__renumber($child, $i+1);
64  }
65  $i++;
66 
67  // Insert a gap at the end of node, if the node has children
68  if (count($childs) > 0) {
69  $i += self::$gap * 2;
70  }
71 
72 
73  $query = 'UPDATE ' . self::$table_tree . ' SET rgt = %s WHERE child = %s AND tree = %s';
74  $res = $ilDB->manipulateF($query, array('integer','integer', 'integer'), array(
75  $i,
76  $node_id,
77  self::$tree_id));
78  return $i;
79  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
$i
Definition: disco.tpl.php:19

◆ getChildIds()

static ilDBUpdate4963::getChildIds (   $a_node)
staticprivate

Get node child ids type $ilDB.

Parameters
type$a_node
Returns
type

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

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

88  {
89  global $ilDB;
90 
91  $query = 'SELECT * FROM ' . self::$table_tree .
92  ' WHERE parent = ' . $ilDB->quote($a_node, 'integer') . ' ' .
93  'AND tree = ' . $ilDB->quote(self::$tree_id, 'integer');
94  $res = $ilDB->query($query);
95 
96  $childs = array();
97  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
98  $childs[] = $row->child;
99  }
100  return $childs;
101  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB

◆ renumberBookmarkTree()

static ilDBUpdate4963::renumberBookmarkTree ( )
static

Wrapper for renumber.

This method locks the table tree (recursive) 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 21 of file class.ilDBUpdate4963.php.

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

22  {
23  global $ilDB;
24 
25  self::$table_tree = "bookmark_tree";
26  self::$gap = 0;
27 
28  $query = 'SELECT tree FROM ' . self::$table_tree .
29  ' GROUP BY tree';
30  $res = $ilDB->query($query);
31 
32  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
33  self::$tree_id = $row->tree;
34  self::__renumber();
35  }
36  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB

Field Documentation

◆ $gap

ilDBUpdate4963::$gap
staticprivate

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

◆ $table_tree

ilDBUpdate4963::$table_tree
staticprivate

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

◆ $tree_id

ilDBUpdate4963::$tree_id
staticprivate

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


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