ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilGlossaryImporter Class Reference

Importer class for files. More...

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

Public Member Functions

 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML.
 finalProcessing ($a_mapping)
 Final processing.
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor.
 init ()
 Init.
 setInstallId ($a_val)
 Set installation id.
 getInstallId ()
 Get installation id.
 setInstallUrl ($a_val)
 Set installation url.
 getInstallUrl ()
 Get installation url.
 setSchemaVersion ($a_val)
 Set schema version.
 getSchemaVersion ()
 Get schema version.
 setImportDirectory ($a_val)
 Set import directory.
 getImportDirectory ()
 Get import directory.
 setSkipEntities ($a_val)
 Set skip entities.
 getSkipEntities ()
 Get skip entities.

Additional Inherited Members

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

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

ilGlossaryImporter::finalProcessing (   $a_mapping)

Final processing.

Parameters
@return

Reimplemented from ilXmlImporter.

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

References ilObjTaxonomy\saveUsage().

{
//echo "<pre>".print_r($a_mapping, true)."</pre>"; exit;
// get all glossaries of the import
include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
$maps = $a_mapping->getMappingsOfEntity("Modules/Glossary", "glo");
foreach ($maps as $old => $new)
{
if ($old != "new_id" && (int) $old > 0)
{
// get all new taxonomys of this object
$new_tax_ids = $a_mapping->getMapping("Services/Taxonomy", "tax_usage_of_obj", $old);
if($new_tax_ids !== false)
{
$tax_ids = explode(":", $new_tax_ids);
foreach ($tax_ids as $tid)
{
}
}
}
}
}

+ Here is the call graph for this function:

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

Import XML.

Parameters
@return

Reimplemented from ilXmlImporter.

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

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

{
if ($a_entity == "glo")
{
// case i container
if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_id))
{
$newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
$xml_file = $this->getImportDirectory().'/'.basename($this->getImportDirectory()).'.xml';
$GLOBALS['ilLog']->write(__METHOD__.': Using XML file '.$xml_file);
}
else if ($new_id = $a_mapping->getMapping('Modules/Glossary','glo', "new_id")) // this mapping is only set by ilObjGlossaryGUI
{
$newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
$xml_file = $this->getImportDirectory().'/'.basename($this->getImportDirectory()).'.xml';
$GLOBALS['ilLog']->write(__METHOD__.': Using XML file '.$xml_file);
}
else
{
// Shouldn't happen
$GLOBALS['ilLog']->write(__METHOD__.': Called in non container mode');
$GLOBALS['ilLog']->logStack();
return false;
}
if(!file_exists($xml_file))
{
$GLOBALS['ilLog']->write(__METHOD__.': ERROR Cannot find '.$xml_file);
return false;
}
include_once './Modules/LearningModule/classes/class.ilContObjParser.php';
$contParser = new ilContObjParser(
$newObj,
$xml_file,
basename($this->getImportDirectory())
);
$contParser->startParsing();
ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
// write term map for taxonomies to mapping object
$term_map = $contParser->getGlossaryTermMap();
foreach ($term_map as $k => $v)
{
$a_mapping->addMapping("Services/Taxonomy", "tax_item",
"glo:term:".$k, $v);
// this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
$a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id",
"glo:term:".$k, $newObj->getId());
$a_mapping->addMapping("Services/AdvancedMetaData", "advmd_sub_item",
"advmd:term:".$k, $v);
}
// ???
$a_mapping->addMapping("Services/Taxonomy", "tax_item",
"glo:term:".$k, $v);
$a_mapping->addMapping("Modules/Glossary", "glo", $a_id, $newObj->getId());
$a_mapping->addMapping("Services/AdvancedMetaData", "parent", $a_id, $newObj->getId());
$this->current_glo = $newObj;
}
}

+ Here is the call graph for this function:


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