ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilGlossaryImporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Export/classes/class.ilXmlImporter.php");
5 
14 {
21  function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
22  {
23  // case i container
24  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_id))
25  {
26  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
27 
28  $xml_file = $this->getImportDirectory().'/'.basename($this->getImportDirectory()).'.xml';
29  $GLOBALS['ilLog']->write(__METHOD__.': Using XML file '.$xml_file);
30 
31  }
32  else // case ii, non container
33  {
34  // Shouldn't happen
35  $GLOBALS['ilLog']->write(__METHOD__.': Called in non container mode');
36  $GLOBALS['ilLog']->logStack();
37  return false;
38  }
39 
40  if(!file_exists($xml_file))
41  {
42  $GLOBALS['ilLog']->write(__METHOD__.': ERROR Cannot find '.$xml_file);
43  return false;
44  }
45 
46  include_once './Modules/LearningModule/classes/class.ilContObjParser.php';
47  $contParser = new ilContObjParser(
48  $newObj,
49  $xml_file,
50  dirname($this->getImportDirectory())
51  );
52 
53  $contParser->startParsing();
54  ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
55 
56  $a_mapping->addMapping("Modules/Glossary", "glo", $a_id, $newObj->getId());
57  }
58 }
59 ?>