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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilGlossaryImporter:
+ Collaboration diagram for ilGlossaryImporter:

Public Member Functions

 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

ilImportConfig $config
 
ilGlossaryDataSet $ds
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Importer class for files

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

Definition at line 23 of file class.ilGlossaryImporter.php.

Member Function Documentation

◆ finalProcessing()

ilGlossaryImporter::finalProcessing ( ilImportMapping  $a_mapping)

Reimplemented from ilXmlImporter.

Definition at line 71 of file class.ilGlossaryImporter.php.

73 : void {
74 // get all glossaries of the import
75 $maps = $a_mapping->getMappingsOfEntity("components/ILIAS/Glossary", "glo");
76 foreach ($maps as $old => $new) {
77 if ($old != "new_id" && (int) $old > 0) {
78 // get all new taxonomys of this object
79 $new_tax_ids = $a_mapping->getMapping("components/ILIAS/Taxonomy", "tax_usage_of_obj", $old);
80 if (!is_null($new_tax_ids)) {
81 $tax_ids = explode(":", $new_tax_ids);
82 foreach ($tax_ids as $tid) {
83 ilObjTaxonomy::saveUsage((int) $tid, (int) $new);
84 }
85 }
86
87 // advmd column order
88 if ($this->exportedFromSameInstallation()) {
89 $advmdco = $a_mapping->getMappingsOfEntity("components/ILIAS/Glossary", "advmd_col_order");
90 foreach ($advmdco as $id => $order) {
91 $id = explode(":", $id);
92 $field_glo_id = $id[0];
93 $field_id = $id[1];
94 if ($field_glo_id == $old) {
95 // #17454
96 $new_local_id = $a_mapping->getMapping("components/ILIAS/AdvancedMetaData", "lfld", $field_id);
97 if ($new_local_id) {
98 $field_id = $new_local_id;
99 }
100 ilGlossaryAdvMetaDataAdapter::writeColumnOrder((int) $new, (int) $field_id, (int) $order);
101 }
102 }
103 }
104 }
105 }
106 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static writeColumnOrder(int $a_glo_id, int $a_field_id, int $a_order_nr)
Write single column order.
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 $id, ilImportMapping\getMapping(), ilImportMapping\getMappingsOfEntity(), ilObjTaxonomy\saveUsage(), and ilGlossaryAdvMetaDataAdapter\writeColumnOrder().

+ Here is the call graph for this function:

◆ importXmlRepresentation()

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

Reimplemented from ilXmlImporter.

Definition at line 35 of file class.ilGlossaryImporter.php.

40 : void {
41 if ($a_entity == "glo") {
42 // case i container
43 if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
44 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
45 }
46
47 // in the new version (5.1) we are also here, but the following file should not exist
48 // if being exported with 5.1 or higher
49 $xml_file = $this->getImportDirectory() . '/' . basename($this->getImportDirectory()) . '.xml';
50 $GLOBALS['ilLog']->write(__METHOD__ . ': Using XML file ' . $xml_file);
51
52 // old school import
53 if (file_exists($xml_file)) {
54 throw new ilGlossaryOldImportException("This glossary seems to be from ILIAS version 5.0.x or lower. Import is not supported anymore.");
55 } else {
56 // necessary?
57 // ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
58 $parser = new ilDataSetImportParser(
59 $a_entity,
60 $this->getSchemaVersion(),
61 $a_xml,
62 $this->ds,
63 $a_mapping
64 );
65
66 // in the new version the mapping above is done in the dataset
67 }
68 }
69 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, ilXmlImporter\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), and ilXmlImporter\getSchemaVersion().

+ Here is the call graph for this function:

◆ init()

ilGlossaryImporter::init ( )

Reimplemented from ilXmlImporter.

Definition at line 28 of file class.ilGlossaryImporter.php.

28 : void
29 {
30 $this->ds = new ilGlossaryDataSet();
31 $this->ds->setDSPrefix("ds");
32 $this->config = $this->getImport()->getConfig("components/ILIAS/Glossary");
33 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilXmlImporter\getImport().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilImportConfig ilGlossaryImporter::$config
protected

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

◆ $ds

ilGlossaryDataSet ilGlossaryImporter::$ds
protected

Definition at line 26 of file class.ilGlossaryImporter.php.


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