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

Public Member Functions

 __construct ()
 
 init ()
 
 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 QuestionPoolImporter $importer
 
readonly ilTestQuestionPoolLegacyImporter $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.ilTestQuestionPoolImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionPoolImporter::__construct ( )

Reimplemented from ilXmlImporter.

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

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

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ finalizeTaxonomyUsage()

ilTestQuestionPoolImporter::finalizeTaxonomyUsage ( ilImportMapping  $a_mapping)
private

Definition at line 89 of file class.ilTestQuestionPoolImporter.php.

89 : void
90 {
91 $qpl_mappings = $a_mapping->getMappingsOfEntity('components/ILIAS/TestQuestionPool', 'qpl');
92
93 foreach ($qpl_mappings as $old => $new) {
94 if ($old === 'new_id' || (int) $old <= 0) {
95 continue;
96 }
97
98 $new_tax_ids = $a_mapping->getMapping(
99 'components/ILIAS/Taxonomy',
100 'tax_usage_of_obj',
101 (string) $old
102 );
103
104 if ($new_tax_ids === null) {
105 continue;
106 }
107
108 $tax_ids = explode(':', $new_tax_ids);
109 foreach ($tax_ids as $tid) {
110 ilObjTaxonomy::saveUsage((int) $tid, (int) $new);
111 }
112 }
113 }
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()

ilTestQuestionPoolImporter::finalProcessing ( ilImportMapping  $a_mapping)

Reimplemented from ilXmlImporter.

Definition at line 76 of file class.ilTestQuestionPoolImporter.php.

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

◆ importXmlRepresentation()

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

Reimplemented from ilXmlImporter.

Definition at line 50 of file class.ilTestQuestionPoolImporter.php.

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

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

+ Here is the call graph for this function:

◆ init()

ilTestQuestionPoolImporter::init ( )

Reimplemented from ilXmlImporter.

Definition at line 43 of file class.ilTestQuestionPoolImporter.php.

43 : void
44 {
45 $this->legacy_importer->setImport($this->getImport());
46 $this->legacy_importer->setImportDirectory($this->getImportDirectory());
47 $this->legacy_importer->init();
48 }

References ilXmlImporter\getImport(), and ilXmlImporter\getImportDirectory().

+ Here is the call graph for this function:

Field Documentation

◆ $importer

readonly QuestionPoolImporter ilTestQuestionPoolImporter::$importer
protected

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

◆ $legacy_importer

readonly ilTestQuestionPoolLegacyImporter ilTestQuestionPoolImporter::$legacy_importer
protected

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

◆ $session

readonly ImportSessionRepository ilTestQuestionPoolImporter::$session
protected

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


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