Create resource entries for the learning module "PKG" and all SCOS and Assets.
245 {
246 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
248
249
250
251
252 foreach (
$tree->getSubTree(
$tree->getNodeData(
$tree->root_id),
true, array(
'sco',
'ass')) as $obj) {
253 $attrs = array();
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";
258 } else {
259 $attrs[($this->version == "2004"?"adlcp:scormType":"adlcp:scormtype")] = "asset";
260 }
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");
268
269 $attrs = array();
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");
278
279 $attrs = array();
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");
285
286 $attrs = array();
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");
297
298 $attrs = array();
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, "");
303
304 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
305
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]);
311 $currdir = getcwd();
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)), "");
316 }
317 }
318 chdir($currdir);
319
320 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
322
323
324
325
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())), "");
336 }
337 }
338 }
339
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())), "");
347 }
348 }
349 unset($page_obj);
350 }
351
352 $this->writer->xmlEndTag("resource");
353 }
354 if ($this->version == "2004") {
355 $attrs = array();
356 $attrs["identifier"] = "PKG";
357 $attrs["type"] = "webcontent";
358 $attrs[($this->version == "2004"?"adlcp:scormType":"adlcp:scormtype")] = "asset";
359 $this->writer->xmlStartTag("resource", $attrs, "");
360
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) {
366 $attrs = array();
367 $attrs["href"] = $xsd_file;
368 $this->writer->xmlElement("file", $attrs, "");
369 }
370 $this->writer->xmlEndTag("resource");
371 }
372 }
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupType($a_id, $a_reference=false)
lookup object type
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.