ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 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 ()
 
 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)
 
- 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
 getTableFilterLabelFor ()
 Get label "for" attribute value. 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
 
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 31 of file class.ilSingleChoiceWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

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

53  {
54  parent::__construct($a_title, $a_postvar);
55  $this->setSuffixes(['jpg', 'jpeg', 'png', 'gif']);
56  $this->setSize('25');
57  $this->setMaxLength(1000);
58  $this->validationRegexp = '';
59 
60  global $DIC;
61  $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
62  $this->renderer = $DIC->ui()->renderer();
63  $this->upload_limit = $DIC['ui.upload_limit_resolver'];
64  $this->forms_helper = new ilTestLegacyFormsHelper();
65  }
renderer()
global $DIC
Definition: shib_login.php:22
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setMaxLength(?int $a_maxlength)
__construct(Container $dic, ilPlugin $plugin)
+ 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 233 of file class.ilSingleChoiceWizardInputGUI.php.

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

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

233  : array|string
234  {
235  $to_string = $this->refinery->kindlyTo()->string();
236  $answers = $this->forms_helper->transformArray($data, 'answer', $to_string);
237  $image_names = $this->forms_helper->transformArray($data, 'imagename', $to_string);
238  foreach ($answers as $index => $value) {
239  if ($value === '' && !$this->forms_helper->inArray($image_names, $index)) {
240  return 'msg_input_is_required';
241  }
242 
243  if (mb_strlen($value) > $this->getMaxLength()) {
244  return 'msg_input_char_limit_max';
245  }
246  }
247 
248  return $answers;
249  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkInput()

ilSingleChoiceWizardInputGUI::checkInput ( )

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

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

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

◆ getAllowMove()

ilSingleChoiceWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

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

References $allowMove.

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

212  : bool
213  {
214  return $this->allowMove;
215  }
+ Here is the caller graph for this function:

◆ getQuestionObject()

ilSingleChoiceWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

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

References $qstObject.

192  : ?object
193  {
194  return $this->qstObject;
195  }

◆ getShowPoints()

ilSingleChoiceWizardInputGUI::getShowPoints ( )

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

References $showPoints.

Referenced by insert().

132  : bool
133  {
134  return $this->showPoints;
135  }
+ Here is the caller graph for this function:

◆ getSingleline()

◆ getSuffixes()

ilSingleChoiceWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

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

References $suffixes.

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

122  : array
123  {
124  return $this->suffixes;
125  }
+ Here is the caller graph for this function:

◆ getValues()

ilSingleChoiceWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

152  : array
153  {
154  return $this->values;
155  }

◆ insert()

ilSingleChoiceWizardInputGUI::insert ( ilTemplate  $a_tpl)

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

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().

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

202  : void
203  {
204  $this->allowMove = $a_allow_move;
205  }

◆ setHideImages()

ilSingleChoiceWizardInputGUI::setHideImages (   $a_hide)

Set hide images.

Parameters
array$a_hideHide images

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

112  : void
113  {
114  $this->hideImages = $a_hide;
115  }

◆ 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!

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

219  : void
220  {
225  }

◆ setQuestionObject()

ilSingleChoiceWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

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

182  : void
183  {
184  $this->qstObject = &$a_value;
185  }

◆ setShowPoints()

ilSingleChoiceWizardInputGUI::setShowPoints (   $a_value)

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

127  : void
128  {
129  $this->showPoints = $a_value;
130  }

◆ setSingleline()

ilSingleChoiceWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

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

162  : void
163  {
164  $this->singleline = $a_value;
165  }

◆ setSuffixes()

ilSingleChoiceWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

Referenced by __construct().

102  : void
103  {
104  $this->suffixes = $a_suffixes;
105  }
+ Here is the caller graph for this function:

◆ setValue()

ilSingleChoiceWizardInputGUI::setValue (   $a_value)

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

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

Referenced by setValueByArray().

67  : void
68  {
69  $this->values = [];
70 
71  $answers = $this->forms_helper->transformArray($a_value, 'answer', $this->refinery->kindlyTo()->string());
72  $points = $this->forms_helper->transformPoints($a_value);
73 
74  foreach ($answers as $index => $value) {
75  $answer = new ASS_AnswerBinaryStateImage(
76  $value,
77  $points[$index] ?? 0.0,
78  (int) $index,
79  true,
80  null,
81  (int) $a_value['answer_id'][$index] ?? 0
82  );
83  if (isset($a_value['imagename'][$index])) {
84  $answer->setImage($a_value['imagename'][$index]);
85  }
86  $this->values[] = $answer;
87  }
88  }
Class for answers with a binary state indicator.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValueByArray()

ilSingleChoiceWizardInputGUI::setValueByArray ( array  $a_values)

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

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

90  : void
91  {
92  if (isset($a_values[$this->getPostVar()])) {
93  $this->setValue($a_values[$this->getPostVar()] ?? []);
94  }
95  }
+ Here is the call graph for this function:

◆ setValues()

ilSingleChoiceWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

142  : void
143  {
144  $this->values = $a_values;
145  }

Field Documentation

◆ $allowMove

ilSingleChoiceWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $forms_helper

ilTestLegacyFormsHelper ilSingleChoiceWizardInputGUI::$forms_helper
protected

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

◆ $glyph_factory

GlyphFactory ilSingleChoiceWizardInputGUI::$glyph_factory
protected

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

◆ $hideImages

ilSingleChoiceWizardInputGUI::$hideImages = false
protected

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

Referenced by checkInput().

◆ $qstObject

ilSingleChoiceWizardInputGUI::$qstObject = null
protected

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

Referenced by getQuestionObject().

◆ $renderer

Renderer ilSingleChoiceWizardInputGUI::$renderer
protected

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

◆ $showPoints

ilSingleChoiceWizardInputGUI::$showPoints = true
protected

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

Referenced by getShowPoints().

◆ $singleline

ilSingleChoiceWizardInputGUI::$singleline = true
protected

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

Referenced by getSingleline().

◆ $suffixes

ilSingleChoiceWizardInputGUI::$suffixes = []
protected

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

Referenced by getSuffixes().

◆ $upload_limit

UploadLimitResolver ilSingleChoiceWizardInputGUI::$upload_limit
protected

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

◆ $values

ilSingleChoiceWizardInputGUI::$values = []
protected

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

Referenced by getValues().


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