ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilWebResourceImporter Class Reference

Webresource xml importer. More...

+ Inheritance diagram for ilWebResourceImporter:
+ Collaboration diagram for ilWebResourceImporter:

Public Member Functions

 __construct ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Protected Attributes

ilObjLinkResource $link = null
 
ilLogger $logger
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Detailed Description

Webresource xml importer.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om \

Definition at line 26 of file class.ilWebResourceImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebResourceImporter::__construct ( )

Definition at line 32 of file class.ilWebResourceImporter.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\logger().

33  {
34  global $DIC;
35 
37  $this->logger = $DIC->logger()->webr();
38  }
global $DIC
Definition: shib_login.php:25
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ importXmlRepresentation()

ilWebResourceImporter::importXmlRepresentation ( string  $a_entity,
string  $a_id,
string  $a_xml,
ilImportMapping  $a_mapping 
)

Definition at line 43 of file class.ilWebResourceImporter.php.

References Vendor\Package\$e, ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), ILIAS\Repository\link(), ILIAS\Repository\logger(), and ilWebLinkXmlParser\MODE_CREATE.

48  : void {
49  if ($new_id = $a_mapping->getMapping(
50  'components/ILIAS/Container',
51  'objs',
52  $a_id
53  )) {
54  $this->link = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
55  if (!$this->link instanceof ilObjLinkResource) {
56  throw new ilObjectNotFoundException(
57  'Invalid id given ' . $a_id
58  );
59  }
60  } else {
61  $this->link = new ilObjLinkResource();
62  $this->link->setType('webr');
63  $this->link->create(true);
64  }
65 
66  try {
67  $parser = new ilWebLinkXmlParser($this->link, $a_xml);
68  $parser->setMode(ilWebLinkXmlParser::MODE_CREATE);
69  $parser->start();
70  $a_mapping->addMapping(
71  'components/ILIAS/WebResource',
72  'webr',
73  $a_id,
74  (string) $this->link->getId()
75  );
76 
77  $a_mapping->addMapping(
78  'components/ILIAS/MetaData',
79  'md',
80  $a_id . ':0:webr',
81  $this->link->getId() . ':0:webr'
82  );
83  } catch (ilSaxParserException $e) {
84  $this->logger->error(
85  ': Parsing failed with message, "' . $e->getMessage() . '".'
86  );
87  } catch (ilWebLinkXMLParserException $e) {
88  $this->logger->error(
89  ': Parsing failed with message, "' . $e->getMessage() . '".'
90  );
91  }
92  }
XML parser for weblink xml.
SaxParserException thrown by ilSaxParser if property throwException is set.
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
link(string $caption, string $href, bool $new_viewport=false)
Class ilObjLinkResource.
+ Here is the call graph for this function:

Field Documentation

◆ $link

ilObjLinkResource ilWebResourceImporter::$link = null
protected

Definition at line 28 of file class.ilWebResourceImporter.php.

◆ $logger

ilLogger ilWebResourceImporter::$logger
protected

Definition at line 30 of file class.ilWebResourceImporter.php.


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