ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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

 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)
 
- 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
ilExport $exp
 

Private Attributes

ilLearningModuleDataSet $ds
 
ilLearningModuleExportConfig $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)

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

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

◆ getXmlExportTailDependencies()

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

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

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

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

◆ getXmlRepresentation()

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

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

References ilPCQuestion\_getQuestionIdsForPage(), ilXmlExporter\getExport(), ilLMPageObject\getPageList(), and ilPageObject\lookupTranslations().

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

Field Documentation

◆ $config

ilLearningModuleExportConfig 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: