/** * Render materials row * * @param * @return */ function renderMaterialsRow($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(); } foreach ($a_levels as $k => $v) { $mat_cnt = ilPersonalSkill::countAssignedMaterial($a_user_id, $a_tref_id, $v["id"]); if ($mat_cnt == 0) { $a_tpl->setCurrentBlock("val_level_td"); $a_tpl->setVariable("VAL_LEVEL", " "); $a_tpl->parseCurrentBlock(); } else { // links to material files $a_tpl->setCurrentBlock("level_link"); $mat_tt = array(); $cnt = 1; foreach (ilPersonalSkill::getAssignedMaterial($a_user_id, $a_tref_id, $v["id"]) as $item) { $mat_data = $this->getMaterialInfo($item["wsp_id"]); $a_tpl->setVariable("HREF_LINK", $mat_data[1]); $a_tpl->setVariable("TXT_LINK", $cnt); // tooltip $mat_tt_id = "skmg_skl_tt_mat_" . self::$skill_tt_cnt; self::$skill_tt_cnt++; $a_tpl->setVariable("LEVEL_LINK_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]); } $a_tpl->parseCurrentBlock(); $cnt++; } $a_tpl->setCurrentBlock("val_level_td"); $a_tpl->setVariable("TD_CLASS", "ilSkillMat"); $a_tpl->parseCurrentBlock(); } } $a_tpl->setCurrentBlock("value_row"); $a_tpl->setVariable("TXT_VAL_TITLE", $lng->txt("skmg_material")); $a_tpl->parseCurrentBlock(); }
/** * Get HTML * * @param * @return */ function getHTML() { global $ilCtrl; $tpl = new ilTemplate("tpl.grouped_list.html", true, true, "Services/UIComponent/GroupedList"); $tt_calls = ""; foreach ($this->items as $i) { switch ($i["type"]) { case "sep": $tpl->touchBlock("sep"); $tpl->touchBlock("item"); break; case "next_col": $tpl->touchBlock("next_col"); $tpl->touchBlock("item"); break; case "group_head": $tpl->setCurrentBlock("group_head"); if ($i["add_class"] != "") { $tpl->setVariable("ADD_CLASS", $i["add_class"]); } $tpl->setVariable("GROUP_HEAD", $i["content"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); break; case "entry": if ($i["href"] != "") { $tpl->setCurrentBlock("linked_entry"); if ($i["add_class"] != "") { $tpl->setVariable("ADD_CLASS", $i["add_class"]); } $tpl->setVariable("HREF", $i["href"]); $tpl->setVariable("TXT_ENTRY", $i["content"]); if ($i["target"] != "") { $tpl->setVariable("TARGET", 'target="' . $i["target"] . '"'); } else { $tpl->setVariable("TARGET", 'target="_top"'); } if ($i["onclick"] != "") { $tpl->setVariable("ONCLICK", 'onclick="' . $i["onclick"] . '"'); } if ($i["id"] != "") { $tpl->setVariable("ID", 'id="' . $i["id"] . '"'); } $tpl->parseCurrentBlock(); $tpl->touchBlock("item"); if ($i["ttip"] != "" && $i["id"] != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; if ($ilCtrl->isAsynch()) { $tt_calls .= " " . ilTooltipGUI::getTooltip($i["id"], $i["ttip"], "", $i["tt_my"], $i["tt_at"], $i["tt_use_htmlspecialchars"]); } else { ilTooltipGUI::addTooltip($i["id"], $i["ttip"], "", $i["tt_my"], $i["tt_at"], $i["tt_use_htmlspecialchars"]); } } } else { $tpl->setCurrentBlock("unlinked_entry"); if ($i["add_class"] != "") { $tpl->setVariable("ADD_CLASS2", $i["add_class"]); } $tpl->setVariable("TXT_ENTRY2", $i["content"]); $tpl->parseCurrentBlock(); } break; } } if ($this->multi_column) { $tpl->touchBlock("multi_start"); $tpl->touchBlock("multi_end"); } if ($tt_calls != "") { $tpl->setCurrentBlock("script"); $tpl->setVariable("TT_CALLS", $tt_calls); $tpl->parseCurrentBlock(); } if ($this->getAsDropDown()) { if ($this->dd_pullright) { $tpl->setVariable("LIST_CLASS", "dropdown-menu pull-right"); } else { $tpl->setVariable("LIST_CLASS", "dropdown-menu"); } $tpl->setVariable("LIST_ROLE", "menu"); } else { $tpl->setVariable("LIST_CLASS", ""); $tpl->setVariable("LIST_ROLE", ""); } return $tpl->get(); }
/** * 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(); }