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

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)
 
- Protected Attributes inherited from ilSingleChoiceWizardInputGUI
 $values = []
 
 $allowMove = false
 
 $singleline = true
 
 $qstObject = null
 
 $suffixes = []
 
 $showPoints = true
 
 $hideImages = false
 
ArrayBasedRequestWrapper $post_wrapper
 
- 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

Reimplemented from ilSingleChoiceWizardInputGUI.

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

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

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

+ Here is the call graph for this function:

◆ insert()

ilEssayKeywordWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Reimplemented from ilSingleChoiceWizardInputGUI.

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

109 : void
110 {
111 global $DIC;
112 $lng = $DIC['lng'];
113
114 $tpl = new ilTemplate("tpl.prop_essaykeywordswizardinput.html", true, true, "Modules/TestQuestionPool");
115 $i = 0;
116 foreach ($this->values as $value) {
117 if ($this->getSingleline()) {
118 if (is_object($value)) {
119 $tpl->setCurrentBlock("prop_text_propval");
120 $tpl->setVariable(
121 "PROPERTY_VALUE",
123 );
124 $tpl->parseCurrentBlock();
125 $tpl->setCurrentBlock("prop_points_propval");
126 $tpl->setVariable(
127 "PROPERTY_VALUE",
129 );
130 $tpl->parseCurrentBlock();
131 }
132 $tpl->setCurrentBlock('singleline');
133 $tpl->setVariable("SIZE", $this->getSize());
134 $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][$i]");
135 $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
136 $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
137 $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
138 if ($this->getDisabled()) {
139 $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
140 }
141 $tpl->parseCurrentBlock();
142 } else {
143 if (!$this->getSingleline()) {
144 if (is_object($value)) {
145 $tpl->setCurrentBlock("prop_points_propval");
146 $tpl->setVariable(
147 "PROPERTY_VALUE",
149 );
150 $tpl->parseCurrentBlock();
151 }
152 }
153 }
154
155 $tpl->setCurrentBlock("row");
156 $tpl->setVariable("POST_VAR", $this->getPostVar());
157 $tpl->setVariable("ROW_NUMBER", $i);
158 $tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
159 $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
160 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
161 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
162 if ($this->getDisabled()) {
163 $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
164 }
165 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
166 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
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("./Services/Form/js/ServiceFormWizardInput.js");
188 $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/essaykeywordwizard.js");
189 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
static get(string $a_glyph, string $a_text="")
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, ilGlyphGUI\ADD, ilGlyphGUI\get(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilTextInputGUI\getMaxLength(), ilFormPropertyGUI\getPostVar(), ilSingleChoiceWizardInputGUI\getSingleline(), ilTextInputGUI\getSize(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ setValue()

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

Reimplemented from ilSingleChoiceWizardInputGUI.

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

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 include_once "./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
27 if (isset($a_value['points'])) {
28 $pvalue = $a_value['points'][$index];
29 } else {
30 $value = 0.0;
31 }
32 if (isset($a_value['points_unchecked'])) {
33 $value_unchecked = $a_value['points_unchecked'][$index];
34 } else {
35 $value_unchecked = 0.0;
36 }
37 $answer = new ASS_AnswerMultipleResponseImage($value, (float) $pvalue, $index, $value_unchecked);
38 $this->values[] = $answer;
39 }
40 }
41 }
42 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$index
Definition: metadata.php:145

References $index, and ilTextInputGUI\$value.


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