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

Public Member Functions

 setValue ($a_value)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilSingleChoiceWizardInputGUI
 __construct ($a_title='', $a_postvar='')
 Constructor. More...
 
 setValue ($a_value)
 
 setValueByArray (array $a_values)
 
 setSuffixes ($a_suffixes)
 Set Accepted Suffixes. More...
 
 setHideImages ($a_hide)
 Set hide images. More...
 
 getSuffixes ()
 Get Accepted Suffixes. More...
 
 setShowPoints ($a_value)
 
 getShowPoints ()
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. More...
 
 setSingleline ($a_value)
 Set singleline. More...
 
 getSingleline ()
 Get singleline. More...
 
 setQuestionObject ($a_value)
 Set question object. More...
 
 getQuestionObject ()
 Get question object. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. More...
 
 setPending (string $val)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (ilTemplate $a_tpl)
 
- 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
 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)
 
- Protected Attributes inherited from ilSingleChoiceWizardInputGUI
 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
ArrayBasedRequestWrapper $post_wrapper
 
GlyphFactory $glyph_factory
 
Renderer $renderer
 
UploadLimitResolver $upload_limit
 
- 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

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

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

Member Function Documentation

◆ checkInput()

ilEssayKeywordWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

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

References $DIC, ilFormPropertyGUI\$lng, ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\setAlert(), ilArrayUtil\stripSlashesRecursive(), and ilLanguage\txt().

47  : bool
48  {
49  global $DIC;
50  $lng = $DIC['lng'];
51 
52  if (is_array($_POST[$this->getPostVar()])) {
54  $_POST[$this->getPostVar()],
55  false,
57  "assessment"
58  )
59  );
60  } else {
61  $foundvalues = $_POST[$this->getPostVar()];
62  }
63  if (is_array($foundvalues)) {
64  // check answers
65  if (is_array($foundvalues['answer'])) {
66  foreach ($foundvalues['answer'] as $aidx => $answervalue) {
67  if (((strlen($answervalue)) == 0) && (!isset($foundvalues['imagename']) || strlen($foundvalues['imagename'][$aidx]) == 0)) {
68  $this->setAlert($lng->txt("msg_input_is_required"));
69  return false;
70  }
71 
72  if (mb_strlen($answervalue) > $this->getMaxLength()) {
73  $this->setAlert($lng->txt("msg_input_char_limit_max"));
74  return false;
75  }
76  }
77  }
78  // check points
79  $max = 0;
80  if (is_array($foundvalues['points'])) {
81  foreach ($foundvalues['points'] as $points) {
82  if ($points > $max) {
83  $max = $points;
84  }
85  if (((strlen($points)) == 0) || (!is_numeric($points))) {
86  $this->setAlert($lng->txt("form_msg_numeric_value_required"));
87  return false;
88  }
89  }
90  }
91  if ($max == 0) {
92  $this->setAlert($lng->txt("enter_enough_positive_points"));
93  return false;
94  }
95  } else {
96  $this->setAlert($lng->txt("msg_input_is_required"));
97  return false;
98  }
99 
100  return $this->checkSubItemsInput();
101  }
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
static _getUsedHTMLTagsAsString(string $a_module="")
Returns a string of all allowed HTML tags for text editing.
+ Here is the call graph for this function:

◆ insert()

ilEssayKeywordWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Definition at line 107 of file class.ilEssayKeywordWizardInputGUI.php.

References $DIC, ilFormPropertyGUI\$lng, ilTextInputGUI\$value, ilFormPropertyGUI\getDisabled(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), ilSingleChoiceWizardInputGUI\getSingleline(), ilTextInputGUI\getSize(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

107  : void
108  {
109  global $DIC;
110  $lng = $DIC['lng'];
111 
112  $tpl = new ilTemplate("tpl.prop_essaykeywordswizardinput.html", true, true, "Modules/TestQuestionPool");
113  $i = 0;
114  foreach ($this->values as $value) {
115  if ($this->getSingleline()) {
116  if (is_object($value)) {
117  $tpl->setCurrentBlock("prop_text_propval");
118  $tpl->setVariable(
119  "PROPERTY_VALUE",
120  ilLegacyFormElementsUtil::prepareFormOutput($value->getAnswertext())
121  );
122  $tpl->parseCurrentBlock();
123  $tpl->setCurrentBlock("prop_points_propval");
124  $tpl->setVariable(
125  "PROPERTY_VALUE",
126  ilLegacyFormElementsUtil::prepareFormOutput($value->getPointsChecked())
127  );
128  $tpl->parseCurrentBlock();
129  }
130  $tpl->setCurrentBlock('singleline');
131  $tpl->setVariable("SIZE", $this->getSize());
132  $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][$i]");
133  $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
134  $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
135  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
136  if ($this->getDisabled()) {
137  $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
138  }
139  $tpl->parseCurrentBlock();
140  } else {
141  if (!$this->getSingleline()) {
142  if (is_object($value)) {
143  $tpl->setCurrentBlock("prop_points_propval");
144  $tpl->setVariable(
145  "PROPERTY_VALUE",
147  );
148  $tpl->parseCurrentBlock();
149  }
150  }
151  }
152 
153  $tpl->setCurrentBlock("row");
154  $tpl->setVariable("POST_VAR", $this->getPostVar());
155  $tpl->setVariable("ROW_NUMBER", $i);
156  $tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
157  $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
158  if ($this->getDisabled()) {
159  $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
160  }
161  $tpl->setVariable("ADD_BUTTON", $this->renderer->render(
162  $this->glyph_factory->add()->withAction('#')
163  ));
164  $tpl->setVariable("REMOVE_BUTTON", $this->renderer->render(
165  $this->glyph_factory->remove()->withAction('#')
166  ));
167  $tpl->parseCurrentBlock();
168  $i++;
169  }
170 
171  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
172  $tpl->setVariable("TEXT_YES", $lng->txt('yes'));
173  $tpl->setVariable("TEXT_NO", $lng->txt('no'));
174  $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
175  $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
176  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
177  $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
178  $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
179  $tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('checkbox_checked'));
180 
181  $a_tpl->setCurrentBlock("prop_generic");
182  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
183  $a_tpl->parseCurrentBlock();
184 
185  global $DIC;
186  $tpl = $DIC['tpl'];
187  $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/answerwizardinput.js");
188  $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/essaykeywordwizard.js");
189  }
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:

◆ setValue()

ilEssayKeywordWizardInputGUI::setValue (   $a_value)

Definition at line 20 of file class.ilEssayKeywordWizardInputGUI.php.

References ilTextInputGUI\$value.

20  : void
21  {
22  $this->values = array();
23  if (is_array($a_value)) {
24  if (is_array($a_value['answer'])) {
25  foreach ($a_value['answer'] as $index => $value) {
26  if (isset($a_value['points'])) {
27  $pvalue = $a_value['points'][$index];
28  } else {
29  $value = 0.0;
30  }
31  if (isset($a_value['points_unchecked'])) {
32  $value_unchecked = $a_value['points_unchecked'][$index];
33  } else {
34  $value_unchecked = 0.0;
35  }
36  $answer = new ASS_AnswerMultipleResponseImage($value, (float) $pvalue, $index, $value_unchecked);
37  $this->values[] = $answer;
38  }
39  }
40  }
41  }
ASS_AnswerBinaryStateImage is a class for answers with a binary state indicator (checked/unchecked, set/unset) and an image file.

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