ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContainerLocalProfiles.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $db;
16
20 protected $profiles = array();
21
25 protected $obj_id;
26
30 protected $mem_rol_id;
31
37 public function __construct(int $a_obj_id)
38 {
39 global $DIC;
40
41 $this->db = $DIC->database();
42 $this->setObjId($a_obj_id);
43
44 if ($this->getObjId() > 0) {
45 $this->setMemberRoleId();
46 $this->read();
47 }
48 }
49
55 protected function setObjId(int $a_obj_id)
56 {
57 $this->obj_id = $a_obj_id;
58 }
59
65 protected function getObjId() : int
66 {
67 return $this->obj_id;
68 }
69
75 protected function setMemberRoleId()
76 {
77 $refs = ilObject::_getAllReferences($this->getObjId());
78 $ref_id = end($refs);
79 $this->mem_rol_id = ilParticipants::getDefaultMemberRole($ref_id);
80 }
81
87 protected function getMemberRoleId() : int
88 {
89 return $this->mem_rol_id;
90 }
91
97 public function getProfiles()
98 {
99 return $this->profiles;
100 }
101
105 protected function read()
106 {
107 $db = $this->db;
108
109 $this->profiles = array();
110 $set = $db->query(
111 "SELECT spr.profile_id, spr.role_id, sp.title FROM skl_profile_role spr INNER JOIN skl_profile sp " .
112 " ON spr.profile_id = sp.id " .
113 " WHERE sp.ref_id <> 0 " .
114 " AND role_id = " . $db->quote($this->getMemberRoleId(), "integer")
115 );
116 while ($rec = $db->fetchAssoc($set)) {
117 $this->profiles[$rec["profile_id"]] = $rec;
118 }
119 }
120}
An exception for terminatinating execution or to throw for unit testing.
Local competence profiles of a container.
__construct(int $a_obj_id)
Constructor.
getMemberRoleId()
Get member role id of object.
setMemberRoleId()
Set member role id of object.
setObjId(int $a_obj_id)
Set object id.
static _getAllReferences($a_id)
get all reference ids of object
static getDefaultMemberRole($a_ref_id)
global $DIC
Definition: goto.php:24