Ejemplo n.º 1
0
 /**
  * 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 "wiki":
             include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
             if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
                 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
             } else {
                 $newObj = new ilObjWiki();
                 $newObj->setType("wiki");
                 $newObj->create(true);
             }
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->setShortTitle($a_rec["Short"]);
             $newObj->setStartPage($a_rec["StartPage"]);
             $newObj->setRatingOverall($a_rec["RatingOverall"]);
             $newObj->setRating($a_rec["Rating"]);
             $newObj->setIntroduction($a_rec["Introduction"]);
             $newObj->setPublicNotes($a_rec["PublicNotes"]);
             // >= 4.3
             if (isset($a_rec["PageToc"])) {
                 // $newObj->setImportantPages($a_rec["ImpPages"]);
                 $newObj->setPageToc($a_rec["PageToc"]);
                 $newObj->setRatingAsBlock($a_rec["RatingSide"]);
                 $newObj->setRatingForNewPages($a_rec["RatingNew"]);
                 $newObj->setRatingCategories($a_rec["RatingExt"]);
             }
             $newObj->update(true);
             $this->current_obj = $newObj;
             $a_mapping->addMapping("Modules/Wiki", "wiki", $a_rec["Id"], $newObj->getId());
             $a_mapping->addMapping("Services/Rating", "rating_category_parent_id", $a_rec["Id"], $newObj->getId());
             $a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_rec["Id"], $newObj->getId());
             break;
         case "wpg":
             $wiki_id = $a_mapping->getMapping("Modules/Wiki", "wiki", $a_rec["WikiId"]);
             include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
             $wpage = new ilWikiPage();
             $wpage->setWikiId($wiki_id);
             $wpage->setTitle($a_rec["Title"]);
             // >= 4.3
             if (isset($a_rec["Blocked"])) {
                 $wpage->setBlocked($a_rec["Blocked"]);
                 $wpage->setRating($a_rec["Rating"]);
             }
             $wpage->create(true);
             $a_mapping->addMapping("Modules/Wiki", "wpg", $a_rec["Id"], $wpage->getId());
             $a_mapping->addMapping("Services/COPage", "pg", "wpg:" . $a_rec["Id"], "wpg:" . $wpage->getId());
             $a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item", "advmd:wpg:" . $a_rec["Id"], $wpage->getId());
             break;
     }
 }