3 declare(strict_types=1);
51 $this->
user = $DIC->user();
53 if (is_null($bsc_skl_lvl_db_rep)) {
54 $this->bsc_skl_lvl_db_rep = $DIC->skills()->internal()->repo()->getLevelRepo();
59 if (is_null($bsc_skl_usr_lvl_db_rep)) {
60 $this->bsc_skl_usr_lvl_db_rep = $DIC->skills()->internal()->repo()->getUserLevelRepo();
65 if (is_null($bsc_skl_tre_rep)) {
66 $this->bsc_skl_tre_rep = $DIC->skills()->internal()->repo()->getTreeRepo();
78 public function read(): void
99 $skill->setType($this->
getType());
105 if (
sizeof($levels)) {
106 foreach ($levels as $item) {
107 $skill->addLevel($item[
"title"], $item[
"description"]);
121 public function addLevel(
string $a_title,
string $a_description,
string $a_import_id =
""): void
123 $skill_id = $this->
getId();
124 $this->bsc_skl_lvl_db_rep->addLevel($skill_id, $a_title, $a_description, $a_import_id);
129 $skill_id = $this->
getId();
131 return $this->bsc_skl_lvl_db_rep->getLevelData($skill_id, $a_id);
138 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
140 return $repository->lookupLevelTitle($a_id);
147 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
149 return $repository->lookupLevelDescription($a_id);
156 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
158 return $repository->lookupLevelSkillId($a_id);
165 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
166 $repository->writeLevelTitle($a_id, $a_title);
173 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
174 $repository->writeLevelDescription($a_id, $a_description);
180 $this->bsc_skl_lvl_db_rep->updateLevelOrder($order);
185 $this->bsc_skl_lvl_db_rep->deleteLevel($a_id);
190 $skill_id = $this->
getId();
191 $this->bsc_skl_lvl_db_rep->fixLevelNumbering($skill_id);
209 int $a_trigger_ref_id = 0,
210 bool $a_self_eval =
false 214 $ilDB = $DIC->database();
217 throw new ilSkillException(
"resetUserSkillLevelStatus currently only provided for self evaluations.");
221 $trigger_obj_id = ($a_trigger_ref_id > 0)
222 ? $obj_adapter->getObjIdForRefId($a_trigger_ref_id)
227 $status_date = $repository->hasRecentSelfEvaluation($a_user_id, $a_skill_id, $a_tref_id, $a_trigger_ref_id);
228 if ($status_date !=
"") {
232 $repository->resetUserSkillLevelStatus(
248 int $a_trigger_ref_id = 0
252 $ilDB = $DIC->database();
255 $trigger_obj_id = ($a_trigger_ref_id > 0)
256 ? $obj_adapter->getObjIdForRefId($a_trigger_ref_id)
260 return $repository->hasRecentSelfEvaluation(
271 string $a_timestamp_to = null,
277 $ilDB = $DIC->database();
281 return $repository->getNewAchievementsPerUser($a_timestamp, $a_timestamp_to, $a_user_id, $a_self_eval);
287 int $a_trigger_ref_id,
290 bool $a_force =
false,
291 bool $a_self_eval =
false,
292 string $a_unique_identifier =
"",
293 float $a_next_level_fulfilment = 0.0,
294 string $trigger_user_id =
"" 298 $ilDB = $DIC->database();
301 $trigger_ref_id = $a_trigger_ref_id;
303 $trigger_obj_id = $obj_adapter->getObjIdForRefId($trigger_ref_id);
304 $trigger_title = $obj_adapter->getTitleForObjId($trigger_obj_id);
305 $trigger_type = $obj_adapter->getTypeForObjId($trigger_obj_id);
311 if ($a_self_eval && self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id)) {
312 $status_date = self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id);
313 if ($status_date !=
"") {
319 if (!($a_next_level_fulfilment >= 0) || !($a_next_level_fulfilment < 1)) {
320 throw new \UnexpectedValueException(
321 "Next level fulfilment must be equal to or greater than 0 and less than 1, '" .
322 $a_next_level_fulfilment .
"' given." 327 $repository->writeUserSkillLevelStatus(
339 $a_unique_identifier,
340 $a_next_level_fulfilment,
347 int $a_trigger_obj_id,
348 bool $a_self_eval =
false,
349 string $a_unique_identifier =
"" 353 $ilDB = $DIC->database();
355 if ($a_trigger_obj_id == 0) {
360 return $repository->removeAllUserSkillLevelStatusOfObject(
372 $ilDB = $DIC->database();
375 $repository->removeAllUserData($a_user_id);
384 if ($a_user_id == 0) {
385 $a_user_id = $this->
user->getId();
387 $skill_id = $this->
getId();
390 return $this->bsc_skl_usr_lvl_db_rep->getMaxLevelPerType(
406 if ($a_user_id == 0) {
407 $a_user_id = $this->
user->getId();
409 $skill_id = $this->
getId();
411 return $this->bsc_skl_usr_lvl_db_rep->getNextLevelFulfilmentPerType(
425 if ($a_user_id == 0) {
426 $a_user_id = $this->
user->getId();
428 $skill_id = $this->
getId();
430 return $this->bsc_skl_usr_lvl_db_rep->getAllLevelEntriesOfUser($skill_id, $a_tref_id, $a_user_id, $a_self_eval);
438 if ($a_user_id == 0) {
439 $a_user_id = $this->
user->getId();
441 $skill_id = $this->
getId();
443 return $this->bsc_skl_usr_lvl_db_rep->getAllHistoricLevelEntriesOfUser(
457 if ($a_user_id == 0) {
458 $a_user_id = $this->
user->getId();
460 $skill_id = $this->
getId();
463 return $this->bsc_skl_usr_lvl_db_rep->getMaxLevelPerObject(
479 if ($a_user_id == 0) {
480 $a_user_id = $this->
user->getId();
482 $skill_id = $this->
getId();
484 return $this->bsc_skl_usr_lvl_db_rep->getNextLevelFulfilmentPerObject(
498 if ($a_user_id == 0) {
499 $a_user_id = $this->
user->getId();
501 $skill_id = $this->
getId();
504 return $this->bsc_skl_usr_lvl_db_rep->getMaxLevel($skill_id, $levels, $a_tref_id, $a_user_id, $a_self_eval);
512 if ($a_user_id == 0) {
513 $a_user_id = $this->
user->getId();
515 $skill_id = $this->
getId();
517 return $this->bsc_skl_usr_lvl_db_rep->getNextLevelFulfilment($skill_id, $a_tref_id, $a_user_id, $a_self_eval);
527 $ilDB = $DIC->database();
531 return $repository->hasSelfEvaluated($a_user_id, $a_skill_id, $a_tref_id);
540 if ($a_user_id == 0) {
541 $a_user_id = $this->
user->getId();
543 $skill_id = $this->
getId();
545 return $this->bsc_skl_usr_lvl_db_rep->getLastLevelPerObject(
560 if ($a_user_id == 0) {
561 $a_user_id = $this->
user->getId();
563 $skill_id = $this->
getId();
565 return $this->bsc_skl_usr_lvl_db_rep->getLastUpdatePerObject(
597 $usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
599 return $usage_manager->getUsageInfoGeneric(
601 Usage\SkillUsageManager::USER_ASSIGNED,
602 "skl_user_skill_level",
608 int $a_source_inst_id,
609 int $a_skill_import_id,
610 int $a_tref_import_id = 0
614 if ($a_source_inst_id == 0) {
618 $repository = $DIC->skills()->internal()->repo()->getTreeRepo();
619 return $repository->getCommonSkillIdForImportId(
630 $repository = $DIC->skills()->internal()->repo()->getTreeRepo();
632 return $repository->getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
636 int $a_source_inst_id,
637 int $a_level_import_id,
638 int $a_skill_import_id,
639 int $a_tref_import_id = 0
641 $level_id_data = self::getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
642 $skill_data = self::getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id);
644 foreach ($level_id_data as $l) {
646 foreach ($skill_data as $s) {
649 "level_id" => $l[
"level_id"],
650 "creation_date" => $l[
"creation_date"],
651 "skill_id" => $s[
"skill_id"],
652 "tref_id" => $s[
"tref_id"]
getShortTitleForCertificate()
static writeLevelTitle(int $a_id, string $a_title)
getAllHistoricLevelEntriesOfUser(int $a_tref_id, int $a_user_id=0, int $a_eval_by=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAllLevelEntriesOfUser(int $a_tref_id, int $a_user_id=0, int $a_self_eval=0)
__construct(int $a_id=0, ilSkillLevelRepository $bsc_skl_lvl_db_rep=null, ilSkillUserLevelRepository $bsc_skl_usr_lvl_db_rep=null, ilSkillTreeRepository $bsc_skl_tre_rep=null)
getLastLevelPerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
static lookupLevelSkillId(int $a_id)
getMaxLevelPerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static removeAllUserSkillLevelStatusOfObject(int $a_user_id, int $a_trigger_obj_id, bool $a_self_eval=false, string $a_unique_identifier="")
static lookupLevelTitle(int $a_id)
ilSkillUserLevelRepository $bsc_skl_usr_lvl_db_rep
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getCommonSkillIdForImportId(int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
static writeLevelDescription(int $a_id, string $a_description)
updateLevelOrder(array $order)
static hasSelfEvaluated(int $a_user_id, int $a_skill_id, int $a_tref_id)
addLevel(string $a_title, string $a_description, string $a_import_id="")
ilSkillLevelRepository $bsc_skl_lvl_db_rep
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNewAchievementsPerUser(string $a_timestamp, string $a_timestamp_to=null, int $a_user_id=0, int $a_self_eval=0)
read()
Read data from database.
static writeUserSkillLevelStatus(int $a_level_id, int $a_user_id, int $a_trigger_ref_id, int $a_tref_id=0, int $a_status=ilBasicSkill::ACHIEVED, bool $a_force=false, bool $a_self_eval=false, string $a_unique_identifier="", float $a_next_level_fulfilment=0.0, string $trigger_user_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLevelData(int $a_id=0)
ilSkillTreeRepository $bsc_skl_tre_rep
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static removeAllUserData(int $a_user_id)
static hasRecentSelfEvaluation(int $a_user_id, int $a_skill_id, int $a_tref_id=0, int $a_trigger_ref_id=0)
getMaxLevel(int $a_tref_id, int $a_user_id=0, int $a_self_eval=0)
getNextLevelFulfilmentPerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
getMaxLevelPerType(int $a_tref_id, string $a_type, int $a_user_id=0, int $a_self_eval=0)
static lookupLevelDescription(int $a_id)
static getLevelIdForImportIdMatchSkill(int $a_source_inst_id, int $a_level_import_id, int $a_skill_import_id, int $a_tref_import_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsageInfo(array $a_cskill_ids)
getNextLevelFulfilmentPerType(int $a_tref_id, string $a_type, int $a_user_id=0, int $a_self_eval=0)
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
getLastUpdatePerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
getSkillForLevelId(int $a_level_id)
static resetUserSkillLevelStatus(int $a_user_id, int $a_skill_id, int $a_tref_id=0, int $a_trigger_ref_id=0, bool $a_self_eval=false)
getNextLevelFulfilment(int $a_tref_id, int $a_user_id=0, int $a_self_eval=0)