ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 Set Value. More...
 
 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 ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilTextInputGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValidationFailureMessage ($a_msg)
 Set message string for validation failure. More...
 
 getValidationFailureMessage ()
 
 setValidationRegexp ($a_value)
 Set validation regexp. More...
 
 getValidationRegexp ()
 Get validation regexp. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setInlineStyle ($a_style)
 Set inline style. More...
 
 getInlineStyle ()
 Get inline style. More...
 
 setCssClass ($a_class)
 
 getCssClass ()
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setSuffix ($a_value)
 Set suffix. More...
 
 getSuffix ()
 Get suffix. More...
 
 setInputType ($a_type)
 set input type More...
 
 getInputType ()
 get input type More...
 
 setSubmitFormOnEnter ($a_val)
 Set submit form on enter. More...
 
 getSubmitFormOnEnter ()
 Get submit form on enter. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getDataSource ()
 get datasource link for js autocomplete More...
 
 setDataSource ($href, $a_delimiter=null)
 set datasource link for js autocomplete More...
 
 setDataSourceSubmitOnSelection ($a_stat)
 
 getDataSourceSubmitOnSelection ()
 
 setDataSourceSubmitUrl ($a_url)
 
 getDataSourceSubmitUrl ()
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
 getTableFilterHTML ()
 Get HTML for table filter. More...
 
 getToolbarHTML ()
 Get HTML for toolbar. More...
 
 setDisableHtmlAutoComplete ($autocomplete)
 
 isHtmlAutoCompleteDisabled ()
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($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...
 
- 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 = 255
 
 $key_name = ""
 
 $value_name = ""
 
- Protected Attributes inherited from ilTextInputGUI
 $value
 
 $maxlength = 200
 
 $size = 40
 
 $validationRegexp
 
 $validationFailureMessage = ''
 
 $suffix
 
 $style_css
 
 $css_class
 
 $ajax_datasource
 
 $ajax_datasource_delimiter
 
 $ajax_datasource_commit = false
 
 $ajax_datasource_commit_url
 
 $submit_form_on_enter = false
 
 $autocomplete_disabled = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

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

28 {
29 parent::__construct($a_title, $a_postvar);
30 }

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

196 {
197 global $DIC;
198 $lng = $DIC['lng'];
199
200 if (is_array($_POST[$this->getPostVar()])) {
202 }
203 $foundvalues = $_POST[$this->getPostVar()];
204 $max_points = 0;
205
206 if (is_array($foundvalues)) {
207 // check answers
208 if (is_array($foundvalues['key']) && is_array($foundvalues['value'])) {
209 foreach ($foundvalues['key'] as $val) {
210 if ($this->getRequired() && (strlen($val)) == 0) {
211 $this->setAlert($lng->txt("msg_input_is_required"));
212 return false;
213 }
214 }
215 foreach ($foundvalues['value'] as $val) {
216 if ($this->getRequired() && (strlen($val)) == 0) {
217 $this->setAlert($lng->txt("msg_input_is_required"));
218 return false;
219 }
220 }
221 foreach ($foundvalues['points'] as $val) {
222 if ($this->getRequired() && (strlen($val)) == 0) {
223 $this->setAlert($lng->txt("msg_input_is_required"));
224 return false;
225 }
226 if (!is_numeric(str_replace(",", ".", $val))) {
227 $this->setAlert($lng->txt("form_msg_numeric_value_required"));
228 return false;
229 }
230 if ((float) $val <= 0) {
231 $this->setAlert($lng->txt("positive_numbers_required"));
232 return false;
233 }
234 }
235 } else {
236 if ($this->getRequired()) {
237 $this->setAlert($lng->txt("msg_input_is_required"));
238 return false;
239 }
240 }
241 } else {
242 if ($this->getRequired()) {
243 $this->setAlert($lng->txt("msg_input_is_required"));
244 return false;
245 }
246 }
247
248 return $this->checkSubItemsInput();
249 }
$_POST["username"]
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
global $DIC
Definition: saml.php:7

References $_POST, $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashesRecursive().

+ Here is the call graph for this function:

◆ getKeyMaxlength()

ilErrorTextWizardInputGUI::getKeyMaxlength ( )

Get key maxlength.

Returns
integer Key maxlength

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

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 65 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 125 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 145 of file class.ilErrorTextWizardInputGUI.php.

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

References $values.

◆ getValueSize()

ilErrorTextWizardInputGUI::getValueSize ( )

Get value size.

Returns
integer value size

Definition at line 85 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 (   $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssErrorTextCorrectionsInputGUI.

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

257 {
258 global $DIC;
259 $lng = $DIC['lng'];
260
261 $tpl = new ilTemplate("tpl.prop_errortextwizardinput.html", true, true, "Modules/TestQuestionPool");
262 $i = 0;
263 foreach ($this->values as $value) {
264 if (is_object($value)) {
265 if (strlen($value->text_wrong)) {
266 $tpl->setCurrentBlock("prop_key_propval");
267 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->text_wrong));
268 $tpl->parseCurrentBlock();
269 }
270 if (strlen($value->text_correct)) {
271 $tpl->setCurrentBlock("prop_value_propval");
272 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->text_correct));
273 $tpl->parseCurrentBlock();
274 }
275 if (strlen($value->points)) {
276 $tpl->setCurrentBlock("prop_points_propval");
277 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->points));
278 $tpl->parseCurrentBlock();
279 }
280 }
281
282 $tpl->setCurrentBlock("row");
283 $class = ($i % 2 == 0) ? "even" : "odd";
284 if ($i == 0) {
285 $class .= " first";
286 }
287 if ($i == count($this->values) - 1) {
288 $class .= " last";
289 }
290 $tpl->setVariable("ROW_CLASS", $class);
291 $tpl->setVariable("ROW_NUMBER", $i);
292
293 $tpl->setVariable("KEY_SIZE", $this->getKeySize());
294 $tpl->setVariable("KEY_ID", $this->getPostVar() . "[key][$i]");
295 $tpl->setVariable("KEY_MAXLENGTH", $this->getKeyMaxlength());
296
297 $tpl->setVariable("VALUE_SIZE", $this->getValueSize());
298 $tpl->setVariable("VALUE_ID", $this->getPostVar() . "[value][$i]");
299 $tpl->setVariable("VALUE_MAXLENGTH", $this->getValueMaxlength());
300
301 $tpl->setVariable("POST_VAR", $this->getPostVar());
302
303 $tpl->parseCurrentBlock();
304
305 $i++;
306 }
307 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
308 $tpl->setVariable("KEY_TEXT", $this->getKeyName());
309 $tpl->setVariable("VALUE_TEXT", $this->getValueName());
310 $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
311
312 $a_tpl->setCurrentBlock("prop_generic");
313 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
314 $a_tpl->parseCurrentBlock();
315 }
$tpl
Definition: ilias.php:10
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$i
Definition: disco.tpl.php:19

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, getKeyMaxlength(), getKeyName(), getKeySize(), ilFormPropertyGUI\getPostVar(), getValueMaxlength(), getValueName(), getValueSize(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ setKeyMaxlength()

ilErrorTextWizardInputGUI::setKeyMaxlength (   $a_maxlength)

Set key maxlength.

Parameters
integer$a_sizeKey maxlength

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

96 {
97 $this->key_maxlength = $a_maxlength;
98 }

◆ setKeyName()

ilErrorTextWizardInputGUI::setKeyName (   $a_name)

Set key name.

Parameters
string$a_namevalue name

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

156 {
157 $this->key_name = $a_name;
158 }

◆ setKeySize()

ilErrorTextWizardInputGUI::setKeySize (   $a_size)

Set key size.

Parameters
integer$a_sizeKey size

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

56 {
57 $this->key_size = $a_size;
58 }

◆ setValue()

ilErrorTextWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssErrorTextCorrectionsInputGUI.

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

38 {
39 $this->values = array();
40 if (is_array($a_value)) {
41 include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
42 if (is_array($a_value['key'])) {
43 foreach ($a_value['key'] as $idx => $key) {
44 array_push($this->values, new assAnswerErrorText($key, $a_value['value'][$idx], str_replace(",", ".", $a_value['points'][$idx])));
45 }
46 }
47 }
48 }
Class for error text answers.
$key
Definition: croninfo.php:18

References $key.

◆ setValueMaxlength()

ilErrorTextWizardInputGUI::setValueMaxlength (   $a_maxlength)

Set value maxlength.

Parameters
integer$a_sizevalue maxlength

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

116 {
117 $this->value_maxlength = $a_maxlength;
118 }

◆ setValueName()

ilErrorTextWizardInputGUI::setValueName (   $a_name)

Set value name.

Parameters
string$a_namevalue name

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

136 {
137 $this->value_name = $a_name;
138 }

◆ setValues()

ilErrorTextWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

176 {
177 $this->values = $a_values;
178 }

◆ setValueSize()

ilErrorTextWizardInputGUI::setValueSize (   $a_size)

Set value size.

Parameters
integer$a_sizevalue size

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

76 {
77 $this->value_size = $a_size;
78 }

Field Documentation

◆ $key_maxlength

ilErrorTextWizardInputGUI::$key_maxlength = 255
protected

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

Referenced by getKeyMaxlength().

◆ $key_name

ilErrorTextWizardInputGUI::$key_name = ""
protected

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

Referenced by getKeyName().

◆ $key_size

ilErrorTextWizardInputGUI::$key_size = 20
protected

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

Referenced by getKeySize().

◆ $value_maxlength

ilErrorTextWizardInputGUI::$value_maxlength = 255
protected

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

Referenced by getValueMaxlength().

◆ $value_name

ilErrorTextWizardInputGUI::$value_name = ""
protected

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

Referenced by getValueName().

◆ $value_size

ilErrorTextWizardInputGUI::$value_size = 20
protected

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

Referenced by getValueSize().

◆ $values

ilErrorTextWizardInputGUI::$values = array()
protected

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

Referenced by getValues().


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