ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMatchingPairWizardInputGUI Class Reference

This class represents a key value pair wizard property in a property form. More...

+ Inheritance diagram for ilMatchingPairWizardInputGUI:
+ Collaboration diagram for ilMatchingPairWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 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 (&$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...
 
 removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Protected Attributes

 $pairs = array()
 
 $allowMove = false
 
 $terms = array()
 
 $definitions = array()
 
- 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
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- 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 13 of file class.ilMatchingPairWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

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

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

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.

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

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

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

+ Here is the call graph for this function:

◆ getAllowMove()

ilMatchingPairWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

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

References $allowMove.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilMatchingPairWizardInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

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

190 {
191 global $lng;
192
193 $tpl = new ilTemplate("tpl.prop_matchingpairinput.html", true, true, "Modules/TestQuestionPool");
194 $i = 0;
195
196 foreach ($this->pairs as $pair)
197 {
198 $counter = 1;
199 $tpl->setCurrentBlock("option_term");
200 $tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select')));
201 $tpl->setVariable("VALUE_OPTION", 0);
202 $tpl->parseCurrentBlock();
203 foreach ($this->terms as $term)
204 {
205 $tpl->setCurrentBlock("option_term");
206 $tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($term->identifier));
207 $tpl->setVariable("TEXT_OPTION", $lng->txt('term') . " " . $counter);
208 if ($pair->term->identifier == $term->identifier) $tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
209 $tpl->parseCurrentBlock();
210 $counter++;
211 }
212 $counter = 1;
213 $tpl->setCurrentBlock("option_definition");
214 $tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select')));
215 $tpl->setVariable("VALUE_OPTION", 0);
216 $tpl->parseCurrentBlock();
217 foreach ($this->definitions as $definition)
218 {
219 $tpl->setCurrentBlock("option_definition");
220 $tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($definition->identifier));
221 $tpl->setVariable("TEXT_OPTION", $lng->txt('definition') . " " . $counter);
222 if ($pair->definition->identifier == $definition->identifier) $tpl->setVariable('SELECTED_OPTION', ' selected="selected"');
223 $tpl->parseCurrentBlock();
224 $counter++;
225 }
226
227 if (strlen($pair->points))
228 {
229 $tpl->setCurrentBlock('points_value');
230 $tpl->setVariable('POINTS_VALUE', $pair->points);
231 $tpl->parseCurrentBlock();
232 }
233 if ($this->getAllowMove())
234 {
235 $tpl->setCurrentBlock("move");
236 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
237 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
238 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
239 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
240 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
241 $tpl->parseCurrentBlock();
242 }
243
244 $tpl->setCurrentBlock("row");
245 $tpl->setVariable("ROW_NUMBER", $i);
246
247 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
248 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
249 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
250 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
251 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
252
253 $tpl->setVariable("POST_VAR", $this->getPostVar());
254
255 $tpl->parseCurrentBlock();
256
257 $i++;
258 }
259
260 $tpl->setCurrentBlock('term_ids');
261 $ids = array();
262 foreach ($this->terms as $term)
263 {
264 array_push($ids, $term->identifier);
265 }
266 $tpl->setVariable("POST_VAR", $this->getPostVar());
267 $tpl->setVariable("TERM_IDS", join($ids, ","));
268 $tpl->parseCurrentBlock();
269
270 $tpl->setCurrentBlock('definition_ids');
271 $ids = array();
272 foreach ($this->definitions as $definition)
273 {
274 array_push($ids, $definition->identifier);
275 }
276 $tpl->setVariable("POST_VAR", $this->getPostVar());
277 $tpl->setVariable("DEFINITION_IDS", join($ids, ","));
278 $tpl->parseCurrentBlock();
279
280 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
281 $tpl->setVariable("TEXT_POINTS", $lng->txt('points'));
282 $tpl->setVariable("TEXT_DEFINITION", $lng->txt('definition'));
283 $tpl->setVariable("TEXT_TERM", $lng->txt('term'));
284 $tpl->setVariable("TEXT_ACTIONS", $lng->txt('actions'));
285
286 $a_tpl->setCurrentBlock("prop_generic");
287 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
288 $a_tpl->parseCurrentBlock();
289
290 global $tpl;
291 $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
292 $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/matchingpairwizard.js");
293 }
global $tpl
Definition: ilias.php:8
getFieldId()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $lng, $tpl, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getPostVar(), ilUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, 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 101 of file class.ilMatchingPairWizardInputGUI.php.

102 {
103 $this->allowMove = $a_allow_move;
104 }

◆ setDefinitions()

ilMatchingPairWizardInputGUI::setDefinitions (   $a_definitions)

Set definitions.

Parameters
array$a_definitionsDefinitions

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

82 {
83 $this->definitions = $a_definitions;
84 }

◆ setPairs()

ilMatchingPairWizardInputGUI::setPairs (   $a_pairs)

Set pairs.

Parameters
array$a_pairsPairs

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

92 {
93 $this->pairs = $a_pairs;
94 }

◆ setTerms()

ilMatchingPairWizardInputGUI::setTerms (   $a_terms)

Set terms.

Parameters
array$a_termsTerms

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

72 {
73 $this->terms = $a_terms;
74 }

◆ setValue()

ilMatchingPairWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

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

37 {
38 $this->pairs = array();
39 $this->terms = array();
40 $this->definitions = array();
41 if (is_array($a_value))
42 {
43 include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
44 include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
45 include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
46 if (is_array($a_value['term']))
47 {
48 foreach ($a_value['term'] as $idx => $term)
49 {
50 array_push($this->pairs, new assAnswerMatchingPair(new assAnswerMatchingTerm('', '', $term), new assAnswerMatchingDefinition('', '', $a_value['definition'][$idx]), $a_value['points'][$idx]));
51 }
52 }
53 $term_ids = split(",", $a_value['term_id']);
54 foreach ($term_ids as $id)
55 {
56 array_push($this->terms, new assAnswerMatchingTerm('', '', $id));
57 }
58 $definition_ids = split(",", $a_value['definition_id']);
59 foreach ($definition_ids as $id)
60 {
61 array_push($this->definitions, new assAnswerMatchingDefinition('', '', $id));
62 }
63 }
64 }
Class for matching question definitions.
Class for matching question pairs.
Class for matching question terms.

Field Documentation

◆ $allowMove

ilMatchingPairWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $definitions

ilMatchingPairWizardInputGUI::$definitions = array()
protected

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

◆ $pairs

ilMatchingPairWizardInputGUI::$pairs = array()
protected

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

◆ $terms

ilMatchingPairWizardInputGUI::$terms = array()
protected

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


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