ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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)
 
 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 397 of file class.SkillProfileManager.php.

397 : void
398 {
399 $this->profile_role_repo->addRoleToProfile($profile_id, $role_id);
400 }

◆ 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 299 of file class.SkillProfileManager.php.

299 : void
300 {
301 $this->profile_user_repo->addUserToProfile($profile_id, $user_id);
302 }

References $user_id.

◆ countRoles()

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

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

440 : int
441 {
442 $count = $this->profile_role_repo->countRoles($profile_id);
443 return $count;
444 }

◆ countUsers()

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

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

349 : int
350 {
351 $count = $this->profile_user_repo->countUsers($profile_id);
352 return $count;
353 }

◆ 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 }

◆ 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:

◆ getAllGlobalProfiles()

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

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

181 : array
182 {
183 $profiles = $this->profile_repo->getAllGlobalProfiles();
184 return $profiles;
185 }

◆ getAllProfilesOfRole()

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

Get global and local profiles of a role.

Returns
SkillRoleProfile[]

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

416 : array
417 {
418 $profiles = $this->profile_role_repo->getAllProfilesOfRole($role_id);
419 return $profiles;
420 }

◆ getAssignedUserIdsIncludingRoleAssignments()

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

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

278 : array
279 {
280 $all = [];
281 $users = $this->getUserAssignments($profile_id);
282 foreach ($users as $user) {
283 $all[] = $user->getId();
284 }
285
286 $roles = $this->getRoleAssignments($profile_id);
287 foreach ($roles as $role) {
288 $role_users = $this->rbac_review->assignedUsers($role->getId());
289 foreach ($role_users as $user_id) {
290 if (!in_array($user_id, $all)) {
291 $all[] = $user_id;
292 }
293 }
294 }
295
296 return $all;
297 }

References $user_id.

◆ getAssignedUsersForRole()

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

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

270 : array
271 {
272 return $this->rbac_review->assignedUsers($role_id);
273 }

◆ getAssignments()

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

Get all assignments (users and roles)

Returns
SkillProfileAssignmentInterface[]

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

230 : array
231 {
232 $assignments = [];
233
234 $users = $this->getUserAssignments($profile_id);
235 $roles = $this->getRoleAssignments($profile_id);
236 $assignments = array_merge($users, $roles);
237
238 return $assignments;
239 }

◆ getGlobalProfilesOfRole()

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

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

425 : array
426 {
427 $profiles = $this->profile_role_repo->getGlobalProfilesOfRole($role_id);
428 return $profiles;
429 }

◆ getLocalProfilesForObject()

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

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

190 : array
191 {
192 $profiles = $this->profile_repo->getLocalProfilesForObject($ref_id);
193 return $profiles;
194 }

◆ getLocalProfilesOfRole()

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

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

434 : array
435 {
436 $profiles = $this->profile_role_repo->getLocalProfilesOfRole($role_id);
437 return $profiles;
438 }

◆ getMaxLevelOrderNr()

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

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

154 : int
155 {
156 $max = $this->profile_levels_repo->getMaxOrderNr($profile_id);
157 return $max;
158 }

◆ 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 163 of file class.SkillProfileManager.php.

163 : array
164 {
165 $profiles = $this->profile_repo->getProfilesForAllSkillTrees();
166 return $profiles;
167 }

◆ getProfilesForSkillTree()

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

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

172 : array
173 {
174 $profiles = $this->profile_repo->getProfilesForSkillTree($skill_tree_id);
175 return $profiles;
176 }

◆ 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 216 of file class.SkillProfileManager.php.

216 : int
217 {
218 $tree_id = $this->profile_repo->getTreeId($profile_id);
219 return $tree_id;
220 }

◆ 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 449 of file class.SkillProfileManager.php.

449 : array
450 {
451 global $DIC;
452
453 $usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
454
455 return $usage_manager->getUsageInfoGeneric(
456 $a_cskill_ids,
458 "skl_profile_level",
459 "profile_id",
460 "base_skill_id"
461 );
462 }

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

◆ lookupRefId()

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

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

202 : int
203 {
204 $ref_id = $this->profile_repo->lookup($profile_id, "ref_id");
205 return (int) $ref_id;
206 }

◆ lookupTitle()

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

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

196 : string
197 {
198 $title = $this->profile_repo->lookup($profile_id, "title");
199 return $title;
200 }

◆ removeRoleFromAllProfiles()

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

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

407 : void
408 {
409 $this->profile_role_repo->removeRoleFromAllProfiles($role_id);
410 }

◆ removeRoleFromProfile()

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

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

402 : void
403 {
404 $this->profile_role_repo->removeRoleFromProfile($profile_id, $role_id);
405 }

◆ 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 309 of file class.SkillProfileManager.php.

309 : void
310 {
311 $this->profile_user_repo->removeUserFromAllProfiles($user_id);
312 }

References $user_id.

◆ removeUserFromProfile()

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

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

304 : void
305 {
306 $this->profile_user_repo->removeUserFromProfile($profile_id, $user_id);
307 }

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 211 of file class.SkillProfileManager.php.

211 : void
212 {
213 $this->profile_repo->updateRefIdAfterImport($profile_id, $new_ref_id);
214 }

◆ 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 $this->profile_levels_repo->updateSkillOrder($profile_id, $order);
152 }

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: