ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.ilLearningModuleExporter.php
Go to the documentation of this file.
1<?php
2
25{
28 protected \ILIAS\Style\Content\DomainService $content_style_domain;
29
30 public function init(): void
31 {
32 global $DIC;
33
34 $this->ds = new ilLearningModuleDataSet();
35 $this->ds->initByExporter($this);
36 $this->ds->setDSPrefix("ds");
38 $config = $this->getExport()->getExportConfigs()->getElementByComponent('components/ILIAS/LearningModule');
39 $this->config = $config;
40 if ($this->config->getMasterLanguageOnly()) {
42 $co_config = $this->getExport()->getExportConfigs()->getElementByComponent('components/ILIAS/COPage');
43 $conf = $co_config;
44 $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
45 $this->ds->setMasterLanguageOnly(true);
46 }
47 $this->content_style_domain = $DIC->contentStyle()
48 ->domain();
49 }
50
52 string $a_entity,
53 string $a_target_release,
54 array $a_ids
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) {
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 $deps[] = [
137 "component" => "components/ILIAS/Tracking",
138 "entity" => "lpsettings",
139 "ids" => $a_ids
140 ];
141 }
142
143 return $deps;
144 }
145
146 public function getXmlRepresentation(
147 string $a_entity,
148 string $a_schema_version,
149 string $a_id
150 ): string {
151 // workaround: old question export
152 $q_ids = array();
153 $pages = ilLMPageObject::getPageList($a_id);
154 foreach ($pages as $p) {
155 $langs = array("-");
156 if (!$this->config->getMasterLanguageOnly()) {
157 $trans = ilPageObject::lookupTranslations("lm", $p["obj_id"]);
158 foreach ($trans as $t) {
159 if ($t != "-") {
160 $langs[] = $t;
161 }
162 }
163 }
164 foreach ($langs as $l) {
165 // collect questions
166 foreach (ilPCQuestion::_getQuestionIdsForPage("lm", $p["obj_id"], $l) as $q_id) {
167 $q_ids[$q_id] = $q_id;
168 }
169 }
170 }
171 if (count($q_ids) > 0) {
172 $dir = $this->getExport()->export_run_dir;
173 $qti_file = fopen($dir . "/qti.xml", "w");
174 $pool = new ilObjQuestionPool();
175 fwrite($qti_file, $pool->questionsToXML($q_ids));
176 fclose($qti_file);
177 }
178
179 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
180 }
181
182 public function getValidSchemaVersions(
183 string $a_entity
184 ): array {
185 return array(
186 "8.0" => array(
187 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/8",
188 "xsd_file" => "ilias_lm_8.xsd",
189 "uses_dataset" => true,
190 "min" => "8.0",
191 "max" => ""),
192 "5.4.0" => array(
193 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/5_4",
194 "xsd_file" => "ilias_lm_5_4.xsd",
195 "uses_dataset" => true,
196 "min" => "5.4.0",
197 "max" => "7.99.99"),
198 "5.1.0" => array(
199 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/5_1",
200 "xsd_file" => "ilias_lm_5_1.xsd",
201 "uses_dataset" => true,
202 "min" => "5.1.0",
203 "max" => "5.3.99"),
204 "4.1.0" => array(
205 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/4_1",
206 "xsd_file" => "ilias_lm_4_1.xsd",
207 "uses_dataset" => false,
208 "min" => "4.1.0",
209 "max" => "5.0.99")
210 );
211 }
212}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getObjectList(int $lm_id, string $type="")
static getPageList(int $lm_id)
LearningModule Data set class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Style Content DomainService $content_style_domain
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
ilLearningModuleExportConfig $config
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
static isOnlineHelpModule(int $a_id, bool $a_as_obj_id=false)
Is module an online module.
static _getQuestionIdsForPage(string $a_parent_type, int $a_page_id, string $a_lang="-")
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
Xml Exporter class.
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26