ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilErrorTextWizardInputGUI Class Reference

This class represents a key value pair wizard property in a property form. 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 = []
 
 $key_size = 20
 
 $value_size = 20
 
 $key_maxlength = 255
 
 $value_maxlength = 150
 
 $key_name = ""
 
 $value_name = ""
 
ilTestLegacyFormsHelper $forms_helper
 
- 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 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 29 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 47 of file class.ilErrorTextWizardInputGUI.php.

48 {
49 parent::__construct($a_title, $a_postvar);
50 $this->forms_helper = new ilTestLegacyFormsHelper();
51 }
__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 212 of file class.ilErrorTextWizardInputGUI.php.

212 : bool
213 {
214 $kindlyTo = $this->refinery->kindlyTo();
215 $data = $this->raw($this->getPostVar());
216
217 if (!is_array($data)) {
218 $this->setAlert($this->lng->txt('errortext_info'));
219 return false;
220 }
221
222 // check points
223 $points = $this->forms_helper->checkPointsInput($data, $this->getRequired());
224 if (!is_array($points)) {
225 $this->setAlert($this->lng->txt($points));
226 return false;
227 }
228 foreach ($points as $point) {
229 if ($point <= 0) {
230 $this->setAlert($this->lng->txt('positive_numbers_required'));
231 return false;
232 }
233 }
234
235 // check answers
236 $keys = $this->forms_helper->transformArray($data, 'key', $kindlyTo->string());
237 $values = $this->forms_helper->transformArray($data, 'value', $kindlyTo->string());
238 if (empty($keys) || empty($values)) {
239 $this->setAlert($this->lng->txt('msg_input_is_required'));
240 return false;
241 }
242 foreach ([$keys, $values] as $array) {
243 foreach ($array as $item) {
244 if ($item === '' && $this->getRequired()) {
245 $this->setAlert($this->lng->txt('msg_input_is_required'));
246 return false;
247 }
248 }
249 }
250
251 return $this->checkSubItemsInput();
252 }

References $data, $values, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ILIAS\Repository\lng(), ilFormPropertyGUI\raw(), ILIAS\Repository\refinery(), and ilFormPropertyGUI\setAlert().

+ Here is the call graph for this function:

◆ getKeyMaxlength()

ilErrorTextWizardInputGUI::getKeyMaxlength ( )

Get key maxlength.

Returns
integer Key maxlength

Definition at line 123 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 183 of file class.ilErrorTextWizardInputGUI.php.

183 : string
184 {
185 return $this->key_name;
186 }

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 83 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 143 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 163 of file class.ilErrorTextWizardInputGUI.php.

163 : string
164 {
165 return $this->value_name;
166 }

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 203 of file class.ilErrorTextWizardInputGUI.php.

203 : array
204 {
205 return $this->values;
206 }

References $values.

◆ getValueSize()

ilErrorTextWizardInputGUI::getValueSize ( )

Get value size.

Returns
integer value size

Definition at line 103 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 258 of file class.ilErrorTextWizardInputGUI.php.

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

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().

+ Here is the call graph for this function:

◆ setKeyMaxlength()

ilErrorTextWizardInputGUI::setKeyMaxlength (   $a_maxlength)

Set key maxlength.

Parameters
integer$a_sizeKey maxlength

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

113 : void
114 {
115 $this->key_maxlength = $a_maxlength;
116 }

◆ setKeyName()

ilErrorTextWizardInputGUI::setKeyName (   $a_name)

Set key name.

Parameters
string$a_namevalue name

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

173 : void
174 {
175 $this->key_name = $a_name;
176 }

◆ setKeySize()

ilErrorTextWizardInputGUI::setKeySize (   $a_size)

Set key size.

Parameters
integer$a_sizeKey size

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

73 : void
74 {
75 $this->key_size = $a_size;
76 }

◆ setValue()

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

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssErrorTextCorrectionsInputGUI.

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

53 : void
54 {
55 $keys = $this->forms_helper->transformArray($a_value, 'key', $this->refinery->kindlyTo()->string());
56 $points = $this->forms_helper->transformPoints($a_value);
57
58 $this->values = [];
59 foreach ($keys as $index => $key) {
60 $this->values[] = new assAnswerErrorText(
61 $key,
62 $a_value['value'][$index] ?? '',
63 $points[$index] ?? 0.0
64 );
65 }
66 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ setValueMaxlength()

ilErrorTextWizardInputGUI::setValueMaxlength (   $a_maxlength)

Set value maxlength.

Parameters
integer$a_sizevalue maxlength

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

133 : void
134 {
135 $this->value_maxlength = $a_maxlength;
136 }

◆ setValueName()

ilErrorTextWizardInputGUI::setValueName (   $a_name)

Set value name.

Parameters
string$a_namevalue name

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

153 : void
154 {
155 $this->value_name = $a_name;
156 }

◆ setValues()

ilErrorTextWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

193 : void
194 {
195 $this->values = $a_values;
196 }

◆ setValueSize()

ilErrorTextWizardInputGUI::setValueSize (   $a_size)

Set value size.

Parameters
integer$a_sizevalue size

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

93 : void
94 {
95 $this->value_size = $a_size;
96 }

Field Documentation

◆ $forms_helper

ilTestLegacyFormsHelper ilErrorTextWizardInputGUI::$forms_helper
protected

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

◆ $key_maxlength

ilErrorTextWizardInputGUI::$key_maxlength = 255
protected

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

Referenced by getKeyMaxlength().

◆ $key_name

ilErrorTextWizardInputGUI::$key_name = ""
protected

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

Referenced by getKeyName().

◆ $key_size

ilErrorTextWizardInputGUI::$key_size = 20
protected

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

Referenced by getKeySize().

◆ $value_maxlength

ilErrorTextWizardInputGUI::$value_maxlength = 150
protected

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

Referenced by getValueMaxlength().

◆ $value_name

ilErrorTextWizardInputGUI::$value_name = ""
protected

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

Referenced by getValueName().

◆ $value_size

ilErrorTextWizardInputGUI::$value_size = 20
protected

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

Referenced by getValueSize().

◆ $values

ilErrorTextWizardInputGUI::$values = []
protected

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

Referenced by checkInput(), and getValues().


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