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

Public Member Functions

 __construct (ilCtrlInterface $ctrl, ilLanguage $lng, ilObjTest $testOBJ, ilTestRandomQuestionSetConfigGUI $questionSetConfigGUI, ilTestRandomQuestionSetConfig $questionSetConfig)
 
 setSaveCommand (string $saveCommand)
 
 getSaveCommand ()
 
 setSaveAndNewCommand (string $saveAndNewCommand)
 
 getSaveAndNewCommand ()
 
 build (ilTestRandomQuestionSetSourcePoolDefinition $sourcePool, $available_taxonomy_ids)
 
 applySubmit (ilTestRandomQuestionSetSourcePoolDefinition $source_pool_definition, $available_taxonomy_ids)
 
- 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 ()
 

Data Fields

ilObjTest $testOBJ
 
ilTestRandomQuestionSetConfigGUI $questionSetConfigGUI
 
ilTestRandomQuestionSetConfig $questionSetConfig
 

Private Attributes

string $saveCommand = null
 
string $saveAndNewCommand = null
 

Additional Inherited Members

- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 
 checkForRequiredField ()
 
- 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionSetPoolDefinitionFormGUI::__construct ( ilCtrlInterface  $ctrl,
ilLanguage  $lng,
ilObjTest  $testOBJ,
ilTestRandomQuestionSetConfigGUI  $questionSetConfigGUI,
ilTestRandomQuestionSetConfig  $questionSetConfig 
)

Definition at line 43 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

References ilPropertyFormGUI\$ctrl, ilPropertyFormGUI\$lng, $questionSetConfig, $questionSetConfigGUI, $testOBJ, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ applySubmit()

ilTestRandomQuestionSetPoolDefinitionFormGUI::applySubmit ( ilTestRandomQuestionSetSourcePoolDefinition  $source_pool_definition,
  $available_taxonomy_ids 
)

Definition at line 201 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

