ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4include_once("./Services/Export/classes/class.ilXmlImporter.php");
5
16{
17 private $webl = null;
18
19
20 public function init()
21 {
22 }
23
30 public 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 $this->link = ilObjectFactory::getInstanceByObjId($new_id, false);
35 } else {
36 include_once './Modules/WebResource/classes/class.ilObjLinkResource.php';
37 $this->link = new ilObjLinkResource();
38 $this->link->setType('webr');
39 $this->link->create(true);
40 }
41
42 try {
43 include_once './Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
44 $parser = new ilWebLinkXmlParser($this->link, $a_xml);
45 $parser->setMode(ilWebLinkXmlParser::MODE_CREATE);
46 $parser->start();
47 $a_mapping->addMapping('Modules/WebResource', 'webr', $a_id, $this->link->getId());
48 } catch (ilSaxParserException $e) {
49 $GLOBALS['DIC']->logger()->webr()->error(': Parsing failed with message, "' . $e->getMessage() . '".');
50 } catch (ilWebLinkXMLParserException $e) {
51 $GLOBALS['DIC']->logger()->error(': Parsing failed with message, "' . $e->getMessage() . '".');
52 }
53 }
54}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
Class ilObjLinkResource.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
SaxParserException thrown by ilSaxParser if property throwException is set.
XML parser for weblink xml.
Webresource xml importer.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
Xml importer class.