ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

Reimplemented from ilXmlExporter.

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

203 {
204 return array (
205 "5.1.0" => array(
206 "namespace" => "http://www.ilias.de/Modules/LearningModule/lm/5_1",
207 "xsd_file" => "ilias_lm_5_1.xsd",
208 "uses_dataset" => true,
209 "min" => "5.1.0",
210 "max" => ""),
211 "4.1.0" => array(
212 "namespace" => "http://www.ilias.de/Modules/LearningModule/lm/4_1",
213 "xsd_file" => "ilias_lm_4_1.xsd",
214 "uses_dataset" => false,
215 "min" => "4.1.0",
216 "max" => "")
217 );
218 }

◆ 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"

Reimplemented from ilXmlExporter.

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

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

References ilObjContentObject\_lookupStyleSheetId(), ilLMObject\getObjectList(), ilLMPageObject\getPageList(), and ilObjContentObject\isOnlineHelpModule().

+ 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

Reimplemented from ilXmlExporter.

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

146 {
147 // workaround: old question export
148 $q_ids = array();
149 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
150 $pages = ilLMPageObject::getPageList($a_id);
151 foreach ($pages as $p)
152 {
153 $langs = array("-");
154 if (!$this->config->getMasterLanguageOnly())
155 {
156 $trans = ilPageObject::lookupTranslations("lm", $p["obj_id"]);
157 foreach ($trans as $t)
158 {
159 if ($t != "-")
160 {
161 $langs[] = $t;
162 }
163 }
164 }
165 foreach ($langs as $l)
166 {
167 // collect questions
168 include_once("./Services/COPage/classes/class.ilPCQuestion.php");
169 foreach (ilPCQuestion::_getQuestionIdsForPage("lm", $p["obj_id"], $l) as $q_id)
170 {
171 $q_ids[$q_id] = $q_id;
172 }
173 }
174 }
175 if (count($q_ids) > 0)
176 {
177 $dir = $this->getExport()->export_run_dir;
178 $qti_file = fopen($dir."/qti.xml", "w");
179 include_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
180 $pool = new ilObjQuestionPool();
181 fwrite($qti_file, $pool->toXML($q_ids));
182 fclose($qti_file);
183 }
184
185 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
186
187 /*include_once './Modules/LearningModule/classes/class.ilObjLearningModule.php';
188 $lm = new ilObjLearningModule($a_id,false);
189
190 include_once './Modules/LearningModule/classes/class.ilContObjectExport.php';
191 $exp = new ilContObjectExport($lm);
192 $zip = $exp->buildExportFile();*/
193 }
global $l
Definition: afr.php:30
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.
getExport()
Get export.

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

+ Here is the call graph for this function:

◆ init()

ilLearningModuleExporter::init ( )

Initialisation.

Reimplemented from ilXmlExporter.

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

22 {
23 include_once("./Modules/LearningModule/classes/class.ilLearningModuleDataSet.php");
24 $this->ds = new ilLearningModuleDataSet();
25 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
26 $this->ds->setDSPrefix("ds");
27 $this->config = $this->getExport()->getConfig("Modules/LearningModule");
28 if ($this->config->getMasterLanguageOnly())
29 {
30 $conf = $this->getExport()->getConfig("Services/COPage");
31 $conf->setMasterLanguageOnly(true);
32 $this->ds->setMasterLanguageOnly(true);
33 }
34 }
LearningModule Data set class.

References ilXmlExporter\getExport().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilLearningModuleExporter::$config
private

Definition at line 16 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: