• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/Pages/class.ilPCFileItem.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 // Identifier
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                 // Location
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                 // Format
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                 // Identifier
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                 // Location
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                 // Format
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 ?>

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1