ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjTestDynamicQuestionSetConfigGUI Class Reference
+ Collaboration diagram for ilObjTestDynamicQuestionSetConfigGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilAccessHandler $access, ilTabsGUI $tabs, ilLanguage $lng, ilTemplate $tpl, ilDB $db, ilTree $tree, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ)
 Constructor.
 executeCommand ()
 Command Execution.
 getTaxonomyOptionsAsyncCmd ()
 showFormCmd (ilPropertyFormGUI $form=null)
 command method that prints the question set config form
 saveFormCmd ()
 command method that checks the question set config form

Data Fields

const CMD_SHOW_FORM = 'showForm'
 command constants
const CMD_SAVE_FORM = 'saveForm'
const CMD_GET_TAXONOMY_OPTIONS_ASYNC = 'getTaxonomyOptionsAsync'
const QUESTION_ORDERING_TYPE_UPDATE_DATE = 'ordering_by_date'
const QUESTION_ORDERING_TYPE_TAXONOMY = 'ordering_by_tax'

Protected Attributes

 $ctrl = null
 $access = null
 $tabs = null
 $lng = null
 $tpl = null
 $db = null
 $tree = null
 $testOBJ = null
 $questionSetConfig = null

Private Member Functions

 performSaveForm (ilPropertyFormGUI $form)
 saves the form fields to the database
 buildForm ()
 builds the question set config form and initialises the fields with the config currently saved in database
 buildQuestionPoolSelectInputOptionArray ($questionPoolsData)
 converts the passed question pools data array to select input option array
 buildTaxonomySelectInputOptionArray ($questionPoolId)
 buildTaxonomySelectInputOptionJson ($questionPoolId)

Detailed Description

Constructor & Destructor Documentation

ilObjTestDynamicQuestionSetConfigGUI::__construct ( ilCtrl  $ctrl,
ilAccessHandler  $access,
ilTabsGUI  $tabs,
ilLanguage  $lng,
ilTemplate  $tpl,
ilDB  $db,
ilTree  $tree,
ilPluginAdmin  $pluginAdmin,
ilObjTest  $testOBJ 
)

Constructor.

Definition at line 94 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References $access, $ctrl, $db, $lng, $tabs, $testOBJ, $tpl, and $tree.

{
$this->ctrl = $ctrl;
$this->access = $access;
$this->tabs = $tabs;
$this->lng = $lng;
$this->tpl = $tpl;
$this->db = $db;
$this->tree = $tree;
$this->pluginAdmin = $pluginAdmin;
$this->testOBJ = $testOBJ;
$this->questionSetConfig = new ilObjTestDynamicQuestionSetConfig($this->tree, $this->db, $this->pluginAdmin, $this->testOBJ);
}

Member Function Documentation

ilObjTestDynamicQuestionSetConfigGUI::buildForm ( )
private

builds the question set config form and initialises the fields with the config currently saved in database

Returns
ilPropertyFormGUI $form

Definition at line 257 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References ilRadioOption\addSubItem(), buildQuestionPoolSelectInputOptionArray(), buildTaxonomySelectInputOptionArray(), QUESTION_ORDERING_TYPE_TAXONOMY, QUESTION_ORDERING_TYPE_UPDATE_DATE, ilRadioOption\setInfo(), ilSelectInputGUI\setOptions(), ilCheckboxInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilRadioOption\setValue(), and ilNonEditableValueGUI\setValue().

Referenced by saveFormCmd(), and showFormCmd().

{
$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');
$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'),
$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'),
$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;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::buildQuestionPoolSelectInputOptionArray (   $questionPoolsData)
private

converts the passed question pools data array to select input option array

Parameters
array$questionPoolsData
Returns
array

Definition at line 362 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by buildForm().

{
$questionPoolSelectInputOptions = array( '' => $this->lng->txt('please_select') );
foreach($questionPoolsData as $qplId => $qplData)
{
$questionPoolSelectInputOptions[$qplId] = $qplData['title'];
}
return $questionPoolSelectInputOptions;
}

+ Here is the caller graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::buildTaxonomySelectInputOptionArray (   $questionPoolId)
private

Definition at line 374 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References ilObject\_lookupTitle(), and ilObjTaxonomy\getUsageOfObject().

Referenced by buildForm(), and buildTaxonomySelectInputOptionJson().

{
$taxSelectOptions = array(
0 => $this->lng->txt('please_select')
);
if( $questionPoolId )
{
require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
$taxIds = ilObjTaxonomy::getUsageOfObject($questionPoolId);
foreach($taxIds as $taxId)
{
$taxSelectOptions[$taxId] = ilObject::_lookupTitle($taxId);
}
}
return $taxSelectOptions;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::buildTaxonomySelectInputOptionJson (   $questionPoolId)
private

Definition at line 395 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References $options, and buildTaxonomySelectInputOptionArray().

Referenced by getTaxonomyOptionsAsyncCmd().

{
$options = array();
foreach($this->buildTaxonomySelectInputOptionArray($questionPoolId) as $optValue => $optLabel)
{
$options[] = array('value' => $optValue, 'label' => $optLabel);
}
return json_encode($options);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::executeCommand ( )

Command Execution.

Definition at line 113 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References $cmd, and ilUtil\sendInfo().

{
// allow only write access
if (!$this->access->checkAccess("write", "", $this->testOBJ->getRefId()))
{
ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
$this->ctrl->redirectByClass('ilObjTestGUI', "infoScreen");
}
// activate corresponding tab (auto activation does not work in ilObjTestGUI-Tabs-Salad)
$this->tabs->activateTab('assQuestions');
// process command
$nextClass = $this->ctrl->getNextClass();
switch($nextClass)
{
default:
$cmd = $this->ctrl->getCmd(self::CMD_SHOW_FORM).'Cmd';
$this->$cmd();
}
}

+ Here is the call graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::getTaxonomyOptionsAsyncCmd ( )

Definition at line 139 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References $_POST, buildTaxonomySelectInputOptionJson(), and exit.

{
$questionPoolId = (int)$_POST['question_pool_id'];
echo $this->buildTaxonomySelectInputOptionJson($questionPoolId);
}

+ Here is the call graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::performSaveForm ( ilPropertyFormGUI  $form)
private

saves the form fields to the database

Parameters
ilPropertyFormGUI$form

Definition at line 213 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References ilObject\_lookupTitle(), and ilPropertyFormGUI\getItemByPostVar().

Referenced by saveFormCmd().

{
$this->questionSetConfig->setSourceQuestionPoolId(
$form->getItemByPostVar('source_qpl_id')->getValue()
);
$this->questionSetConfig->setSourceQuestionPoolTitle( ilObject::_lookupTitle(
$form->getItemByPostVar('source_qpl_id')->getValue()
));
switch( $form->getItemByPostVar('question_ordering')->getValue() )
{
case self::QUESTION_ORDERING_TYPE_UPDATE_DATE:
$this->questionSetConfig->setOrderingTaxonomyId(null);
break;
case self::QUESTION_ORDERING_TYPE_TAXONOMY:
$this->questionSetConfig->setOrderingTaxonomyId(
$form->getItemByPostVar('ordering_tax')->getValue()
);
break;
}
$this->questionSetConfig->setTaxonomyFilterEnabled(
$form->getItemByPostVar('tax_filter_enabled')->getChecked()
);
$this->questionSetConfig->setAnswerStatusFilterEnabled(
$form->getItemByPostVar('answer_status_filter_enabled')->getChecked()
);
$this->questionSetConfig->setPreviousQuestionsListEnabled(
$form->getItemByPostVar('prev_quest_list_enabled')->getChecked()
);
$this->questionSetConfig->saveToDb( $this->testOBJ->getTestId() );
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::saveFormCmd ( )

command method that checks the question set config form

if form is valid it gets saved to the database, otherwise it will be reprinted with alerts

Definition at line 181 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References $errors, buildForm(), performSaveForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showFormCmd().

{
$form = $this->buildForm();
if( $this->testOBJ->participantDataExist() )
{
ilUtil::sendFailure($this->lng->txt("tst_msg_cannot_modify_dynamic_question_set_conf_due_to_part"), true);
return $this->showFormCmd($form);
}
$errors = !$form->checkInput(); // ALWAYS CALL BEFORE setValuesByPost()
$form->setValuesByPost(); // NEVER CALL THIS BEFORE checkInput()
if($errors)
{
ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
return $this->showFormCmd($form);
}
$this->performSaveForm($form);
$this->testOBJ->saveCompleteStatus( $this->questionSetConfig );
ilUtil::sendSuccess($this->lng->txt("tst_msg_dynamic_question_set_config_modified"), true);
$this->ctrl->redirect($this, self::CMD_SHOW_FORM);
}

+ Here is the call graph for this function:

ilObjTestDynamicQuestionSetConfigGUI::showFormCmd ( ilPropertyFormGUI  $form = null)

command method that prints the question set config form

Parameters
ilPropertyFormGUI$form

Definition at line 152 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

References buildForm(), ilUtil\sendFailure(), and ilUtil\sendInfo().

Referenced by saveFormCmd().

{
$this->questionSetConfig->loadFromDb();
if( $this->questionSetConfig->areDepenciesBroken($this->tree) )
{
ilUtil::sendFailure( $this->questionSetConfig->getDepenciesBrokenMessage($this->lng) );
}
elseif( $this->questionSetConfig->areDepenciesInVulnerableState($this->tree) )
{
ilUtil::sendInfo( $this->questionSetConfig->getDepenciesInVulnerableStateMessage($this->lng) );
}
if( $form === null )
{
$form = $this->buildForm();
}
$this->tpl->setContent( $this->ctrl->getHTML($form) );
$this->tpl->addJavaScript('Modules/Test/js/ilTestDynamicQuestionSetConfig.js');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjTestDynamicQuestionSetConfigGUI::$access = null
protected

Definition at line 37 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$ctrl = null
protected

Definition at line 30 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$db = null
protected

Definition at line 65 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$lng = null
protected

Definition at line 51 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$questionSetConfig = null
protected
ilObjTestDynamicQuestionSetConfigGUI::$tabs = null
protected

Definition at line 44 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$testOBJ = null
protected

Definition at line 79 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$tpl = null
protected

Definition at line 58 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

ilObjTestDynamicQuestionSetConfigGUI::$tree = null
protected

Definition at line 72 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by __construct().

const ilObjTestDynamicQuestionSetConfigGUI::CMD_GET_TAXONOMY_OPTIONS_ASYNC = 'getTaxonomyOptionsAsync'
const ilObjTestDynamicQuestionSetConfigGUI::CMD_SAVE_FORM = 'saveForm'
const ilObjTestDynamicQuestionSetConfigGUI::CMD_SHOW_FORM = 'showForm'

command constants

Definition at line 21 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

const ilObjTestDynamicQuestionSetConfigGUI::QUESTION_ORDERING_TYPE_TAXONOMY = 'ordering_by_tax'

Definition at line 89 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by buildForm().

const ilObjTestDynamicQuestionSetConfigGUI::QUESTION_ORDERING_TYPE_UPDATE_DATE = 'ordering_by_date'

Definition at line 88 of file class.ilObjTestDynamicQuestionSetConfigGUI.php.

Referenced by buildForm().


The documentation for this class was generated from the following file: