5 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Page.php");
6 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
32 $ilDB = $DIC->database();
34 $this->cont_obj = $a_cont_obj;
38 $this->inst_id = IL_INST_ID;
46 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
47 require_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
49 $this->version = $ver;
57 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $this->cont_obj->getType() .
"_m_" . $this->cont_obj->getId();
58 switch ($this->version) {
60 $attrs[
"xmlns:imsss"] =
"http://www.imsglobal.org/xsd/imsss";
61 $attrs[
"xmlns:adlseq"] =
"http://www.adlnet.org/xsd/adlseq_v1p3";
62 $attrs[
"xmlns:adlnav"] =
"http://www.adlnet.org/xsd/adlnav_v1p3";
63 $attrs[
"xmlns:xsi"] =
"http://www.w3.org/2001/XMLSchema-instance";
64 $attrs[
"xmlns:adlcp"] =
"http://www.adlnet.org/xsd/adlcp_v1p3";
65 $attrs[
"xmlns"] =
"http://www.imsglobal.org/xsd/imscp_v1p1";
66 $attrs[
"xsi:schemaLocation"] =
"http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd http://www.adlnet.org/xsd/adlcp_v1p3 adlcp_v1p3.xsd http://www.imsglobal.org/xsd/imsss imsss_v1p0.xsd http://www.adlnet.org/xsd/adlseq_v1p3 adlseq_v1p3.xsd http://www.adlnet.org/xsd/adlnav_v1p3 adlnav_v1p3.xsd";
67 $attrs[
"version"] =
"2004 " . $revision .
" Edition";
70 $attrs[
"xmlns"] =
"http://www.imsproject.org/xsd/imscp_rootv1p1p2";
71 $attrs[
"xmlns:adlcp"] =
"http://www.adlnet.org/xsd/adlcp_rootv1p2";
72 $attrs[
"xmlns:xsi"] =
"http://www.w3.org/2001/XMLSchema-instance";
73 $attrs[
"xsi:schemaLocation"] =
"http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd";
74 $attrs[
"version"] =
"1.1";
77 $this->writer->xmlStartTag(
"manifest", $attrs);
79 if ($this->version ==
"2004") {
80 $this->writer->xmlStartTag(
"metadata");
81 $this->writer->xmlElement(
"schema", null,
"ADL SCORM");
82 $this->writer->xmlElement(
"schemaversion", null,
"2004 " . $revision .
" Edition");
83 $this->writer->xmlElement(
"adlcp:location", null,
"indexMD.xml");
84 $this->writer->xmlEndTag(
"metadata");
88 if ($this->version ==
"2004") {
89 $attrs[
"xmlns:imscp"] =
"http://www.imsglobal.org/xsd/imscp_v1p1";
91 $attrs[
"default"] =
"il_" . IL_INST_ID .
"_" . $this->cont_obj->getType() .
"_" . $this->cont_obj->getId();
92 $this->writer->xmlStartTag(
"organizations", $attrs);
96 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $this->cont_obj->getType() .
"_" . $this->cont_obj->getId();
97 $attrs[
"structure"] =
"hierarchical";
98 $this->writer->xmlStartTag(
"organization", $attrs);
102 $this->writer->xmlElement(
"title", $attrs, $this->cont_obj->getTitle());
106 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
116 if ($this->version ==
"2004") {
118 $this->writer->xmlData($this->writer->xmlFormatData($seq_item->exportAsXML()),
false,
false);
122 $this->writer->xmlEndTag(
"organization");
125 $this->writer->xmlEndTag(
"organizations");
129 $this->writer->xmlStartTag(
"resources", $attrs);
135 $this->writer->xmlEndTag(
"resources");
138 $this->writer->xmlEndTag(
"manifest");
145 $this->writer->_XmlWriter;
151 public function dump($a_target_dir)
153 $this->writer->xmlDumpFile($a_target_dir .
"/imsmanifest.xml",
false);
163 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
164 require_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
166 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
173 foreach (
$tree->getFilteredSubTree(
$tree->getRootId(), array(
'page')) as $obj) {
174 if ($obj[
'type'] ==
'') {
178 if ($obj[
'type'] !=
'sco' && $last_type ==
"sco") {
179 $this->writer->xmlEndTag(
"item");
181 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'];
182 if ($obj[
'type'] ==
'sco') {
183 $attrs[
"identifierref"] = $attrs[
"identifier"] .
"_ref";
185 $this->writer->xmlStartTag(
"item", $attrs);
188 $this->writer->xmlElement(
"title", $attrs, $obj[
'title']);
190 if ($this->version ==
"2004") {
193 $this->writer->xmlData($this->writer->xmlFormatData($seq_item->exportAsXML()),
false,
false);
196 if ($obj[
'type'] ==
'sco') {
197 $this->writer->xmlEndTag(
"item");
199 $last_type = $obj[
'type'];
201 $this->writer->xmlEndTag(
"item");
210 foreach (
$tree->getFilteredChilds(array(
'page'), $a_parent_node) as $obj) {
211 if ($obj[
'type'] ==
'') {
215 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'];
216 if ($obj[
'type'] ==
'sco' || $obj[
'type'] ==
'ass') {
217 $attrs[
"identifierref"] = $attrs[
"identifier"] .
"_ref";
219 $this->writer->xmlStartTag(
"item", $attrs);
221 $this->writer->xmlElement(
"title", $attrs, $obj[
'title']);
223 if (
$tree->getFilteredChilds(array(
'page'), $obj[
'obj_id'])) {
227 if ($this->version ==
"2004") {
228 if ($obj[
'type'] ==
'sco' || $obj[
'type'] ==
'ass') {
229 $this->writer->xmlStartTag(
"metadata");
230 $this->writer->xmlElement(
"adlcp:location", null, $obj[
'obj_id'] .
"/indexMD.xml");
231 $this->writer->xmlEndTag(
"metadata");
233 require_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
235 $this->writer->xmlData($this->writer->xmlFormatData($seq_item->exportAsXML()),
false,
false);
237 $this->writer->xmlEndTag(
"item");
246 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
252 foreach (
$tree->getSubTree(
$tree->getNodeData(
$tree->root_id),
true, array(
'sco',
'ass')) as $obj) {
254 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
"_ref";
255 $attrs[
"type"] =
"webcontent";
256 if ($obj[
'type'] ==
"sco") {
257 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"sco";
259 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"asset";
261 $attrs[
"href"] =
"./" . $obj[
'obj_id'] .
"/index.html";
262 $this->writer->xmlStartTag(
"resource", $attrs,
"");
263 $this->writer->xmlElement(
"dependency", array(
"identifierref" =>
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'ITSELF'),
"");
264 $this->writer->xmlElement(
"dependency", array(
"identifierref" =>
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'OBJECTS'),
"");
265 $this->writer->xmlElement(
"dependency", array(
"identifierref" =>
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'RESOURCES'),
"");
266 $this->writer->xmlElement(
"dependency", array(
"identifierref" =>
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'FLAVOUR'),
"");
267 $this->writer->xmlEndTag(
"resource");
270 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'ITSELF';
271 $attrs[
"type"] =
"webcontent";
272 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"asset";
273 $this->writer->xmlStartTag(
"resource", $attrs,
"");
274 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/index.xml"),
"");
275 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/ilias_co_3_7.dtd"),
"");
276 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/index.html"),
"");
277 $this->writer->xmlEndTag(
"resource");
280 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'RESOURCES';
281 $attrs[
"type"] =
"webcontent";
282 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"asset";
283 $this->writer->xmlStartTag(
"resource", $attrs,
"");
284 $this->writer->xmlEndTag(
"resource");
287 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'FLAVOUR';
288 $attrs[
"type"] =
"webcontent";
289 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"asset";
290 $this->writer->xmlStartTag(
"resource", $attrs,
"");
291 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/index.xml"),
"");
292 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/sco.xsl"),
"");
293 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/css/system.css"),
"");
294 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/css/style.css"),
"");
295 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/js/scorm.js"),
"");
296 $this->writer->xmlEndTag(
"resource");
299 $attrs[
"identifier"] =
"il_" . IL_INST_ID .
"_" . $obj[
'type'] .
"_" . $obj[
'obj_id'] .
'OBJECTS';
300 $attrs[
"type"] =
"webcontent";
301 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"asset";
302 $this->writer->xmlStartTag(
"resource", $attrs,
"");
304 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
307 $active_css = explode(
'?', $active_css);
308 $css = fread(
fopen($active_css[0],
'r'), filesize($active_css[0]));
309 preg_match_all(
"/url\(([^\)]*)\)/", $css, $css_files);
310 $css_files = array_unique($css_files[1]);
312 chdir(dirname($active_css[0]));
313 foreach ($css_files as $fileref) {
314 if (file_exists($fileref)) {
315 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/images/" . basename($fileref)),
"");
320 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
326 foreach ($pagetree->getSubTree($pagetree->getNodeData($obj[
'obj_id']),
false,
'page') as $page) {
328 $page_obj->buildDom();
329 $mob_ids = $page_obj->collectMediaObjects(
false);
330 foreach ($mob_ids as $mob_id) {
333 $media_obj = $media_obj->getMediaItem(
"Standard");
334 if ($media_obj != null && $media_obj->getLocationType() ==
"LocalFile") {
335 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/objects/il_" . IL_INST_ID .
"_mob_" . $mob_id .
"/" . rawurlencode($media_obj->getLocation())),
"");
340 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
342 foreach ($file_ids as $file_id) {
344 include_once(
"./Modules/File/classes/class.ilObjFile.php");
345 $file_obj =
new ilObjFile($file_id,
false);
346 $this->writer->xmlElement(
"file", array(
"href" =>
"./" . $obj[
'obj_id'] .
"/objects/il_" . IL_INST_ID .
"_file_" . $file_id .
"/" . rawurlencode($file_obj->getFileName())),
"");
352 $this->writer->xmlEndTag(
"resource");
354 if ($this->version ==
"2004") {
356 $attrs[
"identifier"] =
"PKG";
357 $attrs[
"type"] =
"webcontent";
358 $attrs[($this->version ==
"2004"?
"adlcp:scormType":
"adlcp:scormtype")] =
"asset";
359 $this->writer->xmlStartTag(
"resource", $attrs,
"");
361 $xsd_files = array(
'adlcp_v1p3.xsd',
'adlseq_v1p3.xsd',
'imsss_v1p0.xsd',
'adlnav_v1p3.xsd',
'adlnav_v1p3.xsd',
362 'imscp_v1p1.xsd',
'imsmanifest.xml',
'imsss_v1p0auxresource.xsd',
'imsss_v1p0control.xsd',
'imsss_v1p0delivery.xsd',
363 'imsss_v1p0limit.xsd',
'imsss_v1p0objective.xsd',
'imsss_v1p0random.xsd',
'imsss_v1p0rollup.xsd',
'imsss_v1p0seqrule.xsd',
364 'imsss_v1p0util.xsd',
'xml.xsd',
'index.html');
365 foreach ($xsd_files as $xsd_file) {
367 $attrs[
"href"] = $xsd_file;
368 $this->writer->xmlElement(
"file", $attrs,
"");
370 $this->writer->xmlEndTag(
"resource");
__construct(&$a_cont_obj)
Constructor public.
Class ilSCORM2004Condition.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
writeItemHierarchyRec($tree, $a_parent_node)
write item hierarchy (Recursive Style)
buildManifest($ver, $revision=null)
build manifest structure
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
writeResources()
Create resource entries for the learning module "PKG" and all SCOS and Assets.
xmlHeader()
Writes xml header public.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
dump($a_target_dir)
dump manifest file into directory
static _lookupType($a_id, $a_reference=false)
lookup object type
writeItemHierarchy()
write item hierarchy
Scorm 2004 Content Object Manifest export class.