/**
  * Save childs order
  *
  * @param
  * @return
  */
 static function saveChildsOrder($a_par_id, $a_childs_order, $a_templates = false)
 {
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $skill_tree = new ilSkillTree();
     if ($a_par_id != $skill_tree->readRootId()) {
         $childs = $skill_tree->getChilds($a_par_id);
     } else {
         if ($a_templates) {
             $childs = $skill_tree->getChildsByTypeFilter($a_par_id, array("skrt", "sktp", "sctp"));
         } else {
             $childs = $skill_tree->getChildsByTypeFilter($a_par_id, array("skrt", "skll", "scat", "sktr"));
         }
     }
     foreach ($childs as $k => $c) {
         if (isset($a_childs_order[$c["child"]])) {
             $childs[$k]["order_nr"] = (int) $a_childs_order[$c["child"]];
         }
     }
     $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
     $cnt = 10;
     foreach ($childs as $c) {
         ilSkillTreeNode::_writeOrderNr($c["child"], $cnt);
         $cnt += 10;
     }
 }
 /**
  * LIst skills for adding
  *
  * @param
  * @return
  */
 function listSkillsForAdd()
 {
     global $ilUser, $tpl, $ilCtrl, $lng, $ilTabs;
     ilUtil::sendInfo($lng->txt("skmg_select_skill"));
     $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, ""));
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $skill_tree = new ilSkillTree();
     require_once "./Services/Skill/classes/class.ilPersonalSkillExplorer.php";
     $exp = new ilPersonalSkillExplorer($ilCtrl->getLinkTarget($this, "listSkillsForAdd"));
     $exp->setTargetGet("obj_id");
     $exp->setExpandTarget($ilCtrl->getLinkTarget($this, "listSkillsForAdd"));
     if ($_GET["skpexpand"] == "") {
         $expanded = $skill_tree->readRootId();
     } else {
         $expanded = $_GET["skpexpand"];
     }
     if ($_GET["obj_id"] > 0) {
         $path = $this->skill_tree->getPathId($_GET["obj_id"]);
         $exp->setForceOpenPath($path);
         $exp->highlightNode($_GET["obj_id"]);
     } else {
         $exp->highlightNode($this->skill_tree->readRootId());
     }
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     // asynchronous output
     if ($ilCtrl->isAsynch()) {
         echo $output;
         exit;
     }
     $tpl->setContent($output);
 }
 /**
  * Assign Level
  */
 function assignLevel()
 {
     global $lng, $ilTabs, $ilCtrl, $tpl;
     $tpl->setTitle($lng->txt("skmg_profile") . ": " . $this->profile->getTitle());
     $tpl->setDescription("");
     //$this->setTabs("levels");
     ilUtil::sendInfo($lng->txt("skmg_select_skill_level_assign"));
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "showLevels"));
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $skill_tree = new ilSkillTree();
     require_once "./Services/Skill/classes/class.ilSkillProfileAssignmentExplorer.php";
     $exp = new ilSkillProfileAssignmentExplorer($ilCtrl->getLinkTarget($this, "assignLevel"));
     $exp->setTargetGet("level_id");
     $exp->setExpandTarget($ilCtrl->getLinkTarget($this, "assignLevel"));
     if ($_GET["skaexpand"] == "") {
         $expanded = $skill_tree->readRootId();
     } else {
         $expanded = $_GET["skaexpand"];
     }
     /*		if ($_GET["level_id"] > 0)
     		{
     			$path = $this->skill_tree->getPathId($_GET["obj_id"]);
     			$exp->setForceOpenPath($path);
     			$exp->highlightNode($_GET["obj_id"]);
     		}
     		else
     		{
     			$exp->highlightNode($this->skill_tree->readRootId());
     		}*/
     $exp->setExpand($expanded);
     // build html-output
     $exp->setOutput(0);
     $output = $exp->getOutput();
     // asynchronous output
     if ($ilCtrl->isAsynch()) {
         echo $output;
         exit;
     }
     $tpl->setContent($output);
 }