ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 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
 
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)

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

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

◆ getXmlExportTailDependencies()

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

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

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

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) {
73  $pages = ilLMPageObject::getPageList($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" => "components/ILIAS/COPage",
85  "entity" => "pg",
86  "ids" => $pg_ids),
87  array(
88  "component" => "components/ILIAS/MetaData",
89  "entity" => "md",
90  "ids" => $md_ids),
91  );
92 
93  if (!$this->config->getMasterLanguageOnly()) {
94  $deps[] = array(
95  "component" => "components/ILIAS/ILIASObject",
96  "entity" => "transl",
97  "ids" => $md_ids);
98  $deps[] = array(
99  "component" => "components/ILIAS/ILIASObject",
100  "entity" => "transl_entry",
101  "ids" => $a_ids);
102  }
103  $deps[] = array(
104  "component" => "components/ILIAS/ILIASObject",
105  "entity" => "tile",
106  "ids" => $a_ids);
107 
108  $deps[] = array(
109  "component" => "components/ILIAS/ILIASObject",
110  "entity" => "service_settings",
111  "ids" => $a_ids);
112 
113  // help export
114  foreach ($a_ids as $id) {
116  $deps[] = array(
117  "component" => "components/ILIAS/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)->getExportStyleId();
126  $deps[] = array(
127  "component" => "components/ILIAS/Style",
128  "entity" => "sty",
129  "ids" => $style_id
130  );
131  }
132  }
133 
134  return $deps;
135  }
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 137 of file class.ilLearningModuleExporter.php.

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

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

◆ init()

ilLearningModuleExporter::init ( )

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

References $DIC, and ilXmlExporter\getExport().

30  : void
31  {
32  global $DIC;
33 
34  $this->ds = new ilLearningModuleDataSet();
35  $this->ds->initByExporter($this);
36  $this->ds->setDSPrefix("ds");
37  $this->config = $this->getExport()->getConfig("components/ILIAS/LearningModule");
38  if ($this->config->getMasterLanguageOnly()) {
39  $conf = $this->getExport()->getConfig("components/ILIAS/COPage");
40  $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
41  $this->ds->setMasterLanguageOnly(true);
42  }
43  $this->content_style_domain = $DIC->contentStyle()
44  ->domain();
45  }
global $DIC
Definition: shib_login.php:22
LearningModule Data set class.
+ 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: