/** * Get levels * * @param * @return */ function getLevels() { include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; $this->skill = ilSkillTreeNodeFactory::getInstance($this->basic_skill_id); foreach ($this->skill->getLevelData() as $k => $v) { $levels[] = $v; } return $levels; }
/** * Get levels * * @param * @return */ function getLevels() { global $lng; include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; $this->skill = ilSkillTreeNodeFactory::getInstance($this->basic_skill_id); $levels[] = array("id" => 0, "description" => $lng->txt("skmg_no_skills")); foreach ($this->skill->getLevelData() as $k => $v) { $levels[] = $v; } return $levels; }
/** * Collect page elements (that need to be exported separately) * * @param string $a_pg_type page type * @param int $a_pg_id page id */ function collectPageElements($a_type, $a_id) { // collect media objects $pg_mobs = ilObjMediaObject::_getMobsOfObject($a_type, $a_id); foreach ($pg_mobs as $pg_mob) { $this->mobs[$pg_mob] = $pg_mob; } // collect all files include_once "./Modules/File/classes/class.ilObjFile.php"; $files = ilObjFile::_getFilesOfObject($a_type, $a_id); foreach ($files as $f) { $this->files[$f] = $f; } $skill_tree = $ws_tree = null; $pcs = ilPageContentUsage::getUsagesOfPage($a_id, $a_type); foreach ($pcs as $pc) { // skils if ($pc["type"] == "skmg") { $skill_id = $pc["id"]; // get user id from portfolio page include_once "Services/Portfolio/classes/class.ilPortfolioPage.php"; $page = new ilPortfolioPage(0, $a_id); $user_id = $page->create_user; // we only need 1 instance each if (!$skill_tree) { include_once "Services/Skill/classes/class.ilSkillTree.php"; $skill_tree = new ilSkillTree(); include_once "Services/Skill/classes/class.ilPersonalSkill.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $ws_tree = new ilWorkspaceTree($user_id); } // walk skill tree $b_skills = ilSkillTreeNode::getSkillTreeNodes($skill_id, true); foreach ($b_skills as $bs) { $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]); $level_data = $skill->getLevelData(); foreach ($level_data as $k => $v) { // get assigned materials from personal skill $mat = ilPersonalSkill::getAssignedMaterial($user_id, $bs["tref"], $v["id"]); if (sizeof($mat)) { foreach ($mat as $item) { $wsp_id = $item["wsp_id"]; $obj_id = $ws_tree->lookupObjectId($wsp_id); // all possible material types for now switch (ilObject::_lookupType($obj_id)) { case "file": $this->files[$obj_id] = $obj_id; break; case "tstv": include_once "Modules/Test/classes/class.ilObjTestVerification.php"; $obj = new ilObjTestVerification($obj_id, false); $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename()); break; case "excv": include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php"; $obj = new ilObjExerciseVerification($obj_id, false); $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename()); break; } } } } } } } }
/** * Get skill presentation HTML * * @return */ function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0) { 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, $a_tref_id); 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); $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]); $level_data = $skill->getLevelData(); if ($this->mode == "gap") { if ($this->getProfileId() > 0) { $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); } $this->renderActualLevelsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); $this->renderGapSelfEvalRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); $this->renderSuggestedResources($tpl, $level_data, $bs["id"], $bs["tref"]); } else { if ($this->getProfileId() > 0) { $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); } $this->renderMaterialsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); // get date of self evaluation $se_date = ilPersonalSkill::getSelfEvaluationDate($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]); $se_rendered = $se_date == "" ? true : false; // get all object triggered entries and render them foreach ($skill->getAllLevelEntriesOfUser($bs["tref"], $user->getId()) as $level_entry) { // render the self evaluation at the correct position within the list of object triggered entries if ($se_date > $level_entry["status_date"] && !$se_rendered) { $this->renderSelfEvaluationRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); $se_rendered = true; } $this->renderObjectEvalRow($tpl, $level_data, $level_entry); } // if not rendered yet, render self evaluation now if (!$se_rendered) { $this->renderSelfEvaluationRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]); } } $too_low = true; $current_target_level = 0; 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(); // profile targel level /* 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"]; } } 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")); }*/ $tpl->setVariable("TXT_TARGET", $lng->txt("skmg_target_level")); $tpl->setVariable("TXT_360_SURVEY", $lng->txt("skmg_360_survey")); 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(); }
/** * 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(); }
/** * Get node object instance */ function readNodeObject($a_node_id) { include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; $this->node_object = ilSkillTreeNodeFactory::getInstance($a_node_id); }
/** * Delete chapters/scos/pages */ function confirmedDelete() { global $ilCtrl; // delete all selected objects include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; foreach ($_POST["id"] as $id) { if ($id != IL_FIRST_NODE) { $obj = ilSkillTreeNodeFactory::getInstance($id); $node_data = $this->skill_tree->getNodeData($id); if (is_object($obj)) { $obj->delete(); } if ($this->skill_tree->isInTree($id)) { $this->skill_tree->deleteTree($node_data); } } } // feedback ilUtil::sendInfo($this->lng->txt("info_deleted"), true); }
/** * Execute Drag Drop Action * * @param string $source_id Source element ID * @param string $target_id Target element ID * @param string $first_child Insert as first child of target * @param string $movecopy Position ("move" | "copy") */ function executeDragDrop($source_id, $target_id, $first_child, $as_subitem = false, $movecopy = "move") { include_once "./Services/Skill/classes/class.ilSkillTree.php"; $tree = new ilSkillTree(); include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php"; $source_obj = ilSkillTreeNodeFactory::getInstance($source_id); if (!$first_child) { $target_obj = ilSkillTreeNodeFactory::getInstance($target_id); $target_parent = $tree->getParentId($target_id); } // handle skills if ($source_obj->getType() == "skll") { if ($tree->isInTree($source_obj->getId())) { $node_data = $tree->getNodeData($source_obj->getId()); // cut on move if ($movecopy == "move") { $parent_id = $tree->getParentId($source_obj->getId()); $tree->deleteTree($node_data); } // paste page if (!$tree->isInTree($source_obj->getId())) { if ($first_child) { $target_pos = IL_FIRST_NODE; $parent = $target_id; } else { if ($as_subitem) { $parent = $target_id; $target_pos = IL_FIRST_NODE; $childs = $tree->getChildsByType($parent, array("skll", "scat")); if (count($childs) != 0) { $target_pos = $childs[count($childs) - 1]["obj_id"]; } } else { $target_pos = $target_id; $parent = $target_parent; } } // insert skill into tree $tree->insertNode($source_obj->getId(), $parent, $target_pos); } } } // handle skil categories if ($source_obj->getType() == "scat") { $source_node = $tree->getNodeData($source_id); $subnodes = $tree->getSubtree($source_node); // check, if target is within subtree foreach ($subnodes as $subnode) { if ($subnode["obj_id"] == $target_id) { return; } } $target_pos = $target_id; if ($first_child) { $target_pos = IL_FIRST_NODE; $target_parent = $target_id; } else { if ($as_subitem) { $target_parent = $target_id; $target_pos = IL_FIRST_NODE; $childs = $tree->getChilds($target_parent); if (count($childs) != 0) { $target_pos = $childs[count($childs) - 1]["obj_id"]; } } } // delete source tree if ($movecopy == "move") { $tree->deleteTree($source_node); } if (!$tree->isInTree($source_id)) { $tree->insertNode($source_id, $target_parent, $target_pos); // insert moved tree if ($movecopy == "move") { foreach ($subnodes as $node) { if ($node["obj_id"] != $source_id) { $tree->insertNode($node["obj_id"], $node["parent"]); } } } } } }