ILIAS  release_8 Revision v8.24
ILIAS\Skill\Profile\SkillProfileRoleDBRepository Class Reference
+ Collaboration diagram for ILIAS\Skill\Profile\SkillProfileRoleDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db=null)
 
 deleteProfileRoles (int $profile_id)
 
 getAssignedRoles (int $profile_id)
 
 addRoleToProfile (int $profile_id, int $role_id)
 
 removeRoleFromProfile (int $profile_id, int $role_id)
 
 removeRoleFromAllProfiles (int $role_id)
 
 getAllProfilesOfRole (int $role_id)
 
 getGlobalProfilesOfRole (int $role_id)
 
 getLocalProfilesOfRole (int $role_id, int $ref_id)
 
 countRoles (int $profile_id)
 

Protected Attributes

ilDBInterface $db
 
ilLanguage $lng
 
ilRbacReview $review
 

Detailed Description

Definition at line 22 of file class.SkillProfileRoleDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::__construct ( \ilDBInterface  $db = null)

Definition at line 28 of file class.SkillProfileRoleDBRepository.php.

29 {
30 global $DIC;
31
32 $this->db = ($db) ?: $DIC->database();
33 $this->lng = $DIC->language();
34 $this->review = $DIC->rbac()->review();
35 }
global $DIC
Definition: feed.php:28

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $DIC, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ addRoleToProfile()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::addRoleToProfile ( int  $profile_id,
int  $role_id 
)

Definition at line 85 of file class.SkillProfileRoleDBRepository.php.

