/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd, $a_top_skill_id, $a_tref_id, $a_basic_skill_id) { global $ilCtrl, $lng, $ilAccess, $lng, $ilUser; $this->top_skill_id = $a_top_skill_id; $this->tref_id = (int) $a_tref_id; $this->basic_skill_id = $a_basic_skill_id; $this->cur_level_id = ilPersonalSkill::getSelfEvaluation($ilUser->getId(), $this->top_skill_id, $this->tref_id, $this->basic_skill_id); // build title include_once "./Services/Skill/classes/class.ilSkillTree.php"; $stree = new ilSkillTree(); $path = $stree->getPathFull($this->basic_skill_id); $title = $sep = ""; foreach ($path as $p) { if ($p["type"] != "skrt") { $title .= $sep . $p["title"]; $sep = " > "; } } parent::__construct($a_parent_obj, $a_parent_cmd); $this->setData($this->getLevels()); $this->setTitle($title); $this->setLimit(9999); $this->addColumn("", "", "", true); $this->addColumn($this->lng->txt("skmg_skill_level")); $this->addColumn($this->lng->txt("description")); $this->setEnableHeader(true); $this->setRowTemplate("tpl.simple_self_eval.html", "Services/Skill"); $this->disable("footer"); $this->setEnableTitle(true); $this->addCommandButton("saveSelfEvaluation", $lng->txt("save")); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); }
/** * Render self evaluation row * * @param * @return */ function renderSelfEvaluationRow($a_tpl, $a_levels, $a_top_skill_id, $a_base_skill, $a_tref_id = 0, $a_user_id = 0) { global $ilUser, $lng; if ($a_user_id == 0) { $a_user_id = $ilUser->getId(); } $se_date = ilPersonalSkill::getSelfEvaluationDate($a_user_id, $a_top_skill_id, $a_tref_id, $a_base_skill); $se_level = ilPersonalSkill::getSelfEvaluation($a_user_id, $a_top_skill_id, $a_tref_id, $a_base_skill); // check, if current self eval level is in current level data $valid_sel_level = false; if ($se_level > 0) { foreach ($a_levels as $k => $v) { if ($v["id"] == $se_level) { $valid_sel_level = true; } } } reset($a_levels); $found = false; foreach ($a_levels as $k => $v) { $a_tpl->setCurrentBlock("val_level_td"); if ($valid_sel_level && !$found) { $a_tpl->setVariable("VAL_LEVEL", "x"); $a_tpl->setVariable("TD_CLASS", "ilSkillSelf"); } else { $a_tpl->setVariable("VAL_LEVEL", " "); } $a_tpl->parseCurrentBlock(); if ($v["id"] == $se_level) { $found = true; } } $a_tpl->setCurrentBlock("value_row"); ilDatePresentation::setUseRelativeDates(false); $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_self_evaluation") . ", " . ilDatePresentation::formatDate(new ilDateTime($se_date, IL_CAL_DATETIME))); ilDatePresentation::setUseRelativeDates(true); $a_tpl->parseCurrentBlock(); }
/** * Get skill presentation HTML * * @return */ function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false) { global $ilUser, $lng, $ilCtrl, $ilSetting; $this->tooltips = array(); if ($a_user_id == 0) { $user = $ilUser; } else { $user = new ilObjUser($a_user_id); } $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill"); include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; include_once "./Services/Skill/classes/class.ilSkillTree.php"; $stree = new ilSkillTree(); include_once "./Services/Skill/classes/class.ilSkillTreeNode.php"; include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; // general settings for the action drop down include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $act_list = new ilAdvancedSelectionListGUI(); $act_list->setListTitle($lng->txt("actions")); $act_list->setSelectionHeaderClass("small"); // $act_list->setLinksMode("il_ContainerItemCommand2"); $act_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK); $act_list->setUseImages(false); $b_skills = ilSkillTreeNode::getSkillTreeNodes($a_top_skill_id, true); foreach ($b_skills as $bs) { $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]); // check draft foreach ($path as $p) { if ($p["draft"]) { continue 2; } } reset($path); $se_level = ilPersonalSkill::getSelfEvaluation($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]); $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]); $level_data = $skill->getLevelData(); // check, if current self eval level is in current level data $valid_sel_level = false; if ($se_level > 0) { foreach ($level_data as $k => $v) { if ($v["id"] == $se_level) { $valid_sel_level = true; } } } reset($level_data); $found = false; foreach ($level_data as $k => $v) { // level $tpl->setCurrentBlock("level_td"); $tpl->setVariable("VAL_LEVEL", $v["title"]); $tt_id = "skmg_skl_tt_" . self::$skill_tt_cnt; self::$skill_tt_cnt++; $tpl->setVariable("TT_ID", $tt_id); if ($v["description"] != "") { ilTooltipGUI::addTooltip($tt_id, $v["description"]); } $tpl->parseCurrentBlock(); // self evaluation $tpl->setCurrentBlock("self_eval_td"); if ($valid_sel_level && !$found) { $tpl->setVariable("VAL_SELF_EVAL", "x"); $tpl->setVariable("CLASS_SELF_EVAL", "ilSkillSelf"); } else { $tpl->setVariable("VAL_SELF_EVAL", " "); } $tpl->parseCurrentBlock(); if ($v["id"] == $se_level) { $found = true; } // assigned materials if ($this->use_materials) { $mat_cnt = ilPersonalSkill::countAssignedMaterial($user->getId(), $bs["tref"], $v["id"]); if ($mat_cnt == 0) { $tpl->setCurrentBlock("material_td"); $tpl->setVariable("VAL_MATERIAL", " "); $tpl->parseCurrentBlock(); } else { // links to material files $tpl->setCurrentBlock("material_links"); $mat_tt = array(); $cnt = 1; foreach (ilPersonalSkill::getAssignedMaterial($user->getId(), $bs["tref"], $v["id"]) as $item) { $mat_data = $this->getMaterialInfo($item["wsp_id"]); $tpl->setVariable("URL_MATERIAL", $mat_data[1]); $tpl->setVariable("TXT_MATERIAL", $cnt); // tooltip $mat_tt_id = "skmg_skl_tt_mat_" . self::$skill_tt_cnt; self::$skill_tt_cnt++; $tpl->setVariable("TOOLTIP_MATERIAL_ID", $mat_tt_id); if (!$this->offline_mode) { ilTooltipGUI::addTooltip($mat_tt_id, $mat_data[0]); } else { $this->tooltips[] = ilTooltipGUI::getTooltip($mat_tt_id, $mat_data[0]); } $tpl->parseCurrentBlock(); $cnt++; } $tpl->setCurrentBlock("material_td"); $tpl->setVariable("CLASS_MAT", "ilSkillMat"); $tpl->parseCurrentBlock(); } } } $title = $sep = ""; $found = false; foreach ($path as $p) { if ($found) { $title .= $sep . $p["title"]; $sep = " > "; } if ($a_top_skill_id == $p["child"]) { $found = true; } } $tpl->setCurrentBlock("skill"); $tpl->setVariable("BSKILL_TITLE", $title); $tpl->setVariable("TXT_LEVEL", $lng->txt("skmg_level")); $tpl->setVariable("TXT_SELF_EVAL", $lng->txt("skmg_self_evaluation")); if ($this->use_materials) { $tpl->setVariable("TXT_MATERIAL", $lng->txt("skmg_material")); } if ($a_edit) { $act_list->flush(); $act_list->setId("act_" . $a_top_skill_id . "_" . $bs["id"]); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "tref_id", $bs["tref"]); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "basic_skill_id", $bs["id"]); if ($this->use_materials) { $act_list->addItem($lng->txt('skmg_assign_materials'), "", $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials")); } $act_list->addItem($lng->txt('skmg_self_evaluation'), "", $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "selfEvaluation")); $tpl->setVariable("ACTIONS2", $act_list->getHTML()); } $tpl->parseCurrentBlock(); } $tpl->setVariable("SKILL_TITLE", ilSkillTreeNode::_lookupTitle($a_top_skill_id)); if ($a_edit) { $act_list->flush(); $act_list->setId("act_" . $a_top_skill_id); $ilCtrl->setParameterByClass("ilpersonalskillsgui", "skill_id", $a_top_skill_id); // $act_list->addItem($lng->txt('skmg_assign_materials'), "", // $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials")); $act_list->addItem($lng->txt('skmg_remove_skill'), "", $ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "confirmSkillRemove")); $tpl->setVariable("ACTIONS1", $act_list->getHTML()); } return $tpl->get(); }