ILIAS  release_8 Revision v8.24
class.ilContainerLocalProfiles.php
Go to the documentation of this file.
1<?php
2
26{
27 protected ilDBInterface $db;
28 protected array $profiles = [];
29 protected int $obj_id = 0;
30 protected int $mem_rol_id = 0;
31
32 public function __construct(int $a_obj_id)
33 {
34 global $DIC;
35
36 $this->db = $DIC->database();
37 $this->setObjId($a_obj_id);
38
39 if ($this->getObjId() > 0) {
40 $this->setMemberRoleId();
41 $this->read();
42 }
43 }
44
45 protected function setObjId(int $a_obj_id): void
46 {
47 $this->obj_id = $a_obj_id;
48 }
49
50 protected function getObjId(): int
51 {
52 return $this->obj_id;
53 }
54
55 protected function setMemberRoleId(): void
56 {
57 $refs = ilObject::_getAllReferences($this->getObjId());
58 $ref_id = end($refs);
60 }
61
62 protected function getMemberRoleId(): int
63 {
64 return $this->mem_rol_id;
65 }
66
67 public function getProfiles(): array
68 {
69 return $this->profiles;
70 }
71
72 protected function read(): void
73 {
74 $db = $this->db;
75
76 $this->profiles = [];
77 $set = $db->query(
78 "SELECT spr.profile_id, spr.role_id, sp.title, sp.skill_tree_id " .
79 " FROM skl_profile_role spr INNER JOIN skl_profile sp ON spr.profile_id = sp.id " .
80 " WHERE sp.ref_id <> 0 " .
81 " AND role_id = " . $db->quote($this->getMemberRoleId(), "integer")
82 );
83 while ($rec = $db->fetchAssoc($set)) {
84 $this->profiles[$rec["profile_id"]] = $rec;
85 }
86 }
87}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
static getDefaultMemberRole(int $a_ref_id)
global $DIC
Definition: feed.php:28
Interface ilDBInterface.
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
$ref_id
Definition: ltiauth.php:67