ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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
public
$dom
;
20
24
public
function
init
()
25
{
26
$this->
setType
(
"li"
);
27
}
28
32
public
function
newItemAfter
()
33
{
34
$li
= $this->
getNode
();
35
$new_li = $this->dom->create_element(
"ListItem"
);
36
if
($next_li =
$li
->next_sibling()) {
37
$new_li = $next_li->insert_before($new_li, $next_li);
38
}
else
{
39
$parent_list =
$li
->parent_node();
40
$new_li = $parent_list->append_child($new_li);
41
}
42
}
43
44
48
public
function
newItemBefore
()
49
{
50
$li
= $this->
getNode
();
51
$new_li = $this->dom->create_element(
"ListItem"
);
52
$new_li =
$li
->insert_before($new_li,
$li
);
53
}
54
55
59
public
function
deleteItem
()
60
{
61
$parent_node = $this->
getNode
()->parent_node();
62
$cnt = count($parent_node->child_nodes());
63
if
($cnt == 1) {
64
// if list item is the last one -> delete whole list
65
$grandma = $parent_node->parent_node();
66
$grandma->unlink($grandma);
67
}
else
{
68
$li
= $this->
getNode
();
69
$li
->unlink(
$li
);
70
}
71
}
72
76
public
function
moveItemDown
()
77
{
78
$li
= $this->
getNode
();
79
$next =
$li
->next_sibling();
80
$next_copy = $next->clone_node(
true
);
81
$next_copy =
$li
->insert_before($next_copy,
$li
);
82
$next->unlink($next);
83
}
84
88
public
function
moveItemUp
()
89
{
90
$li
= $this->
getNode
();
91
$prev =
$li
->previous_sibling();
92
$li_copy =
$li
->clone_node(
true
);
93
$li_copy = $prev->insert_before($li_copy, $prev);
94
$li
->unlink(
$li
);
95
}
96
}
ilPCListItem\moveItemUp
moveItemUp()
move list item up
Definition:
class.ilPCListItem.php:88
ilPageContent\getNode
& getNode()
Get xml node of page content.
Definition:
class.ilPageContent.php:124
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:93
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:48
ilPCListItem
Class ilPCListItem.
Definition:
class.ilPCListItem.php:17
ilPCListItem\moveItemDown
moveItemDown()
move list item down
Definition:
class.ilPCListItem.php:76
ilPCListItem\deleteItem
deleteItem()
delete row of cell
Definition:
class.ilPCListItem.php:59
php
Services
COPage
classes
class.ilPCListItem.php
Generated on Thu Jan 16 2025 19:02:20 for ILIAS by
1.8.13 (using
Doxyfile
)