/** * Build selectable tree * * @param * @return */ function buildSelectableTree($a_node_id) { if (ilSkillTreeNode::_lookupSelfEvaluation($a_node_id)) { $this->selectable[$a_node_id] = true; $this->selectable[$this->parent[$a_node_id]] = true; } foreach ($this->getOriginalChildsOfNode($a_node_id) as $n) { $this->buildSelectableTree($n["child"]); } if ($this->selectable[$a_node_id] && !ilSkillTreeNode::_lookupDraft($a_node_id)) { $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] = $this->node[$a_node_id]; } }
/** * Get childs of node * * @param int $a_parent_id parent id * @return array childs */ function getChildsOfNode($a_parent_id) { $childs = parent::getChildsOfNode($a_parent_id); include_once "./Services/Skill/classes/class.ilSkillTreeNode.php"; foreach ($childs as $c) { $this->parent[$c["child"]] = $c["parent"]; if ($this->draft[$c["parent"]]) { $this->draft[$c["child"]] = true; } else { $this->draft[$c["child"]] = ilSkillTreeNode::_lookupDraft($c["child"]); } } return $childs; }
/** * Get childs of node * * @param int $a_parent_id parent id * @return array childs */ function getChildsOfNode($a_parent_id) { $childs = $this->tree->getChilds($a_parent_id, $this->order_column); foreach ($childs as $c) { $this->parent[$c["child"]] = $c["parent"]; if ($this->draft[$c["parent"]]) { $this->draft[$c["child"]] = true; } else { $this->draft[$c["child"]] = ilSkillTreeNode::_lookupDraft($c["child"]); } } return $childs; }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $ilCtrl; switch ($a_set["type"]) { // category case "scat": $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $a_set["child"]); $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems"); $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $_GET["obj_id"]); break; // skill template reference // skill template reference case "sktr": $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $a_set["child"]); $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems"); $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]); break; // skill // skill case "skll": $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $a_set["child"]); $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit"); $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $_GET["obj_id"]); break; // -------- // template // -------- // template case "sktp": $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_set["child"]); $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit"); $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]); break; // template category // template category case "sctp": $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_set["child"]); $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems"); $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]); break; } $this->tpl->setVariable("HREF_TITLE", $ret); $this->tpl->setVariable("TITLE", $a_set["title"]); $this->tpl->setVariable("OBJ_ID", $a_set["child"]); $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]); $icon = ilSkillTreeNode::getIconPath($a_set["child"], $a_set["type"], "", ilSkillTreeNode::_lookupDraft($a_set["child"])); $this->tpl->setVariable("ICON", ilUtil::img($icon, "")); }
/** * Set title icon */ function setTitleIcon() { global $tpl; $obj_id = is_object($this->node_object) ? $this->node_object->getId() : 0; $tpl->setTitleIcon(ilSkillTreeNode::getIconPath($obj_id, $this->getType(), "_b", ilSkillTreeNode::_lookupDraft($obj_id))); }
/** * Get childs of node * * @param int $a_parent_id parent id * @return array childs */ function getChildsOfNode($a_parent_id) { $a_parent_id_parts = explode(":", $a_parent_id); $a_parent_skl_tree_id = $a_parent_id_parts[0]; $a_parent_skl_template_tree_id = $a_parent_id_parts[1]; if ($a_parent_skl_template_tree_id == 0) { $childs = $this->tree->getChildsByTypeFilter($a_parent_skl_tree_id, array("scat", "skll", "sktr"), "order_nr"); } else { $childs = $this->tree->getChildsByTypeFilter($a_parent_skl_template_tree_id, array("sktp", "sctp"), "order_nr"); } include_once "./Services/Skill/classes/class.ilSkillTreeNode.php"; $drafts = array(); foreach ($childs as $k => $c) { if ($a_parent_skl_template_tree_id > 0) { // we are in template tree only $child_id = $a_parent_skl_tree_id . ":" . $c["child"]; } else { if (!in_array($c["type"], array("sktr", "sctr"))) { // we are in main tree only $child_id = $c["child"] . ":0"; } else { // get template id for references include_once "./Services/Skill/classes/class.ilSkillTemplateReference.php"; $child_id = $c["child"] . ":" . ilSkillTemplateReference::_lookupTemplateId($c["child"]); } } unset($childs[$k]["child"]); unset($childs[$k]["skl_tree_id"]); unset($childs[$k]["lft"]); unset($childs[$k]["rgt"]); unset($childs[$k]["depth"]); $childs[$k]["id"] = $child_id; $childs[$k]["parent"] = $a_parent_id; $this->parent[$c["id"]] = $a_parent_id; if (ilSkillTreeNode::_lookupDraft($c["child"])) { $drafts[] = $k; } } foreach ($drafts as $d) { unset($childs[$d]); } return $childs; }