/**
  * Save export IDs
  */
 function saveExportIds()
 {
     global $ilCtrl, $lng;
     // check all export ids
     $ok = true;
     if (is_array($_POST["exportid"])) {
         foreach ($_POST["exportid"] as $pg_id => $exp_id) {
             if ($exp_id != "" && !preg_match("/^([a-zA-Z]+)[0-9a-zA-Z_]*\$/", trim($exp_id))) {
                 $ok = false;
             }
         }
     }
     if (!$ok) {
         ilUtil::sendFailure($lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " . $lng->txt("cont_exp_ids_not_resp_format3") . " " . $lng->txt("cont_exp_ids_not_resp_format2"));
         $this->showExportIDsOverview(true);
         return;
     }
     if (is_array($_POST["exportid"])) {
         foreach ($_POST["exportid"] as $pg_id => $exp_id) {
             ilLMPageObject::saveExportId($this->object->getId(), $pg_id, ilUtil::stripSlashes($exp_id), ilLMObject::_lookupType($pg_id));
         }
     }
     ilUtil::sendSuccess($lng->txt("cont_saved_export_ids"), true);
     $ilCtrl->redirect($this, "showExportIdsOverview");
 }
예제 #2
0
 /**
  * copy page
  */
 function copy($a_target_lm)
 {
     // copy page
     $lm_page = new ilLMPageObject($a_target_lm);
     $lm_page->setTitle($this->getTitle());
     $lm_page->setLayout($this->getLayout());
     $lm_page->setLMId($a_target_lm->getId());
     $lm_page->setType($this->getType());
     $lm_page->setDescription($this->getDescription());
     $lm_page->setImportId("il__pg_" . $this->getId());
     $lm_page->create(true);
     // setting "upload" flag to true prevents creating of meta data
     // check whether export id already exists in the target lm
     $del_exp_id = false;
     $exp_id = ilLMPageObject::getExportId($this->getLMId(), $this->getId());
     if (trim($exp_id) != "") {
         if (ilLMPageObject::existsExportID($a_target_lm->getId(), $exp_id)) {
             $del_exp_id = true;
         }
     }
     // copy meta data
     include_once "Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
     $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->getType());
     // check whether export id already exists in the target lm
     if ($del_exp_id) {
         ilLMPageObject::saveExportId($a_target_lm->getId(), $lm_page->getId(), "");
     } else {
         ilLMPageObject::saveExportId($a_target_lm->getId(), $lm_page->getId(), trim($exp_id));
     }
     // copy page content and activation
     $page = $lm_page->getPageObject();
     $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
     /*$page->setXMLContent($this->page_object->copyXMLContent());
     		$page->setActive($this->page_object->getActive());
     		$page->setActivationStart($this->page_object->getActivationStart());
     		$page->setActivationEnd($this->page_object->getActivationEnd());
     		$page->buildDom();
     		$page->update();*/
     $lm_page->read();
     // this gets the updated page object into lm page
     // copy translations
     include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
     ilLMObjTranslation::copy($this->getId(), $lm_page->getId());
     return $lm_page;
 }