204 : array {
205 $log_array = [];
206 // fau: taxFilter/typeFilter - submit multiple taxonomy and node selections - submit type selections
207 $taxonomy_filter = [];
208 foreach ($available_taxonomy_ids as $tax_id) {
209 if ($this->getItemByPostVar("filter_tax_id_{$tax_id}")->getChecked()) {
210 $node_ids = (array) $this->getItemByPostVar("filter_tax_nodes_{$tax_id}")->getValue();
211 if (!empty($node_ids)) {
212 foreach ($node_ids as $node_id) {
213 $taxonomy_filter[(int) $tax_id][] = (int) $node_id;
214 }
215 }
216 }
217 }
218 $source_pool_definition->setOriginalTaxonomyFilter($taxonomy_filter);
219
220 $type_filter = [];
221 if ($this->getItemByPostVar('filter_type_enabled')->getChecked()) {
222 $type_filter = $this->getItemByPostVar('filter_type')->getMultiValues();
223 }
224 $source_pool_definition->setTypeFilter($type_filter);
225
226 $life_cycle_filter = [];
227 if ($this->getItemByPostVar('filter_lifecycle_enabled')->getChecked()) {
228 $life_cycle_filter = $this->getItemByPostVar('filter_lifecycle')->getMultiValues();
229 }
230 $source_pool_definition->setLifecycleFilter($life_cycle_filter);
231
232 // fau.
233
234 if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
235 $question_amount = $this->getItemByPostVar('question_amount_per_pool')->getValue();
236 $source_pool_definition->setQuestionAmount(intval($question_amount));
237 $log_array[AdditionalInformationGenerator::KEY_QUESTION_AMOUNT_PER_POOL] = $question_amount;
238 }
239
240 return [
241 AdditionalInformationGenerator::KEY_SOURCE_POOL => $source_pool_definition->getPoolId(),
242 AdditionalInformationGenerator::KEY_SOURCE_TAXONOMY_FILTER => $taxonomy_filter,
243 AdditionalInformationGenerator::KEY_SOURCE_TYPE_FILTER => $type_filter,
244 AdditionalInformationGenerator::KEY_SOURCE_LIFECYCLE_FILTER => $life_cycle_filter
245 ] + $log_array;
246 }
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\getItemByPostVar(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ build()

ilTestRandomQuestionSetPoolDefinitionFormGUI::build ( ilTestRandomQuestionSetSourcePoolDefinition  $sourcePool,
  $available_taxonomy_ids 
)

Definition at line 74 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

74 : void
75 {
76 $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
77
78 $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form'));
79 $this->setId('tstRndQuestSetCfgPoolForm');
80
81 $this->addCommandButton(
82 $this->getSaveCommand(),
83 $this->lng->txt('save_and_back')
84 );
85
86 if (null !== $this->getSaveAndNewCommand()) {
87 $this->addCommandButton(
88 $this->getSaveAndNewCommand(),
89 $this->lng->txt('tst_save_and_create_new_rule')
90 );
91 }
92
93 $this->addCommandButton(
95 $this->lng->txt('cancel')
96 );
97
98 $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id');
99 $hiddenDefId->setValue((string) $sourcePool->getId());
100 $this->addItem($hiddenDefId);
101
102 $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id');
103 $hiddenPoolId->setValue((string) $sourcePool->getPoolId());
104 $this->addItem($hiddenPoolId);
105
106 $nonEditablePoolLabel = new ilNonEditableValueGUI(
107 $this->lng->txt('tst_inp_source_pool_label'),
108 'quest_pool_label'
109 );
110 $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng));
111
112 $this->addItem($nonEditablePoolLabel);
113
114
115 if ($available_taxonomy_ids !== []) {
116 $filter = $sourcePool->getOriginalTaxonomyFilter();
117 foreach ($available_taxonomy_ids as $tax_id) {
118 $taxonomy = new ilObjTaxonomy($tax_id);
119 $taxLabel = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
120
121 $taxCheckbox = new ilCheckboxInputGUI($taxLabel, "filter_tax_id_$tax_id");
122
123
124
125 $this->ctrl->setParameterByClass('iltaxselectinputgui', 'src_pool_def_id', $sourcePool->getId());
126 $this->ctrl->setParameterByClass('iltaxselectinputgui', 'quest_pool_id', $sourcePool->getPoolId());
127 $taxSelect = new ilTaxSelectInputGUI($tax_id, "filter_tax_nodes_$tax_id", true);
128 $taxSelect->setRequired(true);
129
130 if (isset($filter[$tax_id])) {
131 $taxCheckbox->setChecked(true);
132 $taxSelect->setValue($filter[$tax_id]);
133 }
134 $taxCheckbox->addSubItem($taxSelect);
135 $this->addItem($taxCheckbox);
136 }
137 // fau.
138 } else {
139 $hiddenNoTax = new ilHiddenInputGUI('filter_tax');
140 $hiddenNoTax->setValue('0');
141 $this->addItem($hiddenNoTax);
142
143 $nonEditableNoTax = new ilNonEditableValueGUI(
144 $this->lng->txt('tst_inp_source_pool_filter_tax'),
145 'no_tax_label'
146 );
147 $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint'));
148 $this->addItem($nonEditableNoTax);
149 }
150
151 $lifecycleFilterValues = $sourcePool->getLifecycleFilter();
152 $lifecycleCheckbox = new ilCheckboxInputGUI($this->lng->txt('tst_filter_lifecycle_enabled'), 'filter_lifecycle_enabled');
153 $lifecycleCheckbox->setChecked(!empty($lifecycleFilterValues));
154 $lifecycleFilter = new ilSelectInputGUI($this->lng->txt('qst_lifecycle'), 'filter_lifecycle');
155 $lifecycleFilter->setRequired(true);
156 $lifecycleFilter->setMulti(true);
157 $lifecycleFilter->setOptions(ilAssQuestionLifecycle::getDraftInstance()->getSelectOptions($this->lng));
158 $lifecycleFilter->setValue($lifecycleFilterValues);
159 $lifecycleCheckbox->addSubItem($lifecycleFilter);
160 $this->addItem($lifecycleCheckbox);
161
162 // fau: taxFilter/typeFilter - show type filter selection
163 $typeFilterOptions = [];
164 foreach (ilObjQuestionPool::_getQuestionTypes(true) as $translation => $data) {
165 $typeFilterOptions[$data['question_type_id']] = $translation;
166 }
167 $filterIds = $sourcePool->getTypeFilter();
168 $typeCheckbox = new ilCheckboxInputGUI($this->lng->txt('tst_filter_question_type_enabled'), 'filter_type_enabled');
169 $typeCheckbox->setChecked(!empty($filterIds));
170 $typeFilter = new ilSelectInputGUI($this->lng->txt('tst_filter_question_type'), 'filter_type');
171 $typeFilter->setRequired(true);
172 $typeFilter->setMulti(true);
173 $typeFilter->setOptions($typeFilterOptions);
174 $typeFilter->setValue($filterIds);
175 $typeCheckbox->addSubItem($typeFilter);
176 $this->addItem($typeCheckbox);
177 // fau.
178
179 if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
180 $questionAmountPerSourcePool = new ilNumberInputGUI(
181 $this->lng->txt('tst_inp_quest_amount_per_source_pool'),
182 'question_amount_per_pool'
183 );
184
185 $questionAmountPerSourcePool->setRequired(true);
186 $questionAmountPerSourcePool->allowDecimals(false);
187 $questionAmountPerSourcePool->setMinValue(0);
188 $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true);
189 $questionAmountPerSourcePool->setSize(4);
190
191 if ($sourcePool->getQuestionAmount()) {
192 $questionAmountPerSourcePool->setValue(
193 $sourcePool->getQuestionAmount() ? (string) $sourcePool->getQuestionAmount() : null
194 );
195 }
196
197 $this->addItem($questionAmountPerSourcePool);
198 }
199 }
This class represents a checkbox property in a property form.
setFormAction(string $a_formaction)
setId(string $a_id)
This class represents a hidden form property in a property form.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $data, ilObjQuestionPool\_getQuestionTypes(), ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, ILIAS\Repository\ctrl(), ilAssQuestionLifecycle\getDraftInstance(), ilTestRandomQuestionSetSourcePoolDefinition\getId(), ilTestRandomQuestionSetSourcePoolDefinition\getLifecycleFilter(), ilTestRandomQuestionSetSourcePoolDefinition\getOriginalTaxonomyFilter(), ilTestRandomQuestionSetSourcePoolDefinition\getPoolId(), ilTestRandomQuestionSetSourcePoolDefinition\getPoolInfoLabel(), ilTestRandomQuestionSetSourcePoolDefinition\getQuestionAmount(), getSaveAndNewCommand(), getSaveCommand(), ilTestRandomQuestionSetSourcePoolDefinition\getTypeFilter(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), ilFormGUI\setId(), and ilPropertyFormGUI\setTitle().

+ Here is the call graph for this function:

◆ getSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveAndNewCommand ( )

Definition at line 69 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

References $saveAndNewCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ getSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveCommand ( )

Definition at line 59 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

References $saveCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ setSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::setSaveAndNewCommand ( string  $saveAndNewCommand)

Definition at line 64 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

64 : void
65 {
66 $this->saveAndNewCommand = $saveAndNewCommand;
67 }

References $saveAndNewCommand.

◆ setSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::setSaveCommand ( string  $saveCommand)

Definition at line 54 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

54 : void
55 {
56 $this->saveCommand = $saveCommand;
57 }

References $saveCommand.

Field Documentation

◆ $questionSetConfig

ilTestRandomQuestionSetConfig ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfig

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

Referenced by __construct().

◆ $questionSetConfigGUI

ilTestRandomQuestionSetConfigGUI ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfigGUI

Definition at line 35 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

Referenced by __construct().

◆ $saveAndNewCommand

string ilTestRandomQuestionSetPoolDefinitionFormGUI::$saveAndNewCommand = null
private

◆ $saveCommand

string ilTestRandomQuestionSetPoolDefinitionFormGUI::$saveCommand = null
private

◆ $testOBJ

ilObjTest ilTestRandomQuestionSetPoolDefinitionFormGUI::$testOBJ

Definition at line 33 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

Referenced by __construct().


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