ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPCMyCourses.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 {
21  protected $user;
22 
23  public $dom;
24 
28  public function init()
29  {
30  global $DIC;
31  $this->user = $DIC->user();
32  $this->setType("mcrs");
33  }
34 
39  public static function getLangVars()
40  {
41  return array("ed_insert_my_courses", "pc_mcrs");
42  }
43 
47  public function setNode($a_node)
48  {
49  parent::setNode($a_node); // this is the PageContent node
50  $this->mcrs_node = &$a_node->first_child(); // this is the courses node
51  }
52 
59  public function create(&$a_pg_obj, $a_hier_id, $a_pc_id = "")
60  {
61  $this->node = $this->createPageContentNode();
62  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
63  $this->mcrs_node = $this->dom->create_element("MyCourses");
64  $this->mcrs_node = $this->node->append_child($this->mcrs_node);
65  }
66 
70  public function setData($a_sort)
71  {
73 
74  $this->mcrs_node->set_attribute("User", $ilUser->getId());
75  $this->mcrs_node->set_attribute("Sort", $a_sort);
76 
77  /* remove all children first
78  $children = $this->cach_node->child_nodes();
79  if($children)
80  {
81  foreach($children as $child)
82  {
83  $this->cach_node->remove_child($child);
84  }
85  }
86  */
87  }
88 
89  public function getSorting()
90  {
91  if (is_object($this->mcrs_node)) {
92  return $this->mcrs_node->get_attribute("Sort");
93  }
94  }
95 }
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create courses node in xml.
init()
Init page content component.
global $DIC
Definition: saml.php:7
setType($a_type)
Set Type.
static getLangVars()
Get lang vars needed for editing.
user()
Definition: user.php:4
Class ilPageContent.
$ilUser
Definition: imgupload.php:18
const IL_INSERT_AFTER
setData($a_sort)
Set courses settings.
Class ilPCMyCourses.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
setNode($a_node)
Set node.