ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTestRandomQuestionSetPoolDefinitionFormGUI Class Reference
+ Inheritance diagram for ilTestRandomQuestionSetPoolDefinitionFormGUI:
+ Collaboration diagram for ilTestRandomQuestionSetPoolDefinitionFormGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilLanguage $lng, ilObjTest $testOBJ, ilTestRandomQuestionSetConfigGUI $questionSetConfigGUI, ilTestRandomQuestionSetConfig $questionSetConfig)
 
 setSaveCommand ($saveCommand)
 
 getSaveCommand ()
 
 setSaveAndNewCommand ($saveAndNewCommand)
 
 getSaveAndNewCommand ()
 
 build (ilTestRandomQuestionSetSourcePoolDefinition $sourcePool, $availableTaxonomyIds)
 
 applySubmit (ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition, $availableTaxonomyIds)
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setTableWidth ($a_width)
 Set table width. More...
 
 getTableWidth ()
 get table width More...
 
 setMode ($a_mode)
 Set Mode ('std', 'subform'). More...
 
 getMode ()
 Get Mode ('std', 'subform'). More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setTitleIcon ($a_titleicon)
 Set TitleIcon. More...
 
 getTitleIcon ()
 Get TitleIcon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setShowTopButtons ($a_val)
 Get show top buttons. More...
 
 getShowTopButtons ()
 Set show top buttons. More...
 
 addItem ($a_item)
 Add Item (Property, SectionHeader). More...
 
 removeItemByPostVar ($a_post_var, $a_remove_unused_headers=false)
 Remove Item. More...
 
 getItemByPostVar ($a_post_var)
 Get Item by POST variable. More...
 
 setItems ($a_items)
 Set Items. More...
 
 getItems ()
 Get Items. More...
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage ($a_val)
 Set disable standard message. More...
 
 getDisableStandardMessage ()
 Get disable standard message. More...
 
 getHideLabels ()
 Get a value indicating whether the labels should be hidden or not. More...
 
 setHideLabels ($a_value=true)
 Set a value indicating whether the labels should be hidden or not. More...
 
 setValuesByArray ($a_values, $a_restrict_to_value_keys=false)
 Set form values from an array. More...
 
 setValuesByPost ()
 Set form values from POST values. More...
 
 checkInput ()
 Check Post Input. More...
 
 getInput ($a_post_var, $ensureValidation=true)
 Returns the value of a HTTP-POST variable, identified by the passed id. More...
 
 addCustomProperty ( $a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property. More...
 
 addCommandButton ($a_cmd, $a_text, $a_id="")
 Add Command button. More...
 
 getCommandButtons ()
 Return all Command buttons. More...
 
 clearCommandButtons ()
 Remove all command buttons. More...
 
 getContent ()
 Get Content. More...
 
 insertItem ($item, $a_sub_item=false)
 
 getHTML ()
 Get HTML. More...
 
 getFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Was any file uploaded? More...
 
 moveFileUpload ($a_target_directory, $a_field, $a_target_name=null, $a_index=null, $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Data Fields

 $ctrl = null
 
 $lng = null
 
 $testOBJ = null
 
 $questionSetConfigGUI = null
 
 $questionSetConfig = null
 

Private Attributes

 $saveCommand = null
 
 $saveAndNewCommand = null
 

Additional Inherited Members

- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 
- Protected Attributes inherited from ilPropertyFormGUI
 $lng
 
 $ctrl
 
 $tpl
 
 $user
 
 $settings
 
 $mode = "std"
 
 $check_input_called = false
 
 $disable_standard_message = false
 
 $top_anchor = "il_form_top"
 
 $titleicon = false
 
 $description = ""
 
 $tbl_width = false
 
 $show_top_buttons = true
 
 $hide_labels = false
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ applySubmit()

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

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

256 {
257 // fau: taxFilter/typeFilter - submit multiple taxonomy and node selections - submit type selections
258 $filter = array();
259 foreach ($availableTaxonomyIds as $taxId) {
260 if ($this->getItemByPostVar("filter_tax_id_$taxId")->getChecked()) {
261 $nodeIds = (array) $this->getItemByPostVar("filter_tax_nodes_$taxId")->getValue();
262 if (!empty($nodeIds)) {
263 foreach ($nodeIds as $nodeId) {
264 $filter[(int) $taxId][] = (int) $nodeId;
265 }
266 }
267 }
268 }
269 $sourcePoolDefinition->setOriginalTaxonomyFilter($filter);
270
271 #switch( true )
272 #{
273 # case $this->getItemByPostVar('source_pool_filter_tax') === null:
274
275 # case !in_array($this->getItemByPostVar('filter_tax')->getValue(), $availableTaxonomyIds):
276
277 # $sourcePoolDefinition->setOriginalFilterTaxId(null);
278 # $sourcePoolDefinition->setOriginalFilterTaxNodeId(null);
279 # break;
280
281 # default:
282
283 # $taxId = $this->getItemByPostVar('filter_tax')->getValue();
284
285 # $sourcePoolDefinition->setOriginalFilterTaxId( $taxId );
286
287 # $sourcePoolDefinition->setOriginalFilterTaxNodeId( $this->getItemByPostVar("filter_tax_$taxId")->getValue() );
288 #}
289
290 $filter = array();
291 if ($this->getItemByPostVar("filter_type_enabled")->getChecked()) {
292 $filter = $this->getItemByPostVar("filter_type")->getMultiValues();
293 }
294 $sourcePoolDefinition->setTypeFilter($filter);
295 // fau.
296
297 if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
298 $sourcePoolDefinition->setQuestionAmount($this->getItemByPostVar('question_amount_per_pool')->getValue());
299 }
300 }
getItemByPostVar($a_post_var)
Get Item by POST variable.
setOriginalTaxonomyFilter($filter=array())
set the original taxonomy filter condition

References ilPropertyFormGUI\getItemByPostVar(), ilTestRandomQuestionSetSourcePoolDefinition\setOriginalTaxonomyFilter(), ilTestRandomQuestionSetSourcePoolDefinition\setQuestionAmount(), and ilTestRandomQuestionSetSourcePoolDefinition\setTypeFilter().

+ Here is the call graph for this function:

◆ build()

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

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

98 {
99 $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
100
101 $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form'));
102 $this->setId('tstRndQuestSetCfgPoolForm');
103
104 $this->addCommandButton(
105 $this->getSaveCommand(),
106 $this->lng->txt('save_and_back')
107 );
108
109 if (null !== $this->getSaveAndNewCommand()) {
110 $this->addCommandButton(
111 $this->getSaveAndNewCommand(),
112 $this->lng->txt('tst_save_and_create_new_rule')
113 );
114 }
115
116 $this->addCommandButton(
118 $this->lng->txt('cancel')
119 );
120
121 $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id');
122 $hiddenDefId->setValue($sourcePool->getId());
123 $this->addItem($hiddenDefId);
124
125 $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id');
126 $hiddenPoolId->setValue($sourcePool->getPoolId());
127 $this->addItem($hiddenPoolId);
128
129 $nonEditablePoolLabel = new ilNonEditableValueGUI(
130 $this->lng->txt('tst_inp_source_pool_label'),
131 'quest_pool_label'
132 );
133 $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng));
134
135 $this->addItem($nonEditablePoolLabel);
136
137
138 if (count($availableTaxonomyIds)) {
139 // fau: taxFilter/typeFilter - edit multiple taxonomy and node selections
140 require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
141
142 // this is needed by ilTaxSelectInputGUI in some cases
143 require_once 'Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php';
144 ilOverlayGUI::initJavaScript();
145
146 $filter = $sourcePool->getOriginalTaxonomyFilter();
147 foreach ($availableTaxonomyIds as $taxId) {
148 $taxonomy = new ilObjTaxonomy($taxId);
149 $taxLabel = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
150
151 $taxCheckbox = new ilCheckboxInputGUI($taxLabel, "filter_tax_id_$taxId");
152
153
154
155 $this->ctrl->setParameterByClass('iltaxselectinputgui', 'src_pool_def_id', $sourcePool->getId());
156 $this->ctrl->setParameterByClass('iltaxselectinputgui', 'quest_pool_id', $sourcePool->getPoolId());
157 $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_nodes_$taxId", true);
158 $taxSelect->setRequired(true);
159
160 if (isset($filter[$taxId])) {
161 $taxCheckbox->setChecked(true);
162 $taxSelect->setValue($filter[$taxId]);
163 }
164 $taxCheckbox->addSubItem($taxSelect);
165 $this->addItem($taxCheckbox);
166 }
167
168 #$taxRadio = new ilRadioGroupInputGUI(
169 # $this->lng->txt('tst_inp_source_pool_filter_tax'), 'filter_tax'
170 #);
171
172 #$taxRadio->setRequired(true);
173
174 #$taxRadio->addOption(new ilRadioOption(
175 # $this->lng->txt('tst_inp_source_pool_no_tax_filter'), 0
176 #));
177
178 #$taxRadio->setValue(0);
179
180 #require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
181
182 #foreach($availableTaxonomyIds as $taxId)
183 #{
184 # $taxonomy = new ilObjTaxonomy($taxId);
185 # $label = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
186
187 # $taxRadioOption = new ilRadioOption($label, $taxId);
188
189 # $taxRadio->addOption($taxRadioOption);
190
191 # $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_$taxId", false);
192 # $taxSelect->setRequired(true);
193 # $taxRadioOption->addSubItem($taxSelect);
194
195 # if( $taxId == $sourcePool->getOriginalFilterTaxId() )
196 # {
197 # $taxRadio->setValue( $sourcePool->getOriginalFilterTaxId() );
198 # $taxSelect->setValue( $sourcePool->getOriginalFilterTaxNodeId() );
199 # }
200 #}
201
202 #$this->addItem($taxRadio);
203 // fau.
204 } else {
205 $hiddenNoTax = new ilHiddenInputGUI('filter_tax');
206 $hiddenNoTax->setValue(0);
207 $this->addItem($hiddenNoTax);
208
209 $nonEditableNoTax = new ilNonEditableValueGUI(
210 $this->lng->txt('tst_inp_source_pool_filter_tax'),
211 'no_tax_label'
212 );
213 $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint'));
214 $this->addItem($nonEditableNoTax);
215 }
216
217 // fau: taxFilter/typeFilter - show type filter selection
218 $typeFilterOptions = array();
219 require_once("./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php");
220 foreach (ilObjQuestionPool::_getQuestionTypes(true) as $translation => $data) {
221 $typeFilterOptions[$data['question_type_id']] = $translation;
222 }
223 $filterIds = $sourcePool->getTypeFilter();
224 $typeCheckbox = new ilCheckboxInputGUI($this->lng->txt('tst_filter_question_type_enabled'), 'filter_type_enabled');
225 $typeCheckbox->setChecked(!empty($filterIds));
226 $typeFilter = new ilSelectInputGUI($this->lng->txt('tst_filter_question_type'), 'filter_type');
227 $typeFilter->setRequired(true);
228 $typeFilter->setMulti(true);
229 $typeFilter->setOptions($typeFilterOptions);
230 $typeFilter->setValue($filterIds);
231 $typeCheckbox->addSubItem($typeFilter);
232 $this->addItem($typeCheckbox);
233 // fau.
234
235 if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
236 $questionAmountPerSourcePool = new ilNumberInputGUI(
237 $this->lng->txt('tst_inp_quest_amount_per_source_pool'),
238 'question_amount_per_pool'
239 );
240
241 $questionAmountPerSourcePool->setRequired(true);
242 $questionAmountPerSourcePool->allowDecimals(false);
243 $questionAmountPerSourcePool->setMinValue(0);
244 $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true);
245 $questionAmountPerSourcePool->setSize(4);
246
247 if ($sourcePool->getQuestionAmount()) {
248 $questionAmountPerSourcePool->setValue($sourcePool->getQuestionAmount());
249 }
250
251 $this->addItem($questionAmountPerSourcePool);
252 }
253 }
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
setId($a_id)
Set 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)
addItem($a_item)
Add Item (Property, SectionHeader).
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setTitle($a_title)
Set Title.
This class represents a selection list property in a property form.
Select taxonomy nodes input GUI.
$data
Definition: bench.php:6

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

+ Here is the call graph for this function:

◆ getSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveAndNewCommand ( )
Returns
null|string

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

References $saveAndNewCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ getSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::getSaveCommand ( )

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

References $saveCommand.

Referenced by build().

+ Here is the caller graph for this function:

◆ setSaveAndNewCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::setSaveAndNewCommand (   $saveAndNewCommand)
Parameters
null | string$saveAndNewCommand

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

85 {
86 $this->saveAndNewCommand = $saveAndNewCommand;
87 }

References $saveAndNewCommand.

◆ setSaveCommand()

ilTestRandomQuestionSetPoolDefinitionFormGUI::setSaveCommand (   $saveCommand)

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

72 {
73 $this->saveCommand = $saveCommand;
74 }

References $saveCommand.

Field Documentation

◆ $ctrl

ilTestRandomQuestionSetPoolDefinitionFormGUI::$ctrl = null

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

Referenced by __construct().

◆ $lng

ilTestRandomQuestionSetPoolDefinitionFormGUI::$lng = null

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

Referenced by __construct().

◆ $questionSetConfig

ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfig = null

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

Referenced by __construct().

◆ $questionSetConfigGUI

ilTestRandomQuestionSetPoolDefinitionFormGUI::$questionSetConfigGUI = null

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

Referenced by __construct().

◆ $saveAndNewCommand

ilTestRandomQuestionSetPoolDefinitionFormGUI::$saveAndNewCommand = null
private

◆ $saveCommand

ilTestRandomQuestionSetPoolDefinitionFormGUI::$saveCommand = null
private

◆ $testOBJ

ilTestRandomQuestionSetPoolDefinitionFormGUI::$testOBJ = null

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

Referenced by __construct().


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