ILIAS  release_8 Revision v8.24
ilAssAnswerCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilAssAnswerCorrectionsInputGUI:
+ Collaboration diagram for ilAssAnswerCorrectionsInputGUI:

Public Member Functions

 isHidePointsEnabled ()
 
 setHidePointsEnabled (bool $hidePointsEnabled)
 
 setValue ($a_value)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilAnswerWizardInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 
 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 (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 ()
 Check input, strip slashes etc. More...
 
 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)
 Get item by post var. More...
 
- 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
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. 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 = 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 ilAnswerWizardInputGUI
 getTextInputLabel ($lng)
 
 getPointsInputLabel ($lng)
 
 getTemplate ()
 
- 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

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

Member Function Documentation

◆ checkInput()

ilAssAnswerCorrectionsInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilAnswerWizardInputGUI.

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

61 : bool
62 {
63 global $DIC;
64 $lng = $DIC['lng'];
65 $foundvalues = $_POST[$this->getPostVar()];
66
67 if ($this->isHidePointsEnabled()) {
68 return true;
69 }
70
71 if (is_array($foundvalues)) {
72 // check points
73 $max = 0;
74 if (is_array($foundvalues['points'])) {
75 foreach ($foundvalues['points'] as $points) {
76 $points = str_replace(',', '.', $points);
77 if ($points > $max) {
78 $max = $points;
79 }
80 if (((strlen($points)) == 0) || (!is_numeric($points))) {
81 $this->setAlert($lng->txt("form_msg_numeric_value_required"));
82 return false;
83 }
84 if ($this->minvalueShouldBeGreater()) {
85 if (trim($points) != "" &&
86 $this->getMinValue() !== false &&
87 $points <= $this->getMinValue()) {
88 $this->setAlert($lng->txt("form_msg_value_too_low"));
89
90 return false;
91 }
92 } else {
93 if (trim($points) != "" &&
94 $this->getMinValue() !== false &&
95 $points < $this->getMinValue()) {
96 $this->setAlert($lng->txt("form_msg_value_too_low"));
97
98 return false;
99 }
100 }
101 }
102 }
103 if ($max == 0) {
104 $this->setAlert($lng->txt("enter_enough_positive_points"));
105 return false;
106 }
107 } else {
108 $this->setAlert($lng->txt("msg_input_is_required"));
109 return false;
110 }
111
112 return $this->checkSubItemsInput();
113 }
minvalueShouldBeGreater()
Get minvalueShouldBeGreater.
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...
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

◆ insert()

ilAssAnswerCorrectionsInputGUI::insert ( ilTemplate  $a_tpl)

Reimplemented from ilAnswerWizardInputGUI.

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

115 : void
116 {
117 global $DIC;
118 $lng = $DIC['lng'];
119
120 $tpl = new ilTemplate("tpl.prop_textsubsetcorrection_input.html", true, true, "Modules/TestQuestionPool");
121 $i = 0;
122 foreach ($this->values as $value) {
123 if (!$this->isHidePointsEnabled()) {
124 $tpl->setCurrentBlock("points");
125 $tpl->setVariable("POST_VAR", $this->getPostVar());
126 $tpl->setVariable("ROW_NUMBER", $i);
127 $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
128 $tpl->setVariable("POINTS", ilLegacyFormElementsUtil::prepareFormOutput($value->getPoints()));
129 $tpl->parseCurrentBlock();
130 }
131
132 $tpl->setCurrentBlock("row");
133 $tpl->setVariable("ANSWER", ilLegacyFormElementsUtil::prepareFormOutput($value->getAnswertext()));
134 $tpl->parseCurrentBlock();
135 $i++;
136 }
137
138 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
139 $tpl->setVariable("ANSWER_TEXT", $this->getTextInputLabel($lng));
140
141 if (!$this->isHidePointsEnabled()) {
142 $tpl->setVariable("POINTS_TEXT", $this->getPointsInputLabel($lng));
143 }
144
145 $a_tpl->setCurrentBlock("prop_generic");
146 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
147 $a_tpl->parseCurrentBlock();
148 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(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

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, ilAnswerWizardInputGUI\getPointsInputLabel(), ilFormPropertyGUI\getPostVar(), ilAnswerWizardInputGUI\getTextInputLabel(), isHidePointsEnabled(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ isHidePointsEnabled()

ilAssAnswerCorrectionsInputGUI::isHidePointsEnabled ( )
Returns
bool

Definition at line 37 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 45 of file class.ilAssAnswerCorrectionsInputGUI.php.

45 : void
46 {
47 $this->hidePointsEnabled = $hidePointsEnabled;
48 }

References $hidePointsEnabled.

◆ setValue()

ilAssAnswerCorrectionsInputGUI::setValue (   $a_value)
Parameters
string | array$a_value

Reimplemented from ilAnswerWizardInputGUI.

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

50 : void
51 {
52 if (is_array($a_value)) {
53 if (is_array($a_value['points'])) {
54 foreach ($a_value['points'] as $index => $value) {
55 $this->values[$index]->setPoints($a_value['points'][$index]);
56 }
57 }
58 }
59 }
$index
Definition: metadata.php:145

References $index, and ilTextInputGUI\$value.

Field Documentation

◆ $hidePointsEnabled

ilAssAnswerCorrectionsInputGUI::$hidePointsEnabled = false
protected

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