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) );
167 $form = $this->
buildForm($this->questionSetConfig->getSourceQuestionPoolId());
170 $this->tpl->setContent( $this->ctrl->getHTML($form) );
172 $this->tpl->addJavaScript(
'Modules/Test/js/ilTestDynamicQuestionSetConfig.js');
180 return (
int)
$_POST[
'source_qpl_id'];
195 if( $this->testOBJ->participantDataExist() )
197 ilUtil::sendFailure($this->lng->txt(
"tst_msg_cannot_modify_dynamic_question_set_conf_due_to_part"),
true);
201 $errors = !$form->checkInput();
202 $form->setValuesByPost();
212 $this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
214 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_dynamic_question_set_config_modified"),
true);
215 $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
225 $this->questionSetConfig->setSourceQuestionPoolId(
235 case self::QUESTION_ORDERING_TYPE_UPDATE_DATE:
236 $this->questionSetConfig->setOrderingTaxonomyId(null);
239 case self::QUESTION_ORDERING_TYPE_TAXONOMY:
240 $this->questionSetConfig->setOrderingTaxonomyId(
246 $this->questionSetConfig->setTaxonomyFilterEnabled(
250 $this->questionSetConfig->setAnswerStatusFilterEnabled(
254 $this->questionSetConfig->saveToDb( $this->testOBJ->getTestId() );
265 $this->questionSetConfig->loadFromDb( $this->testOBJ->getTestId() );
267 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
270 $form->setFormAction($this->ctrl->getFormAction($this));
272 $form->setId(
"tst_form_dynamic_question_set_config");
273 $form->setTitle($this->lng->txt(
'tst_form_dynamic_question_set_config'));
274 $form->setTableWidth(
"100%");
276 $hiddenInputTaxSelectOptAsyncUrl =
new ilHiddenInputGUI(
'taxSelectOptAsyncUrl');
277 $hiddenInputTaxSelectOptAsyncUrl->setValue(
278 $this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC,
'',
true)
280 $form->addItem($hiddenInputTaxSelectOptAsyncUrl);
282 if( $this->testOBJ->participantDataExist() )
284 $pool =
new ilNonEditableValueGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_title');
285 $pool->
setValue( $this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree) );
286 $pool->setDisabled(
true);
287 $form->addItem($pool);
291 $poolInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_id');
293 $this->testOBJ->getAvailableQuestionpools(
true,
false,
false,
true,
true)
295 $poolInput->setValue( $sourceQuestionPoolId );
296 $poolInput->setRequired(
true);
297 $form->addItem($poolInput);
301 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering'),
'question_ordering' 303 $questionOderingInput->
setValue( $this->questionSetConfig->getOrderingTaxonomyId() ?
304 self::QUESTION_ORDERING_TYPE_TAXONOMY : self::QUESTION_ORDERING_TYPE_UPDATE_DATE
307 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_date'),
308 self::QUESTION_ORDERING_TYPE_UPDATE_DATE,
309 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_date_desc')
311 $questionOderingInput->addOption($optionOrderByDate);
313 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_tax'),
314 self::QUESTION_ORDERING_TYPE_TAXONOMY,
315 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_tax_desc')
317 $orderTaxInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax'),
'ordering_tax');
318 $orderTaxInput->
setInfo($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax_description'));
319 $orderTaxInput->
setValue($this->questionSetConfig->getOrderingTaxonomyId());
320 $orderTaxInput->setRequired(
true);
322 $optionOrderByTax->
addSubItem($orderTaxInput);
323 $questionOderingInput->addOption($optionOrderByTax);
324 $form->addItem($questionOderingInput);
326 $taxFilterInput =
new ilCheckboxInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_taxonomie_filter_enabled'),
'tax_filter_enabled');
328 $taxFilterInput->setChecked( $this->questionSetConfig->isTaxonomyFilterEnabled() );
329 $form->addItem($taxFilterInput);
332 $this->lng->txt(
'tst_input_dyn_quest_set_answer_status_filter_enabled'),
'answer_status_filter_enabled' 334 $answStatusFilterInput->
setValue(1);
335 $answStatusFilterInput->setChecked( $this->questionSetConfig->isAnswerStatusFilterEnabled() );
336 $form->addItem($answStatusFilterInput);
338 if( $this->testOBJ->participantDataExist() )
340 $questionOderingInput->setDisabled(
true);
341 $taxFilterInput->setDisabled(
true);
342 $answStatusFilterInput->setDisabled(
true);
346 $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt(
'save'));
360 $questionPoolSelectInputOptions =
array(
'' => $this->lng->txt(
'please_select') );
362 foreach($questionPoolsData as $qplId => $qplData)
364 $questionPoolSelectInputOptions[$qplId] = $qplData[
'title'];
367 return $questionPoolSelectInputOptions;
372 $taxSelectOptions =
array(
373 0 => $this->lng->txt(
'please_select')
376 if( $questionPoolId )
378 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
382 foreach($taxIds as $taxId)
388 return $taxSelectOptions;
397 $options[] =
array(
'value' => $optValue,
'label' => $optLabel);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
This class provides processing control methods.
setValue($a_value)
Set Value.
buildQuestionPoolSelectInputOptionArray($questionPoolsData)
converts the passed question pools data array to select input option array
getTaxonomyOptionsAsyncCmd()
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
saveFormCmd()
command method that checks the question set config form
static _lookupTitle($a_id)
lookup object title
const QUESTION_ORDERING_TYPE_UPDATE_DATE
const QUESTION_ORDERING_TYPE_TAXONOMY
const CMD_GET_TAXONOMY_OPTIONS_ASYNC
setInfo($a_info)
Set Info.
Administration class for plugins.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilTabsGUI $tabs, ilLanguage $lng, ilTemplate $tpl, ilDBInterface $db, ilTree $tree, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
Constructor.
setValue($a_value)
Set Value.
if(!is_array($argv)) $options
addSubItem($a_item)
Add Subitem.
special template class to simplify handling of ITX/PEAR
getSubmittedSourceQuestionPoolId()
buildTaxonomySelectInputOptionJson($questionPoolId)
executeCommand()
Command Execution.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const CMD_SHOW_FORM
command constants
This class represents a non editable value in a property form.
buildTaxonomySelectInputOptionArray($questionPoolId)
showFormCmd(ilPropertyFormGUI $form=null)
command method that prints the question set config form
buildForm($sourceQuestionPoolId)
builds the question set config form and initialises the fields with the config currently saved in dat...
performSaveForm(ilPropertyFormGUI $form)
saves the form fields to the database