ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 
- 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 39 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  $sourcePoolDefinition,
  $availableTaxonomyIds 
)

Definition at line 241 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().

241  : void
242  {
243  // fau: taxFilter/typeFilter - submit multiple taxonomy and node selections - submit type selections
244  $filter = array();
245  foreach ($availableTaxonomyIds as $taxId) {
246  if ($this->getItemByPostVar("filter_tax_id_$taxId")->getChecked()) {
247  $nodeIds = (array) $this->getItemByPostVar("filter_tax_nodes_$taxId")->getValue();
248  if (!empty($nodeIds)) {
249  foreach ($nodeIds as $nodeId) {
250  $filter[(int) $taxId][] = (int) $nodeId;
251  }
252  }
253  }
254  }
255  $sourcePoolDefinition->setOriginalTaxonomyFilter($filter);
256 
257  #switch( true )
258  #{
259  # case $this->getItemByPostVar('source_pool_filter_tax') === null:
260 
261  # case !in_array($this->getItemByPostVar('filter_tax')->getValue(), $availableTaxonomyIds):
262 
263  # $sourcePoolDefinition->setOriginalFilterTaxId(null);
264  # $sourcePoolDefinition->setOriginalFilterTaxNodeId(null);
265  # break;
266 
267  # default:
268 
269  # $taxId = $this->getItemByPostVar('filter_tax')->getValue();
270 
271  # $sourcePoolDefinition->setOriginalFilterTaxId( $taxId );
272 
273  # $sourcePoolDefinition->setOriginalFilterTaxNodeId( $this->getItemByPostVar("filter_tax_$taxId")->getValue() );
274  #}
275 
276  $filter = array();
277  if ($this->getItemByPostVar("filter_type_enabled")->getChecked()) {
278  $filter = $this->getItemByPostVar("filter_type")->getMultiValues();
279  }
280  $sourcePoolDefinition->setTypeFilter($filter);
281 
282  $filter = array();
283  if ($this->getItemByPostVar("filter_lifecycle_enabled")->getChecked()) {
284  $filter = $this->getItemByPostVar("filter_lifecycle")->getMultiValues();
285  }
286  $sourcePoolDefinition->setLifecycleFilter($filter);
287 
288  // fau.
289 
290  if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
291  $sourcePoolDefinition->setQuestionAmount($this->getItemByPostVar('question_amount_per_pool')->getValue());
292  }
293  }
setOriginalTaxonomyFilter($filter=array())
set the original taxonomy filter condition
getItemByPostVar(string $a_post_var)
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:47
+ Here is the call graph for this function:

◆ build()

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

Definition at line 70 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(), ilCheckboxInputGUI\setChecked(), ilFormGUI\setFormAction(), ilFormGUI\setId(), ilFormPropertyGUI\setRequired(), ilPropertyFormGUI\setTitle(), and ilNonEditableValueGUI\setValue().

