4 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
103 $this->pluginAdmin = $pluginAdmin;
117 if (!$this->access->checkAccess(
"write",
"", $this->testOBJ->getRefId()))
120 $this->ctrl->redirectByClass(
'ilObjTestGUI',
"infoScreen");
125 $this->tabs->activateTab(
'assQuestions');
129 $nextClass = $this->ctrl->getNextClass();
134 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_FORM).
'Cmd';
141 $questionPoolId = (int)
$_POST[
'question_pool_id'];
154 $this->questionSetConfig->loadFromDb();
156 if( $this->questionSetConfig->areDepenciesBroken($this->tree) )
160 elseif( $this->questionSetConfig->areDepenciesInVulnerableState($this->tree) )
162 ilUtil::sendInfo( $this->questionSetConfig->getDepenciesInVulnerableStateMessage($this->lng) );
170 $this->tpl->setContent( $this->ctrl->getHTML($form) );
172 $this->tpl->addJavaScript(
'Modules/Test/js/ilTestDynamicQuestionSetConfig.js');
185 if( $this->testOBJ->participantDataExist() )
187 ilUtil::sendFailure($this->lng->txt(
"tst_msg_cannot_modify_dynamic_question_set_conf_due_to_part"),
true);
191 $errors = !$form->checkInput();
192 $form->setValuesByPost();
202 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
204 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_dynamic_question_set_config_modified"),
true);
205 $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
215 $this->questionSetConfig->setSourceQuestionPoolId(
225 case self::QUESTION_ORDERING_TYPE_UPDATE_DATE:
226 $this->questionSetConfig->setOrderingTaxonomyId(null);
229 case self::QUESTION_ORDERING_TYPE_TAXONOMY:
230 $this->questionSetConfig->setOrderingTaxonomyId(
236 $this->questionSetConfig->setTaxonomyFilterEnabled(
240 $this->questionSetConfig->setAnswerStatusFilterEnabled(
244 $this->questionSetConfig->setPreviousQuestionsListEnabled(
248 $this->questionSetConfig->saveToDb( $this->testOBJ->getTestId() );
259 $this->questionSetConfig->loadFromDb( $this->testOBJ->getTestId() );
261 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
264 $form->setFormAction($this->ctrl->getFormAction($this));
266 $form->setId(
"tst_form_dynamic_question_set_config");
267 $form->setTitle($this->lng->txt(
'tst_form_dynamic_question_set_config'));
268 $form->setTableWidth(
"100%");
270 $hiddenInputTaxSelectOptAsyncUrl =
new ilHiddenInputGUI(
'taxSelectOptAsyncUrl');
271 $hiddenInputTaxSelectOptAsyncUrl->setValue(
272 $this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC,
'',
true)
274 $form->addItem($hiddenInputTaxSelectOptAsyncUrl);
276 if( $this->testOBJ->participantDataExist() )
278 $pool =
new ilNonEditableValueGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_title');
279 $pool->
setValue( $this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree) );
280 $pool->setDisabled(
true);
281 $form->addItem($pool);
285 $poolInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_id');
287 $this->testOBJ->getAvailableQuestionpools(
true,
false,
false,
true,
true)
289 $poolInput->setValue( $this->questionSetConfig->getSourceQuestionPoolId() );
290 $poolInput->setRequired(
true);
291 $form->addItem($poolInput);
295 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering'),
'question_ordering'
297 $questionOderingInput->
setValue( $this->questionSetConfig->getOrderingTaxonomyId() ?
301 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_date'),
303 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_date_desc')
305 $questionOderingInput->addOption($optionOrderByDate);
307 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_tax'),
309 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_tax_desc')
311 $orderTaxInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax'),
'ordering_tax');
312 $orderTaxInput->
setInfo($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax_description'));
313 $orderTaxInput->
setValue($this->questionSetConfig->getOrderingTaxonomyId());
314 $orderTaxInput->setRequired(
true);
316 $this->questionSetConfig->getSourceQuestionPoolId()
318 $optionOrderByTax->
addSubItem($orderTaxInput);
319 $questionOderingInput->addOption($optionOrderByTax);
320 $form->addItem($questionOderingInput);
322 $taxFilterInput =
new ilCheckboxInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_taxonomie_filter_enabled'),
'tax_filter_enabled');
324 $taxFilterInput->setChecked( $this->questionSetConfig->isTaxonomyFilterEnabled() );
325 $form->addItem($taxFilterInput);
328 $this->lng->txt(
'tst_input_dyn_quest_set_answer_status_filter_enabled'),
'answer_status_filter_enabled'
330 $answStatusFilterInput->
setValue(1);
331 $answStatusFilterInput->setChecked( $this->questionSetConfig->isAnswerStatusFilterEnabled() );
332 $form->addItem($answStatusFilterInput);
335 $this->lng->txt(
'tst_input_dyn_quest_set_prev_quest_list_enabled'),
'prev_quest_list_enabled'
337 $previousQuestionsListInput->
setValue(1);
338 $previousQuestionsListInput->setChecked( $this->questionSetConfig->isPreviousQuestionsListEnabled() );
339 $form->addItem($previousQuestionsListInput);
341 if( $this->testOBJ->participantDataExist() )
343 $questionOderingInput->setDisabled(
true);
344 $taxFilterInput->setDisabled(
true);
345 $answStatusFilterInput->setDisabled(
true);
346 $previousQuestionsListInput->setDisabled(
true);
350 $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt(
'save'));
364 $questionPoolSelectInputOptions = array(
'' => $this->lng->txt(
'please_select') );
366 foreach($questionPoolsData as $qplId => $qplData)
368 $questionPoolSelectInputOptions[$qplId] = $qplData[
'title'];
371 return $questionPoolSelectInputOptions;
376 $taxSelectOptions = array(
377 0 => $this->lng->txt(
'please_select')
380 if( $questionPoolId )
382 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
386 foreach($taxIds as $taxId)
392 return $taxSelectOptions;
401 $options[] = array(
'value' => $optValue,
'label' => $optLabel);