ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilWebResourceImporter.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 $webl = 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->link = ilObjectFactory::getInstanceByObjId($new_id,false);
36  }
37  else
38  {
39  include_once './Modules/WebResource/classes/class.ilObjLinkResource.php';
40  $this->link = new ilObjLinkResource();
41  $this->link->setType('webr');
42  $this->link->create(true);
43  }
44 
45  try
46  {
47  include_once './Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
48  $parser = new ilWebLinkXmlParser($this->link,$a_xml);
49  $parser->setMode(ilWebLinkXmlParser::MODE_CREATE);
50  $parser->start();
51  $a_mapping->addMapping('Modules/WebResource','webr',$a_id,$this->link->getId());
52  }
53  catch(ilSaxParserException $e)
54  {
55  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
56  }
57  catch(ilWebLinkXMLParserException $e)
58  {
59  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
60  }
61  }
62 }