/**
  * export page objects to xml (see ilias_co.dtd)
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 function exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions)
 {
     global $ilBench;
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     foreach ($questions as $question_id) {
         $ilBench->start("ContentObjectExport", "exportPageObject");
         $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $question_id);
         $attrs = array();
         $a_xml_writer->xmlStartTag("PageObject", $attrs);
         // export xml to writer object
         $ilBench->start("ContentObjectExport", "exportPageObject_XML");
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
         $page_object = new ilAssQuestionPage($question_id);
         $page_object->buildDom();
         $page_object->insertInstIntoIDs($a_inst);
         $mob_ids = $page_object->collectMediaObjects(false);
         require_once 'Services/COPage/classes/class.ilPCFileList.php';
         $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc());
         $xml = $page_object->getXMLFromDom(false, false, false, "", true);
         $xml = str_replace("&", "&", $xml);
         $a_xml_writer->appendXML($xml);
         $page_object->freeDom();
         unset($page_object);
         $ilBench->stop("ContentObjectExport", "exportPageObject_XML");
         // collect media objects
         $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
         //$mob_ids = $page_obj->getMediaObjectIDs();
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
         $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
         // collect all file items
         $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
         //$file_ids = $page_obj->getFileItemIds();
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
         $a_xml_writer->xmlEndTag("PageObject");
         //unset($page_obj);
         $ilBench->stop("ContentObjectExport", "exportPageObject");
     }
 }
 /**
  * Export HTML pages of SCO
  */
 function exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type = "sco", $a_one_file = "", $a_sco_tpl = null)
 {
     global $tpl, $ilCtrl, $ilBench, $ilLog, $lng;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
     include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $output = "";
     $tree = new ilTree($this->slm_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     // @todo
     // Why is that much HTML code in an application class?
     // Please extract all this HTML to a tpl.<t_name>.html file and use
     // placeholders and the template engine to insert data.
     //
     // There copy/paste code residenting in ilSCORM2004ScoGUI. This
     // should be merged.
     //
     // alex, 4 Apr 09
     //
     //		if ($a_one_file == "")
     //		{
     $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
     //		}
     //		else
     //		{
     //			$sco_tpl = $a_sco_tpl;
     //		}
     if ($mode != 'pdf' && $a_one_file == "") {
         include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
         $pg_exp = new ilCOPageHTMLExport($a_target_dir);
         $pg_exp->getPreparedMainTemplate($sco_tpl);
         // init and question lang vars
         $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->slm_id);
         $sco_tpl->setCurrentBlock("init");
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $sco_tpl->setVariable("TXT_INIT_CODE", ilPCQuestion::getJSTextInitCode($lk));
         $sco_tpl->parseCurrentBlock();
         // (additional) style sheets needed
         $styles = array("./css/yahoo/container.css", "./css/question_handling.css");
         foreach ($styles as $style) {
             $sco_tpl->setCurrentBlock("css_file");
             $sco_tpl->setVariable("CSS_FILE", $style);
             $sco_tpl->parseCurrentBlock();
         }
         // (additional) scripts needed
         $scripts = array("./js/scorm.js", "./js/pager.js", "./js/pure.js", "./js/questions_" . $this->getId() . ".js");
         foreach ($scripts as $script) {
             $sco_tpl->setCurrentBlock("js_file");
             $sco_tpl->setVariable("JS_FILE", $script);
             $sco_tpl->parseCurrentBlock();
         }
         if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset") {
             self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
         }
         $sco_tpl->touchBlock("finish");
     }
     // render head
     $sco_tpl->setCurrentBlock("head");
     $sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
     $sco_tpl->parseCurrentBlock();
     $sco_tpl->touchBlock("tail");
     // meta page (meta info at SCO beginning)
     self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
     if ($a_one_file != "") {
         fputs($a_one_file, "<a name='sco" . $this->getId() . "'></a>");
         fputs($a_one_file, $sco_tpl->get("meta_page"));
     }
     //notify Question Exporter of new SCO
     require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
     ilQuestionExporter::indicateNewSco();
     // init export (this initialises glossary template)
     ilSCORM2004PageGUI::initExport();
     $terms = array();
     $terms = $this->getGlossaryTermIds();
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php";
     $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
     $sco_q_ids = array();
     foreach ($pages as $page) {
         //echo(print_r($page));
         $page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0, $this->slm_object->getId());
         $page_obj->setPresentationTitle($page["title"]);
         $page_obj->setOutputMode(IL_PAGE_OFFLINE);
         $page_obj->setStyleId($this->slm_object->getStyleSheetId());
         if (count($terms) > 1) {
             $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this);
         }
         $page_output = $page_obj->showPage("export");
         // collect media objects
         $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
             $media_obj = new ilObjMediaObject($mob_id);
             if ($media_obj->hasFullscreenItem()) {
                 $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
             }
         }
         // collect glossary items
         $int_links = $page_obj->getPageObject()->getInternalLinks(true);
         include_once "./Services/Link/classes/class.ilInternalLink.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         if (is_array($int_links)) {
             foreach ($int_links as $k => $e) {
                 // glossary link
                 if ($e["Type"] == "GlossaryItem") {
                     $karr = explode(":", $k);
                     $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]);
                     $dids = ilGlossaryDefinition::getDefinitionList($tid);
                     foreach ($dids as $did) {
                         include_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                         $def_pg = new ilGlossaryDefPage($did["id"]);
                         $def_pg->buildDom();
                         $mob_ids = $def_pg->collectMediaObjects(false);
                         foreach ($mob_ids as $mob_id) {
                             $this->mob_ids[$mob_id] = $mob_id;
                             //echo "<br>-$mob_id-";
                             $media_obj = new ilObjMediaObject($mob_id);
                             if ($media_obj->hasFullscreenItem()) {
                                 $media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
                             }
                         }
                         include_once "./Services/COPage/classes/class.ilPCFileList.php";
                         $file_ids = ilPCFileList::collectFileItems($def_pg, $def_pg->getDomDoc());
                         foreach ($file_ids as $file_id) {
                             $this->file_ids[$file_id] = $file_id;
                         }
                     }
                 }
             }
         }
         //exit;
         // collect all file items
         include_once "./Services/COPage/classes/class.ilPCFileList.php";
         $file_ids = ilPCFileList::collectFileItems($page_obj->getSCORM2004Page(), $page_obj->getSCORM2004Page()->getDomDoc());
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         if ($mode == 'pdf') {
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $q_id) {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
                 $q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
                 $q_gui->outAdditionalOutput();
                 $html = $q_gui->getPreview(TRUE);
                 $page_output = preg_replace("/{{{{{Question;il__qst_" . $q_id . "}}}}}/i", $html, $page_output);
             }
             $sco_tpl->touchBlock("pdf_pg_break");
         }
         $sco_tpl->setCurrentBlock("page");
         $sco_tpl->setVariable("PAGE", $page_output);
         $sco_tpl->parseCurrentBlock();
         // get all question ids of the sco
         if ($a_one_file != "") {
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $i) {
                 if (!in_array($i, $sco_q_ids)) {
                     $sco_q_ids[] = $i;
                 }
             }
         }
     }
     // glossary
     if ($mode != 'pdf') {
         $sco_tpl->setVariable("GLOSSARY_HTML", ilSCORM2004PageGUI::getGlossaryHTML($this));
     }
     if ($a_one_file == "") {
         $output = $sco_tpl->get();
     } else {
         $output = $sco_tpl->get("page");
     }
     if ($mode == 'pdf') {
         $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\\/div>/i", "<h2>\$1</h2>", $output);
     }
     //$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
     $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_mob_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/files\\/file_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_file_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "./players", $output);
     //		$output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","./players",$output);
     $output = preg_replace("/file=..\\/..\\/..\\/.\\//i", "file=../", $output);
     if ($mode != 'pdf') {
         $output = preg_replace_callback("/href=\"&mob_id=(\\d+)&pg_id=(\\d+)\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         // this one is for fullscreen in glossary entries
         $output = preg_replace_callback("/href=\"fullscreen_(\\d+)\\.html\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
         //			$output = preg_replace("/&#123;/","",$output);
         //			$output = preg_replace("/&#125;/","",$output);
         $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
         fputs(fopen($a_target_dir . '/js/questions_' . $this->getId() . '.js', 'w+'), ilQuestionExporter::questionsJS() . $q_handling);
         copy("./Modules/Scorm2004/templates/default/question_handling.css", $a_target_dir . '/css/question_handling.css');
         // hack to get the question js into the file and to display the correct answers
         if ($a_one_file != "") {
             $output = '<script type="text/javascript">' . ilQuestionExporter::questionsJS() . '</script>' . $output;
             if (count($sco_q_ids) > 0) {
                 $output .= '<script type="text/javascript">';
                 foreach ($sco_q_ids as $i) {
                     if ($i > 0) {
                         $output .= "ilias.questions.showCorrectAnswers(" . $i . "); \n";
                     }
                 }
                 $output .= '</script>';
             }
         }
         foreach (ilQuestionExporter::getMobs() as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
     }
     $this->q_media = ilQuestionExporter::getFiles();
     //questions export end
     if ($a_one_file != "") {
         fputs($a_one_file, $output);
     } else {
         fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
     }
     $this->exportFileItems($a_target_dir, $expLog);
 }
 /**
  * export page objects meta data to xml (see ilias_co.dtd)
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 function exportXMLPageContent(&$a_xml_writer, $a_inst = 0)
 {
     //echo "exportxmlpagecontent:$a_inst:<br>";
     $cont_obj = $this->getContentObject();
     $this->page_object->buildDom();
     $this->page_object->insertInstIntoIDs($a_inst);
     $this->mobs_contained = $this->page_object->collectMediaObjects(false);
     //$this->files_contained = $this->page_object->collectFileItems();
     include_once "./Services/COPage/classes/class.ilPCFileList.php";
     $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
     //		$this->questions_contained = $this->page_object->getQuestionIds();
     $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
     $xml = str_replace("&", "&amp;", $xml);
     $a_xml_writer->appendXML($xml);
     $this->page_object->freeDom();
 }
 function getExportResources()
 {
     $export_files = array();
     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $tree = new ilTree($this->slm_object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
         $page_obj = new ilSCORM2004Page($page["obj_id"]);
         $page_obj->buildDom();
         $mob_ids = $page_obj->collectMediaObjects(false);
         foreach ($mob_ids as $mob_id) {
             if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                 $path = ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false);
                 $media_obj = new ilObjMediaObject($mob_id);
                 $export_files[$i]["date"] = $media_obj->getCreateDate();
                 $export_files[$i]["size"] = @filesize($path);
                 // could be remote, e.g. youtube video
                 $export_files[$i]["file"] = $media_obj->getTitle();
                 $export_files[$i]["type"] = $media_obj->getDescription();
                 $export_files[$i]["path"] = $path;
                 $this->ctrl->setParameter($this, "resource", rawurlencode(ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false)));
                 $export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadResource");
                 $i++;
             }
         }
         include_once "./Services/COPage/classes/class.ilPCFileList.php";
         $file_ids = ilPCFileList::collectFileItems($page_obj, $page_obj->getDomDoc());
         foreach ($file_ids as $file_id) {
             $file_obj = new ilObjFile($file_id, false);
             $export_files[$i]["date"] = $file_obj->getCreateDate();
             $export_files[$i]["size"] = $file_obj->getFileSize();
             $export_files[$i]["file"] = $file_obj->getFileName();
             $export_files[$i]["type"] = $file_obj->getFileType();
             $export_files[$i]["file_id"] = $file_id;
             $this->ctrl->setParameter($this, "file_id", $file_id);
             $export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadFile", "");
             $i++;
         }
         unset($page_obj);
     }
     return $export_files;
 }
Example #5
0
 /**
  * Download file of file lists
  */
 function downloadFile()
 {
     $this->obj->buildDom();
     include_once "./Services/COPage/classes/class.ilPCFileList.php";
     $files = ilPCFileList::collectFileItems($this->obj, $this->obj->getDomDoc());
     $file = explode("_", $_GET["file_id"]);
     require_once "./Modules/File/classes/class.ilObjFile.php";
     $file_id = $file[count($file) - 1];
     // file must be in page
     if (!in_array($file_id, $files)) {
         exit;
     }
     $fileObj =& new ilObjFile($file_id, false);
     $fileObj->sendFile();
     exit;
 }
Example #6
0
 /**
  * export object to xml (see ilias_co.dtd)
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 {
     global $ilBench;
     // export glossary
     $attrs = array();
     $attrs["Type"] = "Glossary";
     $a_xml_writer->xmlStartTag("ContentObject", $attrs);
     // MetaData
     $this->exportXMLMetaData($a_xml_writer);
     // collect media objects
     $terms = $this->getTermList();
     $this->mob_ids = array();
     $this->file_ids = array();
     foreach ($terms as $term) {
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         $defs = ilGlossaryDefinition::getDefinitionList($term[id]);
         foreach ($defs as $def) {
             $this->page_object = new ilGlossaryDefPage($def["id"]);
             $this->page_object->buildDom();
             $this->page_object->insertInstIntoIDs(IL_INST_ID);
             $mob_ids = $this->page_object->collectMediaObjects(false);
             include_once "./Services/COPage/classes/class.ilPCFileList.php";
             $file_ids = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
             foreach ($mob_ids as $mob_id) {
                 $this->mob_ids[$mob_id] = $mob_id;
             }
             foreach ($file_ids as $file_id) {
                 $this->file_ids[$file_id] = $file_id;
             }
         }
     }
     // export media objects
     $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Media Objects");
     $ilBench->start("GlossaryExport", "exportMediaObjects");
     $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
     $ilBench->stop("GlossaryExport", "exportMediaObjects");
     $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Media Objects");
     // FileItems
     $expLog->write(date("[y-m-d H:i:s] ") . "Start Export File Items");
     $ilBench->start("ContentObjectExport", "exportFileItems");
     $this->exportFileItems($a_target_dir, $expLog);
     $ilBench->stop("ContentObjectExport", "exportFileItems");
     $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export File Items");
     // Glossary
     $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Glossary Items");
     $ilBench->start("GlossaryExport", "exportGlossaryItems");
     $this->exportXMLGlossaryItems($a_xml_writer, $a_inst, $expLog);
     $ilBench->stop("GlossaryExport", "exportGlossaryItems");
     $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Glossary Items");
     $a_xml_writer->xmlEndTag("ContentObject");
 }
 /**
  * export page objects meta data to xml (see ilias_co.dtd)
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 function exportXMLDefinition(&$a_xml_writer, $a_inst = 0)
 {
     $this->page_object->buildDom();
     $this->page_object->insertInstIntoIDs($a_inst);
     $this->mobs_contained = $this->page_object->collectMediaObjects(false);
     include_once "./Services/COPage/classes/class.ilPCFileList.php";
     $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
     $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
     $xml = str_replace("&", "&amp;", $xml);
     $a_xml_writer->appendXML($xml);
     $this->page_object->freeDom();
 }
 /**
  * Create resource entries for the learning module "PKG" and all SCOS and Assets
  */
 function writeResources()
 {
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php";
     $tree = new ilSCORM2004Tree($this->cont_obj->getId());
     //$tree = new ilTree($this->cont_obj->getId());
     //$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     //$tree->setTreeTablePK("slm_id");
     foreach ($tree->getSubTree($tree->getNodeData($tree->root_id), true, array('sco', 'ass')) as $obj) {
         $attrs = array();
         $attrs["identifier"] = "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . "_ref";
         $attrs["type"] = "webcontent";
         if ($obj['type'] == "sco") {
             $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "sco";
         } else {
             $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "asset";
         }
         $attrs["href"] = "./" . $obj['obj_id'] . "/index.html";
         $this->writer->xmlStartTag("resource", $attrs, "");
         $this->writer->xmlElement("dependency", array("identifierref" => "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'ITSELF'), "");
         $this->writer->xmlElement("dependency", array("identifierref" => "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'OBJECTS'), "");
         $this->writer->xmlElement("dependency", array("identifierref" => "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'RESOURCES'), "");
         $this->writer->xmlElement("dependency", array("identifierref" => "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'FLAVOUR'), "");
         $this->writer->xmlEndTag("resource");
         $attrs = array();
         $attrs["identifier"] = "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'ITSELF';
         $attrs["type"] = "webcontent";
         $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "asset";
         $this->writer->xmlStartTag("resource", $attrs, "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/index.xml"), "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/ilias_co_3_7.dtd"), "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/index.html"), "");
         $this->writer->xmlEndTag("resource");
         $attrs = array();
         $attrs["identifier"] = "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'RESOURCES';
         $attrs["type"] = "webcontent";
         $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "asset";
         $this->writer->xmlStartTag("resource", $attrs, "");
         $this->writer->xmlEndTag("resource");
         $attrs = array();
         $attrs["identifier"] = "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'FLAVOUR';
         $attrs["type"] = "webcontent";
         $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "asset";
         $this->writer->xmlStartTag("resource", $attrs, "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/index.xml"), "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/sco.xsl"), "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/css/system.css"), "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/css/style.css"), "");
         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/js/scorm.js"), "");
         $this->writer->xmlEndTag("resource");
         $attrs = array();
         $attrs["identifier"] = "il_" . IL_INST_ID . "_" . $obj['type'] . "_" . $obj['obj_id'] . 'OBJECTS';
         $attrs["type"] = "webcontent";
         $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "asset";
         $this->writer->xmlStartTag("resource", $attrs, "");
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         $active_css = ilObjStyleSheet::getContentStylePath($this->cont_obj->getStyleSheetId());
         $active_css = split(@'\\?', $active_css, 2);
         $css = fread(fopen($active_css[0], 'r'), filesize($active_css[0]));
         preg_match_all("/url\\(([^\\)]*)\\)/", $css, $css_files);
         $css_files = array_unique($css_files[1]);
         $currdir = getcwd();
         chdir(dirname($active_css[0]));
         foreach ($css_files as $fileref) {
             if (file_exists($fileref)) {
                 $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/images/" . basename($fileref)), "");
             }
         }
         chdir($currdir);
         include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php";
         $pagetree = new ilSCORM2004Tree($this->cont_obj->getId());
         //$pagetree = new ilTree($this->cont_obj->getId());
         //$pagetree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
         //$pagetree->setTreeTablePK("slm_id");
         foreach ($pagetree->getSubTree($pagetree->getNodeData($obj['obj_id']), false, 'page') as $page) {
             $page_obj = new ilSCORM2004Page($page);
             $page_obj->buildDom();
             $mob_ids = $page_obj->collectMediaObjects(false);
             foreach ($mob_ids as $mob_id) {
                 if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                     $media_obj = new ilObjMediaObject($mob_id);
                     $media_obj = $media_obj->getMediaItem("Standard");
                     if ($media_obj != null && $media_obj->getLocationType() == "LocalFile") {
                         $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/objects/il_" . IL_INST_ID . "_mob_" . $mob_id . "/" . rawurlencode($media_obj->getLocation())), "");
                     }
                 }
             }
             include_once "./Services/COPage/classes/class.ilPCFileList.php";
             $file_ids = ilPCFileList::collectFileItems($page_obj, $page_obj->getDomDoc());
             foreach ($file_ids as $file_id) {
                 if (ilObject::_lookupType($file_id) == "file") {
                     include_once "./Modules/File/classes/class.ilObjFile.php";
                     $file_obj = new ilObjFile($file_id, false);
                     $this->writer->xmlElement("file", array("href" => "./" . $obj['obj_id'] . "/objects/il_" . IL_INST_ID . "_file_" . $file_id . "/" . rawurlencode($file_obj->filename)), "");
                 }
             }
             unset($page_obj);
         }
         $this->writer->xmlEndTag("resource");
     }
     if ($this->version == "2004") {
         $attrs = array();
         $attrs["identifier"] = "PKG";
         $attrs["type"] = "webcontent";
         $attrs[$this->version == "2004" ? "adlcp:scormType" : "adlcp:scormtype"] = "asset";
         $this->writer->xmlStartTag("resource", $attrs, "");
         $xsd_files = array('adlcp_v1p3.xsd', 'adlseq_v1p3.xsd', 'imsss_v1p0.xsd', 'adlnav_v1p3.xsd', 'adlnav_v1p3.xsd', 'imscp_v1p1.xsd', 'imsmanifest.xml', 'imsss_v1p0auxresource.xsd', 'imsss_v1p0control.xsd', 'imsss_v1p0delivery.xsd', 'imsss_v1p0limit.xsd', 'imsss_v1p0objective.xsd', 'imsss_v1p0random.xsd', 'imsss_v1p0rollup.xsd', 'imsss_v1p0seqrule.xsd', 'imsss_v1p0util.xsd', 'xml.xsd', 'index.html');
         foreach ($xsd_files as $xsd_file) {
             $attrs = array();
             $attrs["href"] = $xsd_file;
             $this->writer->xmlElement("file", $attrs, "");
         }
         $this->writer->xmlEndTag("resource");
     }
 }