示例#1
0
 /**
  * Copy contents to clipboard
  *
  * @param	string		$a_hids		array of hierarchical ids of content objects
  */
 function copyContents($a_hids)
 {
     global $ilUser;
     //var_dump($a_hids);
     if (!is_array($a_hids)) {
         return;
     }
     $time = date("Y-m-d H:i:s", time());
     $hier_ids = array();
     $skip = array();
     foreach ($a_hids as $a_hid) {
         if ($a_hid == "") {
             continue;
         }
         $a_hid = explode(":", $a_hid);
         // check, whether new hid is child of existing one or vice versa
         reset($hier_ids);
         foreach ($hier_ids as $h) {
             if ($h . "_" == substr($a_hid[0], 0, strlen($h) + 1)) {
                 $skip[] = $a_hid[0];
             }
             if ($a_hid[0] . "_" == substr($h, 0, strlen($a_hid[0]) + 1)) {
                 $skip[] = $h;
             }
         }
         $pc_id[$a_hid[0]] = $a_hid[1];
         if ($a_hid[0] != "") {
             $hier_ids[$a_hid[0]] = $a_hid[0];
         }
     }
     foreach ($skip as $s) {
         unset($hier_ids[$s]);
     }
     include_once "./Services/COPage/classes/class.ilPageContent.php";
     $hier_ids = ilPageContent::sortHierIds($hier_ids);
     $nr = 1;
     foreach ($hier_ids as $hid) {
         $curr_node = $this->getContentNode($hid, $pc_id[$hid]);
         if (is_object($curr_node)) {
             if ($curr_node->node_name() == "PageContent") {
                 $content = $this->dom->dump_node($curr_node);
                 // remove pc and hier ids
                 $content = eregi_replace("PCID=\"[a-z0-9]*\"", "", $content);
                 $content = eregi_replace("HierId=\"[a-z0-9_]*\"", "", $content);
                 $ilUser->addToPCClipboard($content, $time, $nr);
                 $nr++;
             }
         }
     }
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     ilEditClipboard::setAction("copy");
 }
 /**
  * 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");
 }
 /**
  * paste from clipboard (redirects to clipboard)
  */
 function paste($a_hier_id)
 {
     global $ilCtrl;
     $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     ilEditClipboard::setAction("");
     $this->ctrl->returnToParent($this);
 }
 /**
  * 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);
 }
 /**
  * Copy items to clipboard, then cut them from the current tree
  */
 function cutItems($a_return = "showOrganization")
 {
     global $ilCtrl, $lng;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Node.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 (!ilSCORM2004Node::uniqueTypesCheck($items)) {
         ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
         $ilCtrl->redirect($this, $a_return);
     }
     ilSCORM2004Node::clipboardCut($this->object->getId(), $items);
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     ilEditClipboard::setAction("cut");
     ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
     $ilCtrl->redirect($this, $a_return);
 }
 /**
  * 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();
 }