Import class.
More...
|
| __construct ($a_target_id=0) |
| Constructor. More...
|
|
| getMapping () |
| Get mapping object. More...
|
|
| setEntityTypes ($a_val) |
| Set entity types. More...
|
|
| getEntityTypes () |
| Get entity types. More...
|
|
| addSkipEntity ($a_component, $a_entity, $skip=true) |
| Add skip entity. More...
|
|
| setCurrentDataset ($a_val) |
| Set currrent dataset. More...
|
|
| getCurrentDataset () |
| Get currrent dataset. More...
|
|
| afterEntityTypes () |
| After entity types are parsed. More...
|
|
| importRecord ($a_entity, $a_types, $a_record) |
| After entity types are parsed. More...
|
|
| importEntity ($a_tmp_file, $a_filename, $a_entity, $a_component, $a_copy_file=false) |
| Import entity. More...
|
|
| importObject ($a_new_obj, $a_tmp_file, $a_filename, $a_type, $a_comp="", $a_copy_file=false) |
| Import repository object export file. More...
|
|
| processItemXml ($a_entity, $a_schema_version, $a_id, $a_xml, $a_install_id, $a_install_url) |
| Process item xml. More...
|
|
|
| doImportObject ($dir, $a_type, $a_component="", $a_tmpdir="") |
| Import repository object export file. More...
|
|
Import class.
- Author
- Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
- Version
- $Id$
Definition at line 11 of file class.ilImport.php.
◆ __construct()
ilImport::__construct |
( |
|
$a_target_id = 0 | ) |
|
Constructor.
- Parameters
-
int | id of parent container |
- Returns
Definition at line 26 of file class.ilImport.php.
28 include_once(
"./Services/Export/classes/class.ilImportMapping.php");
30 $this->mapping->setTagetId($a_target_id);
◆ addSkipEntity()
ilImport::addSkipEntity |
( |
|
$a_component, |
|
|
|
$a_entity, |
|
|
|
$skip = true |
|
) |
| |
Add skip entity.
- Parameters
-
string | $a_val | component |
string | $a_val | entity |
Definition at line 68 of file class.ilImport.php.
70 $this->skip_entity[$a_component][$a_entity] = $skip;
◆ afterEntityTypes()
ilImport::afterEntityTypes |
( |
| ) |
|
◆ doImportObject()
ilImport::doImportObject |
( |
|
$dir, |
|
|
|
$a_type, |
|
|
|
$a_component = "" , |
|
|
|
$a_tmpdir = "" |
|
) |
| |
|
protected |
Import repository object export file.
- Parameters
-
string | absolute filename of temporary upload file |
Definition at line 160 of file class.ilImport.php.
References $GLOBALS, $success, and $tpl.
Referenced by importObject().
162 global $objDefinition,
$tpl;
164 if ($a_component ==
"")
166 $comp = $objDefinition->getComponentForType($a_type);
167 $class = $objDefinition->getClassName($a_type);
171 $comp = $a_component;
172 $c = explode(
"/", $comp);
173 $class = $c[count($c) - 1];
182 include_once(
"./Services/Export/classes/class.ilManifestParser.php");
183 if (!is_file($dir.
"/manifest.xml"))
185 include_once(
"./Services/Export/exceptions/class.ilManifestFileNotFoundImportException.php");
187 $e->setManifestDir($dir);
188 $e->setTmpDir($a_tmpdir);
192 $this->mapping->setInstallUrl($parser->getInstallUrl());
193 $this->mapping->setInstallId($parser->getInstallId());
196 $expfiles = $parser->getExportFiles();
198 include_once(
"./Services/Export/classes/class.ilExportFileParser.php");
199 $all_importers = array();
200 foreach ($expfiles as $expfile)
202 $comp = $expfile[
"component"];
203 $comp_arr = explode(
"/", $comp);
204 $import_class_file =
"./".$comp.
"/classes/class.il".$comp_arr[1].
"Importer.php";
205 $class =
"il".$comp_arr[1].
"Importer";
206 include_once($import_class_file);
207 $this->importer =
new $class();
208 $all_importers[] = $this->importer;
209 $this->importer->setImportDirectory($dir);
210 $this->importer->init();
211 $this->current_comp = $comp;
218 $GLOBALS[
'ilLog']->write(__METHOD__.
': Import failed with message: '.$e->getMessage());
219 #$GLOBALS['ilLog']->write(__METHOD__.': '.file_get_contents($dir.'/'.$expfile['path'])); 225 foreach ($all_importers as $imp)
227 $imp->finalProcessing($this->mapping);
231 $top_mapping = $this->mapping->getMappingsOfEntity($this->comp, $a_type);
232 $new_id = (int) current($top_mapping);
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
manifest.xml file not found-exception for import
Manifest parser for ILIAS standard export files.
◆ getCurrentDataset()
ilImport::getCurrentDataset |
( |
| ) |
|
◆ getEntityTypes()
ilImport::getEntityTypes |
( |
| ) |
|
|
final |
Get entity types.
- Returns
- array entity types
Definition at line 57 of file class.ilImport.php.
59 return $this->entity_types;
◆ getMapping()
◆ importEntity()
ilImport::importEntity |
( |
|
$a_tmp_file, |
|
|
|
$a_filename, |
|
|
|
$a_entity, |
|
|
|
$a_component, |
|
|
|
$a_copy_file = false |
|
) |
| |
|
final |
Import entity.
Definition at line 116 of file class.ilImport.php.
References importObject().
119 $this->
importObject(null, $a_tmp_file, $a_filename, $a_entity, $a_component, $a_copy_file);
importObject($a_new_obj, $a_tmp_file, $a_filename, $a_type, $a_comp="", $a_copy_file=false)
Import repository object export file.
◆ importObject()
ilImport::importObject |
( |
|
$a_new_obj, |
|
|
|
$a_tmp_file, |
|
|
|
$a_filename, |
|
|
|
$a_type, |
|
|
|
$a_comp = "" , |
|
|
|
$a_copy_file = false |
|
) |
| |
|
final |
Import repository object export file.
- Parameters
-
string | absolute filename of temporary upload file |
Definition at line 128 of file class.ilImport.php.
References $GLOBALS, ilUtil\delDir(), doImportObject(), ilUtil\ilTempnam(), ilUtil\makeDir(), ilUtil\moveUploadedFile(), and ilUtil\unzip().
Referenced by importEntity().
136 copy($a_tmp_file, $tmpdir.
"/".$a_filename);
143 $dir = $tmpdir.
"/".substr($a_filename, 0, strlen($a_filename) - 4);
145 $GLOBALS[
'ilLog']->write(__METHOD__.
': do import with dir '.$dir);
doImportObject($dir, $a_type, $a_component="", $a_tmpdir="")
Import repository object export file.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
◆ importRecord()
ilImport::importRecord |
( |
|
$a_entity, |
|
|
|
$a_types, |
|
|
|
$a_record |
|
) |
| |
◆ processItemXml()
ilImport::processItemXml |
( |
|
$a_entity, |
|
|
|
$a_schema_version, |
|
|
|
$a_id, |
|
|
|
$a_xml, |
|
|
|
$a_install_id, |
|
|
|
$a_install_url |
|
) |
| |
Process item xml.
ilObjectDefinition $objDefinition
Definition at line 242 of file class.ilImport.php.
References $GLOBALS, and getMapping().
244 global $objDefinition;
247 if ($this->skip_entity[$this->current_comp][$a_entity])
252 if($objDefinition->isRBACObject($a_entity) &&
253 $this->
getMapping()->getMapping(
'Services/Container',
'imported', $a_id))
255 $GLOBALS[
'ilLog']->write(__METHOD__.
': Ignoring referenced '.$a_entity.
' with id '.$a_id);
258 $this->importer->setInstallId($a_install_id);
259 $this->importer->setInstallUrl($a_install_url);
260 $this->importer->setSchemaVersion($a_schema_version);
261 $this->importer->setSkipEntities($this->skip_entity);
262 $new_id = $this->importer->importXmlRepresentation($a_entity, $a_id, $a_xml, $this->mapping);
265 if($objDefinition->isRBACObject($a_entity))
267 $this->
getMapping()->addMapping(
'Services/Container',
'imported', $a_id, 1);
273 $this->mapping->addMapping($this->comp ,$a_entity, $a_id, $new_id);
getMapping()
Get mapping object.
◆ setCurrentDataset()
ilImport::setCurrentDataset |
( |
|
$a_val | ) |
|
Set currrent dataset.
- Parameters
-
Definition at line 78 of file class.ilImport.php.
80 $this->current_dataset = $a_val;
◆ setEntityTypes()
ilImport::setEntityTypes |
( |
|
$a_val | ) |
|
|
final |
Set entity types.
- Parameters
-
Definition at line 47 of file class.ilImport.php.
49 $this->entity_types = $a_val;
◆ $entities
◆ $install_id
ilImport::$install_id = "" |
|
protected |
◆ $install_url
ilImport::$install_url = "" |
|
protected |
◆ $mapping
ilImport::$mapping = null |
|
protected |
◆ $skip_entity
ilImport::$skip_entity = array() |
|
protected |
The documentation for this class was generated from the following file: