ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPCConsultationHours.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("./Services/COPage/classes/class.ilPageContent.php");
5 
17 {
18  var $dom;
19 
23  function init()
24  {
25  $this->setType("cach");
26  }
27 
32  static function getLangVars()
33  {
34  return array("ed_insert_consultation_hours", "pc_cach");
35  }
36 
40  function setNode(&$a_node)
41  {
42  parent::setNode($a_node); // this is the PageContent node
43  $this->cach_node =& $a_node->first_child(); // this is the consultation hours node
44  }
45 
52  function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
53  {
54  $this->node = $this->createPageContentNode();
55  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
56  $this->cach_node = $this->dom->create_element("ConsultationHours");
57  $this->cach_node = $this->node->append_child($this->cach_node);
58  }
59 
66  function setData($a_mode, array $a_grp_ids)
67  {
68  global $ilUser;
69 
70  $this->cach_node->set_attribute("Mode", $a_mode);
71  $this->cach_node->set_attribute("User", $ilUser->getId());
72 
73  // remove all children first
74  $children = $this->cach_node->child_nodes();
75  if($children)
76  {
77  foreach($children as $child)
78  {
79  $this->cach_node->remove_child($child);
80  }
81  }
82 
83  if($a_mode == "manual")
84  {
85  foreach($a_grp_ids as $grp_id)
86  {
87  $field_node = $this->dom->create_element("ConsultationHoursGroup");
88  $field_node = $this->cach_node->append_child($field_node);
89  $field_node->set_attribute("Id", $grp_id);
90  }
91  }
92  }
93 
99  function getGroupIds()
100  {
101  $res = array();
102  if (is_object($this->cach_node))
103  {
104  $children = $this->cach_node->child_nodes();
105  if($children)
106  {
107  foreach($children as $child)
108  {
109  $res[] = $child->get_attribute("Id");
110  }
111  }
112  }
113  return $res;
114  }
115 }
116 ?>