예제 #1
0
 /**
  * SCO preview
  */
 function sco_preview()
 {
     global $tpl, $ilCtrl, $lng;
     // init main template
     $tpl = new ilTemplate("tpl.main.html", true, true);
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $tpl->setBodyClass("");
     $tpl->setCurrentBlock("ContentStyle");
     $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->slm_object->getStyleSheetId()));
     $tpl->parseCurrentBlock();
     // get javascript
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/pure.js");
     $tpl->addJavaScript("./Modules/Scorm2004/scripts/pager.js");
     $tpl->addOnLoadCode("pager.Init();");
     $tree = new ilTree($this->slm_object->getId());
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $meta = new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
     $desc_ids = $meta->getGeneral()->getDescriptionIds();
     $sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
     // get sco template
     $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
     // navigation
     $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->node_object->getSLMId());
     ilSCORM2004Asset::renderNavigation($sco_tpl, "", $lk);
     // meta page (description and objectives)
     ilSCORM2004Asset::renderMetaPage($sco_tpl, $this->node_object, $this->node_object->getType());
     // init export (this initialises glossary template)
     ilSCORM2004PageGUI::initExport();
     $terms = $this->node_object->getGlossaryTermIds();
     // render page
     foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) {
         $page_obj = new ilSCORM2004PageGUI($this->node_object->getType(), $page["obj_id"], 0, $this->slm_object->getId());
         $page_obj->setPresentationTitle($page["title"]);
         $page_obj->setOutputMode(IL_PAGE_PREVIEW);
         $page_obj->setStyleId($this->slm_object->getStyleSheetId());
         if (count($terms) > 1) {
             $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this->node_object);
         }
         $sco_tpl->setCurrentBlock("page_preview");
         $html = $ilCtrl->getHTML($page_obj);
         //$sco_tpl->setVariable("PAGE_PRV", $page_obj->showPage("export"));
         $sco_tpl->setVariable("PAGE_PRV", $html);
         $sco_tpl->parseCurrentBlock();
     }
     $output = $sco_tpl->get();
     // append glossary entries on the sco level
     $output .= ilSCORM2004PageGUI::getGlossaryHTML($this->node_object);
     //insert questions
     require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
     $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
     //		$output = preg_replace("/{/","",$output);
     //		$output = preg_replace("/}/","",$output);
     $output = "<script>var ScormApi=null;" . ilQuestionExporter::questionsJS() . "</script>" . $output;
     $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->node_object->getSLMId());
     //		include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php");
     //		ilSCORM2004PageGUI::addPreparationJavascript($tpl, $lk);
     $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/question_handling.js");
     $tpl->addCss("./Modules/Scorm2004/templates/default/question_handling.css");
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     //inline JS
     $output .= '<script type="text/javascript" src="./Modules/Scorm2004/scripts/questions/question_handling.js"></script>';
     $tpl->setVariable("CONTENT", $output);
 }