19 declare(strict_types=1);
50 $this->
user = $DIC->user();
52 if (is_null($bsc_skl_lvl_db_rep)) {
53 $this->bsc_skl_lvl_db_rep = $DIC->skills()->internal()->repo()->getLevelRepo();
58 if (is_null($bsc_skl_usr_lvl_db_rep)) {
59 $this->bsc_skl_usr_lvl_db_rep = $DIC->skills()->internal()->repo()->getUserLevelRepo();
64 if (is_null($bsc_skl_tre_rep)) {
65 $this->bsc_skl_tre_rep = $DIC->skills()->internal()->repo()->getTreeRepo();
77 public function read(): void
98 $skill->setType($this->
getType());
104 if (
sizeof($levels)) {
105 foreach ($levels as $item) {
106 $skill->addLevel($item[
"title"], $item[
"description"]);
120 public function addLevel(
string $a_title,
string $a_description,
string $a_import_id =
""): void
122 $skill_id = $this->
getId();
123 $this->bsc_skl_lvl_db_rep->addLevel($skill_id, $a_title, $a_description, $a_import_id);
128 $skill_id = $this->
getId();
130 return $this->bsc_skl_lvl_db_rep->getLevelData($skill_id, $a_id);
137 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
139 return $repository->lookupLevelTitle($a_id);
146 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
148 return $repository->lookupLevelDescription($a_id);
155 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
157 return $repository->lookupLevelSkillId($a_id);
164 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
165 $repository->writeLevelTitle($a_id, $a_title);
172 $repository = $DIC->skills()->internal()->repo()->getLevelRepo();
173 $repository->writeLevelDescription($a_id, $a_description);
179 $this->bsc_skl_lvl_db_rep->updateLevelOrder($order);
184 $this->bsc_skl_lvl_db_rep->deleteLevel($a_id);
189 $skill_id = $this->
getId();
190 $this->bsc_skl_lvl_db_rep->fixLevelNumbering($skill_id);
208 int $a_trigger_ref_id = 0,
209 bool $a_self_eval =
false 213 $ilDB = $DIC->database();
216 throw new ilSkillException(
"resetUserSkillLevelStatus currently only provided for self evaluations.");
220 $trigger_obj_id = ($a_trigger_ref_id > 0)
221 ? $obj_adapter->getObjIdForRefId($a_trigger_ref_id)
226 $status_date = $repository->hasRecentSelfEvaluation($a_user_id, $a_skill_id, $a_tref_id, $a_trigger_ref_id);
227 if ($status_date !=
"") {
231 $repository->resetUserSkillLevelStatus(
247 int $a_trigger_ref_id = 0
251 $ilDB = $DIC->database();
254 $trigger_obj_id = ($a_trigger_ref_id > 0)
255 ? $obj_adapter->getObjIdForRefId($a_trigger_ref_id)
259 return $repository->hasRecentSelfEvaluation(
270 ?
string $a_timestamp_to =
null,
276 $ilDB = $DIC->database();
280 return $repository->getNewAchievementsPerUser($a_timestamp, $a_timestamp_to, $a_user_id, $a_self_eval);
286 int $a_trigger_ref_id,
289 bool $a_force =
false,
290 bool $a_self_eval =
false,
291 string $a_unique_identifier =
"",
292 float $a_next_level_fulfilment = 0.0,
293 string $trigger_user_id =
"" 297 $ilDB = $DIC->database();
300 $trigger_ref_id = $a_trigger_ref_id;
302 $trigger_obj_id = $obj_adapter->getObjIdForRefId($trigger_ref_id);
303 $trigger_title = $obj_adapter->getTitleForObjId($trigger_obj_id);
304 $trigger_type = $obj_adapter->getTypeForObjId($trigger_obj_id);
310 if ($a_self_eval && self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id)) {
311 $status_date = self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id);
312 if ($status_date !=
"") {
318 if (!($a_next_level_fulfilment >= 0) || !($a_next_level_fulfilment < 1)) {
319 throw new \UnexpectedValueException(
320 "Next level fulfilment must be equal to or greater than 0 and less than 1, '" .
321 $a_next_level_fulfilment .
"' given." 326 $repository->writeUserSkillLevelStatus(
338 $a_unique_identifier,
339 $a_next_level_fulfilment,
346 int $a_trigger_obj_id,
347 bool $a_self_eval =
false,
348 string $a_unique_identifier =
"" 352 $ilDB = $DIC->database();
354 if ($a_trigger_obj_id == 0) {
359 return $repository->removeAllUserSkillLevelStatusOfObject(
371 $ilDB = $DIC->database();
374 $repository->removeAllUserData($a_user_id);
383 if ($a_user_id == 0) {
384 $a_user_id = $this->
user->getId();
386 $skill_id = $this->
getId();
389 return $this->bsc_skl_usr_lvl_db_rep->getMaxLevelPerType(
405 if ($a_user_id == 0) {
406 $a_user_id = $this->
user->getId();
408 $skill_id = $this->
getId();
410 return $this->bsc_skl_usr_lvl_db_rep->getNextLevelFulfilmentPerType(
424 if ($a_user_id == 0) {
425 $a_user_id = $this->
user->getId();
427 $skill_id = $this->
getId();
429 return $this->bsc_skl_usr_lvl_db_rep->getAllLevelEntriesOfUser($skill_id, $a_tref_id, $a_user_id, $a_self_eval);
437 if ($a_user_id == 0) {
438 $a_user_id = $this->
user->getId();
440 $skill_id = $this->
getId();
442 return $this->bsc_skl_usr_lvl_db_rep->getAllHistoricLevelEntriesOfUser(
456 if ($a_user_id == 0) {
457 $a_user_id = $this->
user->getId();
459 $skill_id = $this->
getId();
462 return $this->bsc_skl_usr_lvl_db_rep->getMaxLevelPerObject(
478 if ($a_user_id == 0) {
479 $a_user_id = $this->
user->getId();
481 $skill_id = $this->
getId();
483 return $this->bsc_skl_usr_lvl_db_rep->getNextLevelFulfilmentPerObject(
497 if ($a_user_id == 0) {
498 $a_user_id = $this->
user->getId();
500 $skill_id = $this->
getId();
503 return $this->bsc_skl_usr_lvl_db_rep->getMaxLevel($skill_id, $levels, $a_tref_id, $a_user_id, $a_self_eval);
511 if ($a_user_id == 0) {
512 $a_user_id = $this->
user->getId();
514 $skill_id = $this->
getId();
516 return $this->bsc_skl_usr_lvl_db_rep->getNextLevelFulfilment($skill_id, $a_tref_id, $a_user_id, $a_self_eval);
526 $ilDB = $DIC->database();
530 return $repository->hasSelfEvaluated($a_user_id, $a_skill_id, $a_tref_id);
539 if ($a_user_id == 0) {
540 $a_user_id = $this->
user->getId();
542 $skill_id = $this->
getId();
544 return $this->bsc_skl_usr_lvl_db_rep->getLastLevelPerObject(
559 if ($a_user_id == 0) {
560 $a_user_id = $this->
user->getId();
562 $skill_id = $this->
getId();
564 return $this->bsc_skl_usr_lvl_db_rep->getLastUpdatePerObject(
596 $usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
598 return $usage_manager->getUsageInfoGeneric(
600 Usage\SkillUsageManager::USER_ASSIGNED,
601 "skl_user_skill_level",
607 int $a_source_inst_id,
608 int $a_skill_import_id,
609 int $a_tref_import_id = 0
613 if ($a_source_inst_id == 0) {
617 $repository = $DIC->skills()->internal()->repo()->getTreeRepo();
618 return $repository->getCommonSkillIdForImportId(
629 $repository = $DIC->skills()->internal()->repo()->getTreeRepo();
631 return $repository->getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
635 int $a_source_inst_id,
636 int $a_level_import_id,
637 int $a_skill_import_id,
638 int $a_tref_import_id = 0
640 $level_id_data = self::getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
641 $skill_data = self::getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id);
643 foreach ($level_id_data as $l) {
645 foreach ($skill_data as $s) {
648 "level_id" => $l[
"level_id"],
649 "creation_date" => $l[
"creation_date"],
650 "skill_id" => $s[
"skill_id"],
651 "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)
Interface ilSkillLevelRepository.
getAllLevelEntriesOfUser(int $a_tref_id, int $a_user_id=0, int $a_self_eval=0)
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)
Class ilBasicSkillObjectAdapter.
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
Interface ilSkillUserLevelRepository.
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addLevel(string $a_title, string $a_description, string $a_import_id="")
__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)
ilSkillLevelRepository $bsc_skl_lvl_db_rep
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="")
getLevelData(int $a_id=0)
ilSkillTreeRepository $bsc_skl_tre_rep
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)
__construct(Container $dic, ilPlugin $plugin)
A node in the skill tree.
static getUsageInfo(array $a_cskill_ids)
static getNewAchievementsPerUser(string $a_timestamp, ?string $a_timestamp_to=null, int $a_user_id=0, int $a_self_eval=0)
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)