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));
265 $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt(
"save"));
267 $form->setId(
"tst_form_dynamic_question_set_config");
268 $form->setTitle($this->lng->txt(
'tst_form_dynamic_question_set_config'));
269 $form->setTableWidth(
"100%");
271 $hiddenInputTaxSelectOptAsyncUrl =
new ilHiddenInputGUI(
'taxSelectOptAsyncUrl');
272 $hiddenInputTaxSelectOptAsyncUrl->setValue(
273 $this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC,
'',
true)
275 $form->addItem($hiddenInputTaxSelectOptAsyncUrl);
277 if( $this->testOBJ->participantDataExist() )
279 $pool =
new ilNonEditableValueGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_title');
280 $pool->
setValue( $this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree) );
281 $pool->setDisabled(
true);
282 $form->addItem($pool);
286 $poolInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_id');
288 $this->testOBJ->getAvailableQuestionpools(
true,
false,
false,
true,
true)
290 $poolInput->setValue( $this->questionSetConfig->getSourceQuestionPoolId() );
291 $poolInput->setRequired(
true);
292 $form->addItem($poolInput);
296 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering'),
'question_ordering'
298 $questionOderingInput->
setValue( $this->questionSetConfig->getOrderingTaxonomyId() ?
302 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_date'),
304 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_date_desc')
306 $questionOderingInput->addOption($optionOrderByDate);
308 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_tax'),
310 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_tax_desc')
312 $orderTaxInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax'),
'ordering_tax');
313 $orderTaxInput->
setInfo($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax_description'));
314 $orderTaxInput->
setValue($this->questionSetConfig->getOrderingTaxonomyId());
315 $orderTaxInput->setRequired(
true);
317 $this->questionSetConfig->getSourceQuestionPoolId()
319 $optionOrderByTax->
addSubItem($orderTaxInput);
320 $questionOderingInput->addOption($optionOrderByTax);
321 $form->addItem($questionOderingInput);
323 $taxFilterInput =
new ilCheckboxInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_taxonomie_filter_enabled'),
'tax_filter_enabled');
325 $taxFilterInput->setChecked( $this->questionSetConfig->isTaxonomyFilterEnabled() );
326 $taxFilterInput->setRequired(
true);
327 $form->addItem($taxFilterInput);
330 $this->lng->txt(
'tst_input_dyn_quest_set_answer_status_filter_enabled'),
'answer_status_filter_enabled'
332 $answStatusFilterInput->
setValue(1);
333 $answStatusFilterInput->setChecked( $this->questionSetConfig->isAnswerStatusFilterEnabled() );
334 $answStatusFilterInput->setRequired(
true);
335 $form->addItem($answStatusFilterInput);
338 $this->lng->txt(
'tst_input_dyn_quest_set_prev_quest_list_enabled'),
'prev_quest_list_enabled'
340 $previousQuestionsListInput->
setValue(1);
341 $previousQuestionsListInput->setChecked( $this->questionSetConfig->isPreviousQuestionsListEnabled() );
342 $previousQuestionsListInput->setRequired(
true);
343 $form->addItem($previousQuestionsListInput);
345 if( $this->testOBJ->participantDataExist() )
347 $questionOderingInput->setDisabled(
true);
348 $taxFilterInput->setDisabled(
true);
349 $answStatusFilterInput->setDisabled(
true);
363 $questionPoolSelectInputOptions = array(
'' => $this->lng->txt(
'please_select') );
365 foreach($questionPoolsData as $qplId => $qplData)
367 $questionPoolSelectInputOptions[$qplId] = $qplData[
'title'];
370 return $questionPoolSelectInputOptions;
375 $taxSelectOptions = array(
376 0 => $this->lng->txt(
'please_select')
379 if( $questionPoolId )
381 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
385 foreach($taxIds as $taxId)
391 return $taxSelectOptions;
400 $options[] = array(
'value' => $optValue,
'label' => $optLabel);