ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  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  {
35  $refs = ilObject::_getAllReferences($new_id);
36  $this->group = ilObjectFactory::getInstanceByRefId(end($refs),false);
37  #$this->group = ilObjectFactory::getInstanceByObjId($new_id,false);
38  }
39  // Mapping for containers without subitems
40  elseif($new_id = $a_mapping->getMapping('Services/Container','refs',0))
41  {
42  $this->group = ilObjectFactory::getInstanceByRefId($new_id,false);
43  }
44  elseif(!$this->group instanceof ilObjGroup)
45  {
46  $this->group = new ilObjGroup();
47  $this->group->create(true);
48  }
49 
50  include_once './Modules/Group/classes/class.ilGroupXMLParser.php';
51  #$GLOBALS['ilLog']->write($a_xml);
52 
53  try
54  {
55  $parser = new ilGroupXMLParser($a_xml,0);
56  $parser->setGroup($this->group);
58  $parser->startParsing();
59  $a_mapping->addMapping('Modules/Group','grp',$a_id,$this->group->getId());
60  }
61  catch(ilSaxParserException $e)
62  {
63  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
64  }
65  catch(ilWebLinkXMLParserException $e)
66  {
67  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
68  }
69  }
70 }
71 ?>
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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:24
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.
Xml importer class.