/**
  * 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;
 }
 /**
  * copy chapter
  */
 function copy($a_target_lm)
 {
     $chap = new ilStructureObject($a_target_lm);
     $chap->setTitle($this->getTitle());
     if ($this->getLMId() != $a_target_lm->getId()) {
         $chap->setImportId("il__st_" . $this->getId());
     }
     $chap->setLMId($a_target_lm->getId());
     $chap->setType($this->getType());
     $chap->setDescription($this->getDescription());
     $chap->create(true);
     $a_copied_nodes[$this->getId()] = $chap->getId();
     // 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(), $chap->getId(), $this->getType());
     // copy translations
     include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php";
     ilLMObjTranslation::copy($this->getId(), $chap->getId());
     return $chap;
 }