ILIAS  release_8 Revision v8.23
ilCategoryExporter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilCategoryExporter:
+ Collaboration diagram for ilCategoryExporter:

Public Member Functions

 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
 init ()
 Init method. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 
 setExport (ilExport $a_exp)
 
 getExport ()
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 init ()
 
 setExportDirectories (string $a_dir_relative, string $a_dir_absolute)
 
 getRelativeExportDirectory ()
 
 getAbsoluteExportDirectory ()
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion (string $a_entity, string $a_target_release)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory (string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
 
- Protected Attributes inherited from ilXmlExporter
string $dir_relative = ""
 
string $dir_absolute = ""
 
ilExport $exp
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for category export

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Member Function Documentation

◆ getValidSchemaVersions()

ilCategoryExporter::getValidSchemaVersions ( string  $a_entity)

Returns schema versions that the component can export to.

ILIAS chooses the first one, that has min/max constraints which fit to the target release. Please put the newest on top.

Definition at line 96 of file class.ilCategoryExporter.php.

96  : array
97  {
98  return [
99  "7.0.0" => [
100  'namespace' => 'https://www.ilias.de/Modules/Category/cat/7_0',
101  'xsd_file' => 'ilias_cat_7_0.xsd',
102  'uses_dataset' => false,
103  'min' => '7.0',
104  'max' => ''
105  ],
106  "4.3.0" => [
107  "namespace" => "https://www.ilias.de/Modules/Category/cat/4_3",
108  "xsd_file" => "ilias_cat_4_3.xsd",
109  "uses_dataset" => false,
110  "min" => "4.3.0",
111  "max" => ""
112  ]
113  ];
114  }

◆ getXmlExportHeadDependencies()

ilCategoryExporter::getXmlExportHeadDependencies ( string  $a_entity,
string  $a_target_release,
array  $a_ids 
)

Get head dependencies.

Parameters
stringentity
stringtarget release
arrayids
Returns
array array of array with keys "component", entity", "ids"

Definition at line 35 of file class.ilCategoryExporter.php.

35  : array
36  {
37  // always trigger container because of co-page(s)
38  return [
39  [
40  'component' => 'Services/Container',
41  'entity' => 'struct',
42  'ids' => $a_ids
43  ]
44  ];
45  }

◆ getXmlExportTailDependencies()

ilCategoryExporter::getXmlExportTailDependencies ( string  $a_entity,
string  $a_target_release,
array  $a_ids 
)

Definition at line 47 of file class.ilCategoryExporter.php.

References $id, and ilObjTaxonomy\getUsageOfObject().

47  : array
48  {
49  if ($a_entity === "cat") {
50  $tax_ids = [];
51  foreach ($a_ids as $id) {
52  $t_ids = ilObjTaxonomy::getUsageOfObject((int) $id);
53  if (count($t_ids) > 0) {
54  $tax_ids[$t_ids[0]] = $t_ids[0];
55  }
56  }
57 
58  return [
59  [
60  "component" => "Services/Taxonomy",
61  "entity" => "tax",
62  "ids" => $tax_ids
63  ]
64  ];
65  }
66  return [];
67  }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getXmlRepresentation()

ilCategoryExporter::getXmlRepresentation ( string  $a_entity,
string  $a_schema_version,
string  $a_id 
)
Exceptions
ilDatabaseException
ilObjectNotFoundException

Definition at line 73 of file class.ilCategoryExporter.php.

References $GLOBALS, ilObject\_getAllReferences(), ilObjectFactory\getInstanceByRefId(), and ilCategoryXmlWriter\MODE_EXPORT.

73  : string
74  {
75  $all_ref = ilObject::_getAllReferences((int) $a_id);
76  $cat_ref_id = end($all_ref);
77  $category = ilObjectFactory::getInstanceByRefId($cat_ref_id, false);
78 
79  if (!$category instanceof ilObjCategory) {
80  $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type category!');
81  return '';
82  }
83 
84 
85  $writer = new ilCategoryXmlWriter($category);
86  $writer->setMode(ilCategoryXmlWriter::MODE_EXPORT);
87  $writer->export(false);
88  return $writer->getXml();
89  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ init()

ilCategoryExporter::init ( )

Init method.

Definition at line 119 of file class.ilCategoryExporter.php.

119  : void
120  {
121  }

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