ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Skill\Profile\SkillProfileManager Class Reference
+ Inheritance diagram for ILIAS\Skill\Profile\SkillProfileManager:
+ Collaboration diagram for ILIAS\Skill\Profile\SkillProfileManager:

Public Member Functions

 __construct (?SkillProfileDBRepository $profile_repo=null, ?SkillProfileLevelsDBRepository $profile_levels_repo=null, ?SkillProfileUserDBRepository $profile_user_repo=null, ?SkillProfileRoleDBRepository $profile_role_repo=null)
 
 getProfile (int $profile_id)
 
 createProfile (SkillProfile $profile)
 
 updateProfile (SkillProfile $profile)
 
 delete (int $profile_id)
 
 deleteProfileLevelsForSkill (int $skill_node_id, bool $is_reference=false)
 
 deleteProfilesFromObject (int $ref_id)
 
 getSkillLevels (int $profile_id)
 
 getSkillLevel (int $profile_id, int $base_skill_id, int $tref_id)
 
 addSkillLevel (SkillProfileLevel $skill_level_obj)
 
 updateSkillLevel (SkillProfileLevel $skill_level_obj)
 
 removeSkillLevel (SkillProfileLevel $skill_level_obj)
 
 updateSkillOrder (int $profile_id, array $order)
 
 fixSkillOrderNumbering (int $profile_id)
 
 getMaxLevelOrderNr (int $profile_id)
 
 getProfilesForAllSkillTrees ()
 
 getProfilesForSkillTree (int $skill_tree_id)
 
 getAllGlobalProfiles ()
 
 getLocalProfilesForObject (int $ref_id)
 
 lookupTitle (int $profile_id)
 
 lookupRefId (int $profile_id)
 
 updateRefIdAfterImport (int $profile_id, int $new_ref_id)
 Update the old ref id with the new ref id after import. More...
 
 getTreeId (int $profile_id)
 
 getAssignments (int $profile_id)
 Get all assignments (users and roles) More...
 
 getAssignedUsersForRole (int $role_id)
 
 getAssignedUserIdsIncludingRoleAssignments (int $profile_id)
 
 addUserToProfile (int $profile_id, int $user_id)
 
 removeUserFromProfile (int $profile_id, int $user_id)
 
 removeUserFromAllProfiles (int $user_id)
 
 countUsers (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)
 Get global and local profiles of a role. More...
 
 getGlobalProfilesOfRole (int $role_id)
 
 getLocalProfilesOfRole (int $role_id)
 
 countRoles (int $profile_id)
 

Static Public Member Functions

static getUsageInfo (array $a_cskill_ids)
 Get title of an assigned item.
Parameters
array{skill_idint, tref_id: int}[] $a_cskill_ids array of common skill ids
Returns
array<string, array<string, array{key: string}[]>>
More...
 
static getUsageInfo (array $a_cskill_ids)
 Get title of an assigned item. More...
 

Protected Member Functions

 deleteProfile (int $profile_id)
 
 deleteProfileLevels (int $profile_id)
 
 deleteProfileUsers (int $profile_id)
 
 deleteProfileRoles (int $profile_id)
 

Protected Attributes

SkillProfileDBRepository $profile_repo
 
SkillProfileLevelsDBRepository $profile_levels_repo
 
SkillProfileUserDBRepository $profile_user_repo
 
SkillProfileRoleDBRepository $profile_role_repo
 
ilRbacReview $rbac_review
 
ilLanguage $lng
 

Detailed Description

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Profile\SkillProfileManager::__construct ( ?SkillProfileDBRepository  $profile_repo = null,
?SkillProfileLevelsDBRepository  $profile_levels_repo = null,
?SkillProfileUserDBRepository  $profile_user_repo = null,
?SkillProfileRoleDBRepository  $profile_role_repo = null 
)

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

