コード例 #1
0
 /**
  * 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;
 }