/**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $ilCtrl->setParameter($this->parent_obj, "sk_id", $a_set["base_skill"]);
     $ilCtrl->setParameter($this->parent_obj, "tref_id", $a_set["tref_id"]);
     $this->tpl->setVariable("COMPETENCE", $a_set["title"]);
     $this->tpl->setVariable("NR_OF_QUESTIONS", $a_set["nr_of_q"]);
     $this->tpl->setVariable("MAX_SCALE_POINTS", $a_set["scale_sum"]);
     $this->tpl->setVariable("CMD", $ilCtrl->getLinkTarget($this->parent_obj, "listSkillThresholds"));
     $this->tpl->setVariable("ACTION", $lng->txt("edit"));
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     $bs = new ilBasicSkill($a_set["base_skill"]);
     $ld = $bs->getLevelData();
     foreach ($ld as $l) {
         $this->tpl->setCurrentBlock("points");
         $this->tpl->setVariable("LEV", $l["title"]);
         $tr = $this->thresholds[$l["id"]][$a_set["tref_id"]];
         if ((int) $tr != 0) {
             $this->tpl->setVariable("THRESHOLD", (int) $tr);
         } else {
             $this->tpl->setVariable("THRESHOLD", "");
         }
         $this->tpl->parseCurrentBlock();
     }
 }
 /**
  * Returns an array containing all variables and values which can be exchanged in the certificate
  * The values should be calculated from real data. The $params parameter array should contain all
  * necessary information to calculate the values.
  *
  * @param array $params An array of parameters to calculate the certificate parameter values
  * @return array The certificate variables
  */
 public function getCertificateVariablesForPresentation($params = array())
 {
     global $lng;
     $lng->loadLanguageModule('certificate');
     $user_data = $params["user_data"];
     $vars = $this->getBaseVariablesForPresentation($user_data, $params["last_access"], null);
     $vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
     $vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
     $vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
     // custom completion date
     $achievement_date = ilBasicSkill::lookupLevelAchievementDate($user_data["usr_id"], $this->skill_level_id);
     if ($achievement_date !== false) {
         $old = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($achievement_date, IL_CAL_DATETIME));
         $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($achievement_date, IL_CAL_DATETIME));
         ilDatePresentation::setUseRelativeDates($old);
     } else {
         $vars["DATE_COMPLETED"] = "";
         $vars["DATETIME_COMPLETED"] = "";
     }
     foreach ($vars as $id => $caption) {
         $insert_tags["[" . $id . "]"] = $caption;
     }
     return $insert_tags;
 }
 static function getInstance($a_id = 0)
 {
     global $ilias, $ilDB;
     $query = "SELECT * FROM skl_tree_node WHERE obj_id = " . $ilDB->quote($a_id, "integer");
     $obj_set = $ilDB->query($query);
     $obj_rec = $ilDB->fetchAssoc($obj_set);
     $obj = null;
     switch ($obj_rec["type"]) {
         case "skll":
             $obj = new ilBasicSkill();
             $obj->setId($obj_rec["obj_id"]);
             $obj->setDataRecord($obj_rec);
             $obj->read();
             break;
         case "scat":
             $obj = new ilSkillCategory();
             $obj->setId($obj_rec["obj_id"]);
             $obj->setDataRecord($obj_rec);
             $obj->read();
             break;
         case "sktp":
             $obj = new ilBasicSkillTemplate();
             $obj->setId($obj_rec["obj_id"]);
             $obj->setDataRecord($obj_rec);
             $obj->read();
             break;
         case "sctp":
             $obj = new ilSkillTemplateCategory();
             $obj->setId($obj_rec["obj_id"]);
             $obj->setDataRecord($obj_rec);
             $obj->read();
             break;
         case "skrt":
             $obj = new ilSkillRoot();
             $obj->setId($obj_rec["obj_id"]);
             $obj->setDataRecord($obj_rec);
             $obj->read();
             break;
         case "sktr":
             $obj = new ilSkillTemplateReference();
             $obj->setId($obj_rec["obj_id"]);
             $obj->setDataRecord($obj_rec);
             $obj->read();
             break;
     }
     return $obj;
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     $path = $this->tree->getSkillTreePath($a_set["base_skill_id"], $a_set["tref_id"]);
     $path_items = array();
     foreach ($path as $p) {
         if ($p["type"] != "skrt") {
             $path_items[] = $p["title"];
         }
     }
     $this->tpl->setVariable("SKILL_TITLE", implode($path_items, " > "));
     $this->tpl->setVariable("LEVEL_TITLE", ilBasicSkill::lookupLevelTitle($a_set["level_id"]));
     $this->tpl->setVariable("ID", (int) $a_set["base_skill_id"] . ":" . (int) $a_set["tref_id"] . ":" . (int) $a_set["level_id"]);
 }
 /**
  * Write skills
  *
  * @param
  * @return
  */
 function writeSkills()
 {
     global $lng, $ilCtrl;
     return;
     include_once "./Modules/Survey/classes/class.ilSurveySkill.php";
     $sskill = new ilSurveySkill($this->survey);
     $apps = $this->survey->getAppraiseesData();
     $ctpl = new ilTemplate("tpl.svy_skill_list_changes.html", true, true, "Modules/Survey");
     foreach ($apps as $app) {
         $new_levels = $sskill->determineSkillLevelsForAppraisee($app["user_id"]);
         foreach ($new_levels as $nl) {
             if ($nl["new_level_id"] > 0) {
                 ilBasicSkill::writeUserSkillLevelStatus($nl["new_level_id"], $app["user_id"], $this->survey->getRefId(), $nl["tref_id"], ilBasicSkill::ACHIEVED);
             }
         }
     }
     ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
     $ilCtrl->redirect($this, "listSkillChanges");
 }
 public function fillRow($data)
 {
     $skill = $data['skill'];
     $levels = $skill->getLevelData();
     $this->tpl->setCurrentBlock('competence');
     $this->tpl->setVariable('ROWSPAN', $this->getRowspan(count($levels)));
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     $this->tpl->setVariable('COMPETENCE', ilBasicSkill::_lookupTitle($skill->getId(), $data['skill_tref_id']));
     $this->tpl->setVariable('NUM_QUESTIONS', $data['num_assigns']);
     $this->tpl->setVariable('MAX_COMP_POINTS', $data['max_points']);
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock('tbl_content');
     for ($i = 0, $max = count($levels); $i < $max; $i++) {
         $level = $levels[$i];
         $this->tpl->setVariable('LEVEL', $level['title']);
         $this->tpl->setVariable('THRESHOLD', $this->buildThresholdInput($data['skill_base_id'], $data['skill_tref_id'], $level['id']));
         if ($i < $max - 1) {
             $this->tpl->parseCurrentBlock();
             $this->tpl->setVariable("CSS_ROW", $this->css_row);
             $this->tpl->setVariable("CSS_NO_BORDER", 'ilBorderlessRow');
         }
     }
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["id"]);
     if ($a_set["supported"]) {
         $this->tpl->setCurrentBlock("cmd");
         $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "assignSkillToQuestion"));
         $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_assign_competence"));
         $this->tpl->parseCurrentBlock();
         if ($s = $this->skill_survey->getSkillForQuestion($a_set["id"])) {
             $this->tpl->setCurrentBlock("cmd");
             $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "removeSkillFromQuestion"));
             $this->tpl->setVariable("TXT_CMD", $lng->txt("survey_remove_competence"));
             $this->tpl->parseCurrentBlock();
             include_once "./Services/Skill/classes/class.ilBasicSkill.php";
             $this->tpl->setVariable("COMPETENCE", ilBasicSkill::_lookupTitle($s["base_skill_id"]));
             //var_dump($a_set);
             $path = $this->skill_tree->getSkillTreePath($s["base_skill_id"], $s["tref_id"]);
             $path_nodes = array();
             foreach ($path as $p) {
                 if ($p["child"] > 1 && $p["child"] != $s["base_skill_id"]) {
                     $path_nodes[] = $p["title"];
                 }
             }
             $this->tpl->setVariable("PATH", implode($path_nodes, " > "));
             $this->tpl->setVariable("COMP_ID", "comp_" . $a_set["id"]);
             /*include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
             		ilTooltipGUI::addTooltip("comp_".$a_set["id"],
             			ilBasicSkill::_lookupDescription($s["base_skill_id"]));*/
         }
     } else {
         $this->tpl->setVariable("NOT_SUPPORTED", $lng->txt("svy_skl_comp_assignm_not_supported"));
     }
     $this->tpl->setVariable("QUESTION_TITLE", $a_set["title"]);
     $ilCtrl->setParameter($this->parent_obj, "q_id", "");
 }
 /**
  * Get gap analysis html
  *
  * @param
  * @return
  */
 function getGapAnalysisHTML($a_user_id = 0, $a_skills = null)
 {
     global $ilUser, $lng;
     //		$this->setTabs("list_skills");
     if ($a_user_id == 0) {
         $user_id = $ilUser->getId();
     } else {
         $user_id = $a_user_id;
     }
     $skills = array();
     if ($this->getProfileId() > 0) {
         $profile = new ilSkillProfile($this->getProfileId());
         $this->profile_levels = $profile->getSkillLevels();
         foreach ($this->profile_levels as $l) {
             $skills[] = array("base_skill_id" => $l["base_skill_id"], "tref_id" => $l["tref_id"], "level_id" => $l["level_id"]);
         }
     } else {
         if (is_array($a_skills)) {
             $skills = $a_skills;
         }
     }
     // get actual levels for gap analysis
     $this->actual_levels = array();
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     foreach ($skills as $sk) {
         $bs = new ilBasicSkill($sk["base_skill_id"]);
         if ($this->gap_mode == "max_per_type") {
             $max = $bs->getMaxLevelPerType($sk["tref_id"], $this->gap_mode_type, $user_id);
             $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
         } else {
             if ($this->gap_mode == "max_per_object") {
                 $max = $bs->getMaxLevelPerObject($sk["tref_id"], $this->gap_mode_obj_id, $user_id);
                 $this->actual_levels[$sk["base_skill_id"]][$sk["tref_id"]] = $max;
             }
         }
     }
     $incl_self_eval = false;
     if (count($this->getGapAnalysisSelfEvalLevels() > 0)) {
         $incl_self_eval = true;
         $self_vals = $this->getGapAnalysisSelfEvalLevels();
     }
     // output spider stuff
     if (count($skills) >= 3) {
         $max_cnt = 0;
         $leg_labels = array();
         //var_dump($this->profile_levels);
         //foreach ($this->profile_levels as $k => $l)
         // write target, actual and self counter to skill array
         foreach ($skills as $k => $l) {
             //$bs = new ilBasicSkill($l["base_skill_id"]);
             $bs = new ilBasicSkill($l["base_skill_id"]);
             $leg_labels[] = $bs->getTitle();
             $levels = $bs->getLevelData();
             $cnt = 0;
             foreach ($levels as $lv) {
                 $cnt++;
                 if ($l["level_id"] == $lv["id"]) {
                     $skills[$k]["target_cnt"] = $cnt;
                 }
                 if ($this->actual_levels[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"]) {
                     $skills[$k]["actual_cnt"] = $cnt;
                 }
                 if ($incl_self_eval) {
                     if ($self_vals[$l["base_skill_id"]][$l["tref_id"]] == $lv["id"]) {
                         $skills[$k]["self_cnt"] = $cnt;
                     }
                 }
                 $max_cnt = max($max_cnt, $cnt);
             }
         }
         //			$leg_labels = array("AAAAA", "BBBBB", "CCCCC");
         //var_dump($this->profile_levels);
         //var_dump($this->actual_levels);
         include_once "./Services/Chart/classes/class.ilChart.php";
         $chart = new ilChart("gap_chart", 600, 300);
         $chart->setYAxisMax($max_cnt);
         $chart->setLegLabels($leg_labels);
         // target level
         $cd = new ilChartData("spider");
         $cd->setLabel($lng->txt("skmg_target_level"));
         $cd->setFill("true", "#A0A0A0");
         // other users
         $cd2 = new ilChartData("spider");
         if ($this->gap_cat_title != "") {
             $cd2->setLabel($this->gap_cat_title);
         } else {
             if ($this->gap_mode == "max_per_type") {
                 $cd2->setLabel($lng->txt("objs_" . $this->gap_mode_type));
             } else {
                 if ($this->gap_mode == "max_per_object") {
                     $cd2->setLabel(ilObject::_lookupTitle($this->gap_mode_obj_id));
                 }
             }
         }
         $cd2->setFill("true", "#8080FF");
         // self evaluation
         if ($incl_self_eval) {
             $cd3 = new ilChartData("spider");
             $cd3->setLabel($lng->txt("skmg_self_evaluation"));
             $cd3->setFill("true", "#FF8080");
         }
         // fill in data
         $cnt = 0;
         foreach ($skills as $pl) {
             $cd->addPoint($cnt, (int) $pl["target_cnt"]);
             $cd2->addPoint($cnt, (int) $pl["actual_cnt"]);
             if ($incl_self_eval) {
                 $cd3->addPoint($cnt, (int) $pl["self_cnt"]);
             }
             $cnt++;
         }
         // add data to chart
         if ($this->getProfileId() > 0) {
             $chart->addData($cd);
         }
         $chart->addData($cd2);
         if ($incl_self_eval && count($this->getGapAnalysisSelfEvalLevels()) > 0) {
             $chart->addData($cd3);
         }
         $lg = new ilChartLegend();
         $chart->setLegend($lg);
         $chart_html = $chart->getHTML();
     }
     $stree = new ilSkillTree();
     $html = "";
     foreach ($skills as $s) {
         $path = $stree->getSkillTreePath($s["base_skill_id"]);
         // check draft
         foreach ($path as $p) {
             if ($p["draft"]) {
                 continue 2;
             }
         }
         $html .= $this->getSkillHTML($s["base_skill_id"], $user_id, false, $s["tref_id"]);
     }
     // list skills
     //		include_once("./Services/Skill/classes/class.ilPersonalSkillTableGUI.php");
     //		$sktab = new ilPersonalSkillTableGUI($this, "listSkills");
     return $chart_html . $html;
 }
 /**
  * Get trigger title for certificate
  *
  * @param
  * @return
  */
 function getTriggerTitleForCertificate($a_level_id)
 {
     die("ilBasicSkill::getTriggerTitleForCertificate is deprecated.");
     $tr = ilBasicSkill::lookupLevelTrigger($a_level_id);
     return ilObject::_lookupTitle($tr["obj_id"]);
 }
 /**
  * Get average level of user self evaluation
  *
  * Note: this method does not make much sense in general, since it
  * assumes that all basic skills have the same level
  */
 static function getAverageLevel($a_se_id, $a_user_id, $a_top_skill_id)
 {
     global $lng;
     $lng->loadLanguageModule("skmg");
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     $stree = new ilSkillTree();
     $cnt = 0;
     $sum = 0;
     if ($stree->isInTree($a_top_skill_id)) {
         $se = new ilSkillSelfEvaluation($a_se_id);
         $levels = $se->getLevels();
         $cnode = $stree->getNodeData($a_top_skill_id);
         $childs = $stree->getSubTree($cnode);
         foreach ($childs as $child) {
             if ($child["type"] == "skll") {
                 $sk = new ilBasicSkill($child["child"]);
                 $ls = $sk->getLevelData();
                 $ord = array();
                 foreach ($ls as $k => $l) {
                     $ord[$l["id"]] = $k + 1;
                 }
                 reset($ls);
                 foreach ($ls as $ld) {
                     if ($ld["id"] == $levels[$child["child"]]) {
                         $sum += $ord[$ld["id"]];
                     }
                 }
                 $cnt += 1;
             }
         }
     }
     if ($cnt > 0) {
         $avg = round($sum / $cnt);
         if ($avg > 0) {
             return array("skill_title" => $cnode["title"], "ord" => $avg, "avg_title" => $ls[$avg - 1]["title"]);
         } else {
             return array("skill_title" => $cnode["title"], "ord" => $avg, "avg_title" => $lng->txt("skmg_no_skills"));
         }
     }
     return null;
 }
 private function invokeSkillLevelTrigger($userId, $skillBaseId, $skillTrefId, $skillLevelId)
 {
     ilBasicSkill::writeUserSkillLevelStatus($skillLevelId, $userId, $this->testOBJ->getRefId(), $skillTrefId, ilBasicSkill::ACHIEVED, true);
     //mail('*****@*****.**', "trigger skill $skillBaseId:$skillTrefId level $skillLevelId for user $userId", '');
 }
 public function completeCompetenceTitles($rows)
 {
     foreach ($rows as $key => $row) {
         $rows[$key]['competence'] = ilBasicSkill::_lookupTitle($row['skill']->getId(), $row['skill_tref_id']);
     }
     return $rows;
 }
 /**
  * Render suggested resources
  *
  * @param
  * @return
  */
 function renderSuggestedResources($a_tpl, $a_levels, $a_base_skill, $a_tref_id)
 {
     global $lng;
     // use a profile
     if ($this->getProfileId() > 0) {
         $profile = new ilSkillProfile($this->getProfileId());
         $profile_levels = $profile->getSkillLevels();
         $too_low = true;
         $current_target_level = 0;
         foreach ($a_levels as $k => $v) {
             foreach ($this->profile_levels as $pl) {
                 if ($pl["level_id"] == $v["id"] && $pl["base_skill_id"] == $v["skill_id"]) {
                     $too_low = true;
                     $current_target_level = $v["id"];
                 }
             }
             if ($this->actual_levels[$v["skill_id"]][0] == $v["id"]) {
                 $too_low = false;
             }
         }
         // suggested resources
         if ($too_low) {
             include_once "./Services/Skill/classes/class.ilSkillResources.php";
             $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
             $res = $skill_res->getResources();
             $imp_resources = array();
             foreach ($res as $level) {
                 foreach ($level as $r) {
                     if ($r["imparting"] == true && $current_target_level == $r["level_id"]) {
                         $imp_resources[] = $r;
                     }
                 }
             }
             foreach ($imp_resources as $r) {
                 $ref_id = $r["rep_ref_id"];
                 $obj_id = ilObject::_lookupObjId($ref_id);
                 $title = ilObject::_lookupTitle($obj_id);
                 include_once "./Services/Link/classes/class.ilLink.php";
                 $a_tpl->setCurrentBlock("resource_item");
                 $a_tpl->setVariable("TXT_RES", $title);
                 $a_tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
                 $a_tpl->parseCurrentBlock();
             }
             if (count($imp_resources) > 0) {
                 $a_tpl->touchBlock("resources_list");
                 $a_tpl->setCurrentBlock("resources");
                 $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_res"));
                 $a_tpl->parseCurrentBlock();
             } else {
                 $a_tpl->setCurrentBlock("resources");
                 $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_needs_impr_no_res"));
                 $a_tpl->parseCurrentBlock();
             }
         } else {
             $a_tpl->setCurrentBlock("resources");
             $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_skill_no_needs_impr"));
             $a_tpl->parseCurrentBlock();
         }
     } else {
         // no profile, just list all resources
         include_once "./Services/Skill/classes/class.ilSkillResources.php";
         $skill_res = new ilSkillResources($a_base_skill, $a_tref_id);
         $res = $skill_res->getResources();
         // add $r["level_id"] info
         $any = false;
         foreach ($res as $level) {
             $available = false;
             $cl = 0;
             foreach ($level as $r) {
                 if ($r["imparting"]) {
                     $ref_id = $r["rep_ref_id"];
                     $obj_id = ilObject::_lookupObjId($ref_id);
                     $title = ilObject::_lookupTitle($obj_id);
                     include_once "./Services/Link/classes/class.ilLink.php";
                     $a_tpl->setCurrentBlock("resource_item");
                     $a_tpl->setVariable("TXT_RES", $title);
                     $a_tpl->setVariable("HREF_RES", ilLink::_getLink($ref_id));
                     $a_tpl->parseCurrentBlock();
                     $available = true;
                     $any = true;
                     $cl = $r["level_id"];
                 }
             }
             if ($available) {
                 $a_tpl->setCurrentBlock("resources_list_level");
                 $a_tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level"));
                 $a_tpl->setVariable("LEVEL_NAME", ilBasicSkill::lookupLevelTitle($cl));
                 $a_tpl->parseCurrentBlock();
                 $a_tpl->touchBlock("resources_list");
             }
         }
         if ($any) {
             $a_tpl->setCurrentBlock("resources");
             $a_tpl->setVariable("SUGGESTED_MAT_MESS", $lng->txt("skmg_suggested_resources"));
             $a_tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * Write appraisee skills
  *
  * @param
  * @return
  */
 function writeAppraiseeSkills($a_app_id)
 {
     // write raters evaluation
     $new_levels = $this->determineSkillLevelsForAppraisee($a_app_id);
     foreach ($new_levels as $nl) {
         if ($nl["new_level_id"] > 0) {
             ilBasicSkill::writeUserSkillLevelStatus($nl["new_level_id"], $a_app_id, $this->survey->getRefId(), $nl["tref_id"], ilBasicSkill::ACHIEVED, true);
         }
     }
     // patch optes start
     // write self evaluation,
     /*
     		$new_levels = $this->determineSkillLevelsForAppraisee($a_app_id, true);
     		foreach ($new_levels as $nl)
     		{
     			if ($nl["new_level_id"] > 0)
     			{
     				ilBasicSkill::writeUserSkillLevelStatus($nl["new_level_id"],
     					$a_app_id, $this->survey->getRefId(), $nl["tref_id"], ilBasicSkill::ACHIEVED, true, 1);
     			}
     		}*/
     // patch optes end
 }
 /**
  * Constructor
  * @access	public
  */
 function __construct($a_id = 0)
 {
     parent::ilSkillTreeNode($a_id);
     $this->setType("sktp");
 }
 /**
  * Get self evaluation
  *
  * @param int $a_user_id user id
  * @param int $a_top_skill the "selectable" top skill
  * @param int $a_tref_id template reference id
  * @param int $a_basic_skill the basic skill the level belongs to
  * @return int level id
  */
 static function getSelfEvaluationDate($a_user_id, $a_top_skill, $a_tref_id, $a_basic_skill)
 {
     global $ilDB;
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     $bs = new ilBasicSkill($a_basic_skill);
     return $bs->getLastUpdatePerObject($a_tref_id, 0, $a_user_id, 1);
     $set = $ilDB->query("SELECT last_update FROM skl_self_eval_level " . " WHERE user_id = " . $ilDB->quote($a_user_id, "integer") . " AND top_skill_id = " . $ilDB->quote($a_top_skill, "integer") . " AND tref_id = " . $ilDB->quote((int) $a_tref_id, "integer") . " AND skill_id = " . $ilDB->quote($a_basic_skill, "integer"));
     $rec = $ilDB->fetchAssoc($set);
     return $rec["last_update"];
 }
 /**
  * Set header for level
  */
 function setLevelHead()
 {
     global $ilTabs, $ilCtrl, $tpl, $lng, $ilHelp;
     // tabs
     $ilTabs->clearTargets();
     $ilHelp->setScreenIdComponent("skmg_lev");
     $ilTabs->setBackTarget($lng->txt("skmg_skill_levels"), $ilCtrl->getLinkTarget($this, "edit"));
     if ($_GET["level_id"] > 0) {
         if ($this->tref_id == 0) {
             $ilTabs->addTab("level_settings", $lng->txt("settings"), $ilCtrl->getLinkTarget($this, "editLevel"));
         } else {
             $ilTabs->addTab("level_resources", $lng->txt("skmg_resources"), $ilCtrl->getLinkTarget($this, "showLevelResources"));
         }
         /*			$ilTabs->addTab("level_trigger",
         				$lng->txt("skmg_trigger"),
         				$ilCtrl->getLinkTarget($this, "editLevelTrigger"));
         
         			$ilTabs->addTab("level_certificate",
         				$lng->txt("certificate"),
         				$ilCtrl->getLinkTargetByClass("ilcertificategui", "certificateEditor"));*/
     }
     // title
     if ($_GET["level_id"] > 0) {
         $tpl->setTitle($lng->txt("skmg_skill_level") . ": " . ilBasicSkill::lookupLevelTitle((int) $_GET["level_id"]));
     } else {
         $tpl->setTitle($lng->txt("skmg_skill_level"));
     }
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $tree = new ilSkillTree();
     $path = $tree->getPathFull($this->node_object->getId());
     $desc = "";
     foreach ($path as $p) {
         if (in_array($p["type"], array("scat", "skll"))) {
             $desc .= $sep . $p["title"];
             $sep = " > ";
         }
     }
     $tpl->setDescription($desc);
     $tpl->setTitleIcon(ilSkillTreeNode::getIconPath(0, "sktp", "", false));
 }
 /**
  * Write appraisee skills
  *
  * @param
  * @return
  */
 function writeAppraiseeSkills($a_app_id)
 {
     $new_levels = $this->determineSkillLevelsForAppraisee($a_app_id);
     foreach ($new_levels as $nl) {
         if ($nl["new_level_id"] > 0) {
             ilBasicSkill::writeUserSkillLevelStatus($nl["new_level_id"], $a_app_id, $this->survey->getRefId(), $nl["tref_id"], ilBasicSkill::ACHIEVED, true);
         }
     }
 }
 /**
  * Confirm level assignment removal
  */
 function confirmLevelAssignmentRemoval()
 {
     global $ilCtrl, $tpl, $lng;
     $this->setTabs("levels");
     if (!is_array($_POST["ass_id"]) || count($_POST["ass_id"]) == 0) {
         ilUtil::sendInfo($lng->txt("no_checkbox"), true);
         $ilCtrl->redirect($this, "showLevels");
     } else {
         include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
         $cgui = new ilConfirmationGUI();
         $cgui->setFormAction($ilCtrl->getFormAction($this));
         $cgui->setHeaderText($lng->txt("skmg_confirm_remove_level_ass"));
         $cgui->setCancel($lng->txt("cancel"), "showLevels");
         $cgui->setConfirm($lng->txt("remove"), "removeLevelAssignments");
         include_once "./Services/Skill/classes/class.ilBasicSkill.php";
         foreach ($_POST["ass_id"] as $i) {
             $id_arr = explode(":", $i);
             $cgui->addItem("ass_id[]", $i, ilBasicSkill::_lookupTitle($id_arr[0]) . ": " . ilBasicSkill::lookupLevelTitle($id_arr[2]));
         }
         $tpl->setContent($cgui->getHTML());
     }
 }
 public function loadAdditionalSkillData()
 {
     require_once 'Services/Skill/classes/class.ilBasicSkill.php';
     require_once 'Services/Skill/classes/class.ilSkillTree.php';
     $this->setSkillTitle(ilBasicSkill::_lookupTitle($this->getSkillBaseId(), $this->getSkillTrefId()));
     $tree = new ilSkillTree();
     $path = $tree->getSkillTreePath($this->getSkillBaseId(), $this->getSkillTrefId());
     $nodes = array();
     foreach ($path as $node) {
         if ($node['child'] > 1 && $node['skill_id'] != $this->getSkillBaseId()) {
             $nodes[] = $node['title'];
         }
     }
     $this->setSkillPath(implode(' > ', $nodes));
 }
 /**
  * Test getSkillLevelsForTrigger
  *
  * @param
  * @return
  */
 function testLevels()
 {
     global $tpl, $lng, $ilCtrl, $ilTabs;
     $this->setTestSubTabs("levels");
     $ilTabs->activateTab("test");
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $this->form->addCommandButton("testLevels", $lng->txt("execute"));
     $this->form->setTitle("getTriggerOfAllCertificates()");
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     // user id
     $ti = new ilTextInputGUI("Ref ID", "ref_id");
     $ti->setMaxLength(200);
     $ti->setValue($_POST["ref_id"]);
     $this->form->addItem($ti);
     $result = "";
     if (isset($_POST["ref_id"])) {
         $result = ilBasicSkill::getSkillLevelsForTrigger($_POST["ref_id"]);
         $result = "<br />Result:<br />" . var_export($result, true);
     }
     $tpl->setContent($this->form->getHTML() . $result);
 }
 /**
  * Remove trigger
  */
 function removeLevelTrigger()
 {
     global $ilCtrl;
     ilBasicSkill::writeLevelTrigger((int) $_GET["level_id"], 0);
     $ilCtrl->redirect($this, "editLevelTrigger");
 }
 /**
  * Get levels
  *
  * @param
  * @return
  */
 function getLevels()
 {
     include_once "./Services/Skill/classes/class.ilBasicSkill.php";
     $bs = new ilBasicSkill($this->base_skill_id);
     return $bs->getLevelData();
 }