4 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
103 $this->pluginAdmin = $pluginAdmin;
117 if (!$this->access->checkAccess(
"write",
"", $this->testOBJ->getRefId())) {
119 $this->ctrl->redirectByClass(
'ilObjTestGUI',
"infoScreen");
124 $this->tabs->activateTab(
'assQuestions');
128 $nextClass = $this->ctrl->getNextClass();
130 switch ($nextClass) {
132 $cmd = $this->ctrl->getCmd(self::CMD_SHOW_FORM) .
'Cmd';
139 $questionPoolId = (int)
$_POST[
'question_pool_id'];
152 $this->questionSetConfig->loadFromDb();
154 if ($this->questionSetConfig->areDepenciesBroken($this->tree)) {
156 } elseif ($this->questionSetConfig->areDepenciesInVulnerableState($this->tree)) {
157 ilUtil::sendInfo($this->questionSetConfig->getDepenciesInVulnerableStateMessage($this->lng));
160 if (
$form === null) {
161 $form = $this->
buildForm($this->questionSetConfig->getSourceQuestionPoolId());
164 $this->tpl->setContent($this->ctrl->getHTML(
$form));
166 $this->tpl->addJavaScript(
'Modules/Test/js/ilTestDynamicQuestionSetConfig.js');
174 return (
int)
$_POST[
'source_qpl_id'];
189 if ($this->testOBJ->participantDataExist()) {
190 ilUtil::sendFailure($this->lng->txt(
"tst_msg_cannot_modify_dynamic_question_set_conf_due_to_part"),
true);
195 $form->setValuesByPost();
204 $this->testOBJ->saveCompleteStatus($this->questionSetConfig);
206 ilUtil::sendSuccess($this->lng->txt(
"tst_msg_dynamic_question_set_config_modified"),
true);
207 $this->ctrl->redirect($this, self::CMD_SHOW_FORM);
217 $this->questionSetConfig->setSourceQuestionPoolId(
226 case self::QUESTION_ORDERING_TYPE_UPDATE_DATE:
227 $this->questionSetConfig->setOrderingTaxonomyId(null);
230 case self::QUESTION_ORDERING_TYPE_TAXONOMY:
231 $this->questionSetConfig->setOrderingTaxonomyId(
237 $this->questionSetConfig->setTaxonomyFilterEnabled(
241 $this->questionSetConfig->setAnswerStatusFilterEnabled(
245 $this->questionSetConfig->saveToDb($this->testOBJ->getTestId());
256 $this->questionSetConfig->loadFromDb($this->testOBJ->getTestId());
258 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
261 $form->setFormAction($this->ctrl->getFormAction($this));
263 $form->setId(
"tst_form_dynamic_question_set_config");
264 $form->setTitle($this->lng->txt(
'tst_form_dynamic_question_set_config'));
265 $form->setTableWidth(
"100%");
267 $hiddenInputTaxSelectOptAsyncUrl =
new ilHiddenInputGUI(
'taxSelectOptAsyncUrl');
268 $hiddenInputTaxSelectOptAsyncUrl->setValue(
269 $this->ctrl->getLinkTarget($this, self::CMD_GET_TAXONOMY_OPTIONS_ASYNC,
'',
true)
271 $form->addItem($hiddenInputTaxSelectOptAsyncUrl);
273 if ($this->testOBJ->participantDataExist()) {
274 $pool =
new ilNonEditableValueGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_title');
275 $pool->
setValue($this->questionSetConfig->getSourceQuestionPoolSummaryString($this->lng, $this->tree));
276 $pool->setDisabled(
true);
277 $form->addItem($pool);
279 $poolInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_source_questionpool'),
'source_qpl_id');
281 $this->testOBJ->getAvailableQuestionpools(
true,
false,
false,
true,
true)
283 $poolInput->setValue($sourceQuestionPoolId);
284 $poolInput->setRequired(
true);
285 $form->addItem($poolInput);
289 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering'),
293 $this->questionSetConfig->getOrderingTaxonomyId() ?
294 self::QUESTION_ORDERING_TYPE_TAXONOMY : self::QUESTION_ORDERING_TYPE_UPDATE_DATE
297 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_date'),
298 self::QUESTION_ORDERING_TYPE_UPDATE_DATE,
299 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_date_desc')
301 $questionOderingInput->addOption($optionOrderByDate);
303 $this->lng->txt(
'tst_input_dynamic_question_set_question_ordering_by_tax'),
304 self::QUESTION_ORDERING_TYPE_TAXONOMY,
305 $this->lng->txt(
'tst_inp_dyn_quest_set_quest_ordering_by_tax_desc')
307 $orderTaxInput =
new ilSelectInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax'),
'ordering_tax');
308 $orderTaxInput->
setInfo($this->lng->txt(
'tst_input_dynamic_question_set_ordering_tax_description'));
309 $orderTaxInput->
setValue($this->questionSetConfig->getOrderingTaxonomyId());
310 $orderTaxInput->setRequired(
true);
312 $optionOrderByTax->
addSubItem($orderTaxInput);
313 $questionOderingInput->addOption($optionOrderByTax);
314 $form->addItem($questionOderingInput);
316 $taxFilterInput =
new ilCheckboxInputGUI($this->lng->txt(
'tst_input_dynamic_question_set_taxonomie_filter_enabled'),
'tax_filter_enabled');
318 $taxFilterInput->setChecked($this->questionSetConfig->isTaxonomyFilterEnabled());
319 $form->addItem($taxFilterInput);
322 $this->lng->txt(
'tst_input_dyn_quest_set_answer_status_filter_enabled'),
323 'answer_status_filter_enabled' 325 $answStatusFilterInput->
setValue(1);
326 $answStatusFilterInput->setChecked($this->questionSetConfig->isAnswerStatusFilterEnabled());
327 $form->addItem($answStatusFilterInput);
329 if ($this->testOBJ->participantDataExist()) {
330 $questionOderingInput->setDisabled(
true);
331 $taxFilterInput->setDisabled(
true);
332 $answStatusFilterInput->setDisabled(
true);
334 $form->addCommandButton(self::CMD_SAVE_FORM, $this->lng->txt(
'save'));
348 $questionPoolSelectInputOptions = array(
'' => $this->lng->txt(
'please_select') );
350 foreach ($questionPoolsData as $qplId => $qplData) {
351 $questionPoolSelectInputOptions[$qplId] = $qplData[
'title'];
354 return $questionPoolSelectInputOptions;
359 $taxSelectOptions = array(
360 0 => $this->lng->txt(
'please_select')
363 if ($questionPoolId) {
364 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
368 foreach ($taxIds as $taxId) {
373 return $taxSelectOptions;
381 $options[] = array(
'value' => $optValue,
'label' => $optLabel);
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.
Interface ilAccessHandler.
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(isset($_POST['submit'])) $form
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...
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