ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilWebResourceImporter Class Reference
+ 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

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

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

Constructor & Destructor Documentation

◆ __construct()

ilWebResourceImporter::__construct ( )

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

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

31  {
32  global $DIC;
33 
35  $this->logger = $DIC->logger()->webr();
36  }
global $DIC
Definition: shib_login.php:26
__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 41 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.

46  : void {
47  if ($new_id = $a_mapping->getMapping(
48  'components/ILIAS/Container',
49  'objs',
50  $a_id
51  )) {
52  $this->link = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
53  if (!$this->link instanceof ilObjLinkResource) {
54  throw new ilObjectNotFoundException(
55  'Invalid id given ' . $a_id
56  );
57  }
58  } else {
59  $this->link = new ilObjLinkResource();
60  $this->link->setType('webr');
61  $this->link->create();
62  }
63 
64  try {
65  $parser = new ilWebLinkXmlParser($this->link, $a_xml);
66  $parser->setMode(ilWebLinkXmlParser::MODE_CREATE);
67  $parser->start();
68  $a_mapping->addMapping(
69  'components/ILIAS/WebResource',
70  'webr',
71  $a_id,
72  (string) $this->link->getId()
73  );
74 
75  $a_mapping->addMapping(
76  'components/ILIAS/MetaData',
77  'md',
78  $a_id . ':0:webr',
79  $this->link->getId() . ':0:webr'
80  );
81  } catch (ilSaxParserException $e) {
82  $this->logger->error(
83  ': Parsing failed with message, "' . $e->getMessage() . '".'
84  );
85  } catch (ilWebLinkXMLParserException $e) {
86  $this->logger->error(
87  ': Parsing failed with message, "' . $e->getMessage() . '".'
88  );
89  }
90  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
+ Here is the call graph for this function:

Field Documentation

◆ $link

ilObjLinkResource ilWebResourceImporter::$link = null
protected

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

◆ $logger

ilLogger ilWebResourceImporter::$logger
protected

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


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