/** * Constructor * @access public */ function ilSCORM2004AssetGUI($a_slm_obj, $a_node_id = 0) { global $ilCtrl; $ilCtrl->saveParameter($this, "obj_id"); $this->ctrl = $ilCtrl; parent::__construct($a_slm_obj, $a_node_id); }
/** * execute command */ function &executeCommand() { global $ilCtrl, $tpl; $next_class = $ilCtrl->getNextClass($this); $cmd = $ilCtrl->getCmd(); switch ($next_class) { case "ilscorm2004pagegui": $tpl->getStandardTemplate(); $this->setContentStyle(); $this->setLocator(); // Determine whether the view of a learning resource should // be shown in the frameset of ilias, or in a separate window. //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame"; $showViewInFrameset = true; $ilCtrl->setReturn($this, "edit"); include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php"; $page_gui =& new ilSCORM2004PageGUI($this->slm_object->getType(), $this->node_object->getId(), 0, $this->getParentGUI()->object->getId(), $this->slm_object->getAssignedGlossary()); $page_gui->setEditPreview(true); $page_gui->setPresentationTitle($this->node_object->getTitle()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->slm_object->getStyleSheetId(), "sahs")); if ($this->node_object->tree->getParentId($this->node_object->getId()) > 0) { $sco = new ilSCORM2004Sco($this->node_object->getSLMObject(), $this->node_object->tree->getParentId($this->node_object->getId())); if (count($sco->getGlossaryTermIds()) > 1) { include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php"; $page_gui->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $sco); } } $ilCtrl->setParameterByClass("ilobjscorm2004learningmodulegui", "active_node", $_GET["obj_id"]); $page_gui->setExplorerUpdater("tree", "tree_div", $ilCtrl->getLinkTargetByClass("ilobjscorm2004learningmodulegui", "showTree", "", true)); $ilCtrl->setParameterByClass("ilobjscorm2004learningmodulegui", "active_node", ""); // set page view link $view_frame = ilFrameTargetInfo::_getFrame("MainContent"); $page_gui->setLinkParams("ref_id=" . $this->slm_object->getRefId()); $tpl->setTitleIcon(ilUtil::getImagePath("icon_pg_b.png")); $page_gui->activateMetaDataEditor($this->slm_object->getID(), $this->node_object->getId(), $this->node_object->getType(), $this->node_object, 'MDUpdateListener'); $ret = $ilCtrl->forwardCommand($page_gui); $this->setTabs(); $tpl->setContent($ret); break; default: $ret =& $this->{$cmd}(); break; } return $ret; }
/** * Get glossary html (only in export mode) */ static function getGlossaryHTML($a_sco) { $ret = self::$export_glo_tpl->get(); $ret .= ilSCORM2004ScoGUI::getGloOverviewOv($a_sco); return $ret; }
/** * execute command */ function executeCommand() { global $ilAccess, $ilCtrl, $tpl, $ilTabs, $lng; $next_class = $ilCtrl->getNextClass($this); $cmd = $ilCtrl->getCmd(); if ($this->object->getEditable() && $cmd != "showEditTree") { $this->showEditTree(); } // update expander include_once "./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php"; $form_gui = new ilSCORM2004OrganizationHFormGUI(); $form_gui->setTree($this->getEditTree()); $form_gui->updateExpanded(); switch ($next_class) { // notes case "ilnotegui": $this->getTemplate(); $this->setLocator(); $this->setTabs(); switch ($_GET["notes_mode"]) { default: $ilTabs->setTabActive("sahs_organization"); return $this->showOrganization(); } break; // chapters // chapters case "ilscorm2004chaptergui": include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ChapterGUI.php"; $chap_gui = new ilSCORM2004ChapterGUI($this->object, $_GET["obj_id"]); $chap_gui->setParentGUI($this); return $ilCtrl->forwardCommand($chap_gui); // sequencing chapters // sequencing chapters case "ilscorm2004seqchaptergui": include_once "./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapterGUI.php"; $chap_gui = new ilSCORM2004SeqChapterGUI($this->object, $_GET["obj_id"]); $chap_gui->setParentGUI($this); return $ilCtrl->forwardCommand($chap_gui); // scos // scos case "ilscorm2004scogui": include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php"; $sco_gui = new ilSCORM2004ScoGUI($this->object, $_GET["obj_id"]); $sco_gui->setParentGUI($this); return $ilCtrl->forwardCommand($sco_gui); // assets // assets case "ilscorm2004assetgui": include_once "./Modules/Scorm2004/classes/class.ilSCORM2004AssetGUI.php"; $ass_gui = new ilSCORM2004AssetGUI($this->object, $_GET["obj_id"]); $ass_gui->setParentGUI($this); return $ilCtrl->forwardCommand($ass_gui); // pages // pages case "ilscorm2004pagenodegui": include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNodeGUI.php"; $page_gui = new ilSCORM2004PageNodeGUI($this->object, $_GET["obj_id"]); $page_gui->setParentGUI($this); $ilCtrl->forwardCommand($page_gui); break; default: parent::executeCommand(); $this->addHeaderAction(); break; } }
/** * 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("/{/","",$output); // $output = preg_replace("/}/","",$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); }
/** * des * * @param * @return */ static function getGloOverviewOv($a_sco) { global $lng; $tpl = new ilTemplate("tpl.sco_glossary_overview.html", true, true, "Modules/Scorm2004"); $terms = $a_sco->getGlossaryTermIds(); $lk = ilObjSAHSLearningModule::getAffectiveLocalization($a_sco->getSLMId()); foreach ($terms as $k => $t) { $tpl->setCurrentBlock("link"); $tpl->setVariable("TXT_LINK", $t); $tpl->setVariable("ID_LINK", "glo_ov_t" . $k); $tpl->parseCurrentBlock(); } $tpl->setVariable("DIV_ID", ilSCORM2004ScoGUI::getGlossaryOverviewId()); $tpl->setVariable("TXT_SCO_GLOSSARY", $lng->txtlng("content", "cont_sco_glossary", $lk)); $tpl->setVariable("TXT_CLOSE", $lng->txtlng("common", "close", $lk)); if (count($terms) > 1) { return $tpl->get(); } else { return ""; } }