ILIAS  release_4-4 Revision
ilCategoryImporter Class Reference

folder xml importer More...

+ Inheritance diagram for ilCategoryImporter:
+ Collaboration diagram for ilCategoryImporter:

Public Member Functions

 init ()
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 

Private Attributes

 $category = null
 

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 

Detailed Description

folder xml importer

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

Definition at line 15 of file class.ilCategoryImporter.php.

Member Function Documentation

◆ importXmlRepresentation()

ilCategoryImporter::importXmlRepresentation (   $a_entity,
  $a_id,
  $a_xml,
  $a_mapping 
)

Import XML.

Parameters

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

References $GLOBALS, ilObject\_getAllReferences(), ilObjectFactory\getInstanceByRefId(), and ilCategoryXmlParser\MODE_UPDATE.

31  {
32  include_once './Modules/Category/classes/class.ilObjCategory.php';
33  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_id))
34  {
35  $refs = ilObject::_getAllReferences($new_id);
36  $this->category = ilObjectFactory::getInstanceByRefId(end($refs),false);
37  }
38  // Mapping for containers without subitems
39  elseif($new_id = $a_mapping->getMapping('Services/Container','refs',0))
40  {
41  $this->category = ilObjectFactory::getInstanceByRefId($new_id,false);
42  }
43  elseif(!$this->category instanceof ilObjCategory)
44  {
45  $this->category = new ilObjCategory();
46  $this->category->create(true);
47  }
48 
49  include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
50 
51  try
52  {
53  $parser = new ilCategoryXmlParser($a_xml,0);
54  $parser->setCategory($this->category);
55  $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
56  $parser->startParsing();
57  $a_mapping->addMapping('Modules/Category','cat',$a_id,$this->category->getId());
58  }
59  catch(ilSaxParserException $e)
60  {
61  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
62  }
63  catch(Excpetion $e)
64  {
65  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
66  }
67  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
SaxParserException thrown by ilSaxParser if property throwException is set.
static _getAllReferences($a_id)
get all reference ids of object
$GLOBALS['ct_recipient']
Class ilObjCategory.
+ Here is the call graph for this function:

◆ init()

ilCategoryImporter::init ( )

Definition at line 20 of file class.ilCategoryImporter.php.

21  {
22  }

Field Documentation

◆ $category

ilCategoryImporter::$category = null
private

Definition at line 17 of file class.ilCategoryImporter.php.


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