コード例 #1
0
 /**
  * @param string          $a_entity
  * @param                 $a_types
  * @param array           $a_rec
  * @param ilImportMapping $a_mapping
  * @param string          $a_schema_version
  */
 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     global $ilDB;
     switch ($a_entity) {
         case 'bibl':
             $new_obj = new ilObjBibliographic();
             $new_obj->setTitle($a_rec['title']);
             $new_obj->setDescription($a_rec['description']);
             $new_obj->setFilename($a_rec['fileName']);
             $new_obj->setOnline(false);
             $new_obj->create();
             $this->import_bib_object = $new_obj;
             $a_mapping->addMapping('Modules/Bibliographic', 'bibl', $a_rec['id'], $new_obj->getId());
             $this->importLibraryFile($a_mapping);
             break;
     }
 }
コード例 #2
0
 /**
  * Called before finishing import. Fix references inside DataCollections
  *
  * @param ilImportMapping $a_mapping
  */
 public function beforeFinishImport(ilImportMapping $a_mapping)
 {
     foreach ($this->import_temp_new_mob_ids as $new_mob_id) {
         ilObjMediaObject::_saveUsage($new_mob_id, "dcl:html", $a_mapping->getTargetId());
     }
     foreach ($this->import_temp_refs as $record_field_id => $old_record_id) {
         $new_record_id = $a_mapping->getMapping('Modules/DataCollection', 'il_dcl_record', $old_record_id);
         $value = $new_record_id ? (int) $new_record_id : NULL;
         /** @var ilDataCollectionRecordField $record_field */
         $record_field = $this->import_record_field_cache[$record_field_id];
         $record_field->setValue($value, true);
         $record_field->doUpdate();
     }
     foreach ($this->import_temp_refs_props as $field_prop_id => $old_field_id) {
         $new_field_id = $a_mapping->getMapping('Modules/DataCollection', 'il_dcl_field', $old_field_id);
         $value = $new_field_id ? (int) $new_field_id : NULL;
         $field_prop = new ilDataCollectionFieldProp($field_prop_id);
         $field_prop->setValue($value);
         $field_prop->doUpdate();
     }
 }