/** * @param ilObjectGUI $a_parent_obj * @param string $a_parent_cmd */ public function __construct(ilObjectGUI $a_parent_obj, $a_parent_cmd) { /** * @var $ilCtrl ilCtrl */ global $ilCtrl; $this->ctrl = $ilCtrl; // Call this immediately in constructor $this->setId('tos_agreement_by_lng'); $this->setDefaultOrderDirection('ASC'); $this->setDefaultOrderField('language'); $this->setExternalSorting(false); $this->setExternalSegmentation(false); parent::__construct($a_parent_obj, $a_parent_cmd); $this->setTitle($this->lng->txt('tos_agreement_by_lng')); $this->addColumn($this->lng->txt('language'), 'language'); $this->addColumn($this->lng->txt('tos_agreement'), 'agreement'); $this->addColumn($this->lng->txt('tos_agreement_document'), 'agreement_document'); $this->optionalColumns = (array) $this->getSelectableColumns(); $this->visibleOptionalColumns = (array) $this->getSelectedColumns(); foreach ($this->visibleOptionalColumns as $column) { $this->addColumn($this->optionalColumns[$column]['txt'], $column); } $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyAgreementByLanguageFilter')); $this->setRowTemplate('tpl.tos_agreement_by_lng_table_row.html', 'Services/TermsOfService'); $this->setShowRowsSelector(true); require_once 'Services/jQuery/classes/class.iljQueryUtil.php'; require_once 'Services/YUI/classes/class.ilYuiUtil.php'; iljQueryUtil::initjQuery(); ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $this->initFilter(); $this->setFilterCommand('applyAgreementByLanguageFilter'); $this->setResetCommand('resetAgreementByLanguageFilter'); }
protected function initOverlay() { include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initOverlay(); $this->tpl->addCss('Modules/TestQuestionPool/templates/default/lac_legend.css'); //$this->setAnchor('fixed_content', 'tr', 'tr'); // we use css instead, does not hoppel over screen for initially visible overlays //$this->setTrigger('lac_legend_toggle_btn', 'click'); // is done by own listener that also changes the toggle label $this->setVisible($this->isInitialVisibilityEnabled()); $this->setAutoHide(false); $this->add(); }
/** * @param $question_id * @param $question_pool_id * * @return ilPropertyFormGUI */ protected function buildAdjustQuestionForm($question_id, $question_pool_id) { require_once './Services/Form/classes/class.ilPropertyFormGUI.php'; require_once './Modules/TestQuestionPool/classes/class.assQuestion.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("adjustment"); /** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */ $question = assQuestion::instantiateQuestionGUI($question_id); $form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>'); $hidden_question_id = new ilHiddenInputGUI('q_id'); $hidden_question_id->setValue($question_id); $form->addItem($hidden_question_id); $hidden_qpl_id = new ilHiddenInputGUI('qpl_id'); $hidden_qpl_id->setValue($question_pool_id); $form->addItem($hidden_qpl_id); $this->populateScoringAdjustments($question, $form); $manscoring_section = new ilFormSectionHeaderGUI(); $manscoring_section->setTitle($this->lng->txt('manscoring')); $form->addItem($manscoring_section); $manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring'); $manscoring_preservation->setChecked(true); $manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info')); $form->addItem($manscoring_preservation); $form->addCommandButton("savescoringfortest", $this->lng->txt("save")); $participants = $this->object->getParticipants(); $active_ids = array_keys($participants); $results = array(); foreach ($active_ids as $active_id) { $passes[] = $this->object->_getPass($active_id); foreach ($passes as $key => $pass) { for ($i = 0; $i <= $pass; $i++) { $results[] = $question->object->getSolutionValues($active_id, $i); } } } $relevant_answers = array(); foreach ($results as $result) { foreach ($result as $answer) { if ($answer['question_fi'] == $question->object->getId()) { $relevant_answers[] = $answer; } } } $answers_view = $question->getAggregatedAnswersView($relevant_answers); include_once 'Services/jQuery/classes/class.iljQueryUtil.php'; iljQueryUtil::initjQuery(); include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js'); $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js"); $container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test'); $container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ'); $container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close')))); $container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview')); $container->setVariable('TXT_CLOSE', $this->lng->txt('close')); $container->setVariable('ANSWER_OVERVIEW', $answers_view); $custom_input = new ilCustomInputGUI('', 'aggr_usr_answ'); $custom_input->setHtml($container->get()); $form->addItem($custom_input); return $form; }
/** * Init javascript * * @param * @return */ static function initJavascript() { global $tpl; include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initOverlay(); $tpl->addJavascript("./Services/UIComponent/Overlay/js/ilOverlay.js"); }
/** * Get selection list HTML */ public function getHTML($a_only_cmd_list_asynch = false) { $items = $this->getItems(); // do not show list, if no item is in list if (count($items) == 0 && !$this->getAsynch()) { return ""; } include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initOverlay(); $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Overlay/js/ilOverlay.js"); $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js"); $tpl = new ilTemplate("tpl.adv_selection_list.html", true, true, "Services/UIComponent/AdvancedSelectionList", "DEFAULT", false, true); reset($items); $cnt = 0; if ($this->getAsynch()) { $tpl->setCurrentBlock("asynch_request"); $tpl->setVariable("IMG_LOADER", ilUtil::getImagePath("loader.gif")); $tpl->parseCurrentBlock(); } else { foreach ($items as $item) { if (isset($item["ref_id"])) { $sel_arr[$item["ref_id"]] = isset($item["title"]) ? $item["title"] : ""; } $this->css_row = $this->css_row != "tblrow1_mo" ? "tblrow1_mo" : "tblrow2_mo"; if ($this->getUseImages()) { if ($item["img"]) { $tpl->setCurrentBlock("image"); $tpl->setVariable("IMG_ITEM", $item["img"]); $tpl->setVariable("ALT_ITEM", $item["alt"]); $tpl->parseCurrentBlock(); } else { $tpl->touchBlock("no_image"); } } if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_HREF || $this->getItemLinkClass() != "") { if ($item["frame"]) { $tpl->setCurrentBlock("frame"); $tpl->setVariable("TARGET_ITEM", $item["frame"]); $tpl->parseCurrentBlock(); } if ($this->getItemLinkClass() != "") { $tpl->setCurrentBlock("item_link_class"); $tpl->setVariable("ITEM_LINK_CLASS", $this->getItemLinkClass()); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("href_s"); $tpl->setVariable("HREF_ITEM", 'href="' . $item["link"] . '"'); $tpl->setVariable("ID_ITEM", $this->getId() . "_" . $item["value"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("href_e"); } $tpl->setCurrentBlock("item"); if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_HREF) { if ($item["prevent_background_click"]) { $tpl->setVariable("ONCLICK_ITEM", ''); } else { if ($item["onclick"] == "") { $tpl->setVariable("ONCLICK_ITEM", 'onclick="' . "return il.AdvancedSelectionList.openTarget('" . $item["link"] . "','" . $item["frame"] . "');" . '"'); } else { $tpl->setVariable("ONCLICK_ITEM", 'onclick="' . "return " . $item["onclick"] . ";" . '"'); } } } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SUBMIT) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="return il.AdvancedSelectionList.submitForm(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $this->on_click_form_id . "','" . $this->form_mode["button_cmd"] . "');\""); } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="return il.AdvancedSelectionList.selectForm(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $item["title"] . "');\""); } else { if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_NOP) { $tpl->setVariable("ONCLICK_ITEM", 'onclick="il.AdvancedSelectionList.clickNop(\'' . $this->getId() . '\'' . ", '" . $this->form_mode["select_name"] . "','" . $item["value"] . "'," . "'" . $item["title"] . "');\""); } } } } $tpl->setVariable("CSS_ROW", $this->css_row); if ($item["html"] == "") { $tpl->setVariable("TXT_ITEM", $item["title"]); } else { $tpl->setVariable("TXT_ITEM", $item["html"]); } $tpl->setVariable("ID_ITEM_TR", $this->getId() . "_" . $item["value"] . "_tr"); if ($item["ttip"] != "") { include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php"; ilTooltipGUI::addTooltip($this->getId() . "_" . $item["value"] . "_tr", $item["ttip"], "", $item["tt_my"], $item["tt_at"], $item["tt_use_htmlspecialchars"]); } $tpl->parseCurrentBlock(); // add item to js object $tpl->setCurrentBlock("js_item"); $tpl->setVariable("IT_ID", $this->getId()); $tpl->setVariable("IT_HID_NAME", $this->form_mode["select_name"]); $tpl->setVariable("IT_HID_VAL", $item["value"]); $tpl->setVariable("IT_TITLE", str_replace("'", "\\'", $item["title"])); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock("cmd_table"); $tpl->parseCurrentBlock(); if ($a_only_cmd_list_asynch) { return $tpl->get("cmd_table"); } if ($this->getHeaderIcon() != ilAdvancedSelectionListGUI::NO_ICON) { $tpl->setCurrentBlock("top_img"); switch ($this->getHeaderIcon()) { case ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT: $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT)); break; case ilAdvancedSelectionListGUI::DOWN_ARROW_DARK: $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK)); break; case ilAdvancedSelectionListGUI::DOWN_ARROW_TOPBAR: $tpl->setVariable("IMG_DOWN", ilUtil::getImagePath(ilAdvancedSelectionListGUI::DOWN_ARROW_TOPBAR)); break; default: $tpl->setVariable("IMG_DOWN", $this->getHeaderIcon()); break; } // do not repeat title (accessibility) -> empty alt //$tpl->setVariable("ALT_SEL_TOP", $this->getListTitle()); $tpl->setVariable("ALT_SEL_TOP", ""); $tpl->parseCurrentBlock(); } // output hidden input, if click mode is form submission if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SUBMIT) { $tpl->setCurrentBlock("hidden_input"); $tpl->setVariable("HID", $this->getId()); $tpl->parseCurrentBlock(); } // output hidden input and initialize if ($this->getOnClickMode() == ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT) { $tpl->setCurrentBlock("hidden_input"); $tpl->setVariable("HID", $this->getId()); $tpl->parseCurrentBlock(); // init hidden input with selected value $tpl->setCurrentBlock("init_hidden_input"); $tpl->setVariable("H2ID", $this->getId()); $tpl->setVariable("HID_NAME", $this->form_mode["select_name"]); $tpl->setVariable("HID_VALUE", $this->getSelectedValue()); $tpl->parseCurrentBlock(); } // js section $tpl->setCurrentBlock("js_section"); if ($this->getAccessKey() > 0) { include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $tpl->setVariable("ACCKEY", ilAccessKeyGUI::getAttribute($this->getAccessKey())); } $cfg["trigger_event"] = $this->getTriggerEvent(); $cfg["auto_hide"] = $this->getAutoHide(); if ($this->getSelectCallback() != "") { $cfg["select_callback"] = $this->getSelectCallback(); } $cfg["anchor_id"] = "ilAdvSelListAnchorElement_" . $this->getId(); $cfg["asynch"] = $this->getAsynch() ? true : false; $cfg["asynch_url"] = $this->getAsynchUrl(); $toggle = $this->getAdditionalToggleElement(); if (is_array($toggle)) { $cfg["toggle_el"] = $toggle["el"]; $cfg["toggle_class_on"] = $toggle["class_on"]; } //echo "<br>".htmlentities($this->getAsynchUrl()); include_once "./Services/JSON/classes/class.ilJsonUtil.php"; $tpl->setVariable("TXT_SEL_TOP", $this->getListTitle()); $tpl->setVariable("ID", $this->getId()); $tpl->setVariable("CFG", ilJsonUtil::encode($cfg)); //echo htmlentities(ilJsonUtil::encode($cfg)); $tpl->setVariable("CLASS_SEL_TOP", $this->getSelectionHeaderClass()); if ($this->getSelectionHeaderSpanClass() != "") { $tpl->setVariable("CLASS_SEL_TOP_SPAN", $this->getSelectionHeaderSpanClass()); } // set the async url to an extra template variable // (needed for a mobile skin) $tpl->setVariable("ASYNC_URL", $this->getAsynchUrl()); $tpl->parseCurrentBlock(); // no js sections if (false) { switch ($this->mode) { // links mode case ilAdvancedSelectionListGUI::MODE_LINKS: reset($items); $cnt = 0; foreach ($items as $item) { $tpl->setCurrentBlock("no_js_link"); $tpl->setVariable("LINKS_CLASS", $this->links_mode["link_class"]); $tpl->setVariable("LINKS_HREF", $item["link"]); $tpl->setVariable("LINKS_TXT", $item["title"]); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("no_js_section"); $tpl->parseCurrentBlock(); } break; case ilAdvancedSelectionListGUI::MODE_FORM_SELECT: reset($items); $cnt = 0; foreach ($items as $item) { $tpl->setCurrentBlock("no_js_form_option"); $tpl->setVariable("FRM_OPTION_TXT", $item["title"]); $tpl->setVariable("FRM_OPTION_VAL", $item["value"]); if ($this->getSelectedValue() == $item["value"]) { $tpl->setVariable("SELECTED", ' selected="selected" '); } $tpl->parseCurrentBlock(); } if ($this->form_mode["include_form_tag"]) { $tpl->setCurrentBlock("no_js_form_begin"); $tpl->setVariable("FRM_ID", $this->form_mode["form_id"]); $tpl->setVariable("FRM_CLASS", $this->form_mode["form_class"]); $tpl->setVariable("FRM_ACTION", $this->form_mode["form_action"]); $tpl->setVariable("FRM_TARGET", $this->form_mode["form_target"]); $tpl->parseCurrentBlock(); $tpl->touchBlock("no_js_form_end"); } if ($this->form_mode["button_text"]) { $tpl->setCurrentBlock("no_js_form_button"); $tpl->setVariable("FRM_BT_TXT", $this->form_mode["button_text"]); $tpl->setVariable("FRM_BT_CLASS", $this->form_mode["button_class"]); if ($this->form_mode["button_cmd"] != "") { $tpl->setVariable("FRM_BT_CMD", 'name="cmd[' . $this->form_mode["button_cmd"] . ']"'); } $tpl->parseCurrentBlock(); } $tpl->setVariable("FRM_SELECT_NAME", $this->form_mode["select_name"]); $tpl->setVariable("FRM_SELECT_CLASS", $this->form_mode["select_class"]); if ($this->getAccessKey() > 0) { include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $tpl->setVariable("ACCKEYNJS", ilAccessKeyGUI::getAttribute($this->getAccessKey())); } $tpl->setCurrentBlock("no_js_section"); $tpl->parseCurrentBlock(); break; } } return $tpl->get(); }
/** * */ private function showManScoringByQuestionParticipantsTable($manPointsPost = array()) { /** * @var $tpl ilTemplate * @var $ilAccess ilAccessHandler */ global $tpl, $ilAccess; if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true); $this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen'); } include_once 'Services/jQuery/classes/class.iljQueryUtil.php'; iljQueryUtil::initjQuery(); include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $mathJaxSetting = new ilSetting('MathJax'); if ($mathJaxSetting->get("enable")) { $tpl->addJavaScript($mathJaxSetting->get("path_to_mathjax")); } $tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js'); $tpl->addJavaScript("./Services/JavaScript/js/Basic.js"); $tpl->addJavaScript("./Services/Form/js/Form.js"); $tpl->addCss($this->object->getTestStyleLocation("output"), "screen"); require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php'; $table = new ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI($this); $table->setManualScoringPointsPostData($manPointsPost); $qst_id = $table->getFilterItemByPostVar('question')->getValue(); $pass_id = $table->getFilterItemByPostVar('pass')->getValue(); $table_data = array(); $selected_questionData = null; if (is_numeric($qst_id)) { $scoring = ilObjAssessmentFolder::_getManualScoring(); $info = assQuestion::_getQuestionInfo($qst_id); $selected_questionData = $info; $type = $info["question_type_fi"]; if (in_array($type, $scoring)) { $selected_questionData = $info; } } if ($selected_questionData && is_numeric($pass_id)) { $data = $this->object->getCompleteEvaluationData(FALSE); foreach ($data->getParticipants() as $active_id => $participant) { $testResultData = $this->object->getTestResult($active_id, $pass_id - 1); foreach ($testResultData as $questionData) { if (!isset($questionData['qid']) || $questionData['qid'] != $selected_questionData['question_id']) { continue; } $table_data[] = array('pass_id' => $pass_id - 1, 'active_id' => $active_id, 'qst_id' => $questionData['qid'], 'reached_points' => assQuestion::_getReachedPoints($active_id, $questionData['qid'], $pass_id - 1), 'maximum_points' => assQuestion::_getMaximumPoints($questionData['qid']), 'participant' => $participant); } } } else { $table->disable('header'); } if ($selected_questionData) { $maxpoints = assQuestion::_getMaximumPoints($selected_questionData['question_id']); if ($maxpoints == 1) { $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')'; } else { $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')'; } $table->setTitle($this->lng->txt('tst_man_scoring_by_qst') . ': ' . $selected_questionData['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $selected_questionData['question_id'] . ']'); } else { $table->setTitle($this->lng->txt('tst_man_scoring_by_qst')); } $table->setData($table_data); $tpl->setContent($table->getHTML()); }