42 {
43 global $DIC;
44
45 $this->profile_repo = ($profile_repo) ?: $DIC->skills()->internal()->repo()->getProfileRepo();
46 $this->profile_levels_repo = ($profile_levels_repo) ?: $DIC->skills()->internal()->repo()->getProfileLevelsRepo();
47 $this->profile_user_repo = ($profile_user_repo) ?: $DIC->skills()->internal()->repo()->getProfileUserRepo();
48 $this->profile_role_repo = ($profile_role_repo) ?: $DIC->skills()->internal()->repo()->getProfileRoleRepo();
49 $this->rbac_review = $DIC->rbac()->review();
50 $this->lng = $DIC->language();
51 }
SkillProfileLevelsDBRepository $profile_levels_repo
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Skill\Profile\SkillProfileManager\$profile_levels_repo, ILIAS\Skill\Profile\SkillProfileManager\$profile_repo, ILIAS\Skill\Profile\SkillProfileManager\$profile_role_repo, ILIAS\Skill\Profile\SkillProfileManager\$profile_user_repo, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ addRoleToProfile()

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

Definition at line 404 of file class.SkillProfileManager.php.

404 : void
405 {
406 $this->profile_role_repo->addRoleToProfile($profile_id, $role_id);
407 }

◆ addSkillLevel()

ILIAS\Skill\Profile\SkillProfileManager::addSkillLevel ( SkillProfileLevel  $skill_level_obj)

Definition at line 134 of file class.SkillProfileManager.php.

134 : void
135 {
136 $this->profile_levels_repo->createOrUpdate($skill_level_obj);
137 }

◆ addUserToProfile()

ILIAS\Skill\Profile\SkillProfileManager::addUserToProfile ( int  $profile_id,
int  $user_id 
)

Definition at line 306 of file class.SkillProfileManager.php.

306 : void
307 {
308 $this->profile_user_repo->addUserToProfile($profile_id, $user_id);
309 }

References $user_id.

◆ countRoles()

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

Definition at line 447 of file class.SkillProfileManager.php.

447 : int
448 {
449 $count = $this->profile_role_repo->countRoles($profile_id);
450 return $count;
451 }

◆ countUsers()

ILIAS\Skill\Profile\SkillProfileManager::countUsers ( int  $profile_id)

Definition at line 356 of file class.SkillProfileManager.php.

356 : int
357 {
358 $count = $this->profile_user_repo->countUsers($profile_id);
359 return $count;
360 }

◆ createProfile()

ILIAS\Skill\Profile\SkillProfileManager::createProfile ( SkillProfile  $profile)

Definition at line 61 of file class.SkillProfileManager.php.

62 {
63 // profile
64 $new_profile = $this->profile_repo->createProfile($profile);
65
66 return $new_profile;
67 }

◆ delete()

ILIAS\Skill\Profile\SkillProfileManager::delete ( int  $profile_id)

◆ deleteProfile()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfile ( int  $profile_id)
protected

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

85 : void
86 {
87 $this->profile_repo->deleteProfile($profile_id);
88 }

Referenced by ILIAS\Skill\Profile\SkillProfileManager\delete().

+ Here is the caller graph for this function:

◆ deleteProfileLevels()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfileLevels ( int  $profile_id)
protected

Definition at line 90 of file class.SkillProfileManager.php.

90 : void
91 {
92 $this->profile_levels_repo->deleteAllForProfile($profile_id);
93 }

Referenced by ILIAS\Skill\Profile\SkillProfileManager\delete().

+ Here is the caller graph for this function:

◆ deleteProfileLevelsForSkill()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfileLevelsForSkill ( int  $skill_node_id,
bool  $is_reference = false 
)

Definition at line 95 of file class.SkillProfileManager.php.

95 : void
96 {
97 $this->profile_levels_repo->deleteAllForSkill($skill_node_id, $is_reference);
98 }

◆ deleteProfileRoles()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfileRoles ( int  $profile_id)
protected

Definition at line 105 of file class.SkillProfileManager.php.

105 : void
106 {
107 $this->profile_role_repo->deleteProfileRoles($profile_id);
108 }

Referenced by ILIAS\Skill\Profile\SkillProfileManager\delete().

+ Here is the caller graph for this function:

◆ deleteProfilesFromObject()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfilesFromObject ( int  $ref_id)

Definition at line 110 of file class.SkillProfileManager.php.

110 : void
111 {
112 $this->profile_repo->deleteProfilesFromObject($ref_id);
113 }
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ deleteProfileUsers()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfileUsers ( int  $profile_id)
protected

Definition at line 100 of file class.SkillProfileManager.php.

100 : void
101 {
102 $this->profile_user_repo->deleteProfileUsers($profile_id);
103 }

Referenced by ILIAS\Skill\Profile\SkillProfileManager\delete().

+ Here is the caller graph for this function:

◆ fixSkillOrderNumbering()

ILIAS\Skill\Profile\SkillProfileManager::fixSkillOrderNumbering ( int  $profile_id)

Definition at line 156 of file class.SkillProfileManager.php.

156 : void
157 {
158 $this->profile_levels_repo->fixSkillOrderNumbering($profile_id);
159 }

◆ getAllGlobalProfiles()

ILIAS\Skill\Profile\SkillProfileManager::getAllGlobalProfiles ( )
Returns
SkillProfile[]

Definition at line 188 of file class.SkillProfileManager.php.

188 : array
189 {
190 $profiles = $this->profile_repo->getAllGlobalProfiles();
191 return $profiles;
192 }

◆ getAllProfilesOfRole()

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

Get global and local profiles of a role.

Returns
SkillRoleProfile[]

Definition at line 423 of file class.SkillProfileManager.php.

423 : array
424 {
425 $profiles = $this->profile_role_repo->getAllProfilesOfRole($role_id);
426 return $profiles;
427 }

◆ getAssignedUserIdsIncludingRoleAssignments()

ILIAS\Skill\Profile\SkillProfileManager::getAssignedUserIdsIncludingRoleAssignments ( int  $profile_id)
Returns
int[]

Definition at line 285 of file class.SkillProfileManager.php.

285 : array
286 {
287 $all = [];
288 $users = $this->getUserAssignments($profile_id);
289 foreach ($users as $user) {
290 $all[] = $user->getId();
291 }
292
293 $roles = $this->getRoleAssignments($profile_id);
294 foreach ($roles as $role) {
295 $role_users = $this->rbac_review->assignedUsers($role->getId());
296 foreach ($role_users as $user_id) {
297 if (!in_array($user_id, $all)) {
298 $all[] = $user_id;
299 }
300 }
301 }
302
303 return $all;
304 }

References $user_id.

◆ getAssignedUsersForRole()

ILIAS\Skill\Profile\SkillProfileManager::getAssignedUsersForRole ( int  $role_id)
Returns
int[]

Definition at line 277 of file class.SkillProfileManager.php.

277 : array
278 {
279 return $this->rbac_review->assignedUsers($role_id);
280 }

◆ getAssignments()

ILIAS\Skill\Profile\SkillProfileManager::getAssignments ( int  $profile_id)

Get all assignments (users and roles)

Returns
SkillProfileAssignmentInterface[]

Definition at line 237 of file class.SkillProfileManager.php.

237 : array
238 {
239 $assignments = [];
240
241 $users = $this->getUserAssignments($profile_id);
242 $roles = $this->getRoleAssignments($profile_id);
243 $assignments = array_merge($users, $roles);
244
245 return $assignments;
246 }

◆ getGlobalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileManager::getGlobalProfilesOfRole ( int  $role_id)
Returns
SkillRoleProfile[]

Definition at line 432 of file class.SkillProfileManager.php.

432 : array
433 {
434 $profiles = $this->profile_role_repo->getGlobalProfilesOfRole($role_id);
435 return $profiles;
436 }

◆ getLocalProfilesForObject()

ILIAS\Skill\Profile\SkillProfileManager::getLocalProfilesForObject ( int  $ref_id)
Returns
SkillProfile[]

Definition at line 197 of file class.SkillProfileManager.php.

197 : array
198 {
199 $profiles = $this->profile_repo->getLocalProfilesForObject($ref_id);
200 return $profiles;
201 }

References $ref_id.

◆ getLocalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileManager::getLocalProfilesOfRole ( int  $role_id)
Returns
SkillRoleProfile[]

Definition at line 441 of file class.SkillProfileManager.php.

441 : array
442 {
443 $profiles = $this->profile_role_repo->getLocalProfilesOfRole($role_id);
444 return $profiles;
445 }

◆ getMaxLevelOrderNr()

ILIAS\Skill\Profile\SkillProfileManager::getMaxLevelOrderNr ( int  $profile_id)

Definition at line 161 of file class.SkillProfileManager.php.

161 : int
162 {
163 $max = $this->profile_levels_repo->getMaxOrderNr($profile_id);
164 return $max;
165 }

◆ getProfile()

ILIAS\Skill\Profile\SkillProfileManager::getProfile ( int  $profile_id)
Exceptions

ilSkillProfileNotFoundException

Definition at line 56 of file class.SkillProfileManager.php.

57 {
58 return $this->profile_repo->get($profile_id);
59 }

◆ getProfilesForAllSkillTrees()

ILIAS\Skill\Profile\SkillProfileManager::getProfilesForAllSkillTrees ( )
Returns
SkillProfile[]

Definition at line 170 of file class.SkillProfileManager.php.

170 : array
171 {
172 $profiles = $this->profile_repo->getProfilesForAllSkillTrees();
173 return $profiles;
174 }

◆ getProfilesForSkillTree()

ILIAS\Skill\Profile\SkillProfileManager::getProfilesForSkillTree ( int  $skill_tree_id)
Returns
SkillProfile[]

Definition at line 179 of file class.SkillProfileManager.php.

179 : array
180 {
181 $profiles = $this->profile_repo->getProfilesForSkillTree($skill_tree_id);
182 return $profiles;
183 }

◆ getSkillLevel()

ILIAS\Skill\Profile\SkillProfileManager::getSkillLevel ( int  $profile_id,
int  $base_skill_id,
int  $tref_id 
)

Definition at line 128 of file class.SkillProfileManager.php.

129 {
130 $level = $this->profile_levels_repo->get($profile_id, $base_skill_id, $tref_id);
131 return $level;
132 }

◆ getSkillLevels()

ILIAS\Skill\Profile\SkillProfileManager::getSkillLevels ( int  $profile_id)
Returns
SkillProfileLevel[]

Definition at line 118 of file class.SkillProfileManager.php.

118 : array
119 {
120 $levels = $this->profile_levels_repo->getAll($profile_id);
121 usort($levels, static function (SkillProfileLevel $level_a, SkillProfileLevel $level_b): int {
122 return $level_a->getOrderNr() <=> $level_b->getOrderNr();
123 });
124
125 return $levels;
126 }

References ILIAS\Skill\Profile\SkillProfileLevel\getOrderNr().

+ Here is the call graph for this function:

◆ getTreeId()

ILIAS\Skill\Profile\SkillProfileManager::getTreeId ( int  $profile_id)

Definition at line 223 of file class.SkillProfileManager.php.

223 : int
224 {
225 $tree_id = $this->profile_repo->getTreeId($profile_id);
226 return $tree_id;
227 }

◆ getUsageInfo()

static ILIAS\Skill\Profile\SkillProfileManager::getUsageInfo ( array  $a_cskill_ids)
static

Get title of an assigned item.

Parameters
array{skill_idint, tref_id: int}[] $a_cskill_ids array of common skill ids
Returns
array<string, array<string, array{key: string}[]>>

Implements ILIAS\Skill\Usage\SkillUsageInfo.

Definition at line 456 of file class.SkillProfileManager.php.

456 : array
457 {
458 global $DIC;
459
460 $usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
461
462 return $usage_manager->getUsageInfoGeneric(
463 $a_cskill_ids,
465 "skl_profile_level",
466 "profile_id",
467 "base_skill_id"
468 );
469 }

References $DIC, and ILIAS\Skill\Usage\SkillUsageManager\PROFILE.

◆ lookupRefId()

ILIAS\Skill\Profile\SkillProfileManager::lookupRefId ( int  $profile_id)

Definition at line 209 of file class.SkillProfileManager.php.

209 : int
210 {
211 $ref_id = $this->profile_repo->lookup($profile_id, "ref_id");
212 return (int) $ref_id;
213 }

References $ref_id.

◆ lookupTitle()

ILIAS\Skill\Profile\SkillProfileManager::lookupTitle ( int  $profile_id)

Definition at line 203 of file class.SkillProfileManager.php.

203 : string
204 {
205 $title = $this->profile_repo->lookup($profile_id, "title");
206 return $title;
207 }

◆ removeRoleFromAllProfiles()

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

Definition at line 414 of file class.SkillProfileManager.php.

414 : void
415 {
416 $this->profile_role_repo->removeRoleFromAllProfiles($role_id);
417 }

◆ removeRoleFromProfile()

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

Definition at line 409 of file class.SkillProfileManager.php.

409 : void
410 {
411 $this->profile_role_repo->removeRoleFromProfile($profile_id, $role_id);
412 }

◆ removeSkillLevel()

ILIAS\Skill\Profile\SkillProfileManager::removeSkillLevel ( SkillProfileLevel  $skill_level_obj)

Definition at line 144 of file class.SkillProfileManager.php.

144 : void
145 {
146 $this->profile_levels_repo->delete($skill_level_obj);
147 }

◆ removeUserFromAllProfiles()

ILIAS\Skill\Profile\SkillProfileManager::removeUserFromAllProfiles ( int  $user_id)

Definition at line 316 of file class.SkillProfileManager.php.

316 : void
317 {
318 $this->profile_user_repo->removeUserFromAllProfiles($user_id);
319 }

References $user_id.

◆ removeUserFromProfile()

ILIAS\Skill\Profile\SkillProfileManager::removeUserFromProfile ( int  $profile_id,
int  $user_id 
)

Definition at line 311 of file class.SkillProfileManager.php.

311 : void
312 {
313 $this->profile_user_repo->removeUserFromProfile($profile_id, $user_id);
314 }

References $user_id.

◆ updateProfile()

ILIAS\Skill\Profile\SkillProfileManager::updateProfile ( SkillProfile  $profile)

Definition at line 69 of file class.SkillProfileManager.php.

70 {
71 // profile
72 $updated_profile = $this->profile_repo->updateProfile($profile);
73
74 return $updated_profile;
75 }

◆ updateRefIdAfterImport()

ILIAS\Skill\Profile\SkillProfileManager::updateRefIdAfterImport ( int  $profile_id,
int  $new_ref_id 
)

Update the old ref id with the new ref id after import.

Definition at line 218 of file class.SkillProfileManager.php.

218 : void
219 {
220 $this->profile_repo->updateRefIdAfterImport($profile_id, $new_ref_id);
221 }

◆ updateSkillLevel()

ILIAS\Skill\Profile\SkillProfileManager::updateSkillLevel ( SkillProfileLevel  $skill_level_obj)

Definition at line 139 of file class.SkillProfileManager.php.

139 : void
140 {
141 $this->profile_levels_repo->createOrUpdate($skill_level_obj);
142 }

◆ updateSkillOrder()

ILIAS\Skill\Profile\SkillProfileManager::updateSkillOrder ( int  $profile_id,
array  $order 
)

Definition at line 149 of file class.SkillProfileManager.php.

149 : void
150 {
151 asort($order);
152
153 $this->profile_levels_repo->updateSkillOrder($profile_id, $order);
154 }

Field Documentation

◆ $lng

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

Definition at line 35 of file class.SkillProfileManager.php.

◆ $profile_levels_repo

SkillProfileLevelsDBRepository ILIAS\Skill\Profile\SkillProfileManager::$profile_levels_repo
protected

◆ $profile_repo

SkillProfileDBRepository ILIAS\Skill\Profile\SkillProfileManager::$profile_repo
protected

◆ $profile_role_repo

SkillProfileRoleDBRepository ILIAS\Skill\Profile\SkillProfileManager::$profile_role_repo
protected

◆ $profile_user_repo

SkillProfileUserDBRepository ILIAS\Skill\Profile\SkillProfileManager::$profile_user_repo
protected

◆ $rbac_review

ilRbacReview ILIAS\Skill\Profile\SkillProfileManager::$rbac_review
protected

Definition at line 34 of file class.SkillProfileManager.php.


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