ILIAS  release_8 Revision v8.24
class.ilPCMyCourses.php
Go to the documentation of this file.
1<?php
2
25{
27 protected ilObjUser $user;
28
29 public function init(): void
30 {
31 global $DIC;
32 $this->user = $DIC->user();
33 $this->setType("mcrs");
34 }
35
36 public static function getLangVars(): array
37 {
38 return array("ed_insert_my_courses", "pc_mcrs");
39 }
40
41 public function setNode(php4DOMElement $a_node): void
42 {
43 parent::setNode($a_node); // this is the PageContent node
44 $this->mcrs_node = $a_node->first_child(); // this is the courses node
45 }
46
47 public function create(
48 ilPageObject $a_pg_obj,
49 string $a_hier_id,
50 string $a_pc_id = ""
51 ): void {
52 $this->node = $this->createPageContentNode();
53 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
54 $this->mcrs_node = $this->dom->create_element("MyCourses");
55 $this->mcrs_node = $this->node->append_child($this->mcrs_node);
56 }
57
61 public function setData(string $a_sort): void
62 {
63 $ilUser = $this->user;
64 $this->mcrs_node->set_attribute("User", $ilUser->getId());
65 $this->mcrs_node->set_attribute("Sort", $a_sort);
66 }
67
68 public function getSorting(): string
69 {
70 if (is_object($this->mcrs_node)) {
71 return $this->mcrs_node->get_attribute("Sort");
72 }
73 return "";
74 }
75}
const IL_INSERT_AFTER
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
php4DOMElement $mcrs_node
init()
Init object.
setNode(php4DOMElement $a_node)
Set xml node of page content.
static getLangVars()
Get lang vars needed for editing.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
setData(string $a_sort)
Set courses settings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType(string $a_type)
Set Type.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34