ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPCConsultationHours.php
Go to the documentation of this file.
1<?php
2
25{
26 protected ilObjUser $user;
27
28 public function init(): void
29 {
30 global $DIC;
31 $this->user = $DIC->user();
32 $this->setType("cach");
33 }
34
35 public static function getLangVars(): array
36 {
37 return array("ed_insert_consultation_hours", "pc_cach");
38 }
39
40 public function create(
41 ilPageObject $a_pg_obj,
42 string $a_hier_id,
43 string $a_pc_id = ""
44 ): void {
45 $this->createPageContentNode();
46 $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
47 $cach_node = $this->dom_doc->createElement("ConsultationHours");
48 $cach_node = $this->getDomNode()->appendChild($cach_node);
49 }
50
54 public function setData(
55 string $a_mode,
56 array $a_grp_ids
57 ): void {
58 $ilUser = $this->user;
59
60 $this->getChildNode()->setAttribute("Mode", $a_mode);
61 $this->getChildNode()->setAttribute("User", $ilUser->getId());
62
63 // remove all children first
64 $this->dom_util->deleteAllChilds($this->getChildNode());
65
66 if ($a_mode === "manual") {
67 foreach ($a_grp_ids as $grp_id) {
68 $field_node = $this->dom_doc->createElement("ConsultationHoursGroup");
69 $field_node = $this->getChildNode()->appendChild($field_node);
70 $field_node->setAttribute("Id", $grp_id);
71 }
72 }
73 }
74
78 public function getGroupIds(): array
79 {
80 $res = array();
81 if (is_object($this->getChildNode())) {
82 foreach ($this->getChildNode()->childNodes as $child) {
83 $res[] = $child->getAttribute("Id");
84 }
85 }
86 return $res;
87 }
88}
const IL_INSERT_AFTER
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setData(string $a_mode, array $a_grp_ids)
Set consultation hours settings.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
static getLangVars()
Get lang vars needed for editing.
getGroupIds()
Get consultation hours group ids.
Content object of ilPageObject (see ILIAS DTD).
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
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26