ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 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 ilSingleChoiceWizardInputGUI
 checkAnswersInput (array $data)
 Checks the input of the answers and returns the answers as an array if the input is valid or a string with the error message if the input is invalid. 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
 
ilTestLegacyFormsHelper $forms_helper
 
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 19 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 43 of file class.ilEssayKeywordWizardInputGUI.php.

References $data, ilSingleChoiceWizardInputGUI\checkAnswersInput(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ILIAS\Repository\lng(), ilFormPropertyGUI\raw(), and ilFormPropertyGUI\setAlert().

43  : bool
44  {
45  $data = $this->raw($this->getPostVar());
46 
47  if (!is_array($data)) {
48  $this->setAlert($this->lng->txt('msg_input_is_required'));
49  return false;
50  }
51 
52  // check answers
53  $answers = $this->checkAnswersInput($data);
54  if (!is_array($answers)) {
55  $this->setAlert($this->lng->txt($answers));
56  return false;
57  }
58 
59  // check points
60  $result = $this->forms_helper->checkPointsInputEnoughPositive($data, true);
61  if (!is_array($result)) {
62  $this->setAlert($this->lng->txt($result));
63  return false;
64  }
65 
66  return $this->checkSubItemsInput();
67  }
checkAnswersInput(array $data)
Checks the input of the answers and returns the answers as an array if the input is valid or a string...
+ Here is the call graph for this function:

◆ insert()

ilEssayKeywordWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Definition at line 73 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(), renderer(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilLanguage\txt().

73  : void
74  {
75  global $DIC;
76  $lng = $DIC['lng'];
77 
78  $tpl = new ilTemplate("tpl.prop_essaykeywordswizardinput.html", true, true, "components/ILIAS/TestQuestionPool");
79  $i = 0;
80  foreach ($this->values as $value) {
81  if ($this->getSingleline()) {
82  if (is_object($value)) {
83  $tpl->setCurrentBlock("prop_text_propval");
84  $tpl->setVariable(
85  "PROPERTY_VALUE",
86  ilLegacyFormElementsUtil::prepareFormOutput($value->getAnswertext())
87  );
88  $tpl->parseCurrentBlock();
89  $tpl->setCurrentBlock("prop_points_propval");
90  $tpl->setVariable(
91  "PROPERTY_VALUE",
92  ilLegacyFormElementsUtil::prepareFormOutput($value->getPointsChecked())
93  );
94  $tpl->parseCurrentBlock();
95  }
96  $tpl->setCurrentBlock('singleline');
97  $tpl->setVariable("SIZE", $this->getSize());
98  $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][$i]");
99  $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i);
100  $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar());
101  $tpl->setVariable("MAXLENGTH", $this->getMaxLength());
102  if ($this->getDisabled()) {
103  $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\"");
104  }
105  $tpl->parseCurrentBlock();
106  } else {
107  if (!$this->getSingleline()) {
108  if (is_object($value)) {
109  $tpl->setCurrentBlock("prop_points_propval");
110  $tpl->setVariable(
111  "PROPERTY_VALUE",
113  );
114  $tpl->parseCurrentBlock();
115  }
116  }
117  }
118 
119  $tpl->setCurrentBlock("row");
120  $tpl->setVariable("POST_VAR", $this->getPostVar());
121  $tpl->setVariable("ROW_NUMBER", $i);
122  $tpl->setVariable("ID", $this->getPostVar() . "[answer][$i]");
123  $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][$i]");
124  if ($this->getDisabled()) {
125  $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\"");
126  }
127  $tpl->setVariable("ADD_BUTTON", $this->renderer->render(
128  $this->glyph_factory->add()->withAction('#')
129  ));
130  $tpl->setVariable("REMOVE_BUTTON", $this->renderer->render(
131  $this->glyph_factory->remove()->withAction('#')
132  ));
133  $tpl->parseCurrentBlock();
134  $i++;
135  }
136 
137  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
138  $tpl->setVariable("TEXT_YES", $lng->txt('yes'));
139  $tpl->setVariable("TEXT_NO", $lng->txt('no'));
140  $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header'));
141  $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question'));
142  $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text'));
143  $tpl->setVariable("POINTS_TEXT", $lng->txt('points'));
144  $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions'));
145  $tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('checkbox_checked'));
146 
147  $a_tpl->setCurrentBlock("prop_generic");
148  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
149  $a_tpl->parseCurrentBlock();
150 
151  global $DIC;
152  $tpl = $DIC['tpl'];
153  $tpl->addJavascript("assets/js/answerwizardinput.js");
154  $tpl->addJavascript("assets/js/essaykeywordwizard.js");
155  }
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...
renderer()
static prepareFormOutput($a_str, bool $a_strip=false)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
global $DIC
Definition: shib_login.php:22
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setValue()

ilEssayKeywordWizardInputGUI::setValue (   $a_value)

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

References ilTextInputGUI\$value, and ILIAS\Repository\refinery().

21  : void
22  {
23  $answers = $this->forms_helper->transformArray($a_value, 'answer', $this->refinery->kindlyTo()->string());
24  $points = $this->forms_helper->transformPoints($a_value, 'points');
25  $points_unchecked = $this->forms_helper->transformPoints($a_value, 'points_unchecked');
26 
27  $this->values = [];
28  foreach ($answers as $index => $value) {
29  $answer = new ASS_AnswerMultipleResponseImage(
30  $value,
31  $points[$index] ?? 0.0,
32  $index,
33  $points_unchecked[$index] ?? 0.0
34  );
35  $this->values[] = $answer;
36  }
37  }
ASS_AnswerBinaryStateImage is a class for answers with a binary state indicator (checked/unchecked, set/unset) and an image file.
+ Here is the call graph for this function:

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