27 include_once(
"./Services/Export/classes/class.ilImportMapping.php");
29 $this->mapping->setTagetId($a_target_id);
48 $this->entity_types = $a_val;
58 return $this->entity_types;
68 $this->current_dataset = $a_val;
78 return $this->current_dataset;
105 final public function importObject($a_new_obj, $a_tmp_file, $a_filename, $a_type)
112 $dir = $tmpdir.
"/".substr($a_filename, 0, strlen($a_filename) - 4);
114 $GLOBALS[
'ilLog']->write(__METHOD__.
': do import with dir '.
$dir);
131 global $objDefinition,
$tpl;
133 $comp = $objDefinition->getComponentForType($a_type);
134 $class = $objDefinition->getClassName($a_type);
142 include_once(
"./Services/Export/classes/class.ilManifestParser.php");
144 $this->mapping->setInstallUrl($parser->getInstallUrl());
145 $this->mapping->setInstallId($parser->getInstallId());
148 $expfiles = $parser->getExportFiles();
150 include_once(
"./Services/Export/classes/class.ilExportFileParser.php");
151 $all_importers = array();
152 foreach ($expfiles as $expfile)
154 $comp = $expfile[
"component"];
155 $comp_arr = explode(
"/", $comp);
156 $import_class_file =
"./".$comp.
"/classes/class.il".$comp_arr[1].
"Importer.php";
157 $class =
"il".$comp_arr[1].
"Importer";
158 include_once($import_class_file);
159 $this->importer =
new $class();
160 $all_importers[] = $this->importer;
161 $this->importer->setImportDirectory(
$dir);
162 $this->importer->init();
165 $this,
"processItemXml");
169 foreach ($all_importers as $imp)
171 $imp->finalProcessing($this->mapping);
175 $top_mapping = $this->mapping->getMappingsOfEntity($this->comp, $a_type);
176 $new_id = (int) current($top_mapping);
186 function processItemXml($a_entity, $a_schema_version, $a_id, $a_xml,$a_install_id, $a_install_url)
188 global $objDefinition;
192 $GLOBALS[
'ilLog']->write(__METHOD__.
': Ignoring referenced '.$a_entity.
' with id '.$a_id);
195 $this->importer->setInstallId($a_install_id);
196 $this->importer->setInstallUrl($a_install_url);
197 $this->importer->setSchemaVersion($a_schema_version);
199 $new_id = $this->importer->importXmlRepresentation($a_entity, $a_id, $a_xml, $this->mapping);
202 if($objDefinition->isRBACObject($a_entity))
204 $this->
getMapping()->addMapping(
'Services/Container',
'imported', $a_id, 1);
210 $this->mapping->addMapping($this->comp ,$a_entity, $a_id, $new_id);