85 : void
86 {
88
89 $ilDB->replace(
90 "skl_profile_role",
91 array("profile_id" => array("integer", $profile_id),
92 "role_id" => array("integer", $role_id),
93 ),
94 []
95 );
96 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

◆ countRoles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::countRoles ( int  $profile_id)

Definition at line 176 of file class.SkillProfileRoleDBRepository.php.

176 : int
177 {
179
180 $set = $ilDB->query(
181 "SELECT count(*) rcnt FROM skl_profile_role " .
182 " WHERE profile_id = " . $ilDB->quote($profile_id, "integer")
183 );
184 $rec = $ilDB->fetchAssoc($set);
185 return (int) $rec["rcnt"];
186 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

◆ deleteProfileRoles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::deleteProfileRoles ( int  $profile_id)

Definition at line 37 of file class.SkillProfileRoleDBRepository.php.

37 : void
38 {
40
41 $ilDB->manipulate(
42 "DELETE FROM skl_profile_role WHERE " .
43 " profile_id = " . $ilDB->quote($profile_id, "integer")
44 );
45 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

◆ getAllProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getAllProfilesOfRole ( int  $role_id)

Definition at line 119 of file class.SkillProfileRoleDBRepository.php.

119 : array
120 {
122
123 $profiles = [];
124 $set = $ilDB->query(
125 "SELECT p.id, p.title, p.description, p.image_id FROM skl_profile_role r JOIN skl_profile p " .
126 " ON (r.profile_id = p.id) " .
127 " WHERE r.role_id = " . $ilDB->quote($role_id, "integer") .
128 " ORDER BY p.title ASC"
129 );
130 while ($rec = $ilDB->fetchAssoc($set)) {
131 $rec['id'] = (int) $rec['id'];
132 $profiles[] = $rec;
133 }
134 return $profiles;
135 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getAssignedRoles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getAssignedRoles ( int  $profile_id)

Definition at line 47 of file class.SkillProfileRoleDBRepository.php.

47 : array
48 {
52
53 $set = $ilDB->query(
54 "SELECT * FROM skl_profile_role " .
55 " WHERE profile_id = " . $ilDB->quote($profile_id, "integer")
56 );
57 $roles = [];
58 while ($rec = $ilDB->fetchAssoc($set)) {
59 $rec["role_id"] = (int) $rec["role_id"];
61 $type = $lng->txt("role");
62 // get object of role
64 // get title of object if course or group
65 $obj_title = "";
66 $obj_type = "";
67 if (\ilObject::_lookupType($obj_id) == "crs" || \ilObject::_lookupType($obj_id) == "grp") {
68 $obj_title = \ilObject::_lookupTitle($obj_id);
69 $obj_type = \ilObject::_lookupType($obj_id);
70 }
71
72 $roles[] = [
73 "type" => $type,
74 "name" => $name,
75 "id" => $rec["role_id"],
76 "object_title" => $obj_title,
77 "object_type" => $obj_type,
78 "object_id" => $obj_id
79 ];
80 }
81
82 return $roles;
83 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getTranslation(string $a_role_title)
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
getObjectReferenceOfRole(int $a_role_id)
if($format !==null) $name
Definition: metadata.php:247
$type

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$lng, $name, ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$review, $type, ilObjRole\_getTranslation(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilRbacReview\getObjectReferenceOfRole(), ILIAS\Repository\int(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getGlobalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getGlobalProfilesOfRole ( int  $role_id)

Definition at line 137 of file class.SkillProfileRoleDBRepository.php.

137 : array
138 {
140
141 $profiles = [];
142 $set = $ilDB->query(
143 "SELECT p.id, p.title, p.description, p.image_id FROM skl_profile_role r JOIN skl_profile p " .
144 " ON (r.profile_id = p.id) " .
145 " WHERE r.role_id = " . $ilDB->quote($role_id, "integer") .
146 " AND p.ref_id = 0" .
147 " ORDER BY p.title ASC"
148 );
149 while ($rec = $ilDB->fetchAssoc($set)) {
150 $rec['id'] = (int) $rec['id'];
151 $profiles[] = $rec;
152 }
153
154 return $profiles;
155 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getLocalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getLocalProfilesOfRole ( int  $role_id,
int  $ref_id 
)

Definition at line 157 of file class.SkillProfileRoleDBRepository.php.

157 : array
158 {
160
161 $profiles = [];
162 $set = $ilDB->query(
163 "SELECT p.id, p.title, p.description, p.image_id FROM skl_profile_role r JOIN skl_profile p " .
164 " ON (r.profile_id = p.id) " .
165 " WHERE r.role_id = " . $ilDB->quote($role_id, "integer") .
166 " AND p.ref_id = " . $ilDB->quote($ref_id, "integer") .
167 " ORDER BY p.title ASC"
168 );
169 while ($rec = $ilDB->fetchAssoc($set)) {
170 $rec['id'] = (int) $rec['id'];
171 $profiles[] = $rec;
172 }
173 return $profiles;
174 }
$ref_id
Definition: ltiauth.php:67

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, $ref_id, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ removeRoleFromAllProfiles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::removeRoleFromAllProfiles ( int  $role_id)

Definition at line 109 of file class.SkillProfileRoleDBRepository.php.

109 : void
110 {
112
113 $ilDB->manipulate(
114 "DELETE FROM skl_profile_role WHERE " .
115 " role_id = " . $ilDB->quote($role_id, "integer")
116 );
117 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

◆ removeRoleFromProfile()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::removeRoleFromProfile ( int  $profile_id,
int  $role_id 
)

Definition at line 98 of file class.SkillProfileRoleDBRepository.php.

98 : void
99 {
101
102 $ilDB->manipulate(
103 "DELETE FROM skl_profile_role WHERE " .
104 " profile_id = " . $ilDB->quote($profile_id, "integer") .
105 " AND role_id = " . $ilDB->quote($role_id, "integer")
106 );
107 }

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

Field Documentation

◆ $db

◆ $lng

ilLanguage ILIAS\Skill\Profile\SkillProfileRoleDBRepository::$lng
protected

◆ $review

ilRbacReview ILIAS\Skill\Profile\SkillProfileRoleDBRepository::$review
protected

The documentation for this class was generated from the following file: