ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilPCTab.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 require_once("./Services/COPage/classes/class.ilPageContent.php");
6 
17 class ilPCTab extends ilPageContent
18 {
19  public $dom;
20 
24  public function init()
25  {
26  $this->setType("tabstab");
27  }
28 
32  public function newItemAfter()
33  {
34  $tab = $this->getNode();
35  $new_tab = $this->dom->create_element("Tab");
36  if ($next_tab = $tab->next_sibling()) {
37  $new_tab = $next_tab->insert_before($new_tab, $next_tab);
38  } else {
39  $parent_tabs = $tab->parent_node();
40  $new_tab = $parent_tabs->append_child($new_tab);
41  }
42  }
43 
44 
48  public function newItemBefore()
49  {
50  $tab = $this->getNode();
51  $new_tab = $this->dom->create_element("Tab");
52  $new_tab = $tab->insert_before($new_tab, $tab);
53  }
54 
55 
59  public function deleteItem()
60  {
61  $tab = $this->getNode();
62  $tab->unlink($tab);
63  }
64 
68  public function moveItemDown()
69  {
70  $tab = $this->getNode();
71  $next = $tab->next_sibling();
72  $next_copy = $next->clone_node(true);
73  $next_copy = $tab->insert_before($next_copy, $tab);
74  $next->unlink($next);
75  }
76 
80  public function moveItemUp()
81  {
82  $tab = $this->getNode();
83  $prev = $tab->previous_sibling();
84  $tab_copy = $tab->clone_node(true);
85  $tab_copy = $prev->insert_before($tab_copy, $prev);
86  $tab->unlink($tab);
87  }
88 }
moveItemUp()
move tab item up
& getNode()
Get xml node of page content.
setType($a_type)
Set Type.
Class ilPCTab.
Class ilPageContent.
newItemBefore()
insert new tab item before current one
moveItemDown()
move tab item down
init()
Init page content component.
deleteItem()
delete tab
newItemAfter()
insert new tab item after current one