ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilDBUpdate4963.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
7
class
ilDBUpdate4963
8
{
9
private
static
$table_tree
;
10
private
static
$tree_id
;
11
private
static
$gap
;
12
21
public
static
function
renumberBookmarkTree
()
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
}
37
38
// PRIVATE
48
private
static
function
__renumber
($node_id = 1,
$i
= 1)
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
}
80
87
private
static
function
getChildIds
($a_node)
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
}
102
}
ilDBUpdate4963\renumberBookmarkTree
static renumberBookmarkTree()
Wrapper for renumber.
Definition:
class.ilDBUpdate4963.php:21
ilDBUpdate4963\getChildIds
static getChildIds($a_node)
Get node child ids type $ilDB.
Definition:
class.ilDBUpdate4963.php:87
ilDBUpdate4963\$table_tree
static $table_tree
Definition:
class.ilDBUpdate4963.php:9
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$query
$query
Definition:
proxy_ylocal.php:13
ilDBUpdate4963\$tree_id
static $tree_id
Definition:
class.ilDBUpdate4963.php:10
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilDBUpdate4963\$gap
static $gap
Definition:
class.ilDBUpdate4963.php:11
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
$i
$i
Definition:
disco.tpl.php:19
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
$row
$row
Definition:
10autofilter-selection-1.php:74
ilDBUpdate4963
Class ilDBUpdate4950.
Definition:
class.ilDBUpdate4963.php:7
ilDBUpdate4963\__renumber
static __renumber($node_id=1, $i=1)
This method is private.
Definition:
class.ilDBUpdate4963.php:48
Services
Migration
DBUpdate_4963
classes
class.ilDBUpdate4963.php
Generated on Sat Jan 18 2025 19:01:35 for ILIAS by
1.8.13 (using
Doxyfile
)