ILIAS  release_8 Revision v8.24
class.ilLearningSequenceExporter.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22{
25
26 public function init(): void
27 {
28 global $DIC;
29
30 $this->settings = $DIC["ilSetting"];
31 $this->rbac_review = $DIC["rbacreview"];
32 }
33
34 public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
35 {
36 $writer = $this->getWriter((int) $a_id);
37 $writer->start();
38
39 return $writer->getXml();
40 }
41
42 protected function getWriter(int $obj_id): ilLearningSequenceXMLWriter
43 {
44 if ($type = ilObject::_lookupType($obj_id) != "lso") {
45 throw new Exception("Wrong type " . $type . " for lso export.");
46 }
47
48 $ref_ids = ilObject::_getAllReferences($obj_id);
49 $ls_ref_id = end($ref_ids);
50
52 $ls_object = ilObjectFactory::getInstanceByRefId($ls_ref_id, false);
53 if (!$ls_object) {
54 throw new Exception("Object for ref id " . $ls_ref_id . " not found.");
55 }
56
57 $lp_settings = new ilLPObjSettings($obj_id);
58
60 $ls_object,
61 $this->settings,
62 $lp_settings,
63 $this->rbac_review
64 );
65 }
66
67 public function getValidSchemaVersions(string $a_entity): array
68 {
69 return array(
70 "5.4.0" => array(
71 "namespace" => "http://www.ilias.de/Modules/LearningSequence/lso/5_4",
72 "xsd_file" => "ilias_lso_5_4.xsd",
73 "uses_dataset" => false,
74 "min" => "5.4.0",
75 "max" => ""
76 )
77 );
78 }
79
80 public function getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids): array
81 {
82 return array(
83 array(
84 'component' => 'Services/Container',
85 'entity' => 'struct',
86 'ids' => $a_ids
87 )
88 );
89 }
90
94 public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
95 {
96 $res = [];
97
98 if ($a_entity == "lso") {
99 // service settings
100 $res[] = array(
101 "component" => "Services/Object",
102 "entity" => "common",
103 "ids" => $a_ids
104 );
105 }
106
107 return $res;
108 }
109}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get head dependencies.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.array array of array with keys "component", entity", "ids"
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$type