ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCategoryImporter Class Reference

folder xml importer More...

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

Public Member Functions

 init ()
 Init. More...
 
 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

return

Reimplemented from ilXmlImporter.

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

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 {
106 ilObjTaxonomy::saveUsage($tid, $new);
107 }
108 }
109 }
110 }
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.

References ilObjTaxonomy\saveUsage().

+ Here is the call graph for this function:

◆ importXmlRepresentation()

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

Import XML.

Parameters

return

Reimplemented from ilXmlImporter.

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

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(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 }
Class ilObjCategory.
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
static _lookupType($a_id, $a_reference=false)
lookup object type
SaxParserException thrown by ilSaxParser if property throwException is set.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

+ Here is the call graph for this function:

◆ init()

ilCategoryImporter::init ( )

Init.

Reimplemented from ilXmlImporter.

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: