/** * Get Options. * * @return array Options. Array ("value" => "option_text") */ function getOptions() { global $lng; if ($this->include_please_select) { $options = array("" => $lng->txt("please_select")); } include_once "./Services/Taxonomy/classes/class.ilTaxonomyTree.php"; $tax_tree = new ilTaxonomyTree($this->getTaxonomyId()); $nodes = $tax_tree->getSubtree($tax_tree->getNodeData($tax_tree->readRootId())); foreach ($nodes as $n) { if ($n["type"] == "taxn") { $options[$n["child"]] = str_repeat(" ", ($n["depth"] - 2) * 2) . $n["title"]; } } return $options; }
/** * Get tree html * * @param * @return */ static function getTreeHTML($a_tax_id, $a_class, $a_cmd, $a_root_node_title = "") { global $ilUser, $tpl, $ilCtrl, $lng; $lng->loadLanguageModule("tax"); include_once "./Services/Taxonomy/classes/class.ilTaxonomyTree.php"; require_once "./Services/Taxonomy/classes/class.ilTaxonomyExplorer.php"; $a_tax_tree = new ilTaxonomyTree($a_tax_id); $exp = new ilTaxonomyExplorer($ilCtrl->getLinkTargetByClass($a_class, $a_cmd), $a_tax_tree, $a_class, $a_cmd); $exp->setTargetGet("tax_node"); if ($a_root_node_title != "") { $exp->setRootNodeTitle($a_root_node_title); } $exp->setExpandTarget($ilCtrl->getLinkTargetByClass($a_class, $a_cmd)); if ($_GET["txexpand"] == "") { $expanded = $a_tax_tree->readRootId(); } else { $expanded = $_GET["txexpand"]; } if ($_GET["tax_node"] > 0) { $path = $a_tax_tree->getPathId($_GET["tax_node"]); $exp->setForceOpenPath($path); $exp->highlightNode($_GET["tax_node"]); } else { $exp->highlightNode($a_tax_tree->readRootId()); } $exp->setExpand($expanded); // build html-output $exp->setOutput(0); $output = $exp->getOutput(); return $output; }
/** * Fix order numbers * * @param * @return */ static function fixOrderNumbers($a_tax_id, $a_parent_id) { include_once "./Services/Taxonomy/classes/class.ilTaxonomyTree.php"; $tax_tree = new ilTaxonomyTree($a_tax_id); if ($a_parent_id == 0) { $a_parent_id = $tax_tree->readRootId(); } $childs = $tax_tree->getChilds($a_parent_id); $childs = ilUtil::sortArray($childs, "order_nr", "asc", false); $cnt = 10; foreach ($childs as $c) { self::writeOrderNr($c["child"], $cnt); $cnt += 10; } }