/**
  * 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"]);
 }
 /**
  * Get title for certificate
  *
  * @param
  * @return
  */
 function getLevelTitleForCertificate($a_level_id)
 {
     die("ilBasicSkill::getLevelTitleForCertificate is deprecated.");
     return ilBasicSkill::lookupLevelTitle($a_level_id);
 }
 /**
  * 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();
         }
     }
 }
 /**
  * Set header for level
  */
 function setLevelHead()
 {
     global $ilTabs, $ilCtrl, $tpl, $lng, $ilHelp;
     // tabs
     $ilTabs->clearTargets();
     $ilHelp->setScreenIdComponent("skmg_lev");
     $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "edit"));
     if ($_GET["level_id"] > 0) {
         $ilTabs->addTab("level_settings", $lng->txt("settings"), $ilCtrl->getLinkTarget($this, "editLevel"));
         /*			$ilTabs->addTab("level_trigger",
         				$lng->txt("skmg_trigger"),
         				$ilCtrl->getLinkTarget($this, "editLevelTrigger"));*/
         $ilTabs->addTab("level_resources", $lng->txt("skmg_resources"), $ilCtrl->getLinkTarget($this, "showLevelResources"));
         /*
         			$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);
 }
 /**
  * Get title for certificate
  *
  * @param
  * @return
  */
 function getLevelTitleForCertificate($a_level_id)
 {
     return ilBasicSkill::lookupLevelTitle($a_level_id);
 }
 /**
  * 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());
     }
 }