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

Public Member Functions

 setValue ($a_value)
 
 checkInput ()
 
 insert ($a_tpl)
 
- Public Member Functions inherited from ilErrorTextWizardInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 setKeySize ($a_size)
 Set key size. More...
 
 getKeySize ()
 Get key size. More...
 
 setValueSize ($a_size)
 Set value size. More...
 
 getValueSize ()
 Get value size. More...
 
 setKeyMaxlength ($a_maxlength)
 Set key maxlength. More...
 
 getKeyMaxlength ()
 Get key maxlength. More...
 
 setValueMaxlength ($a_maxlength)
 Set value maxlength. More...
 
 getValueMaxlength ()
 Get value maxlength. More...
 
 setValueName ($a_name)
 Set value name. More...
 
 getValueName ()
 Get value name. More...
 
 setKeyName ($a_name)
 Set key name. More...
 
 getKeyName ()
 Get key name. More...
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setDataSourceSubmitOnSelection ($a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl ($a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($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...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 
- Protected Attributes inherited from ilErrorTextWizardInputGUI
 $values = array()
 
 $key_size = 20
 
 $value_size = 20
 
 $key_maxlength = 255
 
 $value_maxlength = 255
 
 $key_name = ""
 
 $value_name = ""
 
- Protected Attributes inherited from ilTextInputGUI
 $value
 
 $maxlength = 200
 
 $size = 40
 
 $validationRegexp
 
 $validationFailureMessage = ''
 
 $suffix
 
 $style_css
 
 $css_class
 
 $ajax_datasource
 
 $ajax_datasource_delimiter
 
 $ajax_datasource_commit = false
 
 $ajax_datasource_commit_url
 
 $submit_form_on_enter = false
 
 $autocomplete_disabled = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Detailed Description

Definition at line 13 of file class.ilAssErrorTextCorrectionsInputGUI.php.

Member Function Documentation

◆ checkInput()

ilAssErrorTextCorrectionsInputGUI::checkInput ( )

Definition at line 29 of file class.ilAssErrorTextCorrectionsInputGUI.php.

References $_POST, $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashesRecursive().

30  {
31  global $DIC;
32  $lng = $DIC['lng'];
33 
34  if (is_array($_POST[$this->getPostVar()])) {
36  }
37  $foundvalues = $_POST[$this->getPostVar()];
38 
39  if (is_array($foundvalues)) {
40  if (is_array($foundvalues['points'])) {
41  foreach ($foundvalues['points'] as $val) {
42  if ($this->getRequired() && (strlen($val)) == 0) {
43  $this->setAlert($lng->txt("msg_input_is_required"));
44  return false;
45  }
46  if (!is_numeric(str_replace(",", ".", $val))) {
47  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
48  return false;
49  }
50  if ((float) $val <= 0) {
51  $this->setAlert($lng->txt("positive_numbers_required"));
52  return false;
53  }
54  }
55  } else {
56  if ($this->getRequired()) {
57  $this->setAlert($lng->txt("msg_input_is_required"));
58  return false;
59  }
60  }
61  } else {
62  if ($this->getRequired()) {
63  $this->setAlert($lng->txt("msg_input_is_required"));
64  return false;
65  }
66  }
67 
68  return $this->checkSubItemsInput();
69  }
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
$_POST["username"]
+ Here is the call graph for this function:

◆ insert()

ilAssErrorTextCorrectionsInputGUI::insert (   $a_tpl)

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

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, ilErrorTextWizardInputGUI\getKeyMaxlength(), ilErrorTextWizardInputGUI\getKeyName(), ilErrorTextWizardInputGUI\getKeySize(), ilFormPropertyGUI\getPostVar(), ilErrorTextWizardInputGUI\getValueMaxlength(), ilErrorTextWizardInputGUI\getValueName(), ilErrorTextWizardInputGUI\getValueSize(), and ilUtil\prepareFormOutput().

72  {
73  global $DIC;
74  $lng = $DIC['lng'];
75 
76  $tpl = new ilTemplate("tpl.prop_errortextcorrection_input.html", true, true, "Modules/TestQuestionPool");
77  $i = 0;
78  foreach ($this->values as $value) {
79  $tpl->setCurrentBlock("prop_points_propval");
80  $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->points));
81  $tpl->parseCurrentBlock();
82 
83  $tpl->setCurrentBlock("row");
84 
85  $tpl->setVariable("TEXT_WRONG", ilUtil::prepareFormOutput($value->text_wrong));
86  $tpl->setVariable("TEXT_CORRECT", ilUtil::prepareFormOutput($value->text_correct));
87 
88  $class = ($i % 2 == 0) ? "even" : "odd";
89  if ($i == 0) {
90  $class .= " first";
91  }
92  if ($i == count($this->values) - 1) {
93  $class .= " last";
94  }
95  $tpl->setVariable("ROW_CLASS", $class);
96  $tpl->setVariable("ROW_NUMBER", $i);
97 
98  $tpl->setVariable("KEY_SIZE", $this->getKeySize());
99  $tpl->setVariable("KEY_ID", $this->getPostVar() . "[key][$i]");
100  $tpl->setVariable("KEY_MAXLENGTH", $this->getKeyMaxlength());
101 
102  $tpl->setVariable("VALUE_SIZE", $this->getValueSize());
103  $tpl->setVariable("VALUE_ID", $this->getPostVar() . "[value][$i]");
104  $tpl->setVariable("VALUE_MAXLENGTH", $this->getValueMaxlength());
105 
106  $tpl->setVariable("POST_VAR", $this->getPostVar());
107 
108  $tpl->parseCurrentBlock();
109 
110  $i++;
111  }
112  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
113  $tpl->setVariable("KEY_TEXT", $this->getKeyName());
114  $tpl->setVariable("VALUE_TEXT", $this->getValueName());
115  $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
116 
117  $a_tpl->setCurrentBlock("prop_generic");
118  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
119  $a_tpl->parseCurrentBlock();
120  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ setValue()

ilAssErrorTextCorrectionsInputGUI::setValue (   $a_value)

Definition at line 15 of file class.ilAssErrorTextCorrectionsInputGUI.php.

References $key.

16  {
17  if (is_array($a_value)) {
18  include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
19  if (is_array($a_value['points'])) {
20  foreach ($this->values as $idx => $key) {
21  $this->values[$idx]->points = (
22  str_replace(",", ".", $a_value['points'][$idx])
23  );
24  }
25  }
26  }
27  }
$key
Definition: croninfo.php:18

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