ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
5require_once("./Services/COPage/classes/class.ilPageContent.php");
6
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?>
An exception for terminatinating execution or to throw for unit testing.
Class ilPCListItem.
moveItemUp()
move list item up
deleteItem()
delete row of cell
moveItemDown()
move list item down
newItemBefore()
insert new list item before current one
init()
Init page content component.
newItemAfter()
insert new list item after current one
Class ilPageContent.
& getNode()
Get xml node of page content.
setType($a_type)
Set Type.
$li
Definition: langwiz.php:233