ILIAS  release_8 Revision v8.23
ILIAS\Skill\Profile\SkillProfileManager Class Reference
+ 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)
 
 getById (int $profile_id)
 
 createProfile (SkillProfile $profile)
 
 updateProfile (SkillProfile $profile)
 
 delete (int $profile_id)
 
 deleteProfilesFromObject (int $ref_id)
 
 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...
 
 getAssignedUsers (int $profile_id)
 
 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)
 
 getProfilesOfUser (int $user_id)
 
 countUsers (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)
 Get global and local profiles of a role. More...
 
 getGlobalProfilesOfRole (int $role_id)
 
 getLocalProfilesOfRole (int $role_id, int $ref_id)
 
 countRoles (int $profile_id)
 

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
 

Detailed Description

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

Definition at line 25 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 33 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, and ILIAS\Skill\Profile\SkillProfileManager\$profile_user_repo.

38  {
39  global $DIC;
40 
41  $this->profile_repo = ($profile_repo) ?: $DIC->skills()->internal()->repo()->getProfileRepo();
42  $this->profile_levels_repo = ($profile_levels_repo) ?: $DIC->skills()->internal()->repo()->getProfileLevelsRepo();
43  $this->profile_user_repo = ($profile_user_repo) ?: $DIC->skills()->internal()->repo()->getProfileUserRepo();
44  $this->profile_role_repo = ($profile_role_repo) ?: $DIC->skills()->internal()->repo()->getProfileRoleRepo();
45  $this->rbac_review = $DIC->rbac()->review();
46  }
SkillProfileLevelsDBRepository $profile_levels_repo
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ addRoleToProfile()

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

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

288  : void
289  {
290  $this->profile_role_repo->addRoleToProfile($profile_id, $role_id);
291  }

◆ addUserToProfile()

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

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

229  : void
230  {
231  $this->profile_user_repo->addUserToProfile($profile_id, $user_id);
232  }

◆ countRoles()

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

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

328  : int
329  {
330  $count = $this->profile_role_repo->countRoles($profile_id);
331  return $count;
332  }

◆ countUsers()

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

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

276  : int
277  {
278  $count = $this->profile_user_repo->countUsers($profile_id);
279  return $count;
280  }

◆ createProfile()

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

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

56  : SkillProfile
57  {
58  // profile
59  $new_profile = $this->profile_repo->createProfile($profile);
60 
61  // profile levels
62  $this->profile_levels_repo->createProfileLevels($new_profile->getId(), $new_profile->getSkillLevels());
63 
64  return $new_profile;
65  }

◆ 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->deleteProfileLevels($profile_id);
94  }
+ Here is the caller graph for this function:

◆ deleteProfileRoles()

ILIAS\Skill\Profile\SkillProfileManager::deleteProfileRoles ( 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_role_repo->deleteProfileRoles($profile_id);
104  }
+ Here is the caller graph for this function:

◆ deleteProfilesFromObject()

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

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

106  : void
107  {
108  $this->profile_repo->deleteProfilesFromObject($ref_id);
109  }
$ref_id
Definition: ltiauth.php:67

◆ deleteProfileUsers()

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

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

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

96  : void
97  {
98  $this->profile_user_repo->deleteProfileUsers($profile_id);
99  }
+ Here is the caller graph for this function:

◆ fixSkillOrderNumbering()

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

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

118  : void
119  {
120  $this->profile_levels_repo->fixSkillOrderNumbering($profile_id);
121  }

◆ getAllGlobalProfiles()

ILIAS\Skill\Profile\SkillProfileManager::getAllGlobalProfiles ( )

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

141  : array
142  {
143  $profiles = $this->profile_repo->getAllGlobalProfiles();
144  return $profiles;
145  }

◆ getAllProfilesOfRole()

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

Get global and local profiles of a role.

Returns
array{id: int, title: string, description: string, image_id: string}[]

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

307  : array
308  {
309  $profiles = $this->profile_role_repo->getAllProfilesOfRole($role_id);
310  return $profiles;
311  }

◆ getAssignedRoles()

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

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

Referenced by ILIAS\Skill\Profile\SkillProfileManager\getAssignedUserIdsIncludingRoleAssignments(), and ILIAS\Skill\Profile\SkillProfileManager\getAssignments().

282  : array
283  {
284  $roles = $this->profile_role_repo->getAssignedRoles($profile_id);
285  return $roles;
286  }
+ Here is the caller graph for this function:

◆ getAssignedUserIdsIncludingRoleAssignments()

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

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

References ILIAS\Skill\Profile\SkillProfileManager\getAssignedRoles(), and ILIAS\Skill\Profile\SkillProfileManager\getAssignedUsers().

208  : array
209  {
210  $all = [];
211  $users = $this->getAssignedUsers($profile_id);
212  foreach ($users as $user) {
213  $all[] = $user["id"];
214  }
215 
216  $roles = $this->getAssignedRoles($profile_id);
217  foreach ($roles as $role) {
218  $role_users = $this->rbac_review->assignedUsers($role["id"]);
219  foreach ($role_users as $user_id) {
220  if (!in_array($user_id, $all)) {
221  $all[] = $user_id;
222  }
223  }
224  }
225 
226  return $all;
227  }
+ Here is the call graph for this function:

◆ getAssignedUsers()

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

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

Referenced by ILIAS\Skill\Profile\SkillProfileManager\getAssignedUserIdsIncludingRoleAssignments(), and ILIAS\Skill\Profile\SkillProfileManager\getAssignments().

197  : array
198  {
199  $users = $this->profile_user_repo->getAssignedUsers($profile_id);
200  return $users;
201  }
+ Here is the caller graph for this function:

◆ getAssignedUsersForRole()

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

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

203  : array
204  {
205  return $this->rbac_review->assignedUsers($role_id);
206  }

◆ getAssignments()

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

Get all assignments (users and roles)

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

References ILIAS\Skill\Profile\SkillProfileManager\getAssignedRoles(), and ILIAS\Skill\Profile\SkillProfileManager\getAssignedUsers().

186  : array
187  {
188  $assignments = [];
189 
190  $users = $this->getAssignedUsers($profile_id);
191  $roles = $this->getAssignedRoles($profile_id);
192  $assignments = array_merge($users, $roles);
193 
194  return $assignments;
195  }
+ Here is the call graph for this function:

◆ getById()

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

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

51  : SkillProfile
52  {
53  return $this->profile_repo->getById($profile_id);
54  }

◆ getGlobalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileManager::getGlobalProfilesOfRole ( int  $role_id)
Returns
array{id: int, title: string, description: string, image_id: string}[]

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

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

316  : array
317  {
318  $profiles = $this->profile_role_repo->getGlobalProfilesOfRole($role_id);
319  return $profiles;
320  }
+ Here is the caller graph for this function:

◆ getLocalProfilesForObject()

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

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

147  : array
148  {
149  $profiles = $this->profile_repo->getLocalProfilesForObject($ref_id);
150  return $profiles;
151  }
$ref_id
Definition: ltiauth.php:67

◆ getLocalProfilesOfRole()

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

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

322  : array
323  {
324  $profiles = $this->profile_role_repo->getLocalProfilesOfRole($role_id, $ref_id);
325  return $profiles;
326  }
$ref_id
Definition: ltiauth.php:67

◆ getMaxLevelOrderNr()

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

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

123  : int
124  {
125  $max = $this->profile_levels_repo->getMaxLevelOrderNr($profile_id);
126  return $max;
127  }

◆ getProfilesForAllSkillTrees()

ILIAS\Skill\Profile\SkillProfileManager::getProfilesForAllSkillTrees ( )

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

129  : array
130  {
131  $profiles = $this->profile_repo->getProfilesForAllSkillTrees();
132  return $profiles;
133  }

◆ getProfilesForSkillTree()

ILIAS\Skill\Profile\SkillProfileManager::getProfilesForSkillTree ( int  $skill_tree_id)

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

135  : array
136  {
137  $profiles = $this->profile_repo->getProfilesForSkillTree($skill_tree_id);
138  return $profiles;
139  }

◆ getProfilesOfUser()

ILIAS\Skill\Profile\SkillProfileManager::getProfilesOfUser ( int  $user_id)
Returns
array{id: int, title: string, description: string, image_id: string}[]

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

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

247  : array
248  {
249  $all_profiles = [];
250 
251  // competence profiles coming from user assignments
252  $user_profiles = $this->profile_user_repo->getProfilesOfUser($user_id);
253 
254  // competence profiles coming from role assignments
255  $role_profiles = [];
256  $user_roles = $this->rbac_review->assignedRoles($user_id);
257  foreach ($user_roles as $role) {
258  $profiles = $this->getGlobalProfilesOfRole($role);
259  foreach ($profiles as $profile) {
260  $role_profiles[] = $profile;
261  }
262  }
263 
264  // merge competence profiles and remove multiple occurrences
265  $all_profiles = array_merge($user_profiles, $role_profiles);
266  $temp_profiles = [];
267  foreach ($all_profiles as $v) {
268  if (!isset($temp_profiles[$v["id"]])) {
269  $temp_profiles[$v["id"]] = $v;
270  }
271  }
272  $all_profiles = array_values($temp_profiles);
273  return $all_profiles;
274  }
+ Here is the call graph for this function:

◆ getTreeId()

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

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

173  : int
174  {
175  $tree_id = $this->profile_repo->getTreeId($profile_id);
176  return $tree_id;
177  }

◆ lookupRefId()

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

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

References $ref_id.

159  : int
160  {
161  $ref_id = $this->profile_repo->lookup($profile_id, "ref_id");
162  return (int) $ref_id;
163  }
$ref_id
Definition: ltiauth.php:67

◆ lookupTitle()

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

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

153  : string
154  {
155  $title = $this->profile_repo->lookup($profile_id, "title");
156  return $title;
157  }

◆ removeRoleFromAllProfiles()

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

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

298  : void
299  {
300  $this->profile_role_repo->removeRoleFromAllProfiles($role_id);
301  }

◆ removeRoleFromProfile()

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

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

293  : void
294  {
295  $this->profile_role_repo->removeRoleFromProfile($profile_id, $role_id);
296  }

◆ removeUserFromAllProfiles()

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

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

239  : void
240  {
241  $this->profile_user_repo->removeUserFromAllProfiles($user_id);
242  }

◆ removeUserFromProfile()

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

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

234  : void
235  {
236  $this->profile_user_repo->removeUserFromProfile($profile_id, $user_id);
237  }

◆ updateProfile()

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

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

References ILIAS\Skill\Profile\SkillProfile\getId(), and ILIAS\Skill\Profile\SkillProfile\getSkillLevels().

67  : SkillProfile
68  {
69  // profile
70  $updated_profile = $this->profile_repo->updateProfile($profile);
71 
72  // profile levels
73  $this->profile_levels_repo->updateProfileLevels($profile->getId(), $profile->getSkillLevels());
74 
75  return $updated_profile;
76  }
+ Here is the call graph for this function:

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

168  : void
169  {
170  $this->profile_repo->updateRefIdAfterImport($profile_id, $new_ref_id);
171  }

◆ updateSkillOrder()

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

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

111  : void
112  {
113  asort($order);
114 
115  $this->profile_levels_repo->updateSkillOrder($profile_id, $order);
116  }

Field Documentation

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


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