ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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, $availableTaxonomyIds)
 
 applySubmit (ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition, $availableTaxonomyIds)
 
- 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 41 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

References ilPropertyFormGUI\$ctrl, ilPropertyFormGUI\$lng, $questionSetConfig, $questionSetConfigGUI, $testOBJ, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ applySubmit()

ilTestRandomQuestionSetPoolDefinitionFormGUI::applySubmit ( ilTestRandomQuestionSetSourcePoolDefinition  $sourcePoolDefinition,
  $availableTaxonomyIds 
)

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

References ilPropertyFormGUI\getItemByPostVar(), ILIAS\UI\Implementation\Component\Input\getValue(), ILIAS\Repository\int(), ilTestRandomQuestionSetSourcePoolDefinition\setLifecycleFilter(), ilTestRandomQuestionSetSourcePoolDefinition\setOriginalTaxonomyFilter(), ilTestRandomQuestionSetSourcePoolDefinition\setQuestionAmount(), and ilTestRandomQuestionSetSourcePoolDefinition\setTypeFilter().

201  : void
202  {
203  // fau: taxFilter/typeFilter - submit multiple taxonomy and node selections - submit type selections
204  $filter = array();
205  foreach ($availableTaxonomyIds as $taxId) {
206  if ($this->getItemByPostVar("filter_tax_id_$taxId")->getChecked()) {
207  $nodeIds = (array) $this->getItemByPostVar("filter_tax_nodes_$taxId")->getValue();
208  if (!empty($nodeIds)) {
209  foreach ($nodeIds as $nodeId) {
210  $filter[(int) $taxId][] = (int) $nodeId;
211  }
212  }
213  }
214  }
215  $sourcePoolDefinition->setOriginalTaxonomyFilter($filter);
216 
217  $filter = array();
218  if ($this->getItemByPostVar("filter_type_enabled")->getChecked()) {
219  $filter = $this->getItemByPostVar("filter_type")->getMultiValues();
220  }
221  $sourcePoolDefinition->setTypeFilter($filter);
222 
223  $filter = array();
224  if ($this->getItemByPostVar("filter_lifecycle_enabled")->getChecked()) {
225  $filter = $this->getItemByPostVar("filter_lifecycle")->getMultiValues();
226  }
227  $sourcePoolDefinition->setLifecycleFilter($filter);
228 
229  // fau.
230 
231  if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
232  $sourcePoolDefinition->setQuestionAmount(intval($this->getItemByPostVar('question_amount_per_pool')->getValue()));
233  }
234  }
getItemByPostVar(string $a_post_var)
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:46
+ Here is the call graph for this function:

◆ build()

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

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

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(), ilFormPropertyGUI\setRequired(), and ilPropertyFormGUI\setTitle().

72  : void
73  {
74  $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
75 
76  $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form'));
77  $this->setId('tstRndQuestSetCfgPoolForm');
78 
79  $this->addCommandButton(
80  $this->getSaveCommand(),
81  $this->lng->txt('save_and_back')
82  );
83 
84  if (null !== $this->getSaveAndNewCommand()) {
85  $this->addCommandButton(
86  $this->getSaveAndNewCommand(),
87  $this->lng->txt('tst_save_and_create_new_rule')
88  );
89  }
90 
91  $this->addCommandButton(
93  $this->lng->txt('cancel')
94  );
95 
96  $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id');
97  $hiddenDefId->setValue((string) $sourcePool->getId());
98  $this->addItem($hiddenDefId);
99 
100  $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id');
101  $hiddenPoolId->setValue((string) $sourcePool->getPoolId());
102  $this->addItem($hiddenPoolId);
103 
104  $nonEditablePoolLabel = new ilNonEditableValueGUI(
105  $this->lng->txt('tst_inp_source_pool_label'),
106  'quest_pool_label'
107  );
108  $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng));
109 
110  $this->addItem($nonEditablePoolLabel);
111 
112 
113  if (count($availableTaxonomyIds)) {
114  ilOverlayGUI::initJavaScript();
115 
116  $filter = $sourcePool->getOriginalTaxonomyFilter();
117  foreach ($availableTaxonomyIds as $taxId) {
118  $taxonomy = new ilObjTaxonomy($taxId);
119  $taxLabel = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
120 
121  $taxCheckbox = new ilCheckboxInputGUI($taxLabel, "filter_tax_id_$taxId");
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($taxId, "filter_tax_nodes_$taxId", true);
128  $taxSelect->setRequired(true);
129 
130  if (isset($filter[$taxId])) {
131  $taxCheckbox->setChecked(true);
132  $taxSelect->setValue($filter[$taxId]);
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 = array();
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setId(string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
setFormAction(string $a_formaction)
setRequired(bool $a_required)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
+ Here is the call graph for this function:

◆ getSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveAndNewCommand ( )

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

References $saveAndNewCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ getSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveCommand ( )

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

References $saveCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ setSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::setSaveAndNewCommand ( string  $saveAndNewCommand)

◆ setSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::setSaveCommand ( string  $saveCommand)

Field Documentation

◆ $questionSetConfig

ilTestRandomQuestionSetConfig ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfig

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

Referenced by __construct().

◆ $questionSetConfigGUI

ilTestRandomQuestionSetConfigGUI ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfigGUI

Definition at line 33 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 31 of file class.ilTestRandomQuestionSetPoolDefinitionFormGUI.php.

Referenced by __construct().


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