ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLearningModuleExporter Class Reference

Exporter class for html learning modules. More...

+ Inheritance diagram for ilLearningModuleExporter:
+ Collaboration diagram for ilLearningModuleExporter:

Public Member Functions

 init ()
 Initialisation. More...
 
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies. More...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation. More...
 
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 Constructor. More...
 
 setExport (ilExport $a_exp)
 Set export object. More...
 
 getExport ()
 Get export. More...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation. More...
 
 init ()
 
 setExportDirectories ($a_dir_relative, $a_dir_absolute)
 Export directories. More...
 
 getRelativeExportDirectory ()
 Get relative export directory. More...
 
 getAbsoluteExportDirectory ()
 Get absolute export directory. More...
 
 getXmlExportHeadDependencies ($a_entity, $a_target_release, $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion ($a_entity, $a_target_release)
 Determine schema version. More...
 

Private Attributes

 $ds
 
 $config
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory ($a_obj_type, $a_obj_id, $a_export_type='xml', $a_entity="")
 export directory lookup More...
 
- Protected Attributes inherited from ilXmlExporter
 $dir_relative
 
 $dir_absolute
 
 $exp
 

Detailed Description

Exporter class for html learning modules.

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

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

Member Function Documentation

◆ getValidSchemaVersions()

ilLearningModuleExporter::getValidSchemaVersions (   $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.

Returns

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

174  {
175  return array(
176  "5.4.0" => array(
177  "namespace" => "http://www.ilias.de/Modules/LearningModule/lm/5_4",
178  "xsd_file" => "ilias_lm_5_4.xsd",
179  "uses_dataset" => true,
180  "min" => "5.4.0",
181  "max" => ""),
182  "5.1.0" => array(
183  "namespace" => "http://www.ilias.de/Modules/LearningModule/lm/5_1",
184  "xsd_file" => "ilias_lm_5_1.xsd",
185  "uses_dataset" => true,
186  "min" => "5.1.0",
187  "max" => ""),
188  "4.1.0" => array(
189  "namespace" => "http://www.ilias.de/Modules/LearningModule/lm/4_1",
190  "xsd_file" => "ilias_lm_4_1.xsd",
191  "uses_dataset" => false,
192  "min" => "4.1.0",
193  "max" => "")
194  );
195  }

◆ getXmlExportTailDependencies()

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

Get tail dependencies.

Parameters
stringentity
stringtarget release
arrayids
Returns
array array of array with keys "component", entity", "ids"

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

References Vendor\Package\$c, ilObjContentObject\_lookupStyleSheetId(), ilLMObject\getObjectList(), ilLMPageObject\getPageList(), and ilObjContentObject\isOnlineHelpModule().

45  {
46  $deps = array();
47 
48  if ($a_entity == "lm") {
49  $md_ids = array();
50 
51  // lm related ids
52  foreach ($a_ids as $id) {
53  $md_ids[] = $id . ":0:lm";
54  }
55 
56  // chapter related ids
57  foreach ($a_ids as $id) {
58  $chaps = ilLMObject::getObjectList($id, "st");
59  foreach ($chaps as $c) {
60  $md_ids[] = $id . ":" . $c["obj_id"] . ":st";
61  }
62  }
63 
64  // page related ids
65  $pg_ids = array();
66  foreach ($a_ids as $id) {
67  $pages = ilLMPageObject::getPageList($id);
68  foreach ($pages as $p) {
69  $pg_ids[] = "lm:" . $p["obj_id"];
70  $md_ids[] = $id . ":" . $p["obj_id"] . ":pg";
71  }
72  }
73 
74  // style, multilang, metadata per page/chap?
75 
76  $deps = array(
77  array(
78  "component" => "Services/COPage",
79  "entity" => "pg",
80  "ids" => $pg_ids),
81  array(
82  "component" => "Services/MetaData",
83  "entity" => "md",
84  "ids" => $md_ids),
85  );
86 
87  if (!$this->config->getMasterLanguageOnly()) {
88  $deps[] = array(
89  "component" => "Services/Object",
90  "entity" => "transl",
91  "ids" => $md_ids);
92  }
93  $deps[] = array(
94  "component" => "Services/Object",
95  "entity" => "tile",
96  "ids" => $a_ids);
97 
98  // help export
99  foreach ($a_ids as $id) {
101  $deps[] = array(
102  "component" => "Services/Help",
103  "entity" => "help",
104  "ids" => array($id));
105  }
106  }
107 
108  // style
109  foreach ($a_ids as $id) {
110  if (($s = ilObjContentObject::_lookupStyleSheetId($id)) > 0) {
111  $deps[] = array(
112  "component" => "Services/Style",
113  "entity" => "sty",
114  "ids" => $s
115  );
116  }
117  }
118  }
119 
120  return $deps;
121  }
static _lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
static isOnlineHelpModule($a_id, $a_as_obj_id=false)
Is module an online module.
static getObjectList($lm_id, $type="")
static
static getPageList($lm_id)
static
+ Here is the call graph for this function:

◆ getXmlRepresentation()

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

Get xml representation.

Parameters
stringentity
stringtarget release
stringid
Returns
string xml string

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

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

134  {
135  // workaround: old question export
136  $q_ids = array();
137  $pages = ilLMPageObject::getPageList($a_id);
138  foreach ($pages as $p) {
139  $langs = array("-");
140  if (!$this->config->getMasterLanguageOnly()) {
141  $trans = ilPageObject::lookupTranslations("lm", $p["obj_id"]);
142  foreach ($trans as $t) {
143  if ($t != "-") {
144  $langs[] = $t;
145  }
146  }
147  }
148  foreach ($langs as $l) {
149  // collect questions
150  foreach (ilPCQuestion::_getQuestionIdsForPage("lm", $p["obj_id"], $l) as $q_id) {
151  $q_ids[$q_id] = $q_id;
152  }
153  }
154  }
155  if (count($q_ids) > 0) {
156  $dir = $this->getExport()->export_run_dir;
157  $qti_file = fopen($dir . "/qti.xml", "w");
158  $pool = new ilObjQuestionPool();
159  fwrite($qti_file, $pool->questionsToXML($q_ids));
160  fclose($qti_file);
161  }
162 
163  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
164  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
static lookupTranslations($a_parent_type, $a_id)
Lookup translations.
static getPageList($lm_id)
static
getExport()
Get export.
+ Here is the call graph for this function:

◆ init()

ilLearningModuleExporter::init ( )

Initialisation.

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

References ilXmlExporter\getExport().

24  {
25  $this->ds = new ilLearningModuleDataSet();
26  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
27  $this->ds->setDSPrefix("ds");
28  $this->config = $this->getExport()->getConfig("Modules/LearningModule");
29  if ($this->config->getMasterLanguageOnly()) {
30  $conf = $this->getExport()->getConfig("Services/COPage");
31  $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
32  $this->ds->setMasterLanguageOnly(true);
33  }
34  }
LearningModule Data set class.
getExport()
Get export.
+ Here is the call graph for this function:

Field Documentation

◆ $config

ilLearningModuleExporter::$config
private

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

◆ $ds

ilLearningModuleExporter::$ds
private

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


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