70  : void
71  {
72  $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
73 
74  $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form'));
75  $this->setId('tstRndQuestSetCfgPoolForm');
76 
77  $this->addCommandButton(
78  $this->getSaveCommand(),
79  $this->lng->txt('save_and_back')
80  );
81 
82  if (null !== $this->getSaveAndNewCommand()) {
83  $this->addCommandButton(
84  $this->getSaveAndNewCommand(),
85  $this->lng->txt('tst_save_and_create_new_rule')
86  );
87  }
88 
89  $this->addCommandButton(
91  $this->lng->txt('cancel')
92  );
93 
94  $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id');
95  $hiddenDefId->setValue((string) $sourcePool->getId());
96  $this->addItem($hiddenDefId);
97 
98  $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id');
99  $hiddenPoolId->setValue((string) $sourcePool->getPoolId());
100  $this->addItem($hiddenPoolId);
101 
102  $nonEditablePoolLabel = new ilNonEditableValueGUI(
103  $this->lng->txt('tst_inp_source_pool_label'),
104  'quest_pool_label'
105  );
106  $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng));
107 
108  $this->addItem($nonEditablePoolLabel);
109 
110 
111  if (count($availableTaxonomyIds)) {
112  // fau: taxFilter/typeFilter - edit multiple taxonomy and node selections
113  require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
114 
115  // this is needed by ilTaxSelectInputGUI in some cases
116  require_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
117  ilOverlayGUI::initJavaScript();
118 
119  $filter = $sourcePool->getOriginalTaxonomyFilter();
120  foreach ($availableTaxonomyIds as $taxId) {
121  $taxonomy = new ilObjTaxonomy($taxId);
122  $taxLabel = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
123 
124  $taxCheckbox = new ilCheckboxInputGUI($taxLabel, "filter_tax_id_$taxId");
125 
126 
127 
128  $this->ctrl->setParameterByClass('iltaxselectinputgui', 'src_pool_def_id', $sourcePool->getId());
129  $this->ctrl->setParameterByClass('iltaxselectinputgui', 'quest_pool_id', $sourcePool->getPoolId());
130  $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_nodes_$taxId", true);
131  $taxSelect->setRequired(true);
132 
133  if (isset($filter[$taxId])) {
134  $taxCheckbox->setChecked(true);
135  $taxSelect->setValue($filter[$taxId]);
136  }
137  $taxCheckbox->addSubItem($taxSelect);
138  $this->addItem($taxCheckbox);
139  }
140 
141  #$taxRadio = new ilRadioGroupInputGUI(
142  # $this->lng->txt('tst_inp_source_pool_filter_tax'), 'filter_tax'
143  #);
144 
145  #$taxRadio->setRequired(true);
146 
147  #$taxRadio->addOption(new ilRadioOption(
148  # $this->lng->txt('tst_inp_source_pool_no_tax_filter'), 0
149  #));
150 
151  #$taxRadio->setValue(0);
152 
153  #require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
154 
155  #foreach($availableTaxonomyIds as $taxId)
156  #{
157  # $taxonomy = new ilObjTaxonomy($taxId);
158  # $label = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
159 
160  # $taxRadioOption = new ilRadioOption($label, $taxId);
161 
162  # $taxRadio->addOption($taxRadioOption);
163 
164  # $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_$taxId", false);
165  # $taxSelect->setRequired(true);
166  # $taxRadioOption->addSubItem($taxSelect);
167 
168  # if( $taxId == $sourcePool->getOriginalFilterTaxId() )
169  # {
170  # $taxRadio->setValue( $sourcePool->getOriginalFilterTaxId() );
171  # $taxSelect->setValue( $sourcePool->getOriginalFilterTaxNodeId() );
172  # }
173  #}
174 
175  #$this->addItem($taxRadio);
176  // fau.
177  } else {
178  $hiddenNoTax = new ilHiddenInputGUI('filter_tax');
179  $hiddenNoTax->setValue('0');
180  $this->addItem($hiddenNoTax);
181 
182  $nonEditableNoTax = new ilNonEditableValueGUI(
183  $this->lng->txt('tst_inp_source_pool_filter_tax'),
184  'no_tax_label'
185  );
186  $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint'));
187  $this->addItem($nonEditableNoTax);
188  }
189 
190  $lifecycleFilterValues = $sourcePool->getLifecycleFilter();
191  $lifecycleCheckbox = new ilCheckboxInputGUI($this->lng->txt('tst_filter_lifecycle_enabled'), 'filter_lifecycle_enabled');
192  $lifecycleCheckbox->setChecked(!empty($lifecycleFilterValues));
193  $lifecycleFilter = new ilSelectInputGUI($this->lng->txt('qst_lifecycle'), 'filter_lifecycle');
194  $lifecycleFilter->setRequired(true);
195  $lifecycleFilter->setMulti(true);
196  $lifecycleFilter->setOptions(ilAssQuestionLifecycle::getDraftInstance()->getSelectOptions($this->lng));
197  $lifecycleFilter->setValue($lifecycleFilterValues);
198  $lifecycleCheckbox->addSubItem($lifecycleFilter);
199  $this->addItem($lifecycleCheckbox);
200 
201  // fau: taxFilter/typeFilter - show type filter selection
202  $typeFilterOptions = array();
203  require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
204  foreach (ilObjQuestionPool::_getQuestionTypes(true) as $translation => $data) {
205  $typeFilterOptions[$data['question_type_id']] = $translation;
206  }
207  $filterIds = $sourcePool->getTypeFilter();
208  $typeCheckbox = new ilCheckboxInputGUI($this->lng->txt('tst_filter_question_type_enabled'), 'filter_type_enabled');
209  $typeCheckbox->setChecked(!empty($filterIds));
210  $typeFilter = new ilSelectInputGUI($this->lng->txt('tst_filter_question_type'), 'filter_type');
211  $typeFilter->setRequired(true);
212  $typeFilter->setMulti(true);
213  $typeFilter->setOptions($typeFilterOptions);
214  $typeFilter->setValue($filterIds);
215  $typeCheckbox->addSubItem($typeFilter);
216  $this->addItem($typeCheckbox);
217  // fau.
218 
219  if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
220  $questionAmountPerSourcePool = new ilNumberInputGUI(
221  $this->lng->txt('tst_inp_quest_amount_per_source_pool'),
222  'question_amount_per_pool'
223  );
224 
225  $questionAmountPerSourcePool->setRequired(true);
226  $questionAmountPerSourcePool->allowDecimals(false);
227  $questionAmountPerSourcePool->setMinValue(0);
228  $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true);
229  $questionAmountPerSourcePool->setSize(4);
230 
231  if ($sourcePool->getQuestionAmount()) {
232  $questionAmountPerSourcePool->setValue(
233  $sourcePool->getQuestionAmount() ? (string) $sourcePool->getQuestionAmount() : null
234  );
235  }
236 
237  $this->addItem($questionAmountPerSourcePool);
238  }
239  }
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 checkbox 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)
This class represents a number property in a property form.
setRequired(bool $a_required)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
+ Here is the call graph for this function:

◆ getSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveAndNewCommand ( )

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

References $saveAndNewCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ getSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveCommand ( )

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

Referenced by __construct().

◆ $questionSetConfigGUI

ilTestRandomQuestionSetConfigGUI ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfigGUI

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

Referenced by __construct().


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