/** * Clone * * @access public * @param int target id * @param int copy id * */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilDB, $ilLog; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); $fb = $this->getFeedBlock(); include_once "./Services/Block/classes/class.ilExternalFeedBlock.php"; $new_feed_block = new ilExternalFeedBlock(); $new_feed_block->setContextObjId($new_obj->getId()); $new_feed_block->setContextObjType("feed"); if (is_object($fb)) { $new_feed_block->setFeedUrl($fb->getFeedUrl()); $new_feed_block->setTitle($fb->getTitle()); } $new_feed_block->create(); return $new_obj; }
/** * Import record * * @param * @return */ function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version) { //echo $a_entity; //var_dump($a_rec); switch ($a_entity) { case "feed": include_once "./Modules/ExternalFeed/classes/class.ilObjExternalFeed.php"; if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) { $newObj = ilObjectFactory::getInstanceByObjId($new_id, false); } else { $newObj = new ilObjExternalFeed(); $newObj->setType("feed"); $newObj->create(true); } $newObj->setTitle($a_rec["Title"]); $newObj->setDescription($a_rec["Url"]); $newObj->update(); $this->current_obj = $newObj; $a_mapping->addMapping("Modules/ExternalFeed", "feed", $a_rec["Id"], $newObj->getId()); // create the feed block include_once "./Services/Block/classes/class.ilExternalFeedBlock.php"; $fb = new ilExternalFeedBlock(); $fb->setTitle($a_rec["Title"]); $fb->setFeedUrl($a_rec["Url"]); $fb->setContextObjId($newObj->getId()); $fb->setContextObjType("feed"); $fb->create(); break; } }