ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCategoryExporter Class Reference

Class for category export. 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
ilExport $exp
 

Detailed Description

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  "9.0.0" => [
100  'namespace' => 'https://www.ilias.de/Modules/Category/cat/9_0',
101  'xsd_file' => 'ilias_cat_9_0.xsd',
102  'uses_dataset' => false,
103  'min' => '9.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' => 'components/ILIAS/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" => "components/ILIAS/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  }
Class for category export.
static _getAllReferences(int $id)
get all reference ids for object ID
$GLOBALS["DIC"]
Definition: wac.php:53
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjCategory.
+ 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: