ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
◀ ilDoc Overview
class.ilPCListItem.php
Go to the documentation of this file.
1
<?
php
2
3
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
require_once(
"./Services/COPage/classes/class.ilPageContent.php"
);
6
17
class
ilPCListItem
extends
ilPageContent
18
{
19
var
$dom
;
20
24
function
init
()
25
{
26
$this->
setType
(
"li"
);
27
}
28
32
function
newItemAfter
()
33
{
34
$li
= $this->
getNode
();
35
$new_li = $this->dom->create_element(
"ListItem"
);
36
if
($next_li =
$li
->next_sibling())
37
{
38
$new_li = $next_li->insert_before($new_li, $next_li);
39
}
40
else
41
{
42
$parent_list =
$li
->parent_node();
43
$new_li = $parent_list->append_child($new_li);
44
}
45
}
46
47
51
function
newItemBefore
()
52
{
53
$li
= $this->
getNode
();
54
$new_li = $this->dom->create_element(
"ListItem"
);
55
$new_li =
$li
->insert_before($new_li,
$li
);
56
}
57
58
62
function
deleteItem
()
63
{
64
$parent_node = $this->
getNode
()->parent_node();
65
$cnt = count($parent_node->child_nodes());
66
if
($cnt == 1)
67
{
68
// if list item is the last one -> delete whole list
69
$grandma = $parent_node->parent_node();
70
$grandma->unlink($grandma);
71
}
72
else
73
{
74
$li
= $this->
getNode
();
75
$li
->unlink(
$li
);
76
}
77
}
78
82
function
moveItemDown
()
83
{
84
$li
= $this->
getNode
();
85
$next =
$li
->next_sibling();
86
$next_copy = $next->clone_node(
true
);
87
$next_copy =
$li
->insert_before($next_copy,
$li
);
88
$next->unlink($next);
89
}
90
94
function
moveItemUp
()
95
{
96
$li
= $this->
getNode
();
97
$prev =
$li
->previous_sibling();
98
$li_copy =
$li
->clone_node(
true
);
99
$li_copy = $prev->insert_before($li_copy, $prev);
100
$li
->unlink(
$li
);
101
}
102
103
}
104
?>
ilPCListItem\moveItemUp
moveItemUp()
move list item up
Definition:
class.ilPCListItem.php:94
ilPageContent\getNode
& getNode()
Get xml node of page content.
Definition:
class.ilPageContent.php:125
ilPCListItem\newItemAfter
newItemAfter()
insert new list item after current one
Definition:
class.ilPCListItem.php:32
ilPageContent\setType
setType($a_type)
Set Type.
Definition:
class.ilPageContent.php:94
ilPageContent
Class ilPageContent.
Definition:
class.ilPageContent.php:17
$li
$li
Definition:
langwiz.php:233
ilPCListItem\$dom
$dom
Definition:
class.ilPCListItem.php:19
ilPCListItem\init
init()
Init page content component.
Definition:
class.ilPCListItem.php:24
ilPCListItem\newItemBefore
newItemBefore()
insert new list item before current one
Definition:
class.ilPCListItem.php:51
ilPCListItem
Class ilPCListItem.
Definition:
class.ilPCListItem.php:17
ilPCListItem\moveItemDown
moveItemDown()
move list item down
Definition:
class.ilPCListItem.php:82
ilPCListItem\deleteItem
deleteItem()
delete row of cell
Definition:
class.ilPCListItem.php:62
php
Services
COPage
classes
class.ilPCListItem.php
Generated on Fri Jan 24 2025 19:01:07 for ILIAS by
1.8.13 (using
Doxyfile
)