ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilErrorTextWizardInputGUI 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 ilErrorTextWizardInputGUI:
+ Collaboration diagram for ilErrorTextWizardInputGUI:

Public Member Functions

 __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...
 

Protected Attributes

 $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
 

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
 symbol ()
 
 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 key value pair 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 26 of file class.ilErrorTextWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilErrorTextWizardInputGUI::__construct (   $a_title = "",
  $a_postvar = "" 
)

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 42 of file class.ilErrorTextWizardInputGUI.php.

References ILIAS\MetaData\Repository\Validation\Data\__construct().

43  {
44  parent::__construct($a_title, $a_postvar);
45  }
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilErrorTextWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 203 of file class.ilErrorTextWizardInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilArrayUtil\stripSlashesRecursive(), and ilLanguage\txt().

203  : bool
204  {
205  global $DIC;
206  $lng = $DIC['lng'];
207 
208  if (isset($_POST[$this->getPostVar()]) && is_array($_POST[$this->getPostVar()])) {
209  $foundvalues = ilArrayUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
210  } else {
211  $foundvalues = $_POST[$this->getPostVar()] ?? null;
212  }
213  $max_points = 0;
214 
215  if (is_array($foundvalues) && count($foundvalues) > 0) {
216  // check answers
217  if (is_array($foundvalues['key']) && is_array($foundvalues['value'])) {
218  foreach ($foundvalues['key'] as $val) {
219  if ($this->getRequired() && (strlen($val)) == 0) {
220  $this->setAlert($lng->txt("msg_input_is_required"));
221  return false;
222  }
223  }
224  foreach ($foundvalues['value'] as $val) {
225  if ($this->getRequired() && (strlen($val)) == 0) {
226  $this->setAlert($lng->txt("msg_input_is_required"));
227  return false;
228  }
229  }
230  foreach ($foundvalues['points'] as $val) {
231  $val_num = str_replace(",", ".", $val);
232  if ($this->getRequired() && (strlen($val)) == 0) {
233  $this->setAlert($lng->txt("msg_input_is_required"));
234  return false;
235  }
236  if (!is_numeric($val_num)) {
237  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
238  return false;
239  }
240  if ($val_num <= 0) {
241  $this->setAlert($lng->txt("positive_numbers_required"));
242  return false;
243  }
244  }
245  } else {
246  if ($this->getRequired()) {
247  $this->setAlert($lng->txt("msg_input_is_required"));
248  return false;
249  }
250  }
251  } else {
252  $this->setAlert($lng->txt('errortext_info'));
253  return false;
254  }
255 
256  return $this->checkSubItemsInput();
257  }
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...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ getKeyMaxlength()

ilErrorTextWizardInputGUI::getKeyMaxlength ( )

Get key maxlength.

Returns
integer Key maxlength

Definition at line 114 of file class.ilErrorTextWizardInputGUI.php.

References $key_maxlength.

Referenced by ilAssErrorTextCorrectionsInputGUI\insert(), and insert().

114  : int
115  {
116  return $this->key_maxlength;
117  }
+ Here is the caller graph for this function:

◆ getKeyName()

ilErrorTextWizardInputGUI::getKeyName ( )

Get key name.

Returns
string value name

Definition at line 174 of file class.ilErrorTextWizardInputGUI.php.

References $key_name.

Referenced by ilAssErrorTextCorrectionsInputGUI\insert(), and insert().

174  : string
175  {
176  return $this->key_name;
177  }
+ Here is the caller graph for this function:

◆ getKeySize()

ilErrorTextWizardInputGUI::getKeySize ( )

Get key size.

Returns
integer Key size

Definition at line 74 of file class.ilErrorTextWizardInputGUI.php.

References $key_size.

Referenced by ilAssErrorTextCorrectionsInputGUI\insert(), and insert().

74  : int
75  {
76  return $this->key_size;
77  }
+ Here is the caller graph for this function:

◆ getValueMaxlength()

ilErrorTextWizardInputGUI::getValueMaxlength ( )

Get value maxlength.

Returns
integer value maxlength

Definition at line 134 of file class.ilErrorTextWizardInputGUI.php.

References $value_maxlength.

Referenced by ilAssErrorTextCorrectionsInputGUI\insert(), and insert().

134  : int
135  {
136  return $this->value_maxlength;
137  }
+ Here is the caller graph for this function:

◆ getValueName()

ilErrorTextWizardInputGUI::getValueName ( )

Get value name.

Returns
string value name

Definition at line 154 of file class.ilErrorTextWizardInputGUI.php.

References $value_name.

Referenced by ilAssErrorTextCorrectionsInputGUI\insert(), and insert().

154  : string
155  {
156  return $this->value_name;
157  }
+ Here is the caller graph for this function:

◆ getValues()

ilErrorTextWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

Definition at line 194 of file class.ilErrorTextWizardInputGUI.php.

References $values.

194  : array
195  {
196  return $this->values;
197  }

◆ getValueSize()

ilErrorTextWizardInputGUI::getValueSize ( )

Get value size.

Returns
integer value size

Definition at line 94 of file class.ilErrorTextWizardInputGUI.php.

References $value_size.

Referenced by ilAssErrorTextCorrectionsInputGUI\insert(), and insert().

94  : int
95  {
96  return $this->value_size;
97  }
+ Here is the caller graph for this function:

◆ insert()

ilErrorTextWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Definition at line 263 of file class.ilErrorTextWizardInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ilTextInputGUI\$value, getKeyMaxlength(), getKeyName(), getKeySize(), ilFormPropertyGUI\getPostVar(), getValueMaxlength(), getValueName(), getValueSize(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

263  : void
264  {
265  global $DIC;
266  $lng = $DIC['lng'];
267 
268  $tpl = new ilTemplate("tpl.prop_errortextwizardinput.html", true, true, "Modules/TestQuestionPool");
269  $i = 0;
270  foreach ($this->values as $value) {
271  if (is_object($value)) {
272  if (strlen($value->getTextWrong())) {
273  $tpl->setCurrentBlock("prop_key_propval");
274  $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value->getTextWrong()));
275  $tpl->parseCurrentBlock();
276  }
277  if (strlen($value->getTextCorrect())) {
278  $tpl->setCurrentBlock("prop_value_propval");
279  $tpl->setVariable(
280  "PROPERTY_VALUE",
281  ilLegacyFormElementsUtil::prepareFormOutput($value->getTextCorrect())
282  );
283  $tpl->parseCurrentBlock();
284  }
285  if (strlen($value->getPoints())) {
286  $tpl->setCurrentBlock("prop_points_propval");
287  $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value->getPoints()));
288  $tpl->parseCurrentBlock();
289  }
290  }
291 
292  $tpl->setCurrentBlock("row");
293  $class = ($i % 2 == 0) ? "even" : "odd";
294  if ($i == 0) {
295  $class .= " first";
296  }
297  if ($i == count($this->values) - 1) {
298  $class .= " last";
299  }
300  $tpl->setVariable("ROW_CLASS", $class);
301  $tpl->setVariable("ROW_NUMBER", $i);
302 
303  $tpl->setVariable("KEY_SIZE", $this->getKeySize());
304  $tpl->setVariable("KEY_ID", $this->getPostVar() . "[key][$i]");
305  $tpl->setVariable("KEY_MAXLENGTH", $this->getKeyMaxlength());
306 
307  $tpl->setVariable("VALUE_SIZE", $this->getValueSize());
308  $tpl->setVariable("VALUE_ID", $this->getPostVar() . "[value][$i]");
309  $tpl->setVariable("VALUE_MAXLENGTH", $this->getValueMaxlength());
310 
311  $tpl->setVariable("POST_VAR", $this->getPostVar());
312 
313  $tpl->parseCurrentBlock();
314 
315  $i++;
316  }
317  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
318  $tpl->setVariable("KEY_TEXT", $this->getKeyName());
319  $tpl->setVariable("VALUE_TEXT", $this->getValueName());
320  $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
321 
322  $a_tpl->setCurrentBlock("prop_generic");
323  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
324  $a_tpl->parseCurrentBlock();
325  }
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:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setKeyMaxlength()

ilErrorTextWizardInputGUI::setKeyMaxlength (   $a_maxlength)

Set key maxlength.

Parameters
integer$a_sizeKey maxlength

Definition at line 104 of file class.ilErrorTextWizardInputGUI.php.

104  : void
105  {
106  $this->key_maxlength = $a_maxlength;
107  }

◆ setKeyName()

ilErrorTextWizardInputGUI::setKeyName (   $a_name)

Set key name.

Parameters
string$a_namevalue name

Definition at line 164 of file class.ilErrorTextWizardInputGUI.php.

Referenced by assErrorTextGUI\populateAnswerSpecificFormPart(), and assErrorTextGUI\populateCorrectionsFormProperties().

164  : void
165  {
166  $this->key_name = $a_name;
167  }
+ Here is the caller graph for this function:

◆ setKeySize()

ilErrorTextWizardInputGUI::setKeySize (   $a_size)

Set key size.

Parameters
integer$a_sizeKey size

Definition at line 64 of file class.ilErrorTextWizardInputGUI.php.

64  : void
65  {
66  $this->key_size = $a_size;
67  }

◆ setValue()

ilErrorTextWizardInputGUI::setValue (   $a_value)

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

References ILIAS\LTI\ToolProvider\$key.

47  : void
48  {
49  $this->values = array();
50  if (is_array($a_value)) {
51  if (is_array($a_value['key'])) {
52  foreach ($a_value['key'] as $idx => $key) {
53  $this->values[] = new assAnswerErrorText($key, $a_value['value'][$idx], (float) str_replace(",", ".", $a_value['points'][$idx]));
54  }
55  }
56  }
57  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ setValueMaxlength()

ilErrorTextWizardInputGUI::setValueMaxlength (   $a_maxlength)

Set value maxlength.

Parameters
integer$a_sizevalue maxlength

Definition at line 124 of file class.ilErrorTextWizardInputGUI.php.

124  : void
125  {
126  $this->value_maxlength = $a_maxlength;
127  }

◆ setValueName()

ilErrorTextWizardInputGUI::setValueName (   $a_name)

Set value name.

Parameters
string$a_namevalue name

Definition at line 144 of file class.ilErrorTextWizardInputGUI.php.

144  : void
145  {
146  $this->value_name = $a_name;
147  }

◆ setValues()

ilErrorTextWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 184 of file class.ilErrorTextWizardInputGUI.php.

184  : void
185  {
186  $this->values = $a_values;
187  }

◆ setValueSize()

ilErrorTextWizardInputGUI::setValueSize (   $a_size)

Set value size.

Parameters
integer$a_sizevalue size

Definition at line 84 of file class.ilErrorTextWizardInputGUI.php.

84  : void
85  {
86  $this->value_size = $a_size;
87  }

Field Documentation

◆ $key_maxlength

ilErrorTextWizardInputGUI::$key_maxlength = 255
protected

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

Referenced by getKeyMaxlength().

◆ $key_name

ilErrorTextWizardInputGUI::$key_name = ""
protected

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

Referenced by getKeyName().

◆ $key_size

ilErrorTextWizardInputGUI::$key_size = 20
protected

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

Referenced by getKeySize().

◆ $value_maxlength

ilErrorTextWizardInputGUI::$value_maxlength = 150
protected

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

Referenced by getValueMaxlength().

◆ $value_name

ilErrorTextWizardInputGUI::$value_name = ""
protected

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

Referenced by getValueName().

◆ $value_size

ilErrorTextWizardInputGUI::$value_size = 20
protected

Definition at line 30 of file class.ilErrorTextWizardInputGUI.php.

Referenced by getValueSize().

◆ $values

ilErrorTextWizardInputGUI::$values = array()
protected

Definition at line 28 of file class.ilErrorTextWizardInputGUI.php.

Referenced by getValues().


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