ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ilSingleChoiceWizardInputGUI Class Reference

This class represents a single choice wizard property in a property form. More...

+ Inheritance diagram for ilSingleChoiceWizardInputGUI:
+ Collaboration diagram for ilSingleChoiceWizardInputGUI:

Public Member Functions

 __construct ($a_title='', $a_postvar='')
 Constructor. More...
 
 setValue ($a_value)
 
 setValueByArray (array $a_values)
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 setHideImages ($a_hide)
 Set hide images. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 setShowPoints ($a_value)
 
 getShowPoints ()
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. More...
 
 setSingleline ($a_value)
 Set singleline. More...
 
 getSingleline ()
 Get singleline. More...
 
 setQuestionObject ($a_value)
 Set question object. More...
 
 getQuestionObject ()
 Get question object. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 setPending (string $val)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilTextInputGUI
 __construct (string $a_title="", string $a_postvar="")
 
 setValue ($a_value)
 
 getValue ()
 
 setValidationFailureMessage (string $a_msg)
 
 getValidationFailureMessage ()
 
 setValidationRegexp (string $a_value)
 
 getValidationRegexp ()
 
 setMaxLength (?int $a_maxlength)
 
 getMaxLength ()
 
 setSize (int $a_size)
 
 setInlineStyle (string $a_style)
 
 getInlineStyle ()
 
 setCssClass (string $a_class)
 
 getCssClass ()
 
 setValueByArray (array $a_values)
 
 getSize ()
 
 setSuffix (string $a_value)
 
 getSuffix ()
 
 setInputType (string $a_type)
 set input type More...
 
 getInputType ()
 
 setSubmitFormOnEnter (bool $a_val)
 
 getSubmitFormOnEnter ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 getDataSource ()
 
 setDataSource (string $href, ?string $a_delimiter=null)
 
 setDataSourceSubmitOnSelection (bool $a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl (string $a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 
 render (string $a_mode="")
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
 setDisableHtmlAutoComplete (bool $autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
 getPostValueForComparison ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Member Functions

 checkAnswersInput (array $data)
 Checks the input of the answers and returns the answers as an array if the input is valid or a string with the error message if the input is invalid. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Protected Attributes

 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
ilTestLegacyFormsHelper $forms_helper
 
GlyphFactory $glyph_factory
 
ButtonFactory $button_factory
 
Renderer $renderer
 
UploadLimitResolver $upload_limit
 
- Protected Attributes inherited from ilTextInputGUI
 $value = null
 
int $maxlength = 200
 
int $size = 40
 
string $validationRegexp = ""
 
string $validationFailureMessage = ''
 
string $suffix = ""
 
string $style_css = ""
 
string $css_class = ""
 
string $ajax_datasource = ""
 
string $ajax_datasource_delimiter = null
 
bool $ajax_datasource_commit = false
 
string $ajax_datasource_commit_url = ""
 
bool $submit_form_on_enter = false
 
bool $autocomplete_disabled = false
 
string $input_type = ""
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

This class represents a single choice wizard property in a property form.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

Definition at line 32 of file class.ilSingleChoiceWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSingleChoiceWizardInputGUI::__construct (   $a_title = '',
  $a_postvar = '' 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented in ilKprimChoiceWizardInputGUI.

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

55 {
56 parent::__construct($a_title, $a_postvar);
57 $this->setSuffixes(['jpg', 'jpeg', 'png', 'gif']);
58 $this->setSize('25');
59 $this->setMaxLength(1000);
60 $this->validationRegexp = '';
61
62 global $DIC;
63 $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
64 $this->button_factory = $DIC->ui()->factory()->button();
65 $this->renderer = $DIC->ui()->renderer();
66 $this->upload_limit = $DIC['ui.upload_limit_resolver'];
67 $this->forms_helper = new ilTestLegacyFormsHelper();
68 }
renderer()
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setMaxLength(?int $a_maxlength)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), renderer(), ilTextInputGUI\setMaxLength(), ilTextInputGUI\setSize(), and setSuffixes().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkAnswersInput()

ilSingleChoiceWizardInputGUI::checkAnswersInput ( array  $data)
protected

Checks the input of the answers and returns the answers as an array if the input is valid or a string with the error message if the input is invalid.

The input is invalid if an answer is empty and no imagename was provided.

Returns
string[]|string

Definition at line 236 of file class.ilSingleChoiceWizardInputGUI.php.

236 : array|string
237 {
238 $to_string = $this->refinery->kindlyTo()->string();
239 $answers = $this->forms_helper->transformArray($data, 'answer', $to_string);
240 $image_names = $this->forms_helper->transformArray($data, 'imagename', $to_string);
241 foreach ($answers as $index => $value) {
242 if ($value === '' && !$this->forms_helper->inArray($image_names, $index)) {
243 return 'msg_input_is_required';
244 }
245
246 if (mb_strlen($value) > $this->getMaxLength()) {
247 return 'msg_input_char_limit_max';
248 }
249 }
250
251 return $answers;
252 }

References $data, ilTextInputGUI\$value, ilTextInputGUI\getMaxLength(), and ILIAS\Repository\refinery().

Referenced by ilEssayKeywordWizardInputGUI\checkInput(), ilKprimChoiceWizardInputGUI\checkInput(), ilMultipleChoiceWizardInputGUI\checkInput(), and checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInput()

ilSingleChoiceWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilTextInputGUI.

Reimplemented in ilEssayKeywordWizardInputGUI, ilKprimChoiceWizardInputGUI, ilMultipleChoiceWizardInputGUI, ilAssMultipleChoiceCorrectionsInputGUI, ilAssSingleChoiceCorrectionsInputGUI, and ilKprimChoiceCorrectionsInputGUI.

Definition at line 254 of file class.ilSingleChoiceWizardInputGUI.php.

254 : bool
255 {
256 $data = $this->raw($this->getPostVar());
257
258 if (!is_array($data)) {
259 $this->setAlert($this->lng->txt('msg_input_is_required'));
260 return false;
261 }
262
263 // check points
264 $points = $this->forms_helper->checkPointsInputEnoughPositive($data, true);
265 if (!is_array($points)) {
266 $this->setAlert($this->lng->txt($points));
267 return false;
268 }
269
270 // check answers
271 $answers = $this->checkAnswersInput($data);
272 if (!is_array($answers)) {
273 $this->setAlert($this->lng->txt($answers));
274 return false;
275 }
276 $image_names = $this->forms_helper->transformArray($data, 'imagename', $this->refinery->kindlyTo()->string());
277
278 if (is_array($_FILES) && count($_FILES) && $this->getSingleline() && (!$this->hideImages)) {
279 if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
280 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
281 // error handling
282 if ($error > 0) {
283 switch ($error) {
284 case UPLOAD_ERR_FORM_SIZE:
285 case UPLOAD_ERR_INI_SIZE:
286 $this->setAlert($this->lng->txt('form_msg_file_size_exceeds'));
287 return false;
288 break;
289
290 case UPLOAD_ERR_PARTIAL:
291 $this->setAlert($this->lng->txt('form_msg_file_partially_uploaded'));
292 return false;
293 break;
294
295 case UPLOAD_ERR_NO_FILE:
296 if (
297 !$this->forms_helper->inArray($image_names, $index)
298 && !$this->forms_helper->inArray($answers, $index)
299 && $this->getRequired()
300 ) {
301 $this->setAlert($this->lng->txt('form_msg_file_no_upload'));
302 return false;
303 }
304 break;
305
306 case UPLOAD_ERR_NO_TMP_DIR:
307 $this->setAlert($this->lng->txt('form_msg_file_missing_tmp_dir'));
308 return false;
309 break;
310
311 case UPLOAD_ERR_CANT_WRITE:
312 $this->setAlert($this->lng->txt('form_msg_file_cannot_write_to_disk'));
313 return false;
314 break;
315
316 case UPLOAD_ERR_EXTENSION:
317 $this->setAlert($this->lng->txt('form_msg_file_upload_stopped_ext'));
318 return false;
319 break;
320 }
321 }
322 }
323 } elseif ($this->getRequired()) {
324 $this->setAlert($this->lng->txt('form_msg_file_no_upload'));
325 return false;
326 }
327
328 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
329 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
330 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
331 if ($filename !== '') {
332 $filename_arr = pathinfo($filename);
333 $suffix = $filename_arr['extension'];
334 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
335 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
336 // check suffixes
337 if (
338 $tmpname !== ''
339 && is_array($this->getSuffixes())
340 && !in_array(strtolower($suffix), $this->getSuffixes(), true)
341 ) {
342 $this->setAlert($this->lng->txt('form_msg_file_wrong_file_type'));
343 return false;
344 }
345 }
346 }
347 }
348
349 if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
350 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
351 $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
352 if ($filename !== '') {
353 $filename_arr = pathinfo($filename);
354 $suffix = $filename_arr['extension'];
355 $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
356 $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
357 // virus handling
358 if ($tmpname !== '') {
360 if ($vir[0] == false) {
361 $this->setAlert($this->lng->txt('form_msg_file_virus_found') . '<br />' . $vir[1]);
362 return false;
363 }
364 }
365 }
366 }
367 }
368 }
369
370 return $this->checkSubItemsInput();
371 }
$filename
Definition: buildRTE.php:78
checkAnswersInput(array $data)
Checks the input of the answers and returns the answers as an array if the input is valid or a string...
static virusHandling(string $a_file, string $a_orig_name='', bool $a_clean=true)

