19 declare(strict_types=1);
48 ?: $DIC->skills()->internal()->repo()->getProfileCompletionRepo();
49 $this->tree_service = $DIC->repositoryTree();
50 $this->obj_definition = $DIC[
"objDefinition"];
60 string $gap_mode =
"",
61 string $gap_mode_type =
"",
62 int $gap_mode_obj_id = 0,
63 string $trigger_user =
"" 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") {
73 $sub_objects = $this->tree_service->getSubTree(
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) {
87 $max = $bs->getMaxLevelPerObject($sk->getTrefId(), $gap_mode_obj_id,
$user_id, 0, $trigger_user);
90 $max = $bs->getMaxLevel($sk->getTrefId(),
$user_id);
92 $actual_levels[$sk->getBaseSkillId()][$sk->getTrefId()] = $max;
95 return $actual_levels;
110 foreach ($skills as $sk) {
111 $bs = new \ilBasicSkill($sk->getBaseSkillId());
112 $last = $bs->getLastLevelEntryOfUser(
119 $last_levels[$sk->getBaseSkillId()][$sk->getTrefId()] = $last;
127 string $gap_mode =
"",
128 string $gap_mode_type =
"",
129 int $gap_mode_obj_id = 0
142 string $gap_mode =
"",
143 string $gap_mode_type =
"",
144 int $gap_mode_obj_id = 0
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);
155 $perc = $bs->getNextLevelFulfilment($sk->getTrefId(),
$user_id);
157 $fuls[$sk->getBaseSkillId()][$sk->getTrefId()] = $perc;
168 $profile_levels = $this->profile_manager->getSkillLevels($profile_id);
173 foreach ($profile_levels as $level) {
174 if (isset($actual_levels[$level->getBaseSkillId()][$level->getTrefId()]) &&
175 $actual_levels[$level->getBaseSkillId()][$level->getTrefId()] >= $level->getLevelId()) {
180 if ($profile_count == 0) {
183 $progress = $achieved_count / $profile_count * 100;
185 return (
int) $progress;
205 $user_profiles = $this->profile_manager->getProfilesOfUser($user_id);
207 foreach ($user_profiles as $p) {
209 $profile_comps[$p->getId()] =
true;
211 $profile_comps[$p->getId()] =
false;
215 return $profile_comps;
224 return $this->profile_completion_repo->getEntries($user_id, $profile_id);
233 return $this->profile_completion_repo->getFulfilledEntriesForUser($user_id);
242 return $this->profile_completion_repo->getAllEntriesForUser($user_id);
251 return $this->profile_completion_repo->getAllEntriesForProfile($profile_id);
260 foreach ($completions as $profile_id => $fulfilled) {
262 $this->profile_completion_repo->addFulfilmentEntry($user_id, $profile_id);
264 $this->profile_completion_repo->addNonFulfilmentEntry($user_id, $profile_id);
275 $this->profile_completion_repo->addFulfilmentEntry($user_id, $profile_id);
277 $this->profile_completion_repo->addNonFulfilmentEntry($user_id, $profile_id);
286 $users = $this->profile_manager->getAssignedUserIdsIncludingRoleAssignments($profile_id);
297 $r_users = $this->profile_manager->getAssignedUsersForRole($role_id);
308 $this->profile_completion_repo->deleteEntriesForProfile($profile_id);
316 $this->profile_completion_repo->deleteEntriesForUser($user_id);
writeCompletionEntryForAllAssignedUsersOfProfile(int $profile_id)
Write completion entries for a profile for all assigned users of the given profile.
getProfileProgress(int $user_id, int $profile_id)
Get progress in percent for a profile.
getActualNextLevelFulfilments(int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0)
getActualLastLevels(int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0)
deleteEntriesForProfile(int $profile_id)
Delete all profile completion entries for a profile.
SkillProfileManager $profile_manager
static getSupportedObjectTypes()
static _getAllReferences(int $id)
get all reference ids for object ID
getEntries(int $user_id, int $profile_id)
Get profile completion entries for given user-profile-combination.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
deleteEntriesForUser(int $user_id)
Delete all profile completion entries for a user.
getAllEntriesForUser(int $user_id)
Get all profile completion entries for a user.
getAllEntriesForProfile(int $profile_id)
Get all completion entries for a single profile.
Repository for skill profile completion.
getActualMaxLevels(int $user_id, array $skills, string $gap_mode="", string $gap_mode_type="", int $gap_mode_obj_id=0, string $trigger_user="")
static _lookupObjectId(int $ref_id)
getFulfilledEntriesForUser(int $user_id)
Get all fulfilled profile completion entries for a user.
writeCompletionEntryForAllProfilesOfUser(int $user_id)
Write profile completion entries (fulfilled or non-fulfilled) of user for all profiles.
__construct(SkillProfileManager $profile_manager, ?SkillProfileCompletionDBRepository $profile_completion_repo=null)
getAllProfileCompletionsForUser(int $user_id)
Get all profiles of user which are fulfilled or non-fulfilled.
isProfileFulfilled(int $user_id, int $profile_id)
Check if a profile is fulfilled (progress = 100%)
ilObjectDefinition $obj_definition
SkillProfileCompletionDBRepository $profile_completion_repo
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...
writeCompletionEntryForRole(int $role_id, int $profile_id)
Write completion entries for a profile for assigned users of a role.
Manages skill profile completion.
writeCompletionEntryForSingleProfileOfUser(int $user_id, int $profile_id)
Write profile completion entry (fulfilled or non-fulfilled) of user for given profile.
static _lookupType(int $id, bool $reference=false)