コード例 #1
0
 /**
  * Save tax node form
  *
  */
 public function saveTaxNode()
 {
     global $tpl, $lng, $ilCtrl;
     $this->initTaxNodeForm("create");
     if ($this->form->checkInput()) {
         $tax = $this->getCurrentTaxonomy();
         // create node
         include_once "./Services/Taxonomy/classes/class.ilTaxonomyNode.php";
         $node = new ilTaxonomyNode();
         $node->setTitle($this->form->getInput("title"));
         $tax = $this->getCurrentTaxonomy();
         if ($tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
             $order_nr = $this->form->getInput("order_nr");
         }
         if ($order_nr === "") {
             $order_nr = ilTaxonomyNode::getNextOrderNr($tax->getId(), (int) $_GET["tax_node"]);
         }
         //echo $order_nr; exit;
         $node->setOrderNr($order_nr);
         $node->setTaxonomyId($tax->getId());
         $node->create();
         // put in tree
         ilTaxonomyNode::putInTree($tax->getId(), $node, (int) $_GET["tax_node"]);
         ilTaxonomyNode::fixOrderNumbers($tax->getId(), (int) $_GET["tax_node"]);
         ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
         $ilCtrl->redirect($this, "listNodes");
     } else {
         $this->form->setValuesByPost();
         $tpl->setContent($this->form->getHtml());
     }
 }