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

Public Member Functions

 isHidePointsEnabled ()
 
 setHidePointsEnabled (bool $hidePointsEnabled)
 
 setValue ($a_value)
 
 checkInput ()
 
 insert ($a_tpl)
 
- Public Member Functions inherited from ilAnswerWizardInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 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...
 
 isAddRemoveAllowed ()
 
 setAllowAddRemove ($allowAddRemove)
 
 setMinvalueShouldBeGreater ($a_bool)
 Set minvalueShouldBeGreater. More...
 
 minvalueShouldBeGreater ()
 Get minvalueShouldBeGreater. More...
 
 setMinValue ($a_minvalue)
 Set Minimum Value. More...
 
 getMinValue ()
 Get Minimum Value. 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...
 

Protected Attributes

 $hidePointsEnabled = false
 
- Protected Attributes inherited from ilAnswerWizardInputGUI
 $values = array()
 
 $allowMove = false
 
 $allowAddRemove = true
 
 $singleline = true
 
 $qstObject = null
 
 $minvalue = false
 
 $minvalueShouldBeGreater = false
 
- 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
 

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 ilAnswerWizardInputGUI
 getTextInputLabel ($lng)
 
 getPointsInputLabel ($lng)
 
 getTemplate ()
 
 sanitizeSuperGlobalSubmitValue ()
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

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

Member Function Documentation

◆ checkInput()

ilAssAnswerCorrectionsInputGUI::checkInput ( )

Definition at line 47 of file class.ilAssAnswerCorrectionsInputGUI.php.

References $_POST, $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilAnswerWizardInputGUI\getMinValue(), ilFormPropertyGUI\getPostVar(), isHidePointsEnabled(), ilAnswerWizardInputGUI\minvalueShouldBeGreater(), ilAnswerWizardInputGUI\sanitizeSuperGlobalSubmitValue(), and ilFormPropertyGUI\setAlert().

48  {
49  global $DIC;
50  $lng = $DIC['lng'];
52  $foundvalues = $_POST[$this->getPostVar()];
53 
54  if ($this->isHidePointsEnabled()) {
55  return true;
56  }
57 
58  if (is_array($foundvalues)) {
59  // check points
60  $max = 0;
61  if (is_array($foundvalues['points'])) {
62  foreach ($foundvalues['points'] as $points) {
63  if ($points > $max) {
64  $max = $points;
65  }
66  if (((strlen($points)) == 0) || (!is_numeric($points))) {
67  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
68  return false;
69  }
70  if ($this->minvalueShouldBeGreater()) {
71  if (trim($points) != "" &&
72  $this->getMinValue() !== false &&
73  $points <= $this->getMinValue()) {
74  $this->setAlert($lng->txt("form_msg_value_too_low"));
75 
76  return false;
77  }
78  } else {
79  if (trim($points) != "" &&
80  $this->getMinValue() !== false &&
81  $points < $this->getMinValue()) {
82  $this->setAlert($lng->txt("form_msg_value_too_low"));
83 
84  return false;
85  }
86  }
87  }
88  }
89  if ($max == 0) {
90  $this->setAlert($lng->txt("enter_enough_positive_points"));
91  return false;
92  }
93  } else {
94  $this->setAlert($lng->txt("msg_input_is_required"));
95  return false;
96  }
97 
98  return $this->checkSubItemsInput();
99  }
global $DIC
Definition: saml.php:7
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
$_POST["username"]
+ Here is the call graph for this function:

◆ insert()

ilAssAnswerCorrectionsInputGUI::insert (   $a_tpl)

Definition at line 101 of file class.ilAssAnswerCorrectionsInputGUI.php.

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, ilAnswerWizardInputGUI\getPointsInputLabel(), ilFormPropertyGUI\getPostVar(), ilAnswerWizardInputGUI\getTextInputLabel(), isHidePointsEnabled(), and ilUtil\prepareFormOutput().

102  {
103  global $DIC;
104  $lng = $DIC['lng'];
105 
106  $tpl = new ilTemplate("tpl.prop_textsubsetcorrection_input.html", true, true, "Modules/TestQuestionPool");
107  $i = 0;
108  foreach ($this->values as $value) {
109  if (!$this->isHidePointsEnabled()) {
110  $tpl->setCurrentBlock("points");
111  $tpl->setVariable("POST_VAR", $this->getPostVar());
112  $tpl->setVariable("ROW_NUMBER", $i);
113  $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
114  $tpl->setVariable("POINTS", ilUtil::prepareFormOutput($value->getPoints()));
115  $tpl->parseCurrentBlock();
116  }
117 
118  $tpl->setCurrentBlock("row");
119  $tpl->setVariable("ANSWER", ilUtil::prepareFormOutput($value->getAnswertext()));
120  $tpl->parseCurrentBlock();
121  $i++;
122  }
123 
124  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
125  $tpl->setVariable("ANSWER_TEXT", $this->getTextInputLabel($lng));
126 
127  if (!$this->isHidePointsEnabled()) {
128  $tpl->setVariable("POINTS_TEXT", $this->getPointsInputLabel($lng));
129  }
130 
131  $a_tpl->setCurrentBlock("prop_generic");
132  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
133  $a_tpl->parseCurrentBlock();
134  }
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:

◆ isHidePointsEnabled()

ilAssAnswerCorrectionsInputGUI::isHidePointsEnabled ( )
Returns
bool

Definition at line 23 of file class.ilAssAnswerCorrectionsInputGUI.php.

References $hidePointsEnabled.

Referenced by checkInput(), and insert().

+ Here is the caller graph for this function:

◆ setHidePointsEnabled()

ilAssAnswerCorrectionsInputGUI::setHidePointsEnabled ( bool  $hidePointsEnabled)
Parameters
bool$hidePointsEnabled

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

References $hidePointsEnabled.

32  {
33  $this->hidePointsEnabled = $hidePointsEnabled;
34  }

◆ setValue()

ilAssAnswerCorrectionsInputGUI::setValue (   $a_value)

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

References $index, and ilTextInputGUI\$value.

37  {
38  if (is_array($a_value)) {
39  if (is_array($a_value['points'])) {
40  foreach ($a_value['points'] as $index => $value) {
41  $this->values[$index]->setPoints($a_value['points'][$index]);
42  }
43  }
44  }
45  }
$index
Definition: metadata.php:60

Field Documentation

◆ $hidePointsEnabled

ilAssAnswerCorrectionsInputGUI::$hidePointsEnabled = false
protected

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