/** * 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::_lookupStatus($c["child"]) == ilSkillTreeNode::STATUS_DRAFT; } } return $childs; }
/** * Build selectable tree * * @param int $a_node_id tree id */ function buildSelectableTree($a_node_id) { //echo "<br>-$a_node_id-"; if (in_array(ilSkillTreeNode::_lookupStatus($a_node_id), array(ilSkillTreeNode::STATUS_DRAFT, ilSkillTreeNode::STATUS_OUTDATED))) { return; } if (ilSkillTreeNode::_lookupSelfEvaluation($a_node_id)) { $this->selectable[$a_node_id] = true; $cid = $a_node_id; //$this->selectable[$this->parent[$a_node_id]] = true; while (isset($this->parent[$cid])) { $this->selectable[$this->parent[$cid]] = true; $cid = $this->parent[$cid]; } } foreach ($this->getOriginalChildsOfNode($a_node_id) as $n) { //echo "+".$n["child"]."+"; $this->buildSelectableTree($n["child"]); } if ($this->selectable[$a_node_id]) { $this->setHasSelectableNodes(true); $this->selectable_child_nodes[$this->node[$a_node_id]["parent"]][] = $this->node[$a_node_id]; } }
/** * 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": $tid = ilSkillTemplateReference::_lookupTemplateId($a_set["child"]); $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $a_set["child"]); $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $tid); $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems"); $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]); $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $_GET["tref_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; } if ($this->tref_id == 0) { $this->tpl->setCurrentBlock("cb"); $this->tpl->setVariable("CB_ID", $a_set["child"]); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("nr"); $this->tpl->setVariable("OBJ_ID", $a_set["child"]); $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("HREF_TITLE", $ret); $this->tpl->setVariable("TITLE", $a_set["title"]); $icon = ilSkillTreeNode::getIconPath($a_set["child"], $a_set["type"], "", ilSkillTreeNode::_lookupStatus($a_set["child"])); $this->tpl->setVariable("ICON", ilUtil::img($icon, "")); }
/** * Get childs of node * * @param string $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(); $outdated = 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; //echo "-".$child_id."-"; $cid = $this->getCSkillIdForVTreeId($child_id); //echo "-".$cid."-"; $cid_parts = explode(":", $cid); $childs[$k]["skill_id"] = $cid_parts[0]; $childs[$k]["tref_id"] = $cid_parts[1]; $childs[$k]["cskill_id"] = $cid; $childs[$k]["parent"] = $a_parent_id; $this->parent[$c["id"]] = $a_parent_id; // @todo: prepare this for tref id? if (ilSkillTreeNode::_lookupStatus($c["child"]) == ilSkillTreeNode::STATUS_DRAFT || in_array($a_parent_id, $this->drafts)) { $this->drafts[] = $child_id; $drafts[] = $k; } if (ilSkillTreeNode::_lookupStatus($c["child"]) == ilSkillTreeNode::STATUS_OUTDATED || in_array($a_parent_id, $this->outdated)) { $this->outdated[] = $child_id; $outdated[] = $k; } } if (!$this->getIncludeDrafts()) { foreach ($drafts as $d) { unset($childs[$d]); } } if (!$this->getIncludeOutdated()) { foreach ($outdated as $d) { unset($childs[$d]); } } return $childs; }
/** * 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(), "", ilSkillTreeNode::_lookupStatus($obj_id) == ilSkillTreeNode::STATUS_DRAFT)); }