ILIAS  release_8 Revision v8.24
ilMatchingPairWizardInputGUI 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 ilMatchingPairWizardInputGUI:
+ Collaboration diagram for ilMatchingPairWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 
 setTerms ($a_terms)
 Set terms. More...
 
 setDefinitions ($a_definitions)
 Set definitions. More...
 
 setPairs ($a_pairs)
 Set pairs. More...
 
 setAllowMove ($a_allow_move)
 Set allow move. More...
 
 getAllowMove ()
 Get allow move. 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

 $pairs = []
 
 $allowMove = false
 
 $terms = []
 
 $definitions = []
 
- 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
 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 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 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 26 of file class.ilMatchingPairWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

40 {
41 parent::__construct($a_title, $a_postvar);
42 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilMatchingPairWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssMatchingPairCorrectionsInputGUI.

Definition at line 124 of file class.ilMatchingPairWizardInputGUI.php.

124 : bool
125 {
126 global $DIC;
127 $lng = $DIC['lng'];
128
129 if (is_array($_POST[$this->getPostVar()])) {
130 $foundvalues = ilArrayUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
131 } else {
132 $foundvalues = $_POST[$this->getPostVar()];
133 }
134 if (is_array($foundvalues)) {
135 // check answers
136 if (isset($foundvalues['term']) && is_array($foundvalues['term'])) {
137 foreach ($foundvalues['term'] as $val) {
138 if ($this->getRequired() && $val < 1) {
139 $this->setAlert($lng->txt("msg_input_is_required"));
140 return false;
141 }
142 }
143 foreach ($foundvalues['definition'] as $val) {
144 if ($this->getRequired() && $val < 1) {
145 $this->setAlert($lng->txt("msg_input_is_required"));
146 return false;
147 }
148 }
149 $max = 0;
150 foreach ($foundvalues['points'] as $val) {
151 if ($this->getRequired() && (strlen($val)) === 0) {
152 $this->setAlert($lng->txt("msg_input_is_required"));
153 return false;
154 }
155 $val = str_replace(",", ".", $val);
156 if (!is_numeric($val)) {
157 $this->setAlert($lng->txt("form_msg_numeric_value_required"));
158 return false;
159 }
160
161 $val = (float) $val;
162 if ($val > 0) {
163 $max += $val;
164 }
165 }
166 if ($max <= 0) {
167 $this->setAlert($lng->txt("enter_enough_positive_points"));
168 return false;
169 }
170 } else {
171 if ($this->getRequired()) {
172 $this->setAlert($lng->txt("msg_input_is_required"));
173 return false;
174 }
175 }
176 } else {
177 if ($this->getRequired()) {
178 $this->setAlert($lng->txt("msg_input_is_required"));
179 return false;
180 }
181 }
182 return $this->checkSubItemsInput();
183 }
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

References $DIC, ilFormPropertyGUI\$lng, ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilArrayUtil\stripSlashesRecursive(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getAllowMove()

ilMatchingPairWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

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

References $allowMove.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilMatchingPairWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssMatchingPairCorrectionsInputGUI.

Definition at line 189 of file class.ilMatchingPairWizardInputGUI.php.

189 : void
190 {
191 global $DIC;
192 $lng = $DIC['lng'];
193 $global_tpl = $DIC['tpl'];
194 $global_tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
195 $global_tpl->addJavascript("./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
196
197 $tpl = new ilTemplate("tpl.prop_matchingpairinput.html", true, true, "Modules/TestQuestionPool");
198 $i = 0;
199
200 foreach ($this->pairs as $pair) {
201 $counter = 1;
202 $tpl->setCurrentBlock("option_term");
203 $tpl->setVariable("TEXT_OPTION", ilLegacyFormElementsUtil::prepareFormOutput($lng->txt('please_select')));
204 $tpl->setVariable("VALUE_OPTION", 0);
205 $tpl->parseCurrentBlock();
206 foreach ($this->terms as $term) {
207 $tpl->setCurrentBlock("option_term");
208 $tpl->setVariable("VALUE_OPTION", ilLegacyFormElementsUtil::prepareFormOutput($term->getIdentifier()));
209 $tpl->setVariable("TEXT_OPTION", $lng->txt('term') . " " . $counter);
210 if ($pair->getTerm()->getIdentifier() == $term->getIdentifier()) {
211 $tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
212 }
213 $tpl->parseCurrentBlock();
214 $counter++;
215 }
216 $counter = 1;
217 $tpl->setCurrentBlock("option_definition");
218 $tpl->setVariable("TEXT_OPTION", ilLegacyFormElementsUtil::prepareFormOutput($lng->txt('please_select')));
219 $tpl->setVariable("VALUE_OPTION", 0);
220 $tpl->parseCurrentBlock();
221 foreach ($this->definitions as $definition) {
222 $tpl->setCurrentBlock("option_definition");
223 $tpl->setVariable("VALUE_OPTION", ilLegacyFormElementsUtil::prepareFormOutput($definition->getIdentifier()));
224 $tpl->setVariable("TEXT_OPTION", $lng->txt('definition') . " " . $counter);
225 if ($pair->getDefinition()->getIdentifier() == $definition->getIdentifier()) {
226 $tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
227 }
228 $tpl->parseCurrentBlock();
229 $counter++;
230 }
231
232
233 $tpl->setCurrentBlock('points_value');
234 $tpl->setVariable('POINTS_VALUE', $pair->getPoints());
235 $tpl->parseCurrentBlock();
236
237 if ($this->getAllowMove()) {
238 $tpl->setCurrentBlock("move");
239 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
240 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
241 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
242 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
243 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
244 $tpl->parseCurrentBlock();
245 }
246
247 $tpl->setCurrentBlock("row");
248 $tpl->setVariable("ROW_NUMBER", $i);
249
250 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
251 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
252 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
253 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
254 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
255
256 $tpl->setVariable("POST_VAR", $this->getPostVar());
257
258 $tpl->parseCurrentBlock();
259
260 $i++;
261 }
262
263 $tpl->setCurrentBlock('term_ids');
264 $ids = array();
265 foreach ($this->terms as $term) {
266 array_push($ids, $term->getIdentifier());
267 }
268 $tpl->setVariable("POST_VAR", $this->getPostVar());
269 $tpl->setVariable("TERM_IDS", join(",", $ids));
270 $tpl->parseCurrentBlock();
271
272 $tpl->setCurrentBlock('definition_ids');
273 $ids = array();
274 foreach ($this->definitions as $definition) {
275 array_push($ids, $definition->getIdentifier());
276 }
277 $tpl->setVariable("POST_VAR", $this->getPostVar());
278 $tpl->setVariable("DEFINITION_IDS", join(",", $ids));
279 $tpl->parseCurrentBlock();
280
281 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
282 $tpl->setVariable("TEXT_POINTS", $lng->txt('points'));
283 $tpl->setVariable("TEXT_DEFINITION", $lng->txt('definition'));
284 $tpl->setVariable("TEXT_TERM", $lng->txt('term'));
285 $tpl->setVariable("TEXT_ACTIONS", $lng->txt('actions'));
286
287 $a_tpl->setCurrentBlock("prop_generic");
288 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
289 $a_tpl->parseCurrentBlock();
290 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
ilGlobalTemplateInterface $global_tpl
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, ilFormPropertyGUI\$global_tpl, $i, ilFormPropertyGUI\$lng, $tpl, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getPostVar(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), ilLanguage\txt(), and ilGlyphGUI\UP.

+ Here is the call graph for this function:

◆ setAllowMove()

ilMatchingPairWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 105 of file class.ilMatchingPairWizardInputGUI.php.

105 : void
106 {
107 $this->allowMove = $a_allow_move;
108 }

◆ setDefinitions()

ilMatchingPairWizardInputGUI::setDefinitions (   $a_definitions)

Set definitions.

Parameters
array$a_definitionsDefinitions

Definition at line 85 of file class.ilMatchingPairWizardInputGUI.php.

85 : void
86 {
87 $this->definitions = $a_definitions;
88 }

◆ setPairs()

ilMatchingPairWizardInputGUI::setPairs (   $a_pairs)

Set pairs.

Parameters
array$a_pairsPairs

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

95 : void
96 {
97 $this->pairs = $a_pairs;
98 }

◆ setTerms()

ilMatchingPairWizardInputGUI::setTerms (   $a_terms)

Set terms.

Parameters
array$a_termsTerms

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

75 : void
76 {
77 $this->terms = $a_terms;
78 }

◆ setValue()

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

Reimplemented from ilTextInputGUI.

Reimplemented in ilAssMatchingPairCorrectionsInputGUI.

Definition at line 44 of file class.ilMatchingPairWizardInputGUI.php.

44 : void
45 {
46 $this->pairs = array();
47 $this->terms = array();
48 $this->definitions = array();
49 if (is_array($a_value)) {
50 if (isset($a_value['term']) && is_array($a_value['term'])) {
51 foreach ($a_value['term'] as $idx => $term) {
52 $this->pairs[] = new assAnswerMatchingPair(
53 new assAnswerMatchingTerm('', '', $term),
54 new assAnswerMatchingDefinition('', '', $a_value['definition'][$idx]),
55 (float) $a_value['points'][$idx]
56 );
57 }
58 }
59 $term_ids = explode(",", $a_value['term_id']);
60 foreach ($term_ids as $id) {
61 $this->terms[] = new assAnswerMatchingTerm('', '', $id);
62 }
63 $definition_ids = explode(",", $a_value['definition_id']);
64 foreach ($definition_ids as $id) {
65 $this->definitions[] = new assAnswerMatchingDefinition('', '', $id);
66 }
67 }
68 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $id.

Field Documentation

◆ $allowMove

ilMatchingPairWizardInputGUI::$allowMove = false
protected

Definition at line 29 of file class.ilMatchingPairWizardInputGUI.php.

Referenced by getAllowMove().

◆ $definitions

ilMatchingPairWizardInputGUI::$definitions = []
protected

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

◆ $pairs

ilMatchingPairWizardInputGUI::$pairs = []
protected

◆ $terms

ilMatchingPairWizardInputGUI::$terms = []
protected

Definition at line 30 of file class.ilMatchingPairWizardInputGUI.php.


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