ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSingleChoiceWizardInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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
 
- 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
 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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 28 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 45 of file class.ilSingleChoiceWizardInputGUI.php.

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

46  {
47  parent::__construct($a_title, $a_postvar);
48  $this->setSuffixes(['jpg', 'jpeg', 'png', 'gif']);
49  $this->setSize('25');
50  $this->setMaxLength(1000);
51  $this->validationRegexp = '';
52  global $DIC;
53  $this->post_wrapper = $DIC->http()->wrapper()->post();
54  }
global $DIC
Definition: feed.php:28
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

◆ checkInput()

ilSingleChoiceWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $DIC, $filename, $hideImages, $index, 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().

222  : bool
223  {
224  global $DIC;
225  $lng = $DIC['lng'];
226 
227  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
228 
229  if (is_array($_POST[$this->getPostVar()])) {
230  $foundvalues = ilArrayUtil::stripSlashesRecursive(
231  $_POST[$this->getPostVar()],
232  true,
234  );
235  }
236  //$foundvalues = $_POST[$this->getPostVar()];
237  if (is_array($foundvalues)) {
238  // check answers
239  if (is_array($foundvalues['answer'])) {
240  foreach ($foundvalues['answer'] as $aidx => $answervalue) {
241  if (((strlen($answervalue)) == 0) && (!isset($foundvalues['imagename'][$aidx]) || strlen($foundvalues['imagename'][$aidx]) == 0)) {
242  $this->setAlert($lng->txt("msg_input_is_required"));
243  return false;
244  }
245 
246  if (mb_strlen($answervalue) > $this->getMaxLength()) {
247  $this->setAlert($lng->txt("msg_input_char_limit_max"));
248  return false;
249  }
250  }
251  }
252  // check points
253  $max = 0;
254  if (is_array($foundvalues['points'])) {
255  foreach ($foundvalues['points'] as $points) {
256  $points = str_replace(',', '.', $points);
257  if ($points > $max) {
258  $max = $points;
259  }
260  if (((strlen($points)) == 0) || (!is_numeric($points))) {
261  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
262  return false;
263  }
264  }
265  }
266  if ($max == 0) {
267  $this->setAlert($lng->txt("enter_enough_positive_points"));
268  return false;
269  }
270 
271  if (is_array($_FILES) && count($_FILES) && $this->getSingleline() && (!$this->hideImages)) {
272  if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
273  foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
274  // error handling
275  if ($error > 0) {
276  switch ($error) {
277  case UPLOAD_ERR_FORM_SIZE:
278  case UPLOAD_ERR_INI_SIZE:
279  $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
280  return false;
281  break;
282 
283  case UPLOAD_ERR_PARTIAL:
284  $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
285  return false;
286  break;
287 
288  case UPLOAD_ERR_NO_FILE:
289  if ($this->getRequired()) {
290  if ((!isset($foundvalues['imagename'][$index])) && (!strlen($foundvalues['answer'][$index]))) {
291  $this->setAlert($lng->txt("form_msg_file_no_upload"));
292  return false;
293  }
294  }
295  break;
296 
297  case UPLOAD_ERR_NO_TMP_DIR:
298  $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
299  return false;
300  break;
301 
302  case UPLOAD_ERR_CANT_WRITE:
303  $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
304  return false;
305  break;
306 
307  case UPLOAD_ERR_EXTENSION:
308  $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
309  return false;
310  break;
311  }
312  }
313  }
314  } else {
315  if ($this->getRequired()) {
316  $this->setAlert($lng->txt("form_msg_file_no_upload"));
317  return false;
318  }
319  }
320 
321  if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
322  foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
323  $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
324  if ($filename != '') {
325  $filename_arr = pathinfo($filename);
326  $suffix = $filename_arr["extension"];
327  $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
328  $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
329  // check suffixes
330  if (strlen($tmpname) && is_array($this->getSuffixes())) {
331  if (!in_array(strtolower($suffix), $this->getSuffixes())) {
332  $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
333  return false;
334  }
335  }
336  }
337  }
338  }
339 
340  if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
341  foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
342  $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
343  if ($filename != '') {
344  $filename_arr = pathinfo($filename);
345  $suffix = $filename_arr["extension"];
346  $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
347  $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
348  // virus handling
349  if (strlen($tmpname)) {
350  $vir = ilVirusScanner::virusHandling($tmpname, $filename);
351  if ($vir[0] == false) {
352  $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
353  return false;
354  }
355  }
356  }
357  }
358  }
359  }
360  } else {
361  $this->setAlert($lng->txt("msg_input_is_required"));
362  return false;
363  }
364 
365  return $this->checkSubItemsInput();
366  }
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)
$index
Definition: metadata.php:145
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 203 of file class.ilSingleChoiceWizardInputGUI.php.

References $allowMove.

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

203  : bool
204  {
205  return $this->allowMove;
206  }
+ Here is the caller graph for this function:

◆ getQuestionObject()

ilSingleChoiceWizardInputGUI::getQuestionObject ( )

Get question object.

Returns
object Value

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

References $qstObject.

183  : ?object
184  {
185  return $this->qstObject;
186  }

◆ getShowPoints()

ilSingleChoiceWizardInputGUI::getShowPoints ( )

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

References $showPoints.

Referenced by insert().

123  : bool
124  {
125  return $this->showPoints;
126  }
+ Here is the caller graph for this function:

◆ getSingleline()

◆ getSuffixes()

ilSingleChoiceWizardInputGUI::getSuffixes ( )

Get Accepted Suffixes.

Returns
array Accepted Suffixes

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

References $suffixes.

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

113  : array
114  {
115  return $this->suffixes;
116  }
+ Here is the caller graph for this function:

◆ getValues()

ilSingleChoiceWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

143  : array
144  {
145  return $this->values;
146  }

◆ insert()

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

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

References $DIC, $i, ilFormPropertyGUI\$lng, ilTextInputGUI\$suffix, $tpl, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilFileUtils\getFileSizeInfo(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), getShowPoints(), getSingleline(), ilTextInputGUI\getSize(), getSuffixes(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), ilLanguage\txt(), and ilGlyphGUI\UP.

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

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

193  : void
194  {
195  $this->allowMove = $a_allow_move;
196  }

◆ setHideImages()

ilSingleChoiceWizardInputGUI::setHideImages (   $a_hide)

Set hide images.

Parameters
array$a_hideHide images

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

103  : void
104  {
105  $this->hideImages = $a_hide;
106  }

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

210  : void
211  {
216  }

◆ setQuestionObject()

ilSingleChoiceWizardInputGUI::setQuestionObject (   $a_value)

Set question object.

Parameters
object$a_valuetest object

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

173  : void
174  {
175  $this->qstObject = &$a_value;
176  }

◆ setShowPoints()

ilSingleChoiceWizardInputGUI::setShowPoints (   $a_value)

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

118  : void
119  {
120  $this->showPoints = $a_value;
121  }

◆ setSingleline()

ilSingleChoiceWizardInputGUI::setSingleline (   $a_value)

Set singleline.

Parameters
boolean$a_valueValue

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

153  : void
154  {
155  $this->singleline = $a_value;
156  }

◆ setSuffixes()

ilSingleChoiceWizardInputGUI::setSuffixes (   $a_suffixes)

Set Accepted Suffixes.

Parameters
array$a_suffixesAccepted Suffixes

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

Referenced by __construct().

93  : void
94  {
95  $this->suffixes = $a_suffixes;
96  }
+ Here is the caller graph for this function:

◆ setValue()

ilSingleChoiceWizardInputGUI::setValue (   $a_value)

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

References $index, and ilTextInputGUI\$value.

Referenced by setValueByArray().

56  : void
57  {
58  $this->values = array();
59  if (is_array($a_value)) {
60  if (is_array($a_value['answer'])) {
61  foreach ($a_value['answer'] as $index => $value) {
62  $points = (float) str_replace(",", ".", $a_value['points'][$index]);
63  $answer = new ASS_AnswerBinaryStateImage(
64  (string) $value,
65  $points,
66  (int) $index,
67  1,
68  "",
69  (int) $a_value['answer_id'][$index]
70  );
71  if (isset($a_value['imagename'][$index])) {
72  $answer->setImage($a_value['imagename'][$index]);
73  }
74  $this->values[] = $answer;
75  }
76  }
77  }
78  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$index
Definition: metadata.php:145
+ Here is the caller graph for this function:

◆ setValueByArray()

ilSingleChoiceWizardInputGUI::setValueByArray ( array  $a_values)

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

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

81  : void
82  {
83  if (isset($a_values[$this->getPostVar()])) {
84  $this->setValue($a_values[$this->getPostVar()] ?? []);
85  }
86  }
+ Here is the call graph for this function:

◆ setValues()

ilSingleChoiceWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

133  : void
134  {
135  $this->values = $a_values;
136  }

Field Documentation

◆ $allowMove

ilSingleChoiceWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $hideImages

ilSingleChoiceWizardInputGUI::$hideImages = false
protected

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

Referenced by checkInput().

◆ $post_wrapper

ArrayBasedRequestWrapper ilSingleChoiceWizardInputGUI::$post_wrapper
protected

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

◆ $qstObject

ilSingleChoiceWizardInputGUI::$qstObject = null
protected

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

Referenced by getQuestionObject().

◆ $showPoints

ilSingleChoiceWizardInputGUI::$showPoints = true
protected

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

Referenced by getShowPoints().

◆ $singleline

ilSingleChoiceWizardInputGUI::$singleline = true
protected

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

Referenced by getSingleline().

◆ $suffixes

ilSingleChoiceWizardInputGUI::$suffixes = []
protected

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

Referenced by getSuffixes().

◆ $values

ilSingleChoiceWizardInputGUI::$values = []
protected

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