ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilFolderImporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Export/classes/class.ilXmlImporter.php");
5 
16 {
17  private $folder = null;
18 
19 
20  public function init()
21  {
22  }
23 
30  function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
31  {
32  include_once './Modules/Folder/classes/class.ilObjFolder.php';
33  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_id))
34  {
35  $this->folder = ilObjectFactory::getInstanceByObjId($new_id,false);
36  }
37  elseif($new_id = $a_mapping->getMapping('Services/Container','refs',0))
38  {
39  $this->folder = ilObjectFactory::getInstanceByRefId($new_id,false);
40  }
41  elseif(!$this->folder instanceof ilObjFolder)
42  {
43  $this->folder = new ilObjFolder();
44  $this->folder->create(true);
45  }
46 
47  include_once './Modules/Folder/classes/class.ilFolderXmlParser.php';
48  #$GLOBALS['ilLog']->write($a_xml);
49 
50  try
51  {
52  $parser = new ilFolderXmlParser($this->folder,$a_xml);
53  $parser->start();
54  $a_mapping->addMapping('Modules/Folder','fold',$a_id,$this->folder->getId());
55  }
56  catch(ilSaxParserException $e)
57  {
58  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
59  }
60  catch(ilWebLinkXMLParserException $e)
61  {
62  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
63  }
64  }
65 }
66 ?>