ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 88 of file class.ilCategoryImporter.php.

References ilObjTaxonomy\saveUsage().

89  {
90  //echo "<pre>".print_r($a_mapping, true)."</pre>"; exit;
91  // get all categories of the import
92  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
93  $maps = $a_mapping->getMappingsOfEntity("Modules/Category", "cat");
94  foreach ($maps as $old => $new) {
95  if ($old != "new_id" && (int) $old > 0) {
96  // get all new taxonomys of this object
97  $new_tax_ids = $a_mapping->getMapping("Services/Taxonomy", "tax_usage_of_obj", $old);
98  $tax_ids = explode(":", $new_tax_ids);
99  foreach ($tax_ids as $tid) {
100  ilObjTaxonomy::saveUsage($tid, $new);
101  }
102  }
103  }
104  }
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, $parser, $type, 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  $refs = ilObject::_getAllReferences($new_id);
35  $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
36  }
37  // Mapping for containers without subitems
38  elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
39  $this->category = ilObjectFactory::getInstanceByRefId($new_id, false);
40  } elseif (!$this->category instanceof ilObjCategory) {
41  $this->category = new ilObjCategory();
42  $this->category->create(true);
43  }
44 
45  include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
46 
47  try {
48  $parser = new ilCategoryXmlParser($a_xml, 0);
49  $parser->setCategory($this->category);
51  $parser->startParsing();
52  $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId());
53  } catch (ilSaxParserException $e) {
54  $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
55  } catch (Exception $e) {
56  $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
57  }
58 
59  foreach ($a_mapping->getMappingsOfEntity('Services/Container', 'objs') as $old => $new) {
61 
62  // see ilGlossaryImporter::importXmlRepresentation()
63  // see ilTaxonomyDataSet::importRecord()
64 
65  $a_mapping->addMapping(
66  "Services/Taxonomy",
67  "tax_item",
68  $type . ":obj:" . $old,
69  $new
70  );
71 
72  // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
73  $a_mapping->addMapping(
74  "Services/Taxonomy",
75  "tax_item_obj_id",
76  $type . ":obj:" . $old,
77  $new
78  );
79  }
80  }
$type
SaxParserException thrown by ilSaxParser if property throwException is set.
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Class ilObjCategory.
$parser
Definition: BPMN2Parser.php:23
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ 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: