ILIAS  release_8 Revision v8.24
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 ()
 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

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

43 {
44 parent::__construct($a_title, $a_postvar);
45 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ 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

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssErrorTextCorrectionsInputGUI.

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

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

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

+ Here is the call graph for this function:

◆ getKeyMaxlength()

ilErrorTextWizardInputGUI::getKeyMaxlength ( )

Get key maxlength.

Returns
integer Key maxlength

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

References $key_maxlength.

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

+ Here is the caller graph for this function:

◆ getKeyName()

ilErrorTextWizardInputGUI::getKeyName ( )

Get key name.

Returns
string value name

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

175 : string
176 {
177 return $this->key_name;
178 }

References $key_name.

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

+ Here is the caller graph for this function:

◆ getKeySize()

ilErrorTextWizardInputGUI::getKeySize ( )

Get key size.

Returns
integer Key size

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

References $key_size.

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

+ Here is the caller graph for this function:

◆ getValueMaxlength()

ilErrorTextWizardInputGUI::getValueMaxlength ( )

Get value maxlength.

Returns
integer value maxlength

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

References $value_maxlength.

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

+ Here is the caller graph for this function:

◆ getValueName()

ilErrorTextWizardInputGUI::getValueName ( )

Get value name.

Returns
string value name

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

155 : string
156 {
157 return $this->value_name;
158 }

References $value_name.

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

+ Here is the caller graph for this function:

◆ getValues()

ilErrorTextWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

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

References $values.

◆ getValueSize()

ilErrorTextWizardInputGUI::getValueSize ( )

Get value size.

Returns
integer value size

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

References $value_size.

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

+ Here is the caller graph for this function:

◆ insert()

ilErrorTextWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssErrorTextCorrectionsInputGUI.

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

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

+ Here is the call graph for this function:

◆ setKeyMaxlength()

ilErrorTextWizardInputGUI::setKeyMaxlength (   $a_maxlength)

Set key maxlength.

Parameters
integer$a_sizeKey maxlength

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

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

◆ setKeyName()

ilErrorTextWizardInputGUI::setKeyName (   $a_name)

Set key name.

Parameters
string$a_namevalue name

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

165 : void
166 {
167 $this->key_name = $a_name;
168 }

◆ setKeySize()

ilErrorTextWizardInputGUI::setKeySize (   $a_size)

Set key size.

Parameters
integer$a_sizeKey size

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

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

◆ setValue()

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

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssErrorTextCorrectionsInputGUI.

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

47 : void
48 {
49 $this->values = array();
50 if (is_array($a_value)) {
51 include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
52 if (is_array($a_value['key'])) {
53 foreach ($a_value['key'] as $idx => $key) {
54 $this->values[] = new assAnswerErrorText($key, $a_value['value'][$idx], (float) str_replace(",", ".", $a_value['points'][$idx]));
55 }
56 }
57 }
58 }
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

References ILIAS\LTI\ToolProvider\$key.

◆ setValueMaxlength()

ilErrorTextWizardInputGUI::setValueMaxlength (   $a_maxlength)

Set value maxlength.

Parameters
integer$a_sizevalue maxlength

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

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

◆ setValueName()

ilErrorTextWizardInputGUI::setValueName (   $a_name)

Set value name.

Parameters
string$a_namevalue name

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

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

◆ setValues()

ilErrorTextWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

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

◆ setValueSize()

ilErrorTextWizardInputGUI::setValueSize (   $a_size)

Set value size.

Parameters
integer$a_sizevalue size

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

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

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: