ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilGroupImporter.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 $group = 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/Group/classes/class.ilObjGroup.php';
33  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
34  $refs = ilObject::_getAllReferences($new_id);
35  $this->group = ilObjectFactory::getInstanceByRefId(end($refs), false);
36  #$this->group = ilObjectFactory::getInstanceByObjId($new_id,false);
37  }
38  // Mapping for containers without subitems
39  elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
40  $this->group = ilObjectFactory::getInstanceByRefId($new_id, false);
41  } elseif (!$this->group instanceof ilObjGroup) {
42  $this->group = new ilObjGroup();
43  $this->group->create(true);
44  }
45 
46  include_once './Modules/Group/classes/class.ilGroupXMLParser.php';
47  #$GLOBALS['DIC']['ilLog']->write($a_xml);
48 
49  try {
50  $parser = new ilGroupXMLParser($this->group, $a_xml, 0);
52  $parser->startParsing();
53  $a_mapping->addMapping('Modules/Group', 'grp', $a_id, $this->group->getId());
54  } catch (ilSaxParserException $e) {
55  $GLOBALS['DIC']->logger()->grp()->warning('Parsing failed with message, "' . $e->getMessage() . '".');
56  } catch (ilWebLinkXMLParserException $e) {
57  $GLOBALS['DIC']->logger()->grp()->warning('Parsing failed with message, "' . $e->getMessage() . '".');
58  }
59  }
60 }
SaxParserException thrown by ilSaxParser if property throwException is set.
static _getAllReferences($a_id)
get all reference ids of object
folder xml importer
$parser
Definition: BPMN2Parser.php:23
Group Import Parser.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjGroup.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
Xml importer class.