public function __construct() { global $tpl, $ilCtrl, $ilAccess, $ilToolbar, $ilLocator, $tree, $lng, $ilLog, $ilias; parent::ilContainerGUI(array(), $_GET["ref_id"], true, false); $this->tpl = $tpl; $this->ctrl = $ilCtrl; $this->ilAccess = $ilAccess; $this->ilLocator = $ilLocator; $this->tree = $tree; $this->toolbar = $ilToolbar; $this->ilLog = $ilLog; $this->ilias = $ilias; $lng->loadLanguageModule("orgu"); $this->tpl->addCss('./Modules/OrgUnit/templates/default/orgu.css'); }
private function buildQuestionPage(assQuestionGUI $questionGUI) { $this->tpl->addCss('Services/COPage/css/content.css'); include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php"; $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId()); $pageGUI->setOutputMode("presentation"); $pageGUI->setRenderPageContainer(true); $pageGUI->setPresentationTitle($questionGUI->object->getTitle()); $questionGUI->object->setShuffle(false); // dirty, but works ^^ $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true); $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML)); $pageHTML = $pageGUI->presentation(); $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML); return $pageHTML; }
/** * showRecord * a_val = */ public function renderRecord() { global $ilTabs, $tpl, $ilCtrl, $lng; $rctpl = new ilTemplate("tpl.record_view.html", true, true, "Modules/DataCollection"); $ilTabs->setTabActive("id_content"); $view_id = self::_getViewDefinitionId($this->record_obj); if (!$view_id) { $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords"); } // please do not use ilPageObjectGUI directly here, use derived class // ilDataCollectionRecordViewViewdefinitionGUI //$pageObj = new ilPageObjectGUI("dclf", $view_id); // see ilObjDataCollectionGUI->executeCommand about instantiation include_once "./Modules/DataCollection/classes/class.ilDataCollectionRecordViewViewdefinitionGUI.php"; $pageObj = new ilDataCollectionRecordViewViewdefinitionGUI($this->record_obj->getTableId(), $view_id); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $pageObj->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl")); $html = $pageObj->getHTML(); $rctpl->addCss("./Services/COPage/css/content.css"); $rctpl->fillCssFiles(); $table = ilDataCollectionCache::getTableCache($this->record_obj->getTableId()); foreach ($table->getFields() as $field) { //ILIAS_Ref_Links $pattern = '/\\[dcliln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dcliln\\]/'; if (preg_match($pattern, $html)) { $html = preg_replace($pattern, $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->setOptions("\$1")), $html); } //DataCollection Ref Links $pattern = '/\\[dclrefln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dclrefln\\]/'; if (preg_match($pattern, $html)) { $this->currentField = $field; $html = preg_replace_callback($pattern, array($this, "doReplace"), $html); } $pattern = '/\\[ext tableOf="' . preg_quote($field->getTitle(), "/") . '" field="(.*?)"\\]/'; if (preg_match($pattern, $html)) { $this->currentField = $field; $html = preg_replace_callback($pattern, array($this, "doExtReplace"), $html); } $html = str_ireplace("[" . $field->getTitle() . "]", $this->record_obj->getRecordFieldHTML($field->getId()), $html); } $rctpl->setVariable("CONTENT", $html); //Permanent Link include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php"; $perma_link = new ilPermanentLinkGUI("dcl", $_GET["ref_id"], "_" . $_GET['record_id']); $rctpl->setVariable("PERMA_LINK", $perma_link->getHTML()); $tpl->setContent($rctpl->get()); }
/** * @param bool $editComments */ public function renderRecord($editComments = false) { global $ilTabs, $tpl, $ilCtrl, $lng; $rctpl = new ilTemplate("tpl.record_view.html", false, true, "Modules/DataCollection"); $ilTabs->setTabActive("id_content"); $view_id = self::_getViewDefinitionId($this->record_obj); if (!$view_id) { $ilCtrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords"); } // see ilObjDataCollectionGUI->executeCommand about instantiation include_once "./Modules/DataCollection/classes/class.ilDataCollectionRecordViewViewdefinitionGUI.php"; $pageObj = new ilDataCollectionRecordViewViewdefinitionGUI($this->record_obj->getTableId(), $view_id); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $pageObj->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl")); $html = $pageObj->getHTML(); $rctpl->addCss("./Services/COPage/css/content.css"); $rctpl->fillCssFiles(); $table = ilDataCollectionCache::getTableCache($this->record_obj->getTableId()); foreach ($table->getRecordFields() as $field) { //ILIAS_Ref_Links $pattern = '/\\[dcliln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dcliln\\]/'; if (preg_match($pattern, $html)) { $html = preg_replace($pattern, $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->setOptions("\$1")), $html); } //DataCollection Ref Links $pattern = '/\\[dclrefln field="' . preg_quote($field->getTitle(), "/") . '"\\](.*?)\\[\\/dclrefln\\]/'; if (preg_match($pattern, $html)) { $this->currentField = $field; $html = preg_replace_callback($pattern, array($this, "doReplace"), $html); } $pattern = '/\\[ext tableOf="' . preg_quote($field->getTitle(), "/") . '" field="(.*?)"\\]/'; if (preg_match($pattern, $html)) { $this->currentField = $field; $html = preg_replace_callback($pattern, array($this, "doExtReplace"), $html); } $html = str_ireplace("[" . $field->getTitle() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html); } foreach ($table->getStandardFields() as $field) { $html = str_ireplace("[" . $field->getId() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html); } $rctpl->setVariable("CONTENT", $html); //Permanent Link $perma_link = new ilPermanentLinkGUI("dcl", $_GET["ref_id"], "_" . $_GET['record_id']); $tpl->setVariable('PRMLINK', $perma_link->getHTML()); // Buttons for previous/next records if ($this->is_enabled_paging) { $prevNextLinks = $this->renderPrevNextLinks(); $rctpl->setVariable('PREV_NEXT_RECORD_LINKS', $prevNextLinks); $ilCtrl->clearParameters($this); // #14083 $rctpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this)); $rctpl->setVariable('RECORD', $lng->txt('dcl_record')); $rctpl->setVariable('RECORD_FROM_TOTAL', sprintf($lng->txt('dcl_record_from_total'), $this->current_record_position, count($this->record_ids))); $rctpl->setVariable('SELECT_OPTIONS', $this->renderSelectOptions()); } // Edit Button if ($this->record_obj->hasPermissionToEdit((int) $_GET['ref_id'])) { $button = ilLinkButton::getInstance(); $ilCtrl->setParameterByClass('ildatacollectionrecordeditgui', 'table_id', $this->table->getId()); $ilCtrl->setParameterByClass('ildatacollectionrecordeditgui', 'redirect', ilDataCollectionRecordEditGUI::REDIRECT_DETAIL); $ilCtrl->saveParameterByClass('ildatacollectionrecordeditgui', 'record_id'); $button->setUrl($ilCtrl->getLinkTargetByClass('ildatacollectionrecordeditgui', 'edit')); $button->setCaption($lng->txt('dcl_edit_record'), false); $rctpl->setVariable('EDIT_RECORD_BUTTON', $button->render()); } // Comments if ($this->table->getPublicCommentsEnabled()) { $rctpl->setVariable('COMMENTS', $this->renderComments($editComments)); } $tpl->setContent($rctpl->get()); }
/** * 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); }