ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Skill\Profile\SkillProfileManager Class Reference
+ Inheritance diagram for ILIAS\Skill\Profile\SkillProfileManager:
+ Collaboration diagram for ILIAS\Skill\Profile\SkillProfileManager:

Public Member Functions

 __construct (\ILIAS\Skill\Profile\SkillProfileDBRepository $profile_repo=null, \ILIAS\Skill\Profile\SkillProfileLevelsDBRepository $profile_levels_repo=null, \ILIAS\Skill\Profile\SkillProfileUserDBRepository $profile_user_repo=null, \ILIAS\Skill\Profile\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...
 

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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().

43  {
44  global $DIC;
45 
46  $this->profile_repo = ($profile_repo) ?: $DIC->skills()->internal()->repo()->getProfileRepo();
47  $this->profile_levels_repo = ($profile_levels_repo) ?: $DIC->skills()->internal()->repo()->getProfileLevelsRepo();
48  $this->profile_user_repo = ($profile_user_repo) ?: $DIC->skills()->internal()->repo()->getProfileUserRepo();
49  $this->profile_role_repo = ($profile_role_repo) ?: $DIC->skills()->internal()->repo()->getProfileRoleRepo();
50  $this->rbac_review = $DIC->rbac()->review();
51  $this->lng = $DIC->language();
52  }
SkillProfileLevelsDBRepository $profile_levels_repo
global $DIC
Definition: feed.php:28
+ 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 405 of file class.SkillProfileManager.php.

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

◆ addSkillLevel()

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

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

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

◆ addUserToProfile()

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

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

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

◆ countRoles()

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

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

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

◆ countUsers()

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

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

References ILIAS\Skill\Profile\SkillProfileManager\$lng, $r, ILIAS\Skill\Profile\SkillProfileManager\$rbac_review, ilObjRole\_getTranslation(), ilObject\_hasUntrashedReference(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), ilObject\_lookupType(), and ILIAS\Repository\int().

357  : int
358  {
359  $count = $this->profile_user_repo->countUsers($profile_id);
360  return $count;
361  }
+ Here is the call graph for this function:

◆ createProfile()

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

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

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

◆ delete()

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

◆ deleteProfile()

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

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

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

86  : void
87  {
88  $this->profile_repo->deleteProfile($profile_id);
89  }
+ Here is the caller graph for this function:

◆ deleteProfileLevels()

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

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

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

91  : void
92  {
93  $this->profile_levels_repo->deleteAllForProfile($profile_id);
94  }
+ 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 96 of file class.SkillProfileManager.php.

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

◆ deleteProfileRoles()

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

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

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

106  : void
107  {
108  $this->profile_role_repo->deleteProfileRoles($profile_id);
109  }
+ Here is the caller graph for this function:

◆ deleteProfilesFromObject()

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

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

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

◆ deleteProfileUsers()

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

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

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

101  : void
102  {
103  $this->profile_user_repo->deleteProfileUsers($profile_id);
104  }
+ Here is the caller graph for this function:

◆ fixSkillOrderNumbering()

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

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

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

◆ getAllGlobalProfiles()

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

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

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

◆ getAllProfilesOfRole()

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

Get global and local profiles of a role.

Returns
SkillRoleProfile[]

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

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

◆ getAssignedUserIdsIncludingRoleAssignments()

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

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

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

◆ getAssignedUsersForRole()

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

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

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

◆ getAssignments()

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

Get all assignments (users and roles)

Returns
SkillProfileAssignmentInterface[]

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

References ILIAS\Skill\Profile\SkillProfileManager\$lng, ilUserUtil\getNamePresentation(), and ILIAS\Repository\int().

238  : array
239  {
240  $assignments = [];
241 
242  $users = $this->getUserAssignments($profile_id);
243  $roles = $this->getRoleAssignments($profile_id);
244  $assignments = array_merge($users, $roles);
245 
246  return $assignments;
247  }
+ Here is the call graph for this function:

◆ getGlobalProfilesOfRole()

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

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

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

433  : array
434  {
435  $profiles = $this->profile_role_repo->getGlobalProfilesOfRole($role_id);
436  return $profiles;
437  }
+ Here is the caller graph for this function:

◆ getLocalProfilesForObject()

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

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

198  : array
199  {
200  $profiles = $this->profile_repo->getLocalProfilesForObject($ref_id);
201  return $profiles;
202  }
$ref_id
Definition: ltiauth.php:67

◆ getLocalProfilesOfRole()

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

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

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

◆ getMaxLevelOrderNr()

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

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

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

◆ getProfile()

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

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

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

◆ getProfilesForAllSkillTrees()

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

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

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

◆ getProfilesForSkillTree()

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

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

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

◆ getSkillLevel()

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

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

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

◆ getSkillLevels()

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

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

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

119  : array
120  {
121  $levels = $this->profile_levels_repo->getAll($profile_id);
122  usort($levels, static function (SkillProfileLevel $level_a, SkillProfileLevel $level_b): int {
123  return $level_a->getOrderNr() <=> $level_b->getOrderNr();
124  });
125 
126  return $levels;
127  }
+ Here is the call graph for this function:

◆ getTreeId()

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

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

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

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

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

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

◆ lookupRefId()

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

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

References $ref_id.

210  : int
211  {
212  $ref_id = $this->profile_repo->lookup($profile_id, "ref_id");
213  return (int) $ref_id;
214  }
$ref_id
Definition: ltiauth.php:67

◆ lookupTitle()

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

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

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

◆ removeRoleFromAllProfiles()

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

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

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

◆ removeRoleFromProfile()

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

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

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

◆ removeSkillLevel()

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

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

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

◆ removeUserFromAllProfiles()

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

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

References ILIAS\Skill\Profile\SkillProfileManager\getGlobalProfilesOfRole().

317  : void
318  {
319  $this->profile_user_repo->removeUserFromAllProfiles($user_id);
320  }
+ Here is the call graph for this function:

◆ removeUserFromProfile()

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

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

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

◆ updateProfile()

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

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

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

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

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

◆ updateSkillLevel()

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

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

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

◆ updateSkillOrder()

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

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

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

Field Documentation

◆ $lng

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

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

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