ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPCTab.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once("./Services/COPage/classes/class.ilPageContent.php");
25 
36 class ilPCTab extends ilPageContent
37 {
38  var $dom;
39 
43  function init()
44  {
45  $this->setType("tabstab");
46  }
47 
51  function newItemAfter()
52  {
53  $tab = $this->getNode();
54  $new_tab =& $this->dom->create_element("Tab");
55  if ($next_tab =& $tab->next_sibling())
56  {
57  $new_tab =& $next_tab->insert_before($new_tab, $next_tab);
58  }
59  else
60  {
61  $parent_tabs = $tab->parent_node();
62  $new_tab =& $parent_tabs->append_child($new_tab);
63  }
64  }
65 
66 
70  function newItemBefore()
71  {
72  $tab = $this->getNode();
73  $new_tab = $this->dom->create_element("Tab");
74  $new_tab = $tab->insert_before($new_tab, $tab);
75  }
76 
77 
81  function deleteItem()
82  {
83  $tab =& $this->getNode();
84  $tab->unlink($tab);
85  }
86 
90  function moveItemDown()
91  {
92  $tab = $this->getNode();
93  $next = $tab->next_sibling();
94  $next_copy = $next->clone_node(true);
95  $next_copy = $tab->insert_before($next_copy, $tab);
96  $next->unlink($next);
97  }
98 
102  function moveItemUp()
103  {
104  $tab = $this->getNode();
105  $prev = $tab->previous_sibling();
106  $tab_copy = $tab->clone_node(true);
107  $tab_copy =& $prev->insert_before($tab_copy, $prev);
108  $tab->unlink($tab);
109  }
110 
111 }
112 ?>