References $data, $filename, ilTextInputGUI\$suffix, checkAnswersInput(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSingleline(), getSuffixes(), ILIAS\Repository\lng(), ilFormPropertyGUI\raw(), ILIAS\Repository\refinery(), ilFormPropertyGUI\setAlert(), and ilVirusScanner\virusHandling().

+ Here is the call graph for this function:

◆ getAllowMove()

ilSingleChoiceWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 215 of file class.ilSingleChoiceWizardInputGUI.php.

References $allowMove.

Referenced by ilKprimChoiceWizardInputGUI\insert(), ilMultipleChoiceWizardInputGUI\insert(), and insert().

+ Here is the caller graph for this function:

◆ getQuestionObject()

ilSingleChoiceWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

Definition at line 195 of file class.ilSingleChoiceWizardInputGUI.php.

References $qstObject.

◆ getShowPoints()

ilSingleChoiceWizardInputGUI::getShowPoints ( )

Definition at line 135 of file class.ilSingleChoiceWizardInputGUI.php.

References $showPoints.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getSingleline()

◆ getSuffixes()

ilSingleChoiceWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

Definition at line 125 of file class.ilSingleChoiceWizardInputGUI.php.

References $suffixes.

Referenced by ilMultipleChoiceWizardInputGUI\checkInput(), checkInput(), ilKprimChoiceWizardInputGUI\checkUploads(), ilKprimChoiceWizardInputGUI\insert(), ilMultipleChoiceWizardInputGUI\insert(), and insert().

+ Here is the caller graph for this function:

◆ getValues()

ilSingleChoiceWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

Definition at line 155 of file class.ilSingleChoiceWizardInputGUI.php.

References $values.

◆ insert()

ilSingleChoiceWizardInputGUI::insert ( ilTemplate  $a_tpl)

Reimplemented from ilTextInputGUI.

Reimplemented in ilEssayKeywordWizardInputGUI, ilKprimChoiceWizardInputGUI, ilMultipleChoiceWizardInputGUI, ilAssMultipleChoiceCorrectionsInputGUI, and ilAssSingleChoiceCorrectionsInputGUI.

Definition at line 373 of file class.ilSingleChoiceWizardInputGUI.php.

373 : void
374 {
375 $tpl = new ilTemplate('tpl.prop_singlechoicewizardinput.html', true, true, 'components/ILIAS/TestQuestionPool');
376 $i = 0;
377 foreach ($this->values as $value) {
378 if ($this->getSingleline()) {
379 if (!$this->hideImages) {
380 if ($value->getImage()) {
381 $imagename = $this->qstObject->getImagePathWeb() . $value->getImage();
382 if (($this->getSingleline()) && ($this->qstObject->getThumbSize())) {
383 if (file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->getImage())) {
384 $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->getImage();
385 }
386 }
387 $tpl->setCurrentBlock('image');
388 $tpl->setVariable('SRC_IMAGE', $imagename);
389 $tpl->setVariable('IMAGE_NAME', $value->getImage());
390 $tpl->setVariable(
391 'ALT_IMAGE',
393 );
394 $tpl->setVariable('TXT_DELETE_EXISTING', $this->lng->txt('delete_existing_file'));
395 $tpl->setVariable('IMAGE_ROW_NUMBER', $i);
396 $tpl->setVariable('IMAGE_POST_VAR', $this->getPostVar());
397 $tpl->parseCurrentBlock();
398 }
399 $tpl->setCurrentBlock('addimage');
400 $tpl->setVariable('IMAGE_BROWSE', $this->lng->txt('select_file'));
401 $tpl->setVariable('IMAGE_ID', $this->getPostVar() . "[image][$i]");
402 $tpl->setVariable('MAX_SIZE_WARNING', $this->lng->txt('form_msg_file_size_exceeds'));
403 $tpl->setVariable('MAX_SIZE', $this->upload_limit->getPhpUploadLimitInBytes());
404 $tpl->setVariable('IMAGE_SUBMIT', $this->lng->txt('upload'));
405 $tpl->setVariable('IMAGE_ROW_NUMBER', $i);
406 $tpl->setVariable('IMAGE_POST_VAR', $this->getPostVar());
407 $tpl->parseCurrentBlock();
408 }
409
410 if (is_object($value)) {
411 $tpl->setCurrentBlock('prop_text_propval');
412 $tpl->setVariable(
413 'PROPERTY_VALUE',
415 );
416 $tpl->parseCurrentBlock();
417 if ($this->getShowPoints()) {
418 $tpl->setCurrentBlock('prop_points_propval');
419 $tpl->setVariable(
420 'PROPERTY_VALUE',
422 );
423 $tpl->parseCurrentBlock();
424 }
425 $tpl->setCurrentBlock('prop_answer_id_propval');
426 $tpl->setVariable('PROPERTY_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($value->getId()));
427 $tpl->parseCurrentBlock();
428 }
429 $tpl->setCurrentBlock('singleline');
430 $tpl->setVariable('SIZE', $this->getSize());
431 $tpl->setVariable('SINGLELINE_ID', $this->getPostVar() . "[answer][$i]");
432 $tpl->setVariable('SINGLELINE_ROW_NUMBER', $i);
433 $tpl->setVariable('SINGLELINE_POST_VAR', $this->getPostVar());
434 $tpl->setVariable('MAXLENGTH', $this->getMaxLength());
435 if ($this->getDisabled()) {
436 $tpl->setVariable('DISABLED_SINGLELINE', ' disabled="disabled"');
437 }
438 $tpl->parseCurrentBlock();
439 } elseif (!$this->getSingleline()) {
440 if (is_object($value)) {
441 if ($this->getShowPoints()) {
442 $tpl->setCurrentBlock('prop_points_propval');
443 $tpl->setVariable(
444 'PROPERTY_VALUE',
446 );
447 $tpl->parseCurrentBlock();
448 }
449 $tpl->setCurrentBlock('prop_answer_id_propval');
450 $tpl->setVariable('PROPERTY_VALUE', ilLegacyFormElementsUtil::prepareFormOutput($value->getId()));
451 $tpl->parseCurrentBlock();
452 }
453 $tpl->setCurrentBlock('multiline');
454 $tpl->setVariable(
455 'PROPERTY_VALUE',
457 );
458 $tpl->setVariable('MULTILINE_ID', $this->getPostVar() . "[answer][$i]");
459 $tpl->setVariable('MULTILINE_ROW_NUMBER', $i);
460 $tpl->setVariable('MULTILINE_POST_VAR', $this->getPostVar());
461 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
462 if ($this->getDisabled()) {
463 $tpl->setVariable('DISABLED_MULTILINE', ' disabled="disabled"');
464 }
465 $tpl->parseCurrentBlock();
466 }
467 if ($this->getAllowMove()) {
468 $tpl->setCurrentBlock('move');
469 $tpl->setVariable('ID', $this->getPostVar() . "[$i]");
470 $tpl->setVariable('UP_BUTTON', $this->renderer->render(
471 $this->button_factory->standard('', '')->withSymbol($this->glyph_factory->up())
472 ));
473 $tpl->setVariable('DOWN_BUTTON', $this->renderer->render(
474 $this->button_factory->standard('', '')->withSymbol($this->glyph_factory->down())
475 ));
476 $tpl->parseCurrentBlock();
477 }
478 if ($this->getShowPoints()) {
479 $tpl->setCurrentBlock('points');
480 $tpl->setVariable('POINTS_ID', $this->getPostVar() . "[points][$i]");
481 $tpl->setVariable('POINTS_POST_VAR', $this->getPostVar());
482 $tpl->setVariable('POINTS_ROW_NUMBER', $i);
483 $tpl->parseCurrentBlock();
484 }
485 $tpl->setCurrentBlock('row');
486 $tpl->setVariable('POST_VAR', $this->getPostVar());
487 $tpl->setVariable('ROW_NUMBER', $i);
488 $tpl->setVariable('ID', $this->getPostVar() . "[answer][$i]");
489 if ($this->getDisabled()) {
490 $tpl->setVariable('DISABLED_POINTS', ' disabled="disabled"');
491 }
492 $tpl->setVariable('ADD_BUTTON', $this->renderer->render(
493 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->add())
494 ));
495 $tpl->setVariable('REMOVE_BUTTON', $this->renderer->render(
496 $this->button_factory->shy('', '')->withSymbol($this->glyph_factory->remove())
497 ));
498 $tpl->parseCurrentBlock();
499 $i++;
500 }
501
502 if ($this->getSingleline()) {
503 if (!$this->hideImages) {
504 if (is_array($this->getSuffixes())) {
505 $suff_str = $delim = '';
506 foreach ($this->getSuffixes() as $suffix) {
507 $suff_str .= $delim . '.' . $suffix;
508 $delim = ', ';
509 }
510 $tpl->setCurrentBlock('allowed_image_suffixes');
511 $tpl->setVariable('TXT_ALLOWED_SUFFIXES', $this->lng->txt('file_allowed_suffixes') . ' ' . $suff_str);
512 $tpl->parseCurrentBlock();
513 }
514 $tpl->setCurrentBlock('image_heading');
515 $tpl->setVariable('ANSWER_IMAGE', $this->lng->txt('answer_image'));
516 $tpl->setVariable('TXT_MAX_SIZE', ilFileUtils::getFileSizeInfo());
517 $tpl->parseCurrentBlock();
518 }
519 }
520
521 if ($this->getShowPoints()) {
522 $tpl->setCurrentBlock('points_heading');
523 $tpl->setVariable('POINTS_TEXT', $this->lng->txt('points'));
524 $tpl->parseCurrentBlock();
525 }
526
527 $tpl->setVariable('ELEMENT_ID', $this->getPostVar());
528 $tpl->setVariable('TEXT_YES', $this->lng->txt('yes'));
529 $tpl->setVariable('TEXT_NO', $this->lng->txt('no'));
530 $tpl->setVariable('DELETE_IMAGE_HEADER', $this->lng->txt('delete_image_header'));
531 $tpl->setVariable('DELETE_IMAGE_QUESTION', $this->lng->txt('delete_image_question'));
532 $tpl->setVariable('ANSWER_TEXT', $this->lng->txt('answer_text'));
533 $tpl->setVariable('COMMANDS_TEXT', $this->lng->txt('actions'));
534
535 $a_tpl->setCurrentBlock('prop_generic');
536 $a_tpl->setVariable('PROP_GENERIC', $tpl->get());
537 $a_tpl->parseCurrentBlock();
538
539 global $DIC;
540 $tpl = $DIC['tpl'];
541 $tpl->addJavascript('assets/js/answerwizardinput.js');
542 $tpl->addJavascript('assets/js/singlechoicewizard.js');
543 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static getFileSizeInfo()
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References $DIC, ilTextInputGUI\$suffix, ilTextInputGUI\$value, getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFileUtils\getFileSizeInfo(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), getShowPoints(), getSingleline(), ilTextInputGUI\getSize(), getSuffixes(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), renderer(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ setAllowMove()

ilSingleChoiceWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 205 of file class.ilSingleChoiceWizardInputGUI.php.

205 : void
206 {
207 $this->allowMove = $a_allow_move;
208 }

◆ setHideImages()

ilSingleChoiceWizardInputGUI::setHideImages (   $a_hide)

Set hide images.

Parameters
array$a_hideHide images

Definition at line 115 of file class.ilSingleChoiceWizardInputGUI.php.

115 : void
116 {
117 $this->hideImages = $a_hide;
118 }

◆ setPending()

ilSingleChoiceWizardInputGUI::setPending ( string  $val)

2023-07-05 sk: This is not how it should be, but there is no got way around it right now. We need KS-Forms. Now!

Reimplemented in ilMultipleChoiceWizardInputGUI.

Definition at line 222 of file class.ilSingleChoiceWizardInputGUI.php.

222 : void
223 {
228 }

◆ setQuestionObject()

ilSingleChoiceWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

Definition at line 185 of file class.ilSingleChoiceWizardInputGUI.php.

185 : void
186 {
187 $this->qstObject = &$a_value;
188 }

◆ setShowPoints()

ilSingleChoiceWizardInputGUI::setShowPoints (   $a_value)

Definition at line 130 of file class.ilSingleChoiceWizardInputGUI.php.

130 : void
131 {
132 $this->showPoints = $a_value;
133 }

◆ setSingleline()

ilSingleChoiceWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

Definition at line 165 of file class.ilSingleChoiceWizardInputGUI.php.

165 : void
166 {
167 $this->singleline = $a_value;
168 }

◆ setSuffixes()

ilSingleChoiceWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

Definition at line 105 of file class.ilSingleChoiceWizardInputGUI.php.

105 : void
106 {
107 $this->suffixes = $a_suffixes;
108 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValue()

ilSingleChoiceWizardInputGUI::setValue (   $a_value)
Parameters
string | array$a_value

Reimplemented from ilTextInputGUI.

Reimplemented in ilEssayKeywordWizardInputGUI, ilKprimChoiceWizardInputGUI, ilMultipleChoiceWizardInputGUI, ilAssMultipleChoiceCorrectionsInputGUI, ilAssSingleChoiceCorrectionsInputGUI, and ilKprimChoiceCorrectionsInputGUI.

Definition at line 70 of file class.ilSingleChoiceWizardInputGUI.php.

70 : void
71 {
72 $this->values = [];
73
74 $answers = $this->forms_helper->transformArray($a_value, 'answer', $this->refinery->kindlyTo()->string());
75 $points = $this->forms_helper->transformPoints($a_value);
76
77 foreach ($answers as $index => $value) {
78 $answer = new ASS_AnswerBinaryStateImage(
79 $value,
80 $points[$index] ?? 0.0,
81 (int) $index,
82 true,
83 null,
84 (int) $a_value['answer_id'][$index] ?? 0
85 );
86 if (isset($a_value['imagename'][$index])) {
87 $answer->setImage($a_value['imagename'][$index]);
88 }
89 $this->values[] = $answer;
90 }
91 }
Class for answers with a binary state indicator.

References ilTextInputGUI\$value, and ILIAS\Repository\refinery().

Referenced by setValueByArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilSingleChoiceWizardInputGUI::setValueByArray ( array  $a_values)

Reimplemented from ilTextInputGUI.

Definition at line 93 of file class.ilSingleChoiceWizardInputGUI.php.

93 : void
94 {
95 if (isset($a_values[$this->getPostVar()])) {
96 $this->setValue($a_values[$this->getPostVar()] ?? []);
97 }
98 }

References ilFormPropertyGUI\getPostVar(), and setValue().

+ Here is the call graph for this function:

◆ setValues()

ilSingleChoiceWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 145 of file class.ilSingleChoiceWizardInputGUI.php.

145 : void
146 {
147 $this->values = $a_values;
148 }

Field Documentation

◆ $allowMove

ilSingleChoiceWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $button_factory

ButtonFactory ilSingleChoiceWizardInputGUI::$button_factory
protected

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

◆ $forms_helper

ilTestLegacyFormsHelper ilSingleChoiceWizardInputGUI::$forms_helper
protected

Definition at line 42 of file class.ilSingleChoiceWizardInputGUI.php.

◆ $glyph_factory

GlyphFactory ilSingleChoiceWizardInputGUI::$glyph_factory
protected

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

◆ $hideImages

ilSingleChoiceWizardInputGUI::$hideImages = false
protected

Definition at line 40 of file class.ilSingleChoiceWizardInputGUI.php.

◆ $qstObject

ilSingleChoiceWizardInputGUI::$qstObject = null
protected

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

Referenced by getQuestionObject().

◆ $renderer

Renderer ilSingleChoiceWizardInputGUI::$renderer
protected

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

◆ $showPoints

ilSingleChoiceWizardInputGUI::$showPoints = true
protected

Definition at line 39 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getShowPoints().

◆ $singleline

ilSingleChoiceWizardInputGUI::$singleline = true
protected

Definition at line 36 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getSingleline().

◆ $suffixes

ilSingleChoiceWizardInputGUI::$suffixes = []
protected

Definition at line 38 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getSuffixes().

◆ $upload_limit

UploadLimitResolver ilSingleChoiceWizardInputGUI::$upload_limit
protected

Definition at line 46 of file class.ilSingleChoiceWizardInputGUI.php.

◆ $values

ilSingleChoiceWizardInputGUI::$values = []
protected

Definition at line 34 of file class.ilSingleChoiceWizardInputGUI.php.

Referenced by getValues().


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