function exportScorm($a_inst, $a_target_dir, $ver, &$expLog) { copy('./xml/ilias_co_3_7.dtd', $a_target_dir . '/ilias_co_3_7.dtd'); copy('./Modules/Scorm2004/templates/xsl/sco.xsl', $a_target_dir . '/sco.xsl'); $a_xml_writer = new ilXmlWriter(); // MetaData //file_put_contents($a_target_dir.'/indexMD.xml','<lom xmlns="http://ltsc.ieee.org/xsd/LOM"><general/><classification/></lom>'); $this->exportXMLMetaData($a_xml_writer); $metadata_xml = $a_xml_writer->xmlDumpMem(false); $a_xml_writer->_XmlWriter; $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl"); $args = array('/_xml' => $metadata_xml, '/_xsl' => $xsl); $xh = xslt_create(); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL); xslt_free($xh); file_put_contents($a_target_dir . '/indexMD.xml', $output); $a_xml_writer = new ilXmlWriter(); // set dtd definition $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">"); // set generated comment $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module " . $this->getId() . " of installation " . $a_inst . "."); // set xml header $a_xml_writer->xmlHeader(); global $ilBench; $a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO")); $this->exportXMLMetaData($a_xml_writer); $this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog); $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog); $this->exportHTML($a_inst, $a_target_dir, $expLog); //overwrite scorm.js for scrom 1.2 if ($ver == "12") { copy('./Modules/Scorm2004/scripts/scorm_12.js', $a_target_dir . '/js/scorm.js'); } $a_xml_writer->xmlEndTag("ContentObject"); $a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false); $a_xml_writer->_XmlWriter; // export sco data (currently only objective) to sco.xml if ($this->getType() == "sco") { $objectives_text = ""; $a_xml_writer = new ilXmlWriter(); $tr_data = $this->getObjectives(); foreach ($tr_data as $data) { $objectives_text .= $data->getObjectiveID(); } $a_xml_writer->xmlStartTag("sco"); $a_xml_writer->xmlElement("objective", null, $objectives_text); $a_xml_writer->xmlEndTag("sco"); $a_xml_writer->xmlDumpFile($a_target_dir . '/sco.xml', false); $a_xml_writer->_XmlWriter; } }
/** * Export (authoring) scorm package */ function exportScorm($a_inst, $a_target_dir, $ver, &$expLog) { $a_xml_writer = new ilXmlWriter(); // export metadata $this->exportXMLMetaData($a_xml_writer); $metadata_xml = $a_xml_writer->xmlDumpMem(false); $a_xml_writer->_XmlWriter; $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl"); $args = array('/_xml' => $metadata_xml, '/_xsl' => $xsl); $xh = xslt_create(); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL); xslt_free($xh); file_put_contents($a_target_dir . '/indexMD.xml', $output); // export glossary if ($this->getAssignedGlossary() != 0) { ilUtil::makeDir($a_target_dir . "/glossary"); include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryExport.php"; $glo_xml_writer = new ilXmlWriter(); $glo_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">"); // set xml header $glo_xml_writer->xmlHeader(); $glos = new ilObjGlossary($this->getAssignedGlossary(), false); //$glos->exportHTML($a_target_dir."/glossary", $expLog); $glos_export = new ilGlossaryExport($glos, "xml"); $glos->exportXML($glo_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog); $glo_xml_writer->xmlDumpFile($a_target_dir . "/glossary/glossary.xml"); $glo_xml_writer->_XmlWriter; } $a_xml_writer = new ilXmlWriter(); // set dtd definition $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">"); // set generated comment $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module " . $this->getId() . " of installation " . $a_inst . "."); // set xml header $a_xml_writer->xmlHeader(); global $ilBench; $a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004LearningModule")); // MetaData $this->exportXMLMetaData($a_xml_writer); $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog); // SCO Objects $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Sco Objects"); $this->exportXMLScoObjects($a_inst, $a_target_dir, $ver, $expLog); $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Sco Objects"); $a_xml_writer->xmlEndTag("ContentObject"); $a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false); if ($ver == "2004 4th") { $revision = "4th"; $ver = "2004"; } if ($ver == "2004 3rd") { $revision = "3rd"; $ver = "2004"; } // add content css (note: this is also done per item) $css_dir = $a_target_dir . "/ilias_css_4_2"; ilUtil::makeDir($css_dir); include_once "./Modules/Scorm2004/classes/class.ilScormExportUtil.php"; ilScormExportUtil::exportContentCSS($this, $css_dir); // add manifest include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php"; $manifestBuilder = new ilContObjectManifestBuilder($this); $manifestBuilder->buildManifest($ver, $revision); $manifestBuilder->dump($a_target_dir); $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl"); $args = array('/_xml' => file_get_contents($a_target_dir . "/imsmanifest.xml"), '/_xsl' => $xsl); $xh = xslt_create(); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL); xslt_free($xh); fputs(fopen($a_target_dir . '/index.html', 'w+'), $output); // copy xsd files to target switch ($ver) { case "2004": if ($revision == "3rd") { ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004', $a_target_dir, false); } if ($revision == "4th") { ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004_4th', $a_target_dir, false); } break; case "12": ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_120_export_12', $a_target_dir, false); break; } $a_xml_writer->_XmlWriter; }