/**
  * Copy items to clipboard
  */
 function copyItems()
 {
     global $ilCtrl, $lng;
     $items = ilUtil::stripSlashesArray($_POST["id"]);
     if (!is_array($items)) {
         ilUtil::sendFailure($lng->txt("no_checkbox"), true);
         $ilCtrl->redirect($this, "chapters");
     }
     $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]);
     }
     ilLMObject::clipboardCopy($this->object->getId(), $items);
     ilEditClipboard::setAction("copy");
     ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
     $ilCtrl->redirect($this, "chapters");
 }
 /**
  * Copy a set of chapters/pages into the clipboard
  */
 function clipboardCut($a_cont_obj_id, $a_ids)
 {
     $tree = ilLMObject::getTree($a_cont_obj_id);
     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;
             }
         }
     }
     ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
     // remove the objects from the tree
     // note: we are getting chapters 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);
         }
     }
 }
 /**
  * Copy items to clipboard
  */
 function copyItems($a_return = "view")
 {
     global $ilCtrl, $lng;
     $items = ilUtil::stripSlashesArray($_POST["id"]);
     if (!is_array($items)) {
         ilUtil::sendFailure($lng->txt("no_checkbox"), true);
         $ilCtrl->redirect($this, "showHierarchy");
     }
     $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 (!ilLMObject::uniqueTypesCheck($items)) {
         ilUtil::sendFailure($lng->txt("cont_choose_pages_or_chapters_only"), true);
         $ilCtrl->redirect($this, "showHierarchy");
     }
     ilLMObject::clipboardCopy($this->content_object->getId(), $items);
     ilEditClipboard::setAction("copy");
     ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
     $ilCtrl->redirect($this, $a_return);
 }