/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd) { global $ilCtrl, $lng, $ilAccess, $lng, $ilUser; parent::__construct($a_parent_obj, $a_parent_cmd); include_once "./Services/Skill/classes/class.ilSkillSelfEvaluation.php"; $this->setData(ilSkillSelfEvaluation::getAllSelfEvaluationsOfUser($ilUser->getId())); $this->setTitle($lng->txt("skmg_self_evaluations")); $this->addColumn("", "", 1); $this->addColumn($this->lng->txt("created")); $this->addColumn($this->lng->txt("last_update")); $this->addColumn($this->lng->txt("skmg_skill")); $this->addColumn($this->lng->txt("actions")); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.self_eval_overview_row.html", "Services/Skill"); $this->setEnableTitle(true); $this->addMultiCommand("confirmSelfEvaluationDeletion", $lng->txt("delete")); //$this->addCommandButton("", $lng->txt("")); }
/** * Get average level of user self evaluation * * Note: this method does not make much sense in general, since it * assumes that all basic skills have the same level */ static function getAverageLevel($a_se_id, $a_user_id, $a_top_skill_id) { global $lng; $lng->loadLanguageModule("skmg"); include_once "./Services/Skill/classes/class.ilSkillTree.php"; include_once "./Services/Skill/classes/class.ilBasicSkill.php"; $stree = new ilSkillTree(); $cnt = 0; $sum = 0; if ($stree->isInTree($a_top_skill_id)) { $se = new ilSkillSelfEvaluation($a_se_id); $levels = $se->getLevels(); $cnode = $stree->getNodeData($a_top_skill_id); $childs = $stree->getSubTree($cnode); foreach ($childs as $child) { if ($child["type"] == "skll") { $sk = new ilBasicSkill($child["child"]); $ls = $sk->getLevelData(); $ord = array(); foreach ($ls as $k => $l) { $ord[$l["id"]] = $k + 1; } reset($ls); foreach ($ls as $ld) { if ($ld["id"] == $levels[$child["child"]]) { $sum += $ord[$ld["id"]]; } } $cnt += 1; } } } if ($cnt > 0) { $avg = round($sum / $cnt); if ($avg > 0) { return array("skill_title" => $cnode["title"], "ord" => $avg, "avg_title" => $ls[$avg - 1]["title"]); } else { return array("skill_title" => $cnode["title"], "ord" => $avg, "avg_title" => $lng->txt("skmg_no_skills")); } } return null; }