ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilImportContainer Class Reference

Import class. More...

+ Inheritance diagram for ilImportContainer:
+ Collaboration diagram for ilImportContainer:

Public Member Functions

 __construct (int $a_target_id)
 
- Public Member Functions inherited from ilImport
 __construct (int $a_target_id=0)
 
 getConfig (string $a_comp)
 Get configuration (note that configurations are optional, null may be returned!) More...
 
 getMapping ()
 
 setEntityTypes (array $a_val)
 
 getEntityTypes ()
 
 addSkipEntity (string $a_component, string $a_entity, bool $skip=true)
 Add skip entity. More...
 
 addSkipImporter (string $a_component, bool $skip=true)
 
 importEntity (string $a_tmp_file, string $a_filename, string $a_entity, string $a_component, bool $a_copy_file=false)
 Import entity. More...
 
 importObject (?object $a_new_obj, string $a_tmp_file, string $a_filename, string $a_type, string $a_comp="", bool $a_copy_file=false)
 
 importFromDirectory (string $dir, string $a_type, string $a_comp)
 
 getTemporaryImportDir ()
 Get temporary import directory. More...
 
 processItemXml (string $a_entity, string $a_schema_version, string $a_id, string $a_xml, string $a_install_id, string $a_install_url)
 Process item xml. More...
 

Protected Member Functions

 doImportObject (string $dir, string $a_type, string $a_component="", string $a_tmpdir="")
 Import repository object export file. More...
 
 createDummy (string $a_type)
 
- Protected Member Functions inherited from ilImport
 validateXMLFiles (SplFileInfo $manifest_spl)
 
 checkStatuses (ilImportStatusHandlerCollectionInterface $import_status_collection)
 
 setTemporaryImportDir (string $a_val)
 Set temporary import directory. More...
 
 doImportObject (string $dir, string $a_type, string $a_component="", string $a_tmpdir="")
 Import repository object export file. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilImport
ilLogger $log
 
ilObjectDefinition $objDefinition
 
array $entity_types = []
 
ilXmlImporter $importer = null
 
string $comp = ''
 
string $current_comp = ''
 
string $entities = ""
 
string $tmp_import_dir = ""
 
ilImportMapping $mapping = null
 
array $skip_entity = array()
 
array $configs = array()
 
array $skip_importer = []
 
Archives $archives
 
Filesystems $filesystem
 
ilImportFactory $import
 
ilImportStatusFactory $import_status
 

Detailed Description

Import class.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 25 of file class.ilImportContainer.php.

Constructor & Destructor Documentation

◆ __construct()

ilImportContainer::__construct ( int  $a_target_id)

Reimplemented from ilImport.

Definition at line 27 of file class.ilImportContainer.php.

28 {
29 parent::__construct($a_target_id);
30 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ createDummy()

ilImportContainer::createDummy ( string  $a_type)
protected

Definition at line 73 of file class.ilImportContainer.php.

73 : ilObject
74 {
75 $class_name = "ilObj" . $this->objDefinition->getClassName($a_type);
76
77 $new = new $class_name();
78 $new->setTitle('Import');
79 $new->create(true);
80 $new->createReference();
81 $new->putInTree($this->getMapping()->getTargetId());
82 $new->setPermissions($this->getMapping()->getTargetId());
83
84 $this->getMapping()->addMapping('components/ILIAS/Container', 'objs', '0', (string) $new->getId());
85 $this->getMapping()->addMapping('components/ILIAS/Container', 'refs', '0', (string) $new->getRefId());
86
87 return $new;
88 }
Class ilObject Basic functions for all objects.

◆ doImportObject()

ilImportContainer::doImportObject ( string  $dir,
string  $a_type,
string  $a_component = "",
string  $a_tmpdir = "" 
)
protected

Import repository object export file.

Reimplemented from ilImport.

Definition at line 32 of file class.ilImportContainer.php.

37 : array {
38 $manifest_file = $dir . "/manifest.xml";
39 if (!file_exists($manifest_file)) {
40 return [];
41 }
42 $parser = new ilManifestParser($manifest_file);
43
44 // Handling single containers without subitems
45 // @todo: check if this is required
46 // all container have container export sets
47 $all_importers = array();
48 if (!$parser->getExportSets()) {
49 $this->createDummy($a_type);
50 $import_info = parent::doImportObject($dir, $a_type);
51 $all_importers = array_merge($all_importers, $import_info['importers']);
52 return $import_info;
53 }
54
55 // Handling containers with subitems
56 $first = true;
57 $ret = [];
58 foreach ($parser->getExportSets() as $set) {
59 $import_info = parent::doImportObject($dir . DIRECTORY_SEPARATOR . $set['path'], $set['type']);
60 $all_importers = array_merge($all_importers, $import_info['importers']);
61 if ($first) {
62 $ret = $import_info;
63 $first = false;
64 }
65 }
66 // after container import is finished, call all importers to perform a final processing
67 foreach ($all_importers as $importer) {
69 }
70 return $ret;
71 }
ilXmlImporter $importer
Manifest parser for ILIAS standard export files.
afterContainerImportProcessing(ilImportMapping $mapping)

The documentation for this class was generated from the following file: