56        $this->db = 
$DIC->database();
 
   57        $this->
user = $DIC->user();
 
   60            $this->bsc_skl_lvl_db_rep = 
$DIC->skills()->internal()->repo()->getLevelRepo();
 
   67            $this->bsc_skl_usr_lvl_db_rep = 
$DIC->skills()->internal()->repo()->getUserLevelRepo();
 
   74            $this->bsc_skl_tre_rep = 
$DIC->skills()->internal()->repo()->getTreeRepo();
 
  103    public function delete()
 
  105        $skill_id = $this->
getId();
 
  106        $this->bsc_skl_lvl_db_rep->deleteLevelsOfSkill($skill_id);
 
  107        $this->bsc_skl_usr_lvl_db_rep->deleteUserLevelsOfSkill($skill_id);
 
  118        $skill->setTitle($this->
getTitle());
 
  120        $skill->setType($this->
getType());
 
  126        if (
sizeof($levels)) {
 
  127            foreach ($levels as $item) {
 
  128                $skill->addLevel($item[
"title"], $item[
"description"]);
 
  142    public function addLevel(
string $a_title, 
string $a_description, 
string $a_import_id = 
"")
 
  144        $skill_id = $this->
getId();
 
  145        $this->bsc_skl_lvl_db_rep->addLevel($skill_id, $a_title, $a_description, $a_import_id);
 
  150        $skill_id = $this->
getId();
 
  152        return $this->bsc_skl_lvl_db_rep->getLevelData($skill_id, $a_id);
 
  163        return $repository->lookupLevelTitle($a_id);
 
  174        return $repository->lookupLevelDescription($a_id);
 
  185        return $repository->lookupLevelSkillId($a_id);
 
  195        $repository->writeLevelTitle($a_id, $a_title);
 
  205        $repository->writeLevelDescription($a_id, $a_description);
 
  211        $this->bsc_skl_lvl_db_rep->updateLevelOrder($order);
 
  216        $this->bsc_skl_lvl_db_rep->deleteLevel($a_id);
 
  221        $skill_id = $this->
getId();
 
  222        $this->bsc_skl_lvl_db_rep->fixLevelNumbering($skill_id);
 
  227        return $this->bsc_skl_lvl_db_rep->getSkillForLevelId($a_level_id);
 
  240        int $a_trigger_ref_id = 0,
 
  241        bool $a_self_eval = 
false 
  248            throw new ilSkillException(
"resetUserSkillLevelStatus currently only provided for self evaluations.");
 
  252        $trigger_obj_id = ($a_trigger_ref_id > 0)
 
  253            ? $obj_adapter->getObjIdForRefId($a_trigger_ref_id)
 
  258        $status_date = $repository->hasRecentSelfEvaluation($a_user_id, $a_skill_id, $a_tref_id, $a_trigger_ref_id);
 
  259        if ($status_date != 
"") {
 
  263        $repository->resetUserSkillLevelStatus($update, $trigger_obj_id, $status_date, $a_user_id, $a_skill_id,
 
  264            $a_tref_id, $a_trigger_ref_id, $a_self_eval);
 
  271        int $a_trigger_ref_id = 0
 
  278        $trigger_obj_id = ($a_trigger_ref_id > 0)
 
  279            ? $obj_adapter->getObjIdForRefId($a_trigger_ref_id)
 
  283        return $repository->hasRecentSelfEvaluation($trigger_obj_id, $a_user_id, $a_skill_id, $a_tref_id,
 
  289        string $a_timestamp_to = 
null,
 
  299        return $repository->getNewAchievementsPerUser($a_timestamp, $a_timestamp_to, $a_user_id, $a_self_eval);
 
  305        int $a_trigger_ref_id,
 
  308        bool $a_force = 
false,
 
  309        bool $a_self_eval = 
false,
 
  310        string $a_unique_identifier = 
"",
 
  311        float $a_next_level_fulfilment = 0.0
 
  318        $trigger_ref_id = $a_trigger_ref_id;
 
  320        $trigger_obj_id = $obj_adapter->getObjIdForRefId($trigger_ref_id);
 
  321        $trigger_title = $obj_adapter->getTitleForObjId($trigger_obj_id);
 
  322        $trigger_type = $obj_adapter->getTypeForObjId($trigger_obj_id);
 
  327        if ($a_self_eval && self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id)) {
 
  328            $status_date = self::hasRecentSelfEvaluation($a_user_id, $skill_id, $a_tref_id, $trigger_ref_id);
 
  329            if ($status_date != 
"") {
 
  335        if (!($a_next_level_fulfilment >= 0) || !($a_next_level_fulfilment < 1)) {
 
  336            throw new \UnexpectedValueException(
 
  337                "Next level fulfilment must be equal to or greater than 0 and less than 1, '" .
 
  338                $a_next_level_fulfilment . 
"' given." 
  343        $repository->writeUserSkillLevelStatus($skill_id, $trigger_ref_id, $trigger_obj_id, $trigger_title,
 
  344            $trigger_type, $update, $status_date, $a_level_id, $a_user_id, $a_tref_id, $a_self_eval,
 
  345            $a_unique_identifier, $a_next_level_fulfilment);
 
  350        int $a_trigger_obj_id,
 
  351        bool $a_self_eval = 
false,
 
  352        string $a_unique_identifier = 
"" 
  358        if ($a_trigger_obj_id == 0) {
 
  363        return $repository->removeAllUserSkillLevelStatusOfObject($a_user_id, $a_trigger_obj_id, $a_self_eval,
 
  364            $a_unique_identifier);
 
  374        $repository->removeAllUserData($a_user_id);
 
  383        if ($a_user_id == 0) {
 
  384            $a_user_id = $this->
user->getId();
 
  386        $skill_id = $this->getId();
 
  387        $levels = $this->getLevelData();
 
  389        return $this->bsc_skl_usr_lvl_db_rep->getMaxLevelPerType($skill_id, $levels, $a_tref_id, $a_type, $a_user_id,
 
  398        if ($a_user_id == 0) {
 
  399            $a_user_id = $this->
user->getId();
 
  401        $skill_id = $this->getId();
 
  403        return $this->bsc_skl_usr_lvl_db_rep->getAllLevelEntriesOfUser($skill_id, $a_tref_id, $a_user_id, $a_self_eval);
 
  411        if ($a_user_id == 0) {
 
  412            $a_user_id = $this->
user->getId();
 
  414        $skill_id = $this->getId();
 
  416        return $this->bsc_skl_usr_lvl_db_rep->getAllHistoricLevelEntriesOfUser($skill_id, $a_tref_id, $a_user_id,
 
  426        if ($a_user_id == 0) {
 
  427            $a_user_id = $this->
user->getId();
 
  429        $skill_id = $this->getId();
 
  430        $levels = $this->getLevelData();
 
  432        return $this->bsc_skl_usr_lvl_db_rep->getMaxLevelPerObject($skill_id, $levels, $a_tref_id, $a_object_id,
 
  433            $a_user_id, $a_self_eval);
 
  441        if ($a_user_id == 0) {
 
  442            $a_user_id = $this->
user->getId();
 
  444        $skill_id = $this->getId();
 
  445        $levels = $this->getLevelData();
 
  447        return $this->bsc_skl_usr_lvl_db_rep->getMaxLevel($skill_id, $levels, $a_tref_id, $a_user_id, $a_self_eval);
 
  461        return $repository->hasSelfEvaluated($a_user_id, $a_skill_id, $a_tref_id);
 
  470        if ($a_user_id == 0) {
 
  471            $a_user_id = $this->
user->getId();
 
  473        $skill_id = $this->getId();
 
  475        return $this->bsc_skl_usr_lvl_db_rep->getLastLevelPerObject($skill_id, $a_tref_id, $a_object_id, $a_user_id,
 
  485        if ($a_user_id == 0) {
 
  486            $a_user_id = $this->
user->getId();
 
  488        $skill_id = $this->getId();
 
  490        return $this->bsc_skl_usr_lvl_db_rep->getLastUpdatePerObject($skill_id, $a_tref_id, $a_object_id, $a_user_id,
 
  506        return $this->getTitle();
 
  527            ((int) $a_skill_id) . 
"/" . ((int) $a_skill_level_id) . 
"/certificate.xml";
 
  528        if (@file_exists($certificatefile)) {
 
  546            "skl_user_skill_level",
 
  552        int $a_source_inst_id,
 
  553        int $a_skill_import_id,
 
  554        int $a_tref_import_id = 0
 
  562        if ($a_source_inst_id == 0) {
 
  567        return $repository->getCommonSkillIdForImportId($tree, $a_source_inst_id, $a_skill_import_id,
 
  579        return $repository->getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
 
  591        int $a_source_inst_id,
 
  592        int $a_level_import_id,
 
  593        int $a_skill_import_id,
 
  594        int $a_tref_import_id = 0
 
  596        $level_id_data = self::getLevelIdForImportId($a_source_inst_id, $a_level_import_id);
 
  597        $skill_data = self::getCommonSkillIdForImportId($a_source_inst_id, $a_skill_import_id, $a_tref_import_id);
 
  599        foreach ($level_id_data as $l) {
 
  601            foreach ($skill_data as $s) {
 
  604                        "level_id" => $l[
"level_id"],
 
  605                        "creation_date" => $l[
"creation_date"],
 
  606                        "skill_id" => $s[
"skill_id"],
 
  607                        "tref_id" => $s[
"tref_id"]
 
An exception for terminatinating execution or to throw for unit testing.
Class ilBasicSkillLevelDBRepository.
updateLevelOrder(array $order)
static removeAllUserSkillLevelStatusOfObject(int $a_user_id, int $a_trigger_obj_id, bool $a_self_eval=false, string $a_unique_identifier="")
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)
static lookupLevelSkillId(int $a_id)
getAllLevelEntriesOfUser(int $a_tref_id, int $a_user_id=0, int $a_self_eval=0)
static getNewAchievementsPerUser(string $a_timestamp, string $a_timestamp_to=null, int $a_user_id=0, int $a_self_eval=0)
static getLevelIdForImportIdMatchSkill(int $a_source_inst_id, int $a_level_import_id, int $a_skill_import_id, int $a_tref_import_id=0)
Get level ids for import Ids matching common skills.
getMaxLevel(int $a_tref_id, int $a_user_id=0, int $a_self_eval=0)
static _lookupCertificate(int $a_skill_id, int $a_skill_level_id)
Checks whether a skill level has a certificate or not.
static getCommonSkillIdForImportId(int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
static lookupLevelTitle(int $a_id)
static getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
read()
Read data from database.
static lookupLevelDescription(int $a_id)
getTitleForCertificate()
Get title for certificate.
getLevelData(int $a_id=0)
__construct(int $a_id=0, ilBasicSkillLevelRepository $bsc_skl_lvl_db_rep=null, ilBasicSkillUserLevelRepository $bsc_skl_usr_lvl_db_rep=null, ilBasicSkillTreeRepository $bsc_skl_tre_rep=null)
ilBasicSkill constructor.
static getUsageInfo($a_cskill_ids, &$a_usages)
Get usage info.
static hasRecentSelfEvaluation(int $a_user_id, int $a_skill_id, int $a_tref_id=0, int $a_trigger_ref_id=0)
getLastLevelPerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
getLastUpdatePerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
static removeAllUserData(int $a_user_id)
getAllHistoricLevelEntriesOfUser(int $a_tref_id, int $a_user_id=0, int $a_eval_by=0)
getShortTitleForCertificate()
Get short title for certificate.
static writeLevelDescription(int $a_id, string $a_description)
getSkillForLevelId(int $a_level_id)
static writeLevelTitle(int $a_id, string $a_title)
getMaxLevelPerObject(int $a_tref_id, int $a_object_id, int $a_user_id=0, int $a_self_eval=0)
addLevel(string $a_title, string $a_description, string $a_import_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)
getMaxLevelPerType(int $a_tref_id, string $a_type, int $a_user_id=0, int $a_self_eval=0)
static hasSelfEvaluated(int $a_user_id, int $a_skill_id, int $a_tref_id)
Class ilBasicSkillObjectAdapter.
A node in the skill tree.
getDescription()
Get description.
setType($a_type)
Set type.
getOrderNr()
Get order nr.
getSelfEvaluation()
Get self evaluation.
static getUsageInfoGeneric( $a_cskill_ids, &$a_usages, $a_usage_type, $a_table, $a_key_field, $a_skill_field="skill_id", $a_tref_field="tref_id")
Get standard usage query.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Interface ilBasicSkillLevelRepository.
Interface ilBasicSkillTreeRepository.
Interface ilBasicSkillUserLevelRepository.
Get info on usages of skills.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc