/** * builds the question set config form and initialises the fields * with the config currently saved in database * * @return ilPropertyFormGUI $form */ private function buildForm() { $this->questionSetConfig->loadFromDb($this->testOBJ->getTestId()); require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setId("tst_form_dynamic_question_set_config"); $form->setTitle($this->lng->txt('tst_form_dynamic_question_set_config')); $form->setTableWidth("100%"); $hiddenInputTaxSelectOptAsyncUrl = new ilHiddenInputGUI('taxSelectOptAsyncUrl'); $hiddenInputTaxSelectOptAsyncUrl->setValue($this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC, '', true)); $form->addItem($hiddenInputTaxSelectOptAsyncUrl); if ($this->testOBJ->participantDataExist()) { $pool = new ilNonEditableValueGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_title'); $pool->setValue($this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree)); $pool->setDisabled(true); $form->addItem($pool); } else { $poolInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_source_questionpool'), 'source_qpl_id'); $poolInput->setOptions($this->buildQuestionPoolSelectInputOptionArray($this->testOBJ->getAvailableQuestionpools(true, false, false, true, true))); $poolInput->setValue($this->questionSetConfig->getSourceQuestionPoolId()); $poolInput->setRequired(true); $form->addItem($poolInput); } $questionOderingInput = new ilRadioGroupInputGUI($this->lng->txt('tst_input_dynamic_question_set_question_ordering'), 'question_ordering'); $questionOderingInput->setValue($this->questionSetConfig->getOrderingTaxonomyId() ? self::QUESTION_ORDERING_TYPE_TAXONOMY : self::QUESTION_ORDERING_TYPE_UPDATE_DATE); $optionOrderByDate = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_date'), self::QUESTION_ORDERING_TYPE_UPDATE_DATE, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_date_desc')); $questionOderingInput->addOption($optionOrderByDate); $optionOrderByTax = new ilRadioOption($this->lng->txt('tst_input_dynamic_question_set_question_ordering_by_tax'), self::QUESTION_ORDERING_TYPE_TAXONOMY, $this->lng->txt('tst_inp_dyn_quest_set_quest_ordering_by_tax_desc')); $orderTaxInput = new ilSelectInputGUI($this->lng->txt('tst_input_dynamic_question_set_ordering_tax'), 'ordering_tax'); $orderTaxInput->setInfo($this->lng->txt('tst_input_dynamic_question_set_ordering_tax_description')); $orderTaxInput->setValue($this->questionSetConfig->getOrderingTaxonomyId()); $orderTaxInput->setRequired(true); $orderTaxInput->setOptions($this->buildTaxonomySelectInputOptionArray($this->questionSetConfig->getSourceQuestionPoolId())); $optionOrderByTax->addSubItem($orderTaxInput); $questionOderingInput->addOption($optionOrderByTax); $form->addItem($questionOderingInput); $taxFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dynamic_question_set_taxonomie_filter_enabled'), 'tax_filter_enabled'); $taxFilterInput->setValue(1); $taxFilterInput->setChecked($this->questionSetConfig->isTaxonomyFilterEnabled()); $form->addItem($taxFilterInput); $answStatusFilterInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dyn_quest_set_answer_status_filter_enabled'), 'answer_status_filter_enabled'); $answStatusFilterInput->setValue(1); $answStatusFilterInput->setChecked($this->questionSetConfig->isAnswerStatusFilterEnabled()); $form->addItem($answStatusFilterInput); $previousQuestionsListInput = new ilCheckboxInputGUI($this->lng->txt('tst_input_dyn_quest_set_prev_quest_list_enabled'), 'prev_quest_list_enabled'); $previousQuestionsListInput->setValue(1); $previousQuestionsListInput->setChecked($this->questionSetConfig->isPreviousQuestionsListEnabled()); $form->addItem($previousQuestionsListInput); if ($this->testOBJ->participantDataExist()) { $questionOderingInput->setDisabled(true); $taxFilterInput->setDisabled(true); $answStatusFilterInput->setDisabled(true); $previousQuestionsListInput->setDisabled(true); } else { $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt('save')); } return $form; }
private function initFilteredQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, $taxonomyFilterSelection) { $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin, $dynamicQuestionSetConfig->getSourceQuestionPoolId()); if ($dynamicQuestionSetConfig->isTaxonomyFilterEnabled()) { require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php'; $questionList->setAvailableTaxonomyIds(ilObjTaxonomy::getUsageOfObject($dynamicQuestionSetConfig->getSourceQuestionPoolId())); foreach ($taxonomyFilterSelection as $taxId => $taxNodes) { $questionList->addTaxonomyFilter($taxId, $taxNodes); } } elseif ($dynamicQuestionSetConfig->getOrderingTaxonomyId()) { $questionList->setAvailableTaxonomyIds(array($dynamicQuestionSetConfig->getOrderingTaxonomyId())); } $questionList->load(); return $questionList; }
private function buildQuestionSetFilteredStatisticTableGUI() { require_once 'Modules/Test/classes/tables/class.ilTestDynamicQuestionSetStatisticTableGUI.php'; $gui = $this->buildQuestionSetStatisticTableGUI(ilTestDynamicQuestionSetStatisticTableGUI::FILTERED_TABLE_ID); $gui->initTitle('tst_dynamic_question_set_selection'); $gui->initColumns('tst_num_selected_questions'); require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php'; $gui->setTaxIds(ilObjTaxonomy::getUsageOfObject($this->dynamicQuestionSetConfig->getSourceQuestionPoolId())); $gui->setTaxonomyFilterEnabled($this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled()); $gui->setAnswerStatusFilterEnabled($this->dynamicQuestionSetConfig->isAnswerStatusFilterEnabled()); $gui->initFilter(); $gui->setFilterCommand('filterQuestionSelection'); $gui->setResetCommand('resetQuestionSelection'); return $gui; }
private function initFilteredQuestionList(ilObjTestDynamicQuestionSetConfig $dynamicQuestionSetConfig, ilTestDynamicQuestionSetFilterSelection $filterSelection) { $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin); $questionList->setParentObjIdsFilter(array($dynamicQuestionSetConfig->getSourceQuestionPoolId())); $questionList->setAnswerStatusActiveId($filterSelection->getAnswerStatusActiveId()); if ($dynamicQuestionSetConfig->isAnswerStatusFilterEnabled()) { $questionList->setAnswerStatusFilter($filterSelection->getAnswerStatusSelection()); } if ($dynamicQuestionSetConfig->isTaxonomyFilterEnabled()) { require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php'; $questionList->setAvailableTaxonomyIds(ilObjTaxonomy::getUsageOfObject($dynamicQuestionSetConfig->getSourceQuestionPoolId())); foreach ($filterSelection->getTaxonomySelection() as $taxId => $taxNodes) { $questionList->addTaxonomyFilter($taxId, $taxNodes, $dynamicQuestionSetConfig->getSourceQuestionPoolId(), 'qpl'); } } elseif ($dynamicQuestionSetConfig->getOrderingTaxonomyId()) { $questionList->setAvailableTaxonomyIds(array($dynamicQuestionSetConfig->getOrderingTaxonomyId())); } $questionList->setForcedQuestionIds($filterSelection->getForcedQuestionIds()); $questionList->load(); return $questionList; }
private function outCurrentlyFinishedPage() { $this->prepareTestPageOutput(); $this->populatePreviousButtons($this->testSession->getCurrentQuestionId()); if ($this->object->getKioskMode()) { $this->populateKioskHead(); } if ($this->object->getEnableProcessingTime()) { $this->outProcessingTime($this->testSession->getActiveId()); } $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("FORM_TIMESTAMP", time()); $this->tpl->setVariable("PAGETITLE", "- " . $this->object->getTitle()); if ($this->object->isShowExamIdInTestPassEnabled() && !$this->object->getKioskMode()) { $this->tpl->setCurrentBlock('exam_id'); $this->tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId($this->testSession->getActiveId(), $this->testSession->getPass(), $this->object->getId())); $this->tpl->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id')); $this->tpl->parseCurrentBlock(); } if ($this->object->getShowCancel()) { $this->populateCancelButtonBlock(); } if ($this->dynamicQuestionSetConfig->isTaxonomyFilterEnabled()) { $this->populateQuestionSelectionButtons(); } if ($this->testSequence->openQuestionExists()) { $message = $this->lng->txt('tst_dyn_test_msg_currently_finished_selection'); } else { $message = $this->lng->txt('tst_dyn_test_msg_currently_finished_completely'); $message .= "<br /><br />{$this->buildFinishPagePassDeletionLink()}"; } $msgHtml = $this->tpl->getMessageHTML($message); $this->tpl->addBlockFile('QUESTION_OUTPUT', 'test_currently_finished_msg_block', 'tpl.test_currently_finished_msg.html', 'Modules/Test'); $this->tpl->setCurrentBlock('test_currently_finished_msg_block'); $this->tpl->setVariable('TEST_CURRENTLY_FINISHED_MSG', $msgHtml); $this->tpl->parseCurrentBlock(); }