ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
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...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. 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...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Private Attributes

 $category = null
 

Additional Inherited Members

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

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

◆ finalProcessing()

ilCategoryImporter::finalProcessing (   $a_mapping)

Final processing.

Parameters

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

References $new, $old, and ilObjTaxonomy\saveUsage().

92  {
93 //echo "<pre>".print_r($a_mapping, true)."</pre>"; exit;
94  // get all categories of the import
95  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
96  $maps = $a_mapping->getMappingsOfEntity("Modules/Category", "cat");
97  foreach ($maps as $old => $new)
98  {
99  if ($old != "new_id" && (int) $old > 0)
100  {
101  // get all new taxonomys of this object
102  $new_tax_ids = $a_mapping->getMapping("Services/Taxonomy", "tax_usage_of_obj", $old);
103  $tax_ids = explode(":", $new_tax_ids);
104  foreach ($tax_ids as $tid)
105  {
107  }
108  }
109  }
110  }
$old
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
+ Here is the call graph for this function:

◆ 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, $new, $old, $parser, ilObject\_getAllReferences(), ilObject\_lookupType(), 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);
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(Exception $e)
64  {
65  $GLOBALS['ilLog']->write(__METHOD__.': Parsing failed with message, "'.$e->getMessage().'".');
66  }
67 
68  foreach($a_mapping->getMappingsOfEntity('Services/Container', 'objs') as $old => $new)
69  {
70  $type = ilObject::_lookupType($new);
71 
72  // see ilGlossaryImporter::importXmlRepresentation()
73  // see ilTaxonomyDataSet::importRecord()
74 
75  $a_mapping->addMapping("Services/Taxonomy", "tax_item",
76  $type.":obj:".$old, $new);
77 
78  // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
79  $a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id",
80  $type.":obj:".$old, $new);
81 
82  }
83  }
$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
$old
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilObjCategory.
$parser
Definition: BPMN2Parser.php:24
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ 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: