ILIAS  release_8 Revision v8.24
ilLearningModuleExporter 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 ilLearningModuleExporter:
+ Collaboration diagram for ilLearningModuleExporter:

Public Member Functions

 init ()
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 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...
 
- 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)
 

Protected Attributes

ILIAS Style Content DomainService $content_style_domain
 
- Protected Attributes inherited from ilXmlExporter
string $dir_relative = ""
 
string $dir_absolute = ""
 
ilExport $exp
 

Private Attributes

ilLearningModuleDataSet $ds
 
ilExportConfig $config
 

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="")
 

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 Exporter class for html learning modules

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 24 of file class.ilLearningModuleExporter.php.

Member Function Documentation

◆ getValidSchemaVersions()

ilLearningModuleExporter::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. Example: return array ( "4.1.0" => array( "namespace" => "http://www.ilias.de/Services/MetaData/md/4_1", "xsd_file" => "ilias_md_4_1.xsd", "min" => "4.1.0", "max" => "") );

Reimplemented from ilXmlExporter.

Definition at line 175 of file class.ilLearningModuleExporter.php.

177 : array {
178 return array(
179 "8.0" => array(
180 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/8",
181 "xsd_file" => "ilias_lm_8.xsd",
182 "uses_dataset" => true,
183 "min" => "8.0",
184 "max" => ""),
185 "5.4.0" => array(
186 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/5_4",
187 "xsd_file" => "ilias_lm_5_4.xsd",
188 "uses_dataset" => true,
189 "min" => "5.4.0",
190 "max" => "7.99.99"),
191 "5.1.0" => array(
192 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/5_1",
193 "xsd_file" => "ilias_lm_5_1.xsd",
194 "uses_dataset" => true,
195 "min" => "5.1.0",
196 "max" => "5.3.99"),
197 "4.1.0" => array(
198 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/4_1",
199 "xsd_file" => "ilias_lm_4_1.xsd",
200 "uses_dataset" => false,
201 "min" => "4.1.0",
202 "max" => "5.0.99")
203 );
204 }

◆ getXmlExportTailDependencies()

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

Get tail dependencies.

Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

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

51 : array {
52 $deps = array();
53
54 if ($a_entity == "lm") {
55 $md_ids = array();
56
57 // lm related ids
58 foreach ($a_ids as $id) {
59 $md_ids[] = $id . ":0:lm";
60 }
61
62 // chapter related ids
63 foreach ($a_ids as $id) {
64 $chaps = ilLMObject::getObjectList($id, "st");
65 foreach ($chaps as $c) {
66 $md_ids[] = $id . ":" . $c["obj_id"] . ":st";
67 }
68 }
69
70 // page related ids
71 $pg_ids = array();
72 foreach ($a_ids as $id) {
74 foreach ($pages as $p) {
75 $pg_ids[] = "lm:" . $p["obj_id"];
76 $md_ids[] = $id . ":" . $p["obj_id"] . ":pg";
77 }
78 }
79
80 // style, multilang, metadata per page/chap?
81
82 $deps = array(
83 array(
84 "component" => "Services/COPage",
85 "entity" => "pg",
86 "ids" => $pg_ids),
87 array(
88 "component" => "Services/MetaData",
89 "entity" => "md",
90 "ids" => $md_ids),
91 );
92
93 if (!$this->config->getMasterLanguageOnly()) {
94 $deps[] = array(
95 "component" => "Services/Object",
96 "entity" => "transl",
97 "ids" => $md_ids);
98 $deps[] = array(
99 "component" => "Services/Object",
100 "entity" => "transl_entry",
101 "ids" => $a_ids);
102 }
103 $deps[] = array(
104 "component" => "Services/Object",
105 "entity" => "tile",
106 "ids" => $a_ids);
107
108 $deps[] = array(
109 "component" => "Services/Object",
110 "entity" => "service_settings",
111 "ids" => $a_ids);
112
113 // help export
114 foreach ($a_ids as $id) {
116 $deps[] = array(
117 "component" => "Services/Help",
118 "entity" => "help",
119 "ids" => array($id));
120 }
121 }
122
123 // style
124 foreach ($a_ids as $id) {
125 $style_id = $this->content_style_domain->styleForObjId($id)->getStyleId();
126 if ($style_id > 0) {
127 $deps[] = array(
128 "component" => "Services/Style",
129 "entity" => "sty",
130 "ids" => $style_id
131 );
132 }
133 }
134 }
135
136 return $deps;
137 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getObjectList(int $lm_id, string $type="")
static getPageList(int $lm_id)
static isOnlineHelpModule(int $a_id, bool $a_as_obj_id=false)
Is module an online module.
$c
Definition: cli.php:38

References $c, $id, ilLMObject\getObjectList(), ilLMPageObject\getPageList(), and ilObjContentObject\isOnlineHelpModule().

+ Here is the call graph for this function:

◆ getXmlRepresentation()

ilLearningModuleExporter::getXmlRepresentation ( string  $a_entity,
string  $a_schema_version,
string  $a_id 
)

Reimplemented from ilXmlExporter.

Definition at line 139 of file class.ilLearningModuleExporter.php.

143 : string {
144 // workaround: old question export
145 $q_ids = array();
146 $pages = ilLMPageObject::getPageList($a_id);
147 foreach ($pages as $p) {
148 $langs = array("-");
149 if (!$this->config->getMasterLanguageOnly()) {
150 $trans = ilPageObject::lookupTranslations("lm", $p["obj_id"]);
151 foreach ($trans as $t) {
152 if ($t != "-") {
153 $langs[] = $t;
154 }
155 }
156 }
157 foreach ($langs as $l) {
158 // collect questions
159 foreach (ilPCQuestion::_getQuestionIdsForPage("lm", $p["obj_id"], $l) as $q_id) {
160 $q_ids[$q_id] = $q_id;
161 }
162 }
163 }
164 if (count($q_ids) > 0) {
165 $dir = $this->getExport()->export_run_dir;
166 $qti_file = fopen($dir . "/qti.xml", "w");
167 $pool = new ilObjQuestionPool();
168 fwrite($qti_file, $pool->questionsToXML($q_ids));
169 fclose($qti_file);
170 }
171
172 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
173 }
static _getQuestionIdsForPage(string $a_parent_type, int $a_page_id, string $a_lang="-")
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.

◆ init()

ilLearningModuleExporter::init ( )

Reimplemented from ilXmlExporter.

Definition at line 30 of file class.ilLearningModuleExporter.php.

30 : void
31 {
32 global $DIC;
33
34 $this->ds = new ilLearningModuleDataSet();
35 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
36 $this->ds->setDSPrefix("ds");
37 $this->config = $this->getExport()->getConfig("Modules/LearningModule");
38 if ($this->config->getMasterLanguageOnly()) {
39 $conf = $this->getExport()->getConfig("Services/COPage");
40 $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
41 $this->ds->setMasterLanguageOnly(true);
42 }
43 $this->content_style_domain = $DIC->contentStyle()
44 ->domain();
45 }
LearningModule Data set class.
global $DIC
Definition: feed.php:28

References $DIC, and ilXmlExporter\getExport().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilExportConfig ilLearningModuleExporter::$config
private

Definition at line 27 of file class.ilLearningModuleExporter.php.

◆ $content_style_domain

ILIAS Style Content DomainService ilLearningModuleExporter::$content_style_domain
protected

Definition at line 28 of file class.ilLearningModuleExporter.php.

◆ $ds

ilLearningModuleDataSet ilLearningModuleExporter::$ds
private

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


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