/**
  * Get skill level data
  *
  * @param
  * @return
  */
 function getSkillLevelData()
 {
     $levels = $this->skill->getLevelData();
     // add ressource data
     $res = array();
     include_once "./Services/Skill/classes/class.ilSkillResources.php";
     $resources = new ilSkillResources($this->skill_id);
     foreach ($resources->getResources() as $level_id => $item) {
         $res[$level_id] = array_keys($item);
     }
     foreach ($levels as $idx => $item) {
         $levels[$idx]["ressources"] = $res[$item["id"]];
     }
     return $levels;
 }
 /**
  * Render suggested resources
  *
  * @param
  * @return
  */
 function renderSuggestedResources($a_tpl, $a_levels, $a_base_skill, $a_tref_id)
 {
     global $lng;
     if ($this->getProfileId() == 0) {
         return;
     }
     $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();
     }
 }
 /**
  * Remove level resource
  */
 function removeLevelResources()
 {
     global $ilCtrl, $lng;
     if (is_array($_POST["id"])) {
         include_once "./Services/Skill/classes/class.ilSkillResources.php";
         $sres = new ilSkillResources($this->base_skill_id, $this->tref_id);
         foreach ($_POST["id"] as $i) {
             $sres->setResourceAsImparting((int) $_GET["level_id"], $i, false);
         }
         $sres->save();
         ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
     }
     $ilCtrl->redirect($this, "showLevelResources");
 }