ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestRandomQuestionSetGeneralConfigFormGUI Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetGeneralConfigFormGUI:
+ Collaboration diagram for ilTestRandomQuestionSetGeneralConfigFormGUI:

Public Member Functions

 __construct (private ilTestRandomQuestionSetConfigGUI $questionSetConfigGUI, private ilTestRandomQuestionSetConfig $questionSetConfig)
 
 isEditModeEnabled ()
 
 setEditModeEnabled (bool $edit_mode_enabled)
 
 build ()
 
 save (AdditionalInformationGenerator $additional_info)
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 getInput (string $a_post_var, bool $ensureValidation=true)
 Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Protected Attributes

bool $edit_mode_enabled = true
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Private Member Functions

 fetchValidQuestionAmountConfigModeWithFallbackModePerTest (ilTestRandomQuestionSetConfig $config)
 

Additional Inherited Members

- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 
 checkForRequiredField ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionSetGeneralConfigFormGUI::__construct ( private ilTestRandomQuestionSetConfigGUI  $questionSetConfigGUI,
private ilTestRandomQuestionSetConfig  $questionSetConfig 
)

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

40 {
42 $this->lng->loadLanguageModule('form');
43 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ build()

ilTestRandomQuestionSetGeneralConfigFormGUI::build ( )

Definition at line 55 of file class.ilTestRandomQuestionSetGeneralConfigFormGUI.php.

55 : void
56 {
57 $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
58
59 $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_general_form'));
60 $this->setId('tstRndQuestSetCfgGeneralForm');
61
62 $this->addCommandButton(
64 $this->lng->txt('save')
65 );
66
67 $requirePoolsQuestionsHomoScored = new ilCheckboxInputGUI(
68 $this->lng->txt('tst_inp_all_quest_points_equal_per_pool'),
69 'quest_points_equal_per_pool'
70 );
71
72 $requirePoolsQuestionsHomoScored->setInfo(
73 $this->lng->txt('tst_inp_all_quest_points_equal_per_pool_desc')
74 );
75
76 $requirePoolsQuestionsHomoScored->setChecked(
77 (bool)
78 $this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired()
79 );
80
81 $this->addItem($requirePoolsQuestionsHomoScored);
82
83 // question amount config mode (per test / per pool)
84
85 $questionAmountConfigMode = new ilRadioGroupInputGUI(
86 $this->lng->txt('tst_inp_quest_amount_cfg_mode'),
87 'quest_amount_cfg_mode'
88 );
89
90 $questionAmountConfigMode->setValue($this->fetchValidQuestionAmountConfigModeWithFallbackModePerTest(
91 $this->questionSetConfig
92 ));
93
94 $questionAmountConfigModePerTest = new ilRadioOption(
95 $this->lng->txt('tst_inp_quest_amount_cfg_mode_test'),
97 );
98
99 $questionAmountConfigMode->addOption($questionAmountConfigModePerTest);
100
101 $questionAmountConfigModePerPool = new ilRadioOption(
102 $this->lng->txt('tst_inp_quest_amount_cfg_mode_pool'),
104 );
105
106 $questionAmountConfigMode->addOption($questionAmountConfigModePerPool);
107
108 $questionAmountConfigMode->setRequired(true);
109
110 $this->addItem($questionAmountConfigMode);
111
112 // question amount per test
113
114 $questionAmountPerTest = new ilNumberInputGUI(
115 $this->lng->txt('tst_inp_quest_amount_per_test'),
116 'quest_amount_per_test'
117 );
118
119 $questionAmountPerTest->setRequired(true);
120 $questionAmountPerTest->setMinValue(1);
121 $questionAmountPerTest->allowDecimals(false);
122 $questionAmountPerTest->setMinvalueShouldBeGreater(false);
123 $questionAmountPerTest->setSize(4);
124
125 $questionAmountPerTest->setValue(
126 (string) $this->questionSetConfig->getQuestionAmountPerTest()
127 );
128
129 $questionAmountConfigModePerTest->addSubItem($questionAmountPerTest);
130
131 if (!$this->isEditModeEnabled()) {
132 $requirePoolsQuestionsHomoScored->setDisabled(true);
133 $questionAmountConfigMode->setDisabled(true);
134 $questionAmountPerTest->setDisabled(true);
135 }
136 }
This class represents a checkbox property in a property form.
setFormAction(string $a_formaction)
setId(string $a_id)
This class represents a number property in a property form.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This class represents a property in a property form.
This class represents an option in a radio group.
fetchValidQuestionAmountConfigModeWithFallbackModePerTest(ilTestRandomQuestionSetConfig $config)

References ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilTestRandomQuestionSetConfigGUI\CMD_SAVE_GENERAL_CONFIG_FORM, ILIAS\Repository\ctrl(), fetchValidQuestionAmountConfigModeWithFallbackModePerTest(), isEditModeEnabled(), ILIAS\Repository\lng(), ilTestRandomQuestionSetConfig\QUESTION_AMOUNT_CONFIG_MODE_PER_POOL, ilTestRandomQuestionSetConfig\QUESTION_AMOUNT_CONFIG_MODE_PER_TEST, ilFormGUI\setFormAction(), ilFormGUI\setId(), and ilPropertyFormGUI\setTitle().

+ Here is the call graph for this function:

◆ fetchValidQuestionAmountConfigModeWithFallbackModePerTest()

ilTestRandomQuestionSetGeneralConfigFormGUI::fetchValidQuestionAmountConfigModeWithFallbackModePerTest ( ilTestRandomQuestionSetConfig  $config)
private

◆ isEditModeEnabled()

ilTestRandomQuestionSetGeneralConfigFormGUI::isEditModeEnabled ( )

Definition at line 45 of file class.ilTestRandomQuestionSetGeneralConfigFormGUI.php.

References $edit_mode_enabled.

Referenced by build().

+ Here is the caller graph for this function:

◆ save()

ilTestRandomQuestionSetGeneralConfigFormGUI::save ( AdditionalInformationGenerator  $additional_info)

Definition at line 150 of file class.ilTestRandomQuestionSetGeneralConfigFormGUI.php.

150 : array
151 {
152 $log_array = [];
153 $question_equal_per_pool = $this->getItemByPostVar('quest_points_equal_per_pool')->getChecked();
154 $this->questionSetConfig->setPoolsWithHomogeneousScoredQuestionsRequired(
155 $question_equal_per_pool
156 );
157
158 $log_array[AdditionalInformationGenerator::KEY_HOMOGENEOUS_SCORING] = $additional_info
159 ->getTrueFalseTagForBool($question_equal_per_pool);
160
161 $question_amount_configuration_mode = $this->getItemByPostVar('quest_amount_cfg_mode')->getValue();
162 $this->questionSetConfig->setQuestionAmountConfigurationMode(
163 $question_amount_configuration_mode
164 );
165
166 $log_array[AdditionalInformationGenerator::KEY_QUESTION_AMOUNT_TYPE] = $this->questionSetConfig->getQuestionAmountPerTest()
167 ? $additional_info->getTagForLangVar('tst_inp_quest_amount_cfg_mode_test')
168 : $additional_info->getTagForLangVar('tst_inp_quest_amount_cfg_mode_pool');
169
170 $this->questionSetConfig->setQuestionAmountPerTest(null);
171 if (!$this->questionSetConfig->getQuestionAmountPerTest()) {
172 $question_amount_per_test = (int) $this->getItemByPostVar('quest_amount_per_test')->getValue();
173 $this->questionSetConfig->setQuestionAmountPerTest(
174 $question_amount_per_test
175 );
176 $log_array[AdditionalInformationGenerator::KEY_QUESTION_AMOUNT_PER_TEST] = $question_amount_per_test;
177 }
178
179 $this->questionSetConfig->saveToDb();
180 return $log_array;
181 }
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\getItemByPostVar(), ILIAS\Test\Logging\AdditionalInformationGenerator\getTagForLangVar(), ILIAS\Test\Logging\AdditionalInformationGenerator\getTrueFalseTagForBool(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ setEditModeEnabled()

ilTestRandomQuestionSetGeneralConfigFormGUI::setEditModeEnabled ( bool  $edit_mode_enabled)

Definition at line 50 of file class.ilTestRandomQuestionSetGeneralConfigFormGUI.php.

50 : void
51 {
52 $this->edit_mode_enabled = $edit_mode_enabled;
53 }

References $edit_mode_enabled.

Field Documentation

◆ $edit_mode_enabled

bool ilTestRandomQuestionSetGeneralConfigFormGUI::$edit_mode_enabled = true
protected

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