ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilGlossaryImporter Class Reference

Importer class for files. More...

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

Public Member Functions

 init ()
 Initialisation. More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 
 $imp
 

Detailed Description

Importer class for files.

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

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

Member Function Documentation

◆ finalProcessing()

ilGlossaryImporter::finalProcessing (   $a_mapping)

Final processing.

Parameters

return

Reimplemented from ilXmlImporter.

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

113 {
114//echo "<pre>".print_r($a_mapping, true)."</pre>"; exit;
115 // get all glossaries of the import
116 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
117 $maps = $a_mapping->getMappingsOfEntity("Modules/Glossary", "glo");
118 foreach ($maps as $old => $new)
119 {
120 if ($old != "new_id" && (int) $old > 0)
121 {
122 // get all new taxonomys of this object
123 $new_tax_ids = $a_mapping->getMapping("Services/Taxonomy", "tax_usage_of_obj", $old);
124 if($new_tax_ids !== false)
125 {
126 $tax_ids = explode(":", $new_tax_ids);
127 foreach ($tax_ids as $tid)
128 {
129 ilObjTaxonomy::saveUsage($tid, $new);
130 }
131 }
132
133 // advmd column order
134 if ($this->exportedFromSameInstallation())
135 {
136 include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
137 $advmdco = $a_mapping->getMappingsOfEntity("Modules/Glossary", "advmd_col_order");
138 foreach ($advmdco as $id => $order)
139 {
140 $id = explode(":", $id);
141 $field_glo_id = $id[0];
142 $field_id = $id[1];
143 if ($field_glo_id == $old)
144 {
145 // #17454
146 $new_local_id = $a_mapping->getMapping("Services/AdvancedMetaData", "lfld", $field_id);
147 if($new_local_id)
148 {
149 $field_id = $new_local_id;
150 }
151 ilGlossaryAdvMetaDataAdapter::writeColumnOrder($new, $field_id, $order);
152 }
153 }
154 }
155 }
156 }
157 }
static writeColumnOrder($a_glo_id, $a_field_id, $a_order_nr)
Write single column order.
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
exportedFromSameInstallation()
Is exporting and importing installation identical?

References ilXmlImporter\exportedFromSameInstallation(), ilObjTaxonomy\saveUsage(), and ilGlossaryAdvMetaDataAdapter\writeColumnOrder().

+ Here is the call graph for this function:

◆ importXmlRepresentation()

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

Import XML.

Parameters

return

Reimplemented from ilXmlImporter.

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

33 {
34 if ($a_entity == "glo")
35 {
36 // case i container
37 if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_id))
38 {
39 $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
40 }
41
42 // in the new version (5.1) we are also here, but the following file should not exist
43 // if being exported with 5.1 or higher
44 $xml_file = $this->getImportDirectory().'/'.basename($this->getImportDirectory()).'.xml';
45 $GLOBALS['ilLog']->write(__METHOD__.': Using XML file '.$xml_file);
46
47 // old school import
48 if (file_exists($xml_file))
49 {
50 if (!is_object($newObj))
51 {
52 // create and insert object in objecttree
53 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
54 $newObj = new ilObjGlossary();
55 $newObj->setType("glo");
56 $newObj->setTitle(basename($this->getImportDirectory()));
57 $newObj->create(true);
58 }
59
60 include_once './Modules/LearningModule/classes/class.ilContObjParser.php';
61 $contParser = new ilContObjParser(
62 $newObj,
63 $xml_file,
64 basename($this->getImportDirectory())
65 );
66
67 $contParser->startParsing();
68
69 ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
70
71 // write term map for taxonomies to mapping object
72 $term_map = $contParser->getGlossaryTermMap();
73 foreach ($term_map as $k => $v)
74 {
75 $a_mapping->addMapping("Services/Taxonomy", "tax_item",
76 "glo:term:".$k, $v);
77
78 // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
79 $a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id",
80 "glo:term:".$k, $newObj->getId());
81
82 $a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item",
83 "advmd:term:".$k, $v);
84 }
85
86 $a_mapping->addMapping("Modules/Glossary", "glo", $a_id, $newObj->getId());
87 $a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_id, $newObj->getId());
88
89 $this->current_glo = $newObj;
90 }
91 else
92 {
93 // necessary?
94 // ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
95 include_once("./Services/DataSet/classes/class.ilDataSetImportParser.php");
96 $parser = new ilDataSetImportParser($a_entity, $this->getSchemaVersion(),
97 $a_xml, $this->ds, $a_mapping);
98
99 // in the new version the mapping above is done in the dataset
100 }
101
102
103 }
104 }
Content Object Parser.
Manifest parser for ILIAS standard export files.
Class ilObjGlossary.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
_writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, ilObject\_writeImportId(), ilXmlImporter\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), and ilXmlImporter\getSchemaVersion().

+ Here is the call graph for this function:

◆ init()

ilGlossaryImporter::init ( )

Initialisation.

Reimplemented from ilXmlImporter.

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

19 {
20 include_once("./Modules/Glossary/classes/class.ilGlossaryDataSet.php");
21 $this->ds = new ilGlossaryDataSet();
22 $this->ds->setDSPrefix("ds");
23 $this->config = $this->getImport()->getConfig("Modules/Glossary");
24 }
Glossary Data set class.
getImport()
Get import.

References ilXmlImporter\getImport().

+ Here is the call graph for this function:

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