ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPCProfile.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
32 $this->user = $DIC->user();
33 $this->setType("prof");
34 }
35
36 public function create(
37 ilPageObject $a_pg_obj,
38 string $a_hier_id,
39 string $a_pc_id = ""
40 ): void {
41 $this->createInitialChildNode($a_hier_id, $a_pc_id, "Profile");
42 }
43
44 public function setFields(
45 string $a_mode,
46 ?array $a_fields = null
47 ): void {
48 $ilUser = $this->user;
49
50 $this->getChildNode()->setAttribute("Mode", $a_mode);
51 $this->getChildNode()->setAttribute("User", $ilUser->getId());
52
53 // remove all children first
54 $this->dom_util->deleteAllChilds($this->getChildNode());
55
56 if ($a_mode == "manual") {
57 foreach ($a_fields as $field) {
58 $field_node = $this->dom_doc->createElement("ProfileField");
59 $field_node = $this->getChildNode()->appendChild($field_node);
60 $field_node->setAttribute("Name", $field);
61 }
62 }
63 }
64
65 public function getMode(): string
66 {
67 if (is_object($this->getChildNode())) {
68 return $this->getChildNode()->getAttribute("Mode");
69 }
70 return "";
71 }
72
76 public function getFields(): array
77 {
78 $res = array();
79 if (is_object($this->getChildNode())) {
80 foreach ($this->getChildNode()->childNodes as $child) {
81 $res[] = $child->getAttribute("Name");
82 }
83 }
84 return $res;
85 }
86
87 public static function getLangVars(): array
88 {
89 return array("pc_prof", "ed_insert_profile");
90 }
91}
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
init()
Init object.
setFields(string $a_mode, ?array $a_fields=null)
static getLangVars()
Get lang vars needed for editing.
getFields()
Get profile settings.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
Content object of ilPageObject (see ILIAS DTD).
createInitialChildNode(string $hier_id, string $pc_id, string $child, array $child_attributes=[])
setType(string $a_type)
Set Type.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26