ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
class.ilConditionsExporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Conditions\Export\Factory as ConditionExportFactory;
22
24{
25 protected const string ENTITY = 'cond';
26 protected ConditionExportFactory $factory;
27 protected ilTree $tree;
28
29 public function init(): void
30 {
31 global $DIC;
32 $this->factory = new ConditionExportFactory($DIC->database());
33 $this->tree = $DIC->repositoryTree();
34 }
35
36 public function getXmlRepresentation(
37 string $a_entity,
38 string $a_schema_version,
39 string $a_id
40 ): string {
41 if ($a_entity !== self::ENTITY) {
42 return '';
43 }
44 $ref_id = min(ilObject::_getAllReferences((int) $a_id));
45 $obj_ids = [];
46 foreach ($this->tree->getSubTree($this->tree->getNodeData($ref_id)) as $node) {
47 if (((int) $node['obj_id']) === (int) $a_id) {
48 continue;
49 }
50 $obj_ids[] = (int) $node['obj_id'];
51 }
52 $infos = $this->factory->repository()->getInfosByObjectIds($obj_ids);
53 $writer = $this->factory->xmlWriter();
54 $writer->writeAll($infos);
55 return $writer->__toString();
56 }
57
58 public function getValidSchemaVersions(
59 string $a_entity
60 ): array {
61 return [
62 "11.0" => [
63 "namespace" => "http://www.ilias.de/Components/Conditions/cond/11_0",
64 "xsd_file" => "ilias_cond_11_0.xsd",
65 "min" => "11.0",
66 "max" => ""
67 ]
68 ];
69 }
70}
factory()
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
ConditionExportFactory $factory
static _getAllReferences(int $id)
get all reference ids for object ID
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Xml Exporter class.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26