ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCategoryImporter Class Reference

folder xml importer More...

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

Public Member Functions

 init ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Private Attributes

ilObject $category = null
 

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Detailed Description

folder xml importer

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

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

Member Function Documentation

◆ finalProcessing()

ilCategoryImporter::finalProcessing ( ilImportMapping  $a_mapping)

Reimplemented from ilXmlImporter.

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

91 : void {
92 $maps = $a_mapping->getMappingsOfEntity("components/ILIAS/Category", "cat");
93 foreach ($maps as $old => $new) {
94 if ($old !== "new_id" && (int) $old > 0) {
95 // get all new taxonomys of this object
96 $new_tax_ids = $a_mapping->getMapping("components/ILIAS/Taxonomy", "tax_usage_of_obj", (string) $old);
97 $tax_ids = explode(":", (string) $new_tax_ids);
98 foreach ($tax_ids as $tid) {
99 ilObjTaxonomy::saveUsage((int) $tid, (int) $new);
100 }
101 }
102 }
103 }
getMapping(string $a_comp, string $a_entity, string $a_old_id)
getMappingsOfEntity(string $a_comp, string $a_entity)
static saveUsage(int $a_tax_id, int $a_obj_id)

References ilImportMapping\getMapping(), and ilObjTaxonomy\saveUsage().

+ Here is the call graph for this function:

◆ importXmlRepresentation()

ilCategoryImporter::importXmlRepresentation ( string  $a_entity,
string  $a_id,
string  $a_xml,
ilImportMapping  $a_mapping 
)
Exceptions
ilDatabaseException
ilObjectNotFoundException

Reimplemented from ilXmlImporter.

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

43 : void {
44 if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
45 $refs = ilObject::_getAllReferences((int) $new_id);
46 $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
47 }
48 // Mapping for containers without subitems
49 elseif ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'refs', '0')) {
50 $this->category = ilObjectFactory::getInstanceByRefId((int) $new_id, false);
51 } elseif (!$this->category instanceof ilObjCategory) {
52 $this->category = new ilObjCategory();
53 $this->category->create();
54 }
55
56 try {
57 $parser = new ilCategoryXmlParser($a_xml, 0);
58 $parser->setCategory($this->category);
59 $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
60 $parser->startParsing();
61 $a_mapping->addMapping('components/ILIAS/Category', 'cat', $a_id, (string) $this->category->getId());
62 } catch (ilSaxParserException | Exception $e) {
63 $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
64 }
65
66 foreach ($a_mapping->getMappingsOfEntity('components/ILIAS/Container', 'objs') as $old => $new) {
67 $type = ilObject::_lookupType((int) $new);
68
69 // see ilGlossaryImporter::importXmlRepresentation()
70 // see ilTaxonomyDataSet::importRecord()
71
72 $a_mapping->addMapping(
73 "components/ILIAS/Taxonomy",
74 "tax_item",
75 $type . ":obj:" . $old,
76 $new
77 );
78
79 // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
80 $a_mapping->addMapping(
81 "components/ILIAS/Taxonomy",
82 "tax_item_obj_id",
83 $type . ":obj:" . $old,
84 $new
85 );
86 }
87 }
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
Class ilObjCategory.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$GLOBALS["DIC"]
Definition: wac.php:54

References ilObject\_getAllReferences(), and ilObjectFactory\getInstanceByRefId().

+ Here is the call graph for this function:

◆ init()

ilCategoryImporter::init ( )

Reimplemented from ilXmlImporter.

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

30 : void
31 {
32 }

Field Documentation

◆ $category

ilObject ilCategoryImporter::$category = null
private

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


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