ILIAS  release_8 Revision v8.24
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->setExportDirectories($this->dir_relative, $this->dir_absolute);
36 $this->ds->setDSPrefix("ds");
37 $this->config = $this->getExport()->getConfig("Modules/LearningModule");
38 if ($this->config->getMasterLanguageOnly()) {
39 $conf = $this->getExport()->getConfig("Services/COPage");
40 $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
41 $this->ds->setMasterLanguageOnly(true);
42 }
43 $this->content_style_domain = $DIC->contentStyle()
44 ->domain();
45 }
46
48 string $a_entity,
49 string $a_target_release,
50 array $a_ids
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) {
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" => "Services/COPage",
85 "entity" => "pg",
86 "ids" => $pg_ids),
87 array(
88 "component" => "Services/MetaData",
89 "entity" => "md",
90 "ids" => $md_ids),
91 );
92
93 if (!$this->config->getMasterLanguageOnly()) {
94 $deps[] = array(
95 "component" => "Services/Object",
96 "entity" => "transl",
97 "ids" => $md_ids);
98 $deps[] = array(
99 "component" => "Services/Object",
100 "entity" => "transl_entry",
101 "ids" => $a_ids);
102 }
103 $deps[] = array(
104 "component" => "Services/Object",
105 "entity" => "tile",
106 "ids" => $a_ids);
107
108 $deps[] = array(
109 "component" => "Services/Object",
110 "entity" => "service_settings",
111 "ids" => $a_ids);
112
113 // help export
114 foreach ($a_ids as $id) {
116 $deps[] = array(
117 "component" => "Services/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)->getStyleId();
126 if ($style_id > 0) {
127 $deps[] = array(
128 "component" => "Services/Style",
129 "entity" => "sty",
130 "ids" => $style_id
131 );
132 }
133 }
134 }
135
136 return $deps;
137 }
138
139 public function getXmlRepresentation(
140 string $a_entity,
141 string $a_schema_version,
142 string $a_id
143 ): string {
144 // workaround: old question export
145 $q_ids = array();
146 $pages = ilLMPageObject::getPageList($a_id);
147 foreach ($pages as $p) {
148 $langs = array("-");
149 if (!$this->config->getMasterLanguageOnly()) {
150 $trans = ilPageObject::lookupTranslations("lm", $p["obj_id"]);
151 foreach ($trans as $t) {
152 if ($t != "-") {
153 $langs[] = $t;
154 }
155 }
156 }
157 foreach ($langs as $l) {
158 // collect questions
159 foreach (ilPCQuestion::_getQuestionIdsForPage("lm", $p["obj_id"], $l) as $q_id) {
160 $q_ids[$q_id] = $q_id;
161 }
162 }
163 }
164 if (count($q_ids) > 0) {
165 $dir = $this->getExport()->export_run_dir;
166 $qti_file = fopen($dir . "/qti.xml", "w");
167 $pool = new ilObjQuestionPool();
168 fwrite($qti_file, $pool->questionsToXML($q_ids));
169 fclose($qti_file);
170 }
171
172 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
173 }
174
175 public function getValidSchemaVersions(
176 string $a_entity
177 ): array {
178 return array(
179 "8.0" => array(
180 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/8",
181 "xsd_file" => "ilias_lm_8.xsd",
182 "uses_dataset" => true,
183 "min" => "8.0",
184 "max" => ""),
185 "5.4.0" => array(
186 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/5_4",
187 "xsd_file" => "ilias_lm_5_4.xsd",
188 "uses_dataset" => true,
189 "min" => "5.4.0",
190 "max" => "7.99.99"),
191 "5.1.0" => array(
192 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/5_1",
193 "xsd_file" => "ilias_lm_5_1.xsd",
194 "uses_dataset" => true,
195 "min" => "5.1.0",
196 "max" => "5.3.99"),
197 "4.1.0" => array(
198 "namespace" => "https://www.ilias.de/Modules/LearningModule/lm/4_1",
199 "xsd_file" => "ilias_lm_4_1.xsd",
200 "uses_dataset" => false,
201 "min" => "4.1.0",
202 "max" => "5.0.99")
203 );
204 }
205}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
return true
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
ILIAS Style Content DomainService $content_style_domain
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: cli.php:38
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', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
global $DIC
Definition: feed.php:28