ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 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 Attributes

 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
ArrayBasedRequestWrapper $post_wrapper
 
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...
 
- 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)
 

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\MetaData\Repository\Validation\Data\__construct(), 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->post_wrapper = $DIC->http()->wrapper()->post();
62  $this->glyph_factory = $DIC->ui()->factory()->symbol()->glyph();
63  $this->renderer = $DIC->ui()->renderer();
64  $this->upload_limit = $DIC['ui.upload_limit_resolver'];
65  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setMaxLength(?int $a_maxlength)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilSingleChoiceWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $DIC, $filename, $hideImages, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getSingleline(), getSuffixes(), ilFormPropertyGUI\setAlert(), ilArrayUtil\stripSlashesRecursive(), ilLanguage\txt(), and ilVirusScanner\virusHandling().

233  : bool
234  {
235  global $DIC;
236  $lng = $DIC['lng'];
237 
238  if (is_array($_POST[$this->getPostVar()])) {
239  $foundvalues = ilArrayUtil::stripSlashesRecursive(
240  $_POST[$this->getPostVar()],
241  true,
243  );
244  }
245  //$foundvalues = $_POST[$this->getPostVar()];
246  if (is_array($foundvalues)) {
247  // check answers
248  if (is_array($foundvalues['answer'])) {
249  foreach ($foundvalues['answer'] as $aidx => $answervalue) {
250  if (((strlen($answervalue)) == 0) && (!isset($foundvalues['imagename'][$aidx]) || strlen($foundvalues['imagename'][$aidx]) == 0)) {
251  $this->setAlert($lng->txt("msg_input_is_required"));
252  return false;
253  }
254 
255  if (mb_strlen($answervalue) > $this->getMaxLength()) {
256  $this->setAlert($lng->txt("msg_input_char_limit_max"));
257  return false;
258  }
259  }
260  }
261  // check points
262  $max = 0;
263  if (is_array($foundvalues['points'])) {
264  foreach ($foundvalues['points'] as $points) {
265  $points = str_replace(',', '.', $points);
266  if ($points > $max) {
267  $max = $points;
268  }
269  if (((strlen($points)) == 0) || (!is_numeric($points))) {
270  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
271  return false;
272  }
273  }
274  }
275  if ($max == 0) {
276  $this->setAlert($lng->txt("enter_enough_positive_points"));
277  return false;
278  }
279 
280  if (is_array($_FILES) && count($_FILES) && $this->getSingleline() && (!$this->hideImages)) {
281  if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
282  foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
283  // error handling
284  if ($error > 0) {
285  switch ($error) {
286  case UPLOAD_ERR_FORM_SIZE:
287  case UPLOAD_ERR_INI_SIZE:
288  $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
289  return false;
290  break;
291 
292  case UPLOAD_ERR_PARTIAL:
293  $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
294  return false;
295  break;
296 
297  case UPLOAD_ERR_NO_FILE:
298  if ($this->getRequired()) {
299  if ((!isset($foundvalues['imagename'][$index])) && (!strlen($foundvalues['answer'][$index]))) {
300  $this->setAlert($lng->txt("form_msg_file_no_upload"));
301  return false;
302  }
303  }
304  break;
305 
306  case UPLOAD_ERR_NO_TMP_DIR:
307  $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
308  return false;
309  break;
310 
311  case UPLOAD_ERR_CANT_WRITE:
312  $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
313  return false;
314  break;
315 
316  case UPLOAD_ERR_EXTENSION:
317  $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
318  return false;
319  break;
320  }
321  }
322  }
323  } else {
324  if ($this->getRequired()) {
325  $this->setAlert($lng->txt("form_msg_file_no_upload"));
326  return false;
327  }
328  }
329 
330  if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
331  foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
332  $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
333  if ($filename != '') {
334  $filename_arr = pathinfo($filename);
335  $suffix = $filename_arr["extension"];
336  $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
337  $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
338  // check suffixes
339  if (strlen($tmpname) && is_array($this->getSuffixes())) {
340  if (!in_array(strtolower($suffix), $this->getSuffixes())) {
341  $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
342  return false;
343  }
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 (strlen($tmpname)) {
359  $vir = ilVirusScanner::virusHandling($tmpname, $filename);
360  if ($vir[0] == false) {
361  $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
362  return false;
363  }
364  }
365  }
366  }
367  }
368  }
369  } else {
370  $this->setAlert($lng->txt("msg_input_is_required"));
371  return false;
372  }
373 
374  return $this->checkSubItemsInput();
375  }
static stripSlashesRecursive($a_data, bool $a_strip_html=true, string $a_allow="")
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static virusHandling(string $a_file, string $a_orig_name='', bool $a_clean=true)
global $DIC
Definition: feed.php:28
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
$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 214 of file class.ilSingleChoiceWizardInputGUI.php.

References $allowMove.

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

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

◆ getQuestionObject()

ilSingleChoiceWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

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

References $qstObject.

194  : ?object
195  {
196  return $this->qstObject;
197  }

◆ getShowPoints()

ilSingleChoiceWizardInputGUI::getShowPoints ( )

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

References $showPoints.

Referenced by insert().

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

◆ getSingleline()

◆ getSuffixes()

ilSingleChoiceWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

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

References $suffixes.

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

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

◆ getValues()

ilSingleChoiceWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

154  : array
155  {
156  return $this->values;
157  }

◆ insert()

ilSingleChoiceWizardInputGUI::insert ( ilTemplate  $a_tpl)
Parameters
$a_tplilTemplate

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

References $DIC, ilFormPropertyGUI\$lng, 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(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

Referenced by ilKprimChoiceCorrectionsInputGUI\checkInput(), and ilKprimChoiceWizardInputGUI\checkInput().

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

◆ setAllowMove()

ilSingleChoiceWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

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

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

◆ setHideImages()

ilSingleChoiceWizardInputGUI::setHideImages (   $a_hide)

Set hide images.

Parameters
array$a_hideHide images

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

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

◆ 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 221 of file class.ilSingleChoiceWizardInputGUI.php.

221  : void
222  {
227  }

◆ setQuestionObject()

ilSingleChoiceWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

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

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

◆ setShowPoints()

ilSingleChoiceWizardInputGUI::setShowPoints (   $a_value)

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

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

◆ setSingleline()

ilSingleChoiceWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

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

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

◆ setSuffixes()

ilSingleChoiceWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

Referenced by __construct().

104  : void
105  {
106  $this->suffixes = $a_suffixes;
107  }
+ 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.

Referenced by setValueByArray().

67  : void
68  {
69  $this->values = array();
70  if (is_array($a_value)) {
71  if (is_array($a_value['answer'])) {
72  foreach ($a_value['answer'] as $index => $value) {
73  $points = (float) str_replace(",", ".", $a_value['points'][$index]);
74  $answer = new ASS_AnswerBinaryStateImage(
75  (string) $value,
76  $points,
77  (int) $index,
78  true,
79  null,
80  (int) $a_value['answer_id'][$index]
81  );
82  if (isset($a_value['imagename'][$index])) {
83  $answer->setImage($a_value['imagename'][$index]);
84  }
85  $this->values[] = $answer;
86  }
87  }
88  }
89  }
Class for answers with a binary state indicator.
+ Here is the caller graph for this function:

◆ setValueByArray()

ilSingleChoiceWizardInputGUI::setValueByArray ( array  $a_values)

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

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

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

◆ setValues()

ilSingleChoiceWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

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

Field Documentation

◆ $allowMove

ilSingleChoiceWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

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

◆ $post_wrapper

ArrayBasedRequestWrapper ilSingleChoiceWizardInputGUI::$post_wrapper
protected

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

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

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