ILIAS  release_8 Revision v8.23
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)

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

References $id, ilXmlImporter\exportedFromSameInstallation(), ilImportMapping\getMapping(), ilImportMapping\getMappingsOfEntity(), ilObjTaxonomy\saveUsage(), and ilGlossaryAdvMetaDataAdapter\writeColumnOrder().

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

◆ importXmlRepresentation()

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

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

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

40  : void {
41  if ($a_entity == "glo") {
42  // case i container
43  if ($new_id = $a_mapping->getMapping('Services/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  }
Manifest parser for ILIAS standard export files.
getMapping(string $a_comp, string $a_entity, string $a_old_id)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ init()

ilGlossaryImporter::init ( )

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

References ilXmlImporter\getImport().

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