ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 13 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 186 of file class.ilLearningModuleExporter.php.

References array.

187  {
188  return array(
189  "5.1.0" => array(
190  "namespace" => "http://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" => ""),
195  "4.1.0" => array(
196  "namespace" => "http://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" => "")
201  );
202  }
Create styles array
The data for the language used.

◆ 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 46 of file class.ilLearningModuleExporter.php.

References $id, $s, ilObjContentObject\_lookupStyleSheetId(), array, ilLMObject\getObjectList(), ilLMPageObject\getPageList(), and ilObjContentObject\isOnlineHelpModule().

47  {
48  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
49  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
50 
51  $deps = array();
52 
53  if ($a_entity == "lm") {
54  $md_ids = array();
55 
56  // lm related ids
57  foreach ($a_ids as $id) {
58  $md_ids[] = $id . ":0:lm";
59  }
60 
61  // chapter related ids
62  foreach ($a_ids as $id) {
63  $chaps = ilLMObject::getObjectList($id, "st");
64  foreach ($chaps as $c) {
65  $md_ids[] = $id . ":" . $c["obj_id"] . ":st";
66  }
67  }
68 
69  // page related ids
70  $pg_ids = array();
71  foreach ($a_ids as $id) {
72  $pages = ilLMPageObject::getPageList($id);
73  foreach ($pages as $p) {
74  $pg_ids[] = "lm:" . $p["obj_id"];
75  $md_ids[] = $id . ":" . $p["obj_id"] . ":pg";
76  }
77  }
78 
79  // style, multilang, metadata per page/chap?
80 
81  $deps = array(
82  array(
83  "component" => "Services/COPage",
84  "entity" => "pg",
85  "ids" => $pg_ids),
86  array(
87  "component" => "Services/MetaData",
88  "entity" => "md",
89  "ids" => $md_ids),
90  );
91 
92  if (!$this->config->getMasterLanguageOnly()) {
93  $deps[] = array(
94  "component" => "Services/Object",
95  "entity" => "transl",
96  "ids" => $md_ids);
97  }
98 
99  // help export
100  foreach ($a_ids as $id) {
101  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
103  $deps[] = array(
104  "component" => "Services/Help",
105  "entity" => "help",
106  "ids" => array($id));
107  }
108  }
109 
110  // style
111  foreach ($a_ids as $id) {
112  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
113  if (($s = ilObjContentObject::_lookupStyleSheetId($id)) > 0) {
114  $deps[] = array(
115  "component" => "Services/Style",
116  "entity" => "sty",
117  "ids" => $s
118  );
119  }
120  }
121  }
122 
123  return $deps;
124  }
static _lookupStyleSheetId($a_cont_obj_id)
lookup style sheet ID
if(!array_key_exists('StateId', $_REQUEST)) $id
$s
Definition: pwgen.php:45
Create styles array
The data for the language used.
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 136 of file class.ilLearningModuleExporter.php.

References $l, $t, ilPCQuestion\_getQuestionIdsForPage(), array, ilXmlExporter\getExport(), ilLMPageObject\getPageList(), and ilPageObject\lookupTranslations().

137  {
138  // workaround: old question export
139  $q_ids = array();
140  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
141  $pages = ilLMPageObject::getPageList($a_id);
142  foreach ($pages as $p) {
143  $langs = array("-");
144  if (!$this->config->getMasterLanguageOnly()) {
145  $trans = ilPageObject::lookupTranslations("lm", $p["obj_id"]);
146  foreach ($trans as $t) {
147  if ($t != "-") {
148  $langs[] = $t;
149  }
150  }
151  }
152  foreach ($langs as $l) {
153  // collect questions
154  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
155  foreach (ilPCQuestion::_getQuestionIdsForPage("lm", $p["obj_id"], $l) as $q_id) {
156  $q_ids[$q_id] = $q_id;
157  }
158  }
159  }
160  if (count($q_ids) > 0) {
161  $dir = $this->getExport()->export_run_dir;
162  $qti_file = fopen($dir . "/qti.xml", "w");
163  include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
164  $pool = new ilObjQuestionPool();
165  fwrite($qti_file, $pool->questionsToXML($q_ids));
166  fclose($qti_file);
167  }
168 
169  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
170 
171  /*include_once './Modules/LearningModule/classes/class.ilObjLearningModule.php';
172  $lm = new ilObjLearningModule($a_id,false);
173 
174  include_once './Modules/LearningModule/classes/class.ilContObjectExport.php';
175  $exp = new ilContObjectExport($lm);
176  $zip = $exp->buildExportFile();*/
177  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
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 24 of file class.ilLearningModuleExporter.php.

References ilXmlExporter\getExport().

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

Field Documentation

◆ $config

ilLearningModuleExporter::$config
private

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

◆ $ds

ilLearningModuleExporter::$ds
private

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


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