ILIAS  release_8 Revision v8.24
class.ilExerciseExporter.php
Go to the documentation of this file.
1<?php
2
25{
27
28 public function init(): void
29 {
30 $this->ds = new ilExerciseDataSet();
31 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
32 $this->ds->setDSPrefix("ds");
33 }
34
42 public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
43 {
44 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
45 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
46 }
47
53 public function getValidSchemaVersions(string $a_entity): array
54 {
55 return array(
56 "4.1.0" => array(
57 "namespace" => "https://www.ilias.de/Modules/Exercise/exc/4_1",
58 "xsd_file" => "ilias_exc_4_1.xsd",
59 "uses_dataset" => true,
60 "min" => "4.1.0",
61 "max" => "4.3.99"),
62 "4.4.0" => array(
63 "namespace" => "https://www.ilias.de/Modules/Exercise/exc/4_4",
64 "xsd_file" => "ilias_exc_4_4.xsd",
65 "uses_dataset" => true,
66 "min" => "4.4.0",
67 "max" => "4.4.99"),
68 "5.0.0" => array(
69 "namespace" => "https://www.ilias.de/Modules/Exercise/exc/5_0",
70 "xsd_file" => "ilias_exc_5_0.xsd",
71 "uses_dataset" => true,
72 "min" => "5.0.0",
73 "max" => "5.0.99"),
74 "5.1.0" => array(
75 "namespace" => "https://www.ilias.de/Modules/Exercise/exc/5_1",
76 "xsd_file" => "ilias_exc_5_1.xsd",
77 "uses_dataset" => true,
78 "min" => "5.1.0",
79 "max" => "5.1.99"),
80 "5.2.0" => array(
81 "namespace" => "https://www.ilias.de/Modules/Exercise/exc/5_2",
82 "xsd_file" => "ilias_exc_5_2.xsd",
83 "uses_dataset" => true,
84 "min" => "5.2.0",
85 "max" => "5.2.99"),
86 "5.3.0" => array(
87 "namespace" => "https://www.ilias.de/Modules/Exercise/exc/5_3",
88 "xsd_file" => "ilias_exc_5_3.xsd",
89 "uses_dataset" => true,
90 "min" => "5.3.0",
91 "max" => "")
92 );
93 }
94
95 public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
96 {
97 $deps = [];
98
99 if ($a_entity == "exc") {
100 // service settings
101 $deps[] = array(
102 "component" => "Services/Object",
103 "entity" => "common",
104 "ids" => $a_ids
105 );
106
107 $advmd_ids = array();
108 foreach ($a_ids as $id) {
109 $rec_ids = $this->getActiveAdvMDRecords($id);
110 foreach ($rec_ids as $rec_id) {
111 $advmd_ids[] = $id . ":" . $rec_id;
112 }
113 }
114
115 if ($advmd_ids !== []) {
116 $deps[] = array(
117 "component" => "Services/AdvancedMetaData",
118 "entity" => "advmd",
119 "ids" => $advmd_ids
120 );
121 }
122
123 $md_ids = array();
124 foreach ($a_ids as $exc_id) {
125 $md_ids[] = $exc_id . ":0:exc";
126 }
127 if ($md_ids !== []) {
128 $deps[] =
129 array(
130 "component" => "Services/MetaData",
131 "entity" => "md",
132 "ids" => $md_ids
133 );
134 }
135
136 // service settings
137 $deps[] = array(
138 "component" => "Services/Object",
139 "entity" => "service_settings",
140 "ids" => $a_ids
141 );
142 }
143
144 return $deps;
145 }
146
150 protected function getActiveAdvMDRecords($a_id): array
151 {
152 $active = array();
153
154 foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType("exc") as $record_obj) {
155 foreach ($record_obj->getAssignedObjectTypes() as $obj_info) {
156 if ($obj_info['obj_type'] == 'exc' && $obj_info['optional'] == 0) {
157 $active[] = $record_obj->getRecordId();
158 }
159 // local activation
160 if (
161 $obj_info['obj_type'] == 'exc' &&
162 $obj_info['optional'] == 1 &&
163 $a_id == $record_obj->getParentObject()
164 ) {
165 $active[] = $record_obj->getRecordId();
166 }
167 }
168 }
169
170 return $active;
171 }
172}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.
Exercise data set class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
Get xml representation.
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...