/**
  * Copy items to clipboard
  */
 function copyItems()
 {
     global $ilCtrl, $lng;
     if (!is_array($_POST["id"]) || count($_POST["id"]) == 0) {
         $this->redirectToParent();
     }
     include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
     $items = ilUtil::stripSlashesArray($_POST["id"]);
     $todel = array();
     // delete IDs < 0 (needed for non-js editing)
     foreach ($items as $k => $item) {
         if ($item < 0) {
             $todel[] = $k;
         }
     }
     foreach ($todel as $k) {
         unset($items[$k]);
     }
     if (!ilSkillTreeNode::uniqueTypesCheck($items)) {
         ilUtil::sendInfo($lng->txt("skmg_insert_please_choose_one_type_only"), true);
         $this->redirectToParent();
     }
     ilSkillTreeNode::clipboardCopy(1, $items);
     // @todo: move this to a service since it can be used here, too
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     ilEditClipboard::setAction("copy");
     ilUtil::sendInfo($lng->txt("skmg_selected_items_have_been_copied"), true);
     $this->redirectToParent();
 }
 /**
  * Cut and copy a set of skills/skill categories into the clipboard
  */
 function clipboardCut($a_tree_id, $a_ids)
 {
     self::clearClipboard();
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $tree = new ilSkillTree();
     if (!is_array($a_ids)) {
         return false;
     } else {
         // get all "top" ids, i.e. remove ids, that have a selected parent
         foreach ($a_ids as $id) {
             $path = $tree->getPathId($id);
             $take = true;
             foreach ($path as $path_id) {
                 if ($path_id != $id && in_array($path_id, $a_ids)) {
                     $take = false;
                 }
             }
             if ($take) {
                 $cut_ids[] = $id;
             }
         }
     }
     ilSkillTreeNode::clipboardCopy($a_tree_id, $cut_ids);
     // remove the objects from the tree
     // note: we are getting skills/categories which are *not* in the tree
     // we do not delete any pages/chapters here
     foreach ($cut_ids as $id) {
         $curnode = $tree->getNodeData($id);
         if ($tree->isInTree($id)) {
             $tree->deleteTree($curnode);
         }
     }
 }