Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("content/classes/Pages/class.ilPageContent.php");
00025
00036 class ilPCFileItem extends ilPageContent
00037 {
00038 var $dom;
00039
00044 function ilPCFileItem(&$a_dom)
00045 {
00046 parent::ilPageContent();
00047 $this->setType("flit");
00048
00049 $this->dom =& $a_dom;
00050 }
00051
00052
00056 function newItemAfter($a_id, $a_location, $a_format)
00057 {
00058 $li =& $this->getNode();
00059 $new_item =& $this->dom->create_element("FileItem");
00060 if ($next_li =& $li->next_sibling())
00061 {
00062 $new_item =& $next_li->insert_before($new_item, $next_li);
00063 }
00064 else
00065 {
00066 $parent_list =& $li->parent_node();
00067 $new_item =& $parent_list->append_child($new_item);
00068 }
00069
00070
00071 $id_node =& $this->dom->create_element("Identifier");
00072 $id_node =& $new_item->append_child($id_node);
00073 $id_node->set_attribute("Catalog", "ILIAS");
00074 $id_node->set_attribute("Entry", "il__file_".$a_id);
00075
00076
00077 $loc_node =& $this->dom->create_element("Location");
00078 $loc_node =& $new_item->append_child($loc_node);
00079 $loc_node->set_attribute("Type", "LocalFile");
00080 $loc_node->set_content($a_location);
00081
00082
00083 $form_node =& $this->dom->create_element("Format");
00084 $form_node =& $new_item->append_child($form_node);
00085 $form_node->set_content($a_format);
00086 }
00087
00088
00092 function newItemBefore($a_id, $a_location, $a_format)
00093 {
00094 $li =& $this->getNode();
00095 $new_item =& $this->dom->create_element("FileItem");
00096 $new_item =& $li->insert_before($new_item, $li);
00097
00098
00099 $id_node =& $this->dom->create_element("Identifier");
00100 $id_node =& $new_item->append_child($id_node);
00101 $id_node->set_attribute("Catalog", "ILIAS");
00102 $id_node->set_attribute("Entry", "il__file_".$a_id);
00103
00104
00105 $loc_node =& $this->dom->create_element("Location");
00106 $loc_node =& $new_item->append_child($loc_node);
00107 $loc_node->set_attribute("Type", "LocalFile");
00108 $loc_node->set_content($a_location);
00109
00110
00111 $form_node =& $this->dom->create_element("Format");
00112 $form_node =& $new_item->append_child($form_node);
00113 $form_node->set_content($a_format);
00114 }
00115
00116
00120 function deleteItem()
00121 {
00122 $li =& $this->getNode();
00123 $li->unlink($li);
00124 }
00125
00129 function moveItemDown()
00130 {
00131 $li =& $this->getNode();
00132 $next =& $li->next_sibling();
00133 $next_copy = $next->clone_node(true);
00134 $next_copy =& $li->insert_before($next_copy, $li);
00135 $next->unlink($next);
00136 }
00137
00141 function moveItemUp()
00142 {
00143 $li =& $this->getNode();
00144 $prev =& $li->previous_sibling();
00145 $li_copy = $li->clone_node(true);
00146 $li_copy =& $prev->insert_before($li_copy, $prev);
00147 $li->unlink($li);
00148 }
00149
00150
00151 }
00152 ?>