ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
4include_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}
$parser
Definition: BPMN2Parser.php:23
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
folder xml importer
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
Group Import Parser.
Class ilObjGroup.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getAllReferences($a_id)
get all reference ids of object
SaxParserException thrown by ilSaxParser if property throwException is set.
Xml importer class.