ILIAS  release_8 Revision v8.23
ilAssErrorTextCorrectionsInputGUI Class Reference
+ Inheritance diagram for ilAssErrorTextCorrectionsInputGUI:
+ Collaboration diagram for ilAssErrorTextCorrectionsInputGUI:

Public Member Functions

 setValue ($a_value)
 
 checkInput ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilErrorTextWizardInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 
 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 (ilTemplate $a_tpl)
 Insert property html. More...
 
- 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...
 

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)
 
- Protected Attributes inherited from ilErrorTextWizardInputGUI
 $values = array()
 
 $key_size = 20
 
 $value_size = 20
 
 $key_maxlength = 255
 
 $value_maxlength = 150
 
 $key_name = ""
 
 $value_name = ""
 
- 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
 

Detailed Description

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

Member Function Documentation

◆ checkInput()

ilAssErrorTextCorrectionsInputGUI::checkInput ( )

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

References ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setAlert().

43  : bool
44  {
45  $foundvalues = $_POST[$this->getPostVar()];
46 
47  if (!isset($foundvalues['points'])
48  || !is_array($foundvalues['points'])) {
49  $this->setAlert($this->lng->txt("msg_input_is_required"));
50  return false;
51  }
52 
53  foreach ($foundvalues['points'] as $val) {
54  if ($this->getRequired() && (strlen($val)) == 0) {
55  $this->setAlert($this->lng->txt("msg_input_is_required"));
56  return false;
57  }
58  if (!is_numeric(str_replace(",", ".", $val))) {
59  $this->setAlert($this->lng->txt("form_msg_numeric_value_required"));
60  return false;
61  }
62  if ((float) $val <= 0) {
63  $this->setAlert($this->lng->txt("positive_numbers_required"));
64  return false;
65  }
66  }
67 
68  return $this->checkSubItemsInput();
69  }
+ Here is the call graph for this function:

◆ insert()

ilAssErrorTextCorrectionsInputGUI::insert ( ilTemplate  $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(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

71  : void
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", ilLegacyFormElementsUtil::prepareFormOutput($value->getPoints()));
81  $tpl->parseCurrentBlock();
82 
83  $tpl->setCurrentBlock("row");
84 
85  $tpl->setVariable("TEXT_WRONG", ilLegacyFormElementsUtil::prepareFormOutput($value->getTextWrong()));
86  $tpl->setVariable("TEXT_CORRECT", ilLegacyFormElementsUtil::prepareFormOutput($value->getTextCorrect()));
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  }
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:514
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:

◆ setValue()

ilAssErrorTextCorrectionsInputGUI::setValue (   $a_value)

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

References ILIAS\LTI\ToolProvider\$key.

29  : void
30  {
31  if (is_array($a_value)) {
32  include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
33  if (is_array($a_value['points'])) {
34  foreach ($this->values as $idx => $key) {
35  $this->values[$idx] = $this->values[$idx]->withPoints(
36  str_replace(",", ".", $a_value['points'][$idx])
37  );
38  }
39  }
40  }
41  }
string $key
Consumer key/client ID value.
Definition: System.php:193

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