ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilTestImporter Class Reference
+ Inheritance diagram for ilTestImporter:
+ Collaboration diagram for ilTestImporter:

Public Member Functions

 __construct ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Protected Attributes

readonly ImportSessionRepository $session
 
readonly TestImporter $importer
 
readonly ilTestLegacyImporter $legacy_importer
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Private Member Functions

 finalizeTaxonomyUsage (ilImportMapping $a_mapping)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestImporter::__construct ( )

Reimplemented from ilXmlImporter.

Definition at line 33 of file class.ilTestImporter.php.

34 {
36
37 $local_dic = TestDIC::dic();
38 $this->session = $local_dic['exportimport.session'];
39 $this->importer = $local_dic['exportimport.importer'];
40
41 $this->legacy_importer = new ilTestLegacyImporter();
42 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ finalizeTaxonomyUsage()

ilTestImporter::finalizeTaxonomyUsage ( ilImportMapping  $a_mapping)
private

Definition at line 94 of file class.ilTestImporter.php.

94 : void
95 {
96 $tst_mappings = $a_mapping->getMappingsOfEntity('components/ILIAS/Test', 'tst');
97
98 foreach ($tst_mappings as $old => $new) {
99 if ($old === 'new_id' || (int) $old <= 0) {
100 continue;
101 }
102
103 $new_tax_ids = $a_mapping->getMapping(
104 'components/ILIAS/Taxonomy',
105 'tax_usage_of_obj',
106 (string) $old
107 );
108
109 if ($new_tax_ids !== null) {
110 $tax_ids = explode(':', $new_tax_ids);
111 foreach ($tax_ids as $tid) {
112 ilObjTaxonomy::saveUsage((int) $tid, (int) $new);
113 }
114 }
115 }
116 }
getMapping(string $a_comp, string $a_entity, string $a_old_id)
getMappingsOfEntity(string $a_comp, string $a_entity)
static saveUsage(int $a_tax_id, int $a_obj_id)

References ilImportMapping\getMapping(), ilImportMapping\getMappingsOfEntity(), and ilObjTaxonomy\saveUsage().

+ Here is the call graph for this function:

◆ finalProcessing()

ilTestImporter::finalProcessing ( ilImportMapping  $a_mapping)

Reimplemented from ilXmlImporter.

Definition at line 81 of file class.ilTestImporter.php.

81 : void
82 {
83 // Check if forward to legacy importer is needed
84 $session = $this->session->getSession();
85 if ($session->isLegacyImport()) {
86 $this->legacy_importer->finalProcessing($a_mapping);
87 return;
88 }
89
90 $this->importer->finalize($a_mapping);
91 $this->finalizeTaxonomyUsage($a_mapping);
92 }
finalizeTaxonomyUsage(ilImportMapping $a_mapping)
readonly ImportSessionRepository $session

◆ importXmlRepresentation()

ilTestImporter::importXmlRepresentation ( string  $a_entity,
string  $a_id,
string  $a_xml,
ilImportMapping  $a_mapping 
)

Reimplemented from ilXmlImporter.

Definition at line 55 of file class.ilTestImporter.php.

60 : void {
61 // Check if forward to legacy importer is needed
62 $session = $this->session->getSession();
63 if ($session->isLegacyImport()) {
64 $this->legacy_importer->setInstallId($this->getInstallId());
65 $this->legacy_importer->setInstallUrl($this->getInstallUrl());
66 $this->legacy_importer->setSchemaVersion($this->getSchemaVersion());
67 $this->legacy_importer->setSkipEntities($this->getSkipEntities());
68 $this->legacy_importer->importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping);
69 return;
70 }
71
72 $result = $this->importer->import(
73 XmlDeserializer::fromString($a_xml),
74 $a_mapping,
75 new ReferenceId($a_mapping->getTargetId()),
77 );
78 $this->session->setSession($result);
79 }

References ilXmlImporter\getInstallId(), ilXmlImporter\getInstallUrl(), ilXmlImporter\getSchemaVersion(), and ilXmlImporter\getSkipEntities().

+ Here is the call graph for this function:

Field Documentation

◆ $importer

readonly TestImporter ilTestImporter::$importer
protected

Definition at line 30 of file class.ilTestImporter.php.

◆ $legacy_importer

readonly ilTestLegacyImporter ilTestImporter::$legacy_importer
protected

Definition at line 31 of file class.ilTestImporter.php.

◆ $session

readonly ImportSessionRepository ilTestImporter::$session
protected

Definition at line 29 of file class.ilTestImporter.php.


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