ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPCFileItem.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
6require_once("./Services/COPage/classes/class.ilPageContent.php");
7
19{
23 function init()
24 {
25 $this->setType("flit");
26 }
27
31 function newItemAfter($a_id, $a_location, $a_format)
32 {
33 $li =& $this->getNode();
34 $new_item =& $this->dom->create_element("FileItem");
35 if ($next_li =& $li->next_sibling())
36 {
37 $new_item =& $next_li->insert_before($new_item, $next_li);
38 }
39 else
40 {
41 $parent_list =& $li->parent_node();
42 $new_item =& $parent_list->append_child($new_item);
43 }
44
45 // Identifier
46 $id_node =& $this->dom->create_element("Identifier");
47 $id_node =& $new_item->append_child($id_node);
48 $id_node->set_attribute("Catalog", "ILIAS");
49 $id_node->set_attribute("Entry", "il__file_".$a_id);
50
51 // Location
52 $loc_node =& $this->dom->create_element("Location");
53 $loc_node =& $new_item->append_child($loc_node);
54 $loc_node->set_attribute("Type", "LocalFile");
55 $loc_node->set_content($a_location);
56
57 // Format
58 $form_node =& $this->dom->create_element("Format");
59 $form_node =& $new_item->append_child($form_node);
60 $form_node->set_content($a_format);
61 }
62
63
67 function newItemBefore($a_id, $a_location, $a_format)
68 {
69 $li =& $this->getNode();
70 $new_item =& $this->dom->create_element("FileItem");
71 $new_item =& $li->insert_before($new_item, $li);
72
73 // Identifier
74 $id_node =& $this->dom->create_element("Identifier");
75 $id_node =& $new_item->append_child($id_node);
76 $id_node->set_attribute("Catalog", "ILIAS");
77 $id_node->set_attribute("Entry", "il__file_".$a_id);
78
79 // Location
80 $loc_node =& $this->dom->create_element("Location");
81 $loc_node =& $new_item->append_child($loc_node);
82 $loc_node->set_attribute("Type", "LocalFile");
83 $loc_node->set_content($a_location);
84
85 // Format
86 $form_node =& $this->dom->create_element("Format");
87 $form_node =& $new_item->append_child($form_node);
88 $form_node->set_content($a_format);
89 }
90
94 function deleteItem()
95 {
96 $li =& $this->getNode();
97 $li->unlink($li);
98 }
99
103 function moveItemDown()
104 {
105 $li =& $this->getNode();
106 $next =& $li->next_sibling();
107 $next_copy = $next->clone_node(true);
108 $next_copy =& $li->insert_before($next_copy, $li);
109 $next->unlink($next);
110 }
111
115 function moveItemUp()
116 {
117 $li =& $this->getNode();
118 $prev =& $li->previous_sibling();
119 $li_copy = $li->clone_node(true);
120 $li_copy =& $prev->insert_before($li_copy, $prev);
121 $li->unlink($li);
122 }
123}
124?>
Class ilPCFileItem.
moveItemUp()
move list item up
deleteItem()
Delete file item.
moveItemDown()
move list item down
newItemAfter($a_id, $a_location, $a_format)
insert new list item after current one
newItemBefore($a_id, $a_location, $a_format)
insert new list item before current one
init()
Init page content component.
Class ilPageContent.
& getNode()
Get xml node of page content.
setType($a_type)
Set Type.