/** * Clone container settings * * @access public * @param int target ref_id * @param int copy id * @return object new object */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilLog; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sorting = new ilContainerSortingSettings($new_obj->getId()); $sorting->setSortMode($this->getOrderType()); $sorting->update(); // copy content page // $ilLog->write("copy container, lookup page"); include_once "./Services/Container/classes/class.ilContainerPage.php"; if (ilContainerPage::_exists("cont", $this->getId())) { //$ilLog->write("...page found"); $orig_page = new ilContainerPage($this->getId()); $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId()); /*$new_page_object = new ilContainerPage(); $new_page_object->setParentId($new_obj->getId()); $new_page_object->setId($new_obj->getId()); $new_page_object->createFromXML(); $new_page_object->setXMLContent($orig_page->getXMLContent()); $new_page_object->buildDom(true); $new_page_object->update();*/ //$ilLog->write("...copy ml"); // copy (page) multilang settings /*include_once("./Services/COPage/classes/class.ilPageMultiLang.php"); $ml = new ilPageMultiLang("cont", $this->getId()); $ml->copy("cont", $new_obj->getId());*/ } return $new_obj; }
/** * Clone container settings * * @access public * @param int target ref_id * @param int copy id * @return object new object */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilLog; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); include_once './Services/Container/classes/class.ilContainerSortingSettings.php'; $sorting = new ilContainerSortingSettings($new_obj->getId()); $sorting->setSortMode($this->getOrderType()); $sorting->update(); // copy content page include_once "./Services/Container/classes/class.ilContainerPage.php"; if (ilContainerPage::_exists("cont", $this->getId())) { $orig_page = new ilContainerPage($this->getId()); $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId()); } // #10271 - copy start objects page include_once "./Services/Container/classes/class.ilContainerStartObjectsPage.php"; if (ilContainerStartObjectsPage::_exists("cstr", $this->getId())) { $orig_page = new ilContainerStartObjectsPage($this->getId()); $orig_page->copy($new_obj->getId(), "cstr", $new_obj->getId()); } // #10271 foreach (self::_getContainerSettings($this->getId()) as $keyword => $value) { self::_writeContainerSetting($new_obj->getId(), $keyword, $value); // copy custom icons if ($keyword == "icon_custom" && $value) { // see saveIcons() $new_obj->createContainerDirectory(); $tgt_dir = $new_obj->getContainerDirectory(); $src_dir = $this->getContainerDirectory(); $file = "icon_custom.svg"; $src_file = $src_dir . "/" . $file; if (file_exists($src_file)) { copy($src_file, $tgt_dir . "/" . $file); } } } return $new_obj; }