示例#1
0
 /**
  * Paste items (move operation)
  */
 function pasteItems()
 {
     global $lng, $ilCtrl;
     //var_dump($_GET);
     //var_dump($_POST);
     if ($_GET["move_ids"] != "") {
         $move_ids = explode(",", $_GET["move_ids"]);
         $tax = $this->getCurrentTaxonomy();
         $tree = $tax->getTree();
         include_once "./Services/Taxonomy/classes/class.ilTaxonomyNode.php";
         $target_node = new ilTaxonomyNode((int) $_GET["tax_node"]);
         foreach ($move_ids as $m_id) {
             // cross check taxonomy
             $node = new ilTaxonomyNode((int) $m_id);
             if ($node->getTaxonomyId() == $tax->getId() && ($target_node->getTaxonomyId() == $tax->getId() || $target_node->getId() == $tree->readRootId())) {
                 // check if target is not within the selected nodes
                 if ($tree->isGrandChild((int) $m_id, $target_node->getId())) {
                     ilUtil::sendFailure($lng->txt("tax_target_within_nodes"), true);
                     $this->ctrl->redirect($this, "listNodes");
                 }
                 // if target is not current place, move
                 $parent_id = $tree->getParentId((int) $m_id);
                 if ($parent_id != $target_node->getId()) {
                     $tree->moveTree((int) $m_id, $target_node->getId());
                     ilTaxonomyNode::fixOrderNumbers($tax->getId(), $target_node->getId());
                     ilTaxonomyNode::fixOrderNumbers($tax->getId(), $parent_id);
                 }
             }
         }
     }
     ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
     $ilCtrl->redirect($this, "listNodes");
 }