ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPCResources.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("./Services/COPage/classes/class.ilPageContent.php");
5 
18 {
19  var $dom;
20  var $res_node;
21 
25  function init()
26  {
27  $this->setType("repobj");
28  }
29 
33  function setNode(&$a_node)
34  {
35  parent::setNode($a_node); // this is the PageContent node
36  $this->res_node =& $a_node->first_child(); // this is the Resources node
37  }
38 
45  function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
46  {
47  $this->node = $this->createPageContentNode();
48  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
49  $this->res_node =& $this->dom->create_element("Resources");
50  $this->res_node =& $this->node->append_child($this->res_node);
51  }
52 
58  function setResourceListType($a_type)
59  {
60  if (!empty($a_type))
61  {
62  $children = $this->res_node->child_nodes();
63  for ($i=0; $i<count($children); $i++)
64  {
65  $this->res_node->remove_child($children[$i]);
66  }
67  $list_node =& $this->dom->create_element("ResourceList");
68  $list_node =& $this->res_node->append_child($list_node);
69  $list_node->set_attribute("Type", $a_type);
70  }
71  }
72 
79  {
80  if (is_object($this->res_node))
81  {
82  $children = $this->res_node->child_nodes();
83  if (is_object($children[0]))
84  {
85  return $children[0]->get_attribute("Type");
86  }
87  }
88  }
89 }
90 
91 ?>