/** * 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 "news": $mob_id = null; if ($a_rec["MobId"] > 0) { $mob_id = $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]); } $c = (int) $a_rec["ContextObjId"] . ":" . $a_rec["ContextObjType"] . ":" . (int) $a_rec["ContextSubObjId"] . ":" . $a_rec["ContextSubObjType"]; $context = $a_mapping->getMapping("Services/News", "news_context", $c); $context = explode(":", $context); //var_dump($c); //var_dump($a_mapping->mappings["Services/News"]["news_context"]); include_once "./Services/News/classes/class.ilNewsItem.php"; $newObj = new ilNewsItem(); $newObj->setTitle($a_rec["Title"]); $newObj->setContent($a_rec["Content"]); $newObj->setPriority($a_rec["Priority"]); $newObj->setContextObjId($context[0]); $newObj->setContextObjType($context[1]); $newObj->setContextSubObjId($context[2]); $newObj->setContextSubObjType($context[3]); $newObj->setContentType($a_rec["ContentType"]); $newObj->setVisibility($a_rec["Visibility"]); $newObj->setContentLong($a_rec["ContentLong"]); $newObj->setContentIsLangVar($a_rec["ContentIsLangVar"]); $newObj->setMobId($mob_id); $newObj->setPlaytime($a_rec["Playtime"]); $newObj->create(); $a_mapping->addMapping("Services/News", "news", $a_rec["Id"], $newObj->getId()); break; } }