ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Skill\Profile\SkillProfileCompletionManager Class Reference

Manages skill profile completion. More...

+ Collaboration diagram for ILIAS\Skill\Profile\SkillProfileCompletionManager:

Public Member Functions

 __construct (SkillProfileManager $profile_manager, ?SkillProfileCompletionDBRepository $profile_completion_repo=null)
 
 getActualMaxLevels (int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0, string $trigger_user="")
 
 getLastLevelPerObjectAndTriggerUser (int $user_id, array $skills, int $obj_id, string $trigger_user)
 This does not include any container logic currently only used for survey, individual assessment. More...
 
 getActualLastLevels (int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0)
 
 getActualNextLevelFulfilments (int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0)
 
 getProfileProgress (int $user_id, int $profile_id)
 Get progress in percent for a profile. More...
 
 isProfileFulfilled (int $user_id, int $profile_id)
 Check if a profile is fulfilled (progress = 100%) More...
 
 getAllProfileCompletionsForUser (int $user_id)
 Get all profiles of user which are fulfilled or non-fulfilled. More...
 
 getEntries (int $user_id, int $profile_id)
 Get profile completion entries for given user-profile-combination. More...
 
 getFulfilledEntriesForUser (int $user_id)
 Get all fulfilled profile completion entries for a user. More...
 
 getAllEntriesForUser (int $user_id)
 Get all profile completion entries for a user. More...
 
 getAllEntriesForProfile (int $profile_id)
 Get all completion entries for a single profile. More...
 
 writeCompletionEntryForAllProfilesOfUser (int $user_id)
 Write profile completion entries (fulfilled or non-fulfilled) of user for all profiles. More...
 
 writeCompletionEntryForSingleProfileOfUser (int $user_id, int $profile_id)
 Write profile completion entry (fulfilled or non-fulfilled) of user for given profile. More...
 
 writeCompletionEntryForAllAssignedUsersOfProfile (int $profile_id)
 Write completion entries for a profile for all assigned users of the given profile. More...
 
 writeCompletionEntryForRole (int $role_id, int $profile_id)
 Write completion entries for a profile for assigned users of a role. More...
 
 deleteEntriesForProfile (int $profile_id)
 Delete all profile completion entries for a profile. More...
 
 deleteEntriesForUser (int $user_id)
 Delete all profile completion entries for a user. More...
 

Protected Attributes

SkillProfileManager $profile_manager
 
SkillProfileCompletionDBRepository $profile_completion_repo
 
ilTree $tree_service
 
ilObjectDefinition $obj_definition
 

Detailed Description

Manages skill profile completion.

(business logic)

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

Definition at line 33 of file class.SkillProfileCompletionManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Profile\SkillProfileCompletionManager::__construct ( SkillProfileManager  $profile_manager,
?SkillProfileCompletionDBRepository  $profile_completion_repo = null 
)

Definition at line 40 of file class.SkillProfileCompletionManager.php.

43 {
44 global $DIC;
45
46 $this->profile_manager = $profile_manager;
47 $this->profile_completion_repo = ($profile_completion_repo)
48 ?: $DIC->skills()->internal()->repo()->getProfileCompletionRepo();
49 $this->tree_service = $DIC->repositoryTree();
50 $this->obj_definition = $DIC["objDefinition"];
51 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Skill\Profile\SkillProfileCompletionManager\$profile_completion_repo, and ILIAS\Skill\Profile\SkillProfileCompletionManager\$profile_manager.

Member Function Documentation

◆ deleteEntriesForProfile()

ILIAS\Skill\Profile\SkillProfileCompletionManager::deleteEntriesForProfile ( int  $profile_id)

Delete all profile completion entries for a profile.

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

306 : void
307 {
308 $this->profile_completion_repo->deleteEntriesForProfile($profile_id);
309 }

◆ deleteEntriesForUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::deleteEntriesForUser ( int  $user_id)

Delete all profile completion entries for a user.

Definition at line 314 of file class.SkillProfileCompletionManager.php.

314 : void
315 {
316 $this->profile_completion_repo->deleteEntriesForUser($user_id);
317 }

References $user_id.

◆ getActualLastLevels()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getActualLastLevels ( int  $user_id,
array  $skills,
string  $gap_mode = "",
string  $gap_mode_type = "",
int  $gap_mode_obj_id = 0 
)

Definition at line 124 of file class.SkillProfileCompletionManager.php.

130 : array {
131 // todo for coming feature
132 return [];
133 }

◆ getActualMaxLevels()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getActualMaxLevels ( int  $user_id,
array  $skills,
string  $gap_mode = "",
string  $gap_mode_type = "",
int  $gap_mode_obj_id = 0,
string  $trigger_user = "" 
)
Parameters
GapAnalysisSkill[]$skills
Returns
array<int, array<int, int>>

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

64 : array {
65 // get actual levels for gap analysis
66 $actual_levels = [];
67 foreach ($skills as $sk) {
68 $bs = new \ilBasicSkill($sk->getBaseSkillId());
69 if ($gap_mode == "max_per_type") {
70 $max = $bs->getMaxLevelPerType($sk->getTrefId(), $gap_mode_type, $user_id);
71 } elseif ($gap_mode == "max_per_object") {
72 if ($this->obj_definition->isContainer(\ilObject::_lookupType($gap_mode_obj_id))) {
73 $sub_objects = $this->tree_service->getSubTree(
74 $this->tree_service->getNodeData((int) current(\ilObject::_getAllReferences($gap_mode_obj_id))),
75 false,
77 );
78 $max = 0;
79 foreach ($sub_objects as $ref_id) {
81 $max_tmp = $bs->getMaxLevelPerObject($sk->getTrefId(), $obj_id, $user_id, 0, $trigger_user);
82 if ($max_tmp > $max) {
83 $max = $max_tmp;
84 }
85 }
86 } else {
87 $max = $bs->getMaxLevelPerObject($sk->getTrefId(), $gap_mode_obj_id, $user_id, 0, $trigger_user);
88 }
89 } else {
90 $max = $bs->getMaxLevel($sk->getTrefId(), $user_id);
91 }
92 $actual_levels[$sk->getBaseSkillId()][$sk->getTrefId()] = $max;
93 }
94
95 return $actual_levels;
96 }
static getSupportedObjectTypes()
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:66

References $ref_id, $user_id, ilObject\_getAllReferences(), ilObject\_lookupObjectId(), ilObject\_lookupType(), and ilObjectLP\getSupportedObjectTypes().

+ Here is the call graph for this function:

◆ getActualNextLevelFulfilments()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getActualNextLevelFulfilments ( int  $user_id,
array  $skills,
string  $gap_mode = "",
string  $gap_mode_type = "",
int  $gap_mode_obj_id = 0 
)
Parameters
GapAnalysisSkill[]$skills
Returns
array<int, array<int, float>>

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

145 : array {
146 // get actual next level fulfilments for gap analysis
147 $fuls = [];
148 foreach ($skills as $sk) {
149 $bs = new \ilBasicSkill($sk->getBaseSkillId());
150 if ($gap_mode == "max_per_type") {
151 $perc = $bs->getNextLevelFulfilmentPerType($sk->getTrefId(), $gap_mode_type, $user_id);
152 } elseif ($gap_mode == "max_per_object") {
153 $perc = $bs->getNextLevelFulfilmentPerObject($sk->getTrefId(), $gap_mode_obj_id, $user_id);
154 } else {
155 $perc = $bs->getNextLevelFulfilment($sk->getTrefId(), $user_id);
156 }
157 $fuls[$sk->getBaseSkillId()][$sk->getTrefId()] = $perc;
158 }
159
160 return $fuls;
161 }

References $user_id.

◆ getAllEntriesForProfile()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getAllEntriesForProfile ( int  $profile_id)

Get all completion entries for a single profile.

Returns
SkillProfileCompletion[]

Definition at line 249 of file class.SkillProfileCompletionManager.php.

249 : array
250 {
251 return $this->profile_completion_repo->getAllEntriesForProfile($profile_id);
252 }

◆ getAllEntriesForUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getAllEntriesForUser ( int  $user_id)

Get all profile completion entries for a user.

Returns
SkillProfileCompletion[]

Definition at line 240 of file class.SkillProfileCompletionManager.php.

240 : array
241 {
242 return $this->profile_completion_repo->getAllEntriesForUser($user_id);
243 }

References $user_id.

◆ getAllProfileCompletionsForUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getAllProfileCompletionsForUser ( int  $user_id)

Get all profiles of user which are fulfilled or non-fulfilled.

Returns
array<int, bool>

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

203 : array
204 {
205 $user_profiles = $this->profile_manager->getProfilesOfUser($user_id);
206 $profile_comps = [];
207 foreach ($user_profiles as $p) {
208 if ($this->isProfileFulfilled($user_id, $p->getId())) {
209 $profile_comps[$p->getId()] = true;
210 } else {
211 $profile_comps[$p->getId()] = false;
212 }
213 }
214
215 return $profile_comps;
216 }
isProfileFulfilled(int $user_id, int $profile_id)
Check if a profile is fulfilled (progress = 100%)

References $user_id.

◆ getEntries()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getEntries ( int  $user_id,
int  $profile_id 
)

Get profile completion entries for given user-profile-combination.

Returns
SkillProfileCompletion[]

Definition at line 222 of file class.SkillProfileCompletionManager.php.

222 : array
223 {
224 return $this->profile_completion_repo->getEntries($user_id, $profile_id);
225 }

References $user_id.

◆ getFulfilledEntriesForUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getFulfilledEntriesForUser ( int  $user_id)

Get all fulfilled profile completion entries for a user.

Returns
SkillProfileCompletion[]

Definition at line 231 of file class.SkillProfileCompletionManager.php.

231 : array
232 {
233 return $this->profile_completion_repo->getFulfilledEntriesForUser($user_id);
234 }

References $user_id.

◆ getLastLevelPerObjectAndTriggerUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getLastLevelPerObjectAndTriggerUser ( int  $user_id,
array  $skills,
int  $obj_id,
string  $trigger_user 
)

This does not include any container logic currently only used for survey, individual assessment.

Definition at line 102 of file class.SkillProfileCompletionManager.php.

107 : array {
108 // get actual levels for gap analysis
109 $last_levels = [];
110 foreach ($skills as $sk) {
111 $bs = new \ilBasicSkill($sk->getBaseSkillId());
112 $last = $bs->getLastLevelEntryOfUser(
113 $sk->getTrefId(),
114 $user_id,
115 $obj_id,
116 0,
117 $trigger_user
118 );
119 $last_levels[$sk->getBaseSkillId()][$sk->getTrefId()] = $last;
120 }
121 return $last_levels;
122 }

References $user_id.

◆ getProfileProgress()

ILIAS\Skill\Profile\SkillProfileCompletionManager::getProfileProgress ( int  $user_id,
int  $profile_id 
)

Get progress in percent for a profile.

Definition at line 166 of file class.SkillProfileCompletionManager.php.

166 : int
167 {
168 $profile_levels = $this->profile_manager->getSkillLevels($profile_id);
169 $actual_levels = $this->getActualMaxLevels($user_id, $profile_levels);
170
171 $profile_count = 0;
172 $achieved_count = 0;
173 foreach ($profile_levels as $level) {
174 if (isset($actual_levels[$level->getBaseSkillId()][$level->getTrefId()]) &&
175 $actual_levels[$level->getBaseSkillId()][$level->getTrefId()] >= $level->getLevelId()) {
176 $achieved_count++;
177 }
178 $profile_count++;
179 }
180 if ($profile_count == 0) {
181 return 0;
182 }
183 $progress = $achieved_count / $profile_count * 100;
184
185 return (int) $progress;
186 }
getActualMaxLevels(int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0, string $trigger_user="")

References $user_id.

◆ isProfileFulfilled()

ILIAS\Skill\Profile\SkillProfileCompletionManager::isProfileFulfilled ( int  $user_id,
int  $profile_id 
)

Check if a profile is fulfilled (progress = 100%)

Definition at line 191 of file class.SkillProfileCompletionManager.php.

191 : bool
192 {
193 if ($this->getProfileProgress($user_id, $profile_id) == 100) {
194 return true;
195 }
196 return false;
197 }
getProfileProgress(int $user_id, int $profile_id)
Get progress in percent for a profile.

References $user_id.

◆ writeCompletionEntryForAllAssignedUsersOfProfile()

ILIAS\Skill\Profile\SkillProfileCompletionManager::writeCompletionEntryForAllAssignedUsersOfProfile ( int  $profile_id)

Write completion entries for a profile for all assigned users of the given profile.

Definition at line 284 of file class.SkillProfileCompletionManager.php.

284 : void
285 {
286 $users = $this->profile_manager->getAssignedUserIdsIncludingRoleAssignments($profile_id);
287 foreach ($users as $user_id) {
288 $this->writeCompletionEntryForSingleProfileOfUser($user_id, $profile_id);
289 }
290 }
writeCompletionEntryForSingleProfileOfUser(int $user_id, int $profile_id)
Write profile completion entry (fulfilled or non-fulfilled) of user for given profile.

References $user_id.

◆ writeCompletionEntryForAllProfilesOfUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::writeCompletionEntryForAllProfilesOfUser ( int  $user_id)

Write profile completion entries (fulfilled or non-fulfilled) of user for all profiles.

Definition at line 257 of file class.SkillProfileCompletionManager.php.

257 : void
258 {
259 $completions = $this->getAllProfileCompletionsForUser($user_id);
260 foreach ($completions as $profile_id => $fulfilled) {
261 if ($fulfilled) {
262 $this->profile_completion_repo->addFulfilmentEntry($user_id, $profile_id);
263 } else {
264 $this->profile_completion_repo->addNonFulfilmentEntry($user_id, $profile_id);
265 }
266 }
267 }
getAllProfileCompletionsForUser(int $user_id)
Get all profiles of user which are fulfilled or non-fulfilled.

References $user_id.

◆ writeCompletionEntryForRole()

ILIAS\Skill\Profile\SkillProfileCompletionManager::writeCompletionEntryForRole ( int  $role_id,
int  $profile_id 
)

Write completion entries for a profile for assigned users of a role.

Definition at line 295 of file class.SkillProfileCompletionManager.php.

295 : void
296 {
297 $r_users = $this->profile_manager->getAssignedUsersForRole($role_id);
298 foreach ($r_users as $user_id) {
299 $this->writeCompletionEntryForSingleProfileOfUser($user_id, $profile_id);
300 }
301 }

References $user_id.

◆ writeCompletionEntryForSingleProfileOfUser()

ILIAS\Skill\Profile\SkillProfileCompletionManager::writeCompletionEntryForSingleProfileOfUser ( int  $user_id,
int  $profile_id 
)

Write profile completion entry (fulfilled or non-fulfilled) of user for given profile.

Definition at line 272 of file class.SkillProfileCompletionManager.php.

272 : void
273 {
274 if ($this->isProfileFulfilled($user_id, $profile_id)) {
275 $this->profile_completion_repo->addFulfilmentEntry($user_id, $profile_id);
276 } else {
277 $this->profile_completion_repo->addNonFulfilmentEntry($user_id, $profile_id);
278 }
279 }

References $user_id.

Field Documentation

◆ $obj_definition

ilObjectDefinition ILIAS\Skill\Profile\SkillProfileCompletionManager::$obj_definition
protected

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

◆ $profile_completion_repo

SkillProfileCompletionDBRepository ILIAS\Skill\Profile\SkillProfileCompletionManager::$profile_completion_repo
protected

◆ $profile_manager

SkillProfileManager ILIAS\Skill\Profile\SkillProfileCompletionManager::$profile_manager
protected

◆ $tree_service

ilTree ILIAS\Skill\Profile\SkillProfileCompletionManager::$tree_service
protected

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


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