ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilKVPWizardInputGUI 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 ilKVPWizardInputGUI:
+ Collaboration diagram for ilKVPWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 
 setKeySize ($a_size)
 Set key size. More...
 
 getKeySize ()
 Get key size. More...
 
 setValueSize ($a_size)
 Set value size. More...
 
 getValueSize ()
 Get value size. More...
 
 setKeyMaxlength ($a_maxlength)
 Set key maxlength. More...
 
 getKeyMaxlength ()
 Get key maxlength. More...
 
 setValueMaxlength ($a_maxlength)
 Set value maxlength. More...
 
 getValueMaxlength ()
 Get value maxlength. More...
 
 setValueName ($a_name)
 Set value name. More...
 
 getValueName ()
 Get value name. More...
 
 setKeyName ($a_name)
 Set key name. More...
 
 getKeyName ()
 Get key name. More...
 
 setValues ($a_values)
 Set Values. More...
 
 getValues ()
 Get Values. 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 ()
 
 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...
 

Protected Attributes

 $values = array()
 
 $allowMove = false
 
 $key_size = 20
 
 $value_size = 20
 
 $key_maxlength = 255
 
 $value_maxlength = 255
 
 $key_name = ""
 
 $value_name = ""
 
- 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.ilKVPWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Definition at line 43 of file class.ilKVPWizardInputGUI.php.

References ILIAS\GlobalScreen\Provider\__construct().

44  {
45  parent::__construct($a_title, $a_postvar);
46  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilKVPWizardInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
boolean Input ok, true/false

Definition at line 224 of file class.ilKVPWizardInputGUI.php.

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

224  : bool
225  {
226  global $DIC;
227  $lng = $DIC['lng'];
228 
229  if (is_array($_POST[$this->getPostVar()])) {
230  $_POST[$this->getPostVar()] = ilArrayUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
231  }
232  $foundvalues = $_POST[$this->getPostVar()];
233  if (is_array($foundvalues)) {
234  // check answers
235  if (is_array($foundvalues['key']) && is_array($foundvalues['value'])) {
236  foreach ($foundvalues['key'] as $val) {
237  if ($this->getRequired() && (strlen($val)) == 0) {
238  $this->setAlert($lng->txt("msg_input_is_required"));
239  return false;
240  }
241  }
242  foreach ($foundvalues['value'] as $val) {
243  if ($this->getRequired() && (strlen($val)) == 0) {
244  $this->setAlert($lng->txt("msg_input_is_required"));
245  return false;
246  }
247  }
248  } else {
249  if ($this->getRequired()) {
250  $this->setAlert($lng->txt("msg_input_is_required"));
251  return false;
252  }
253  }
254  } else {
255  if ($this->getRequired()) {
256  $this->setAlert($lng->txt("msg_input_is_required"));
257  return false;
258  }
259  }
260  return $this->checkSubItemsInput();
261  }
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
+ Here is the call graph for this function:

◆ getAllowMove()

ilKVPWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

Definition at line 215 of file class.ilKVPWizardInputGUI.php.

References $allowMove.

Referenced by insert().

215  : bool
216  {
217  return $this->allowMove;
218  }
+ Here is the caller graph for this function:

◆ getKeyMaxlength()

ilKVPWizardInputGUI::getKeyMaxlength ( )

Get key maxlength.

Returns
integer Key maxlength

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

References $key_maxlength.

Referenced by insert().

115  : int
116  {
117  return $this->key_maxlength;
118  }
+ Here is the caller graph for this function:

◆ getKeyName()

ilKVPWizardInputGUI::getKeyName ( )

Get key name.

Returns
string value name

Definition at line 175 of file class.ilKVPWizardInputGUI.php.

References $key_name.

Referenced by insert().

175  : string
176  {
177  return $this->key_name;
178  }
+ Here is the caller graph for this function:

◆ getKeySize()

ilKVPWizardInputGUI::getKeySize ( )

Get key size.

Returns
integer Key size

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

References $key_size.

Referenced by insert().

75  : int
76  {
77  return $this->key_size;
78  }
+ Here is the caller graph for this function:

◆ getValueMaxlength()

ilKVPWizardInputGUI::getValueMaxlength ( )

Get value maxlength.

Returns
integer value maxlength

Definition at line 135 of file class.ilKVPWizardInputGUI.php.

References $value_maxlength.

Referenced by insert().

135  : int
136  {
137  return $this->value_maxlength;
138  }
+ Here is the caller graph for this function:

◆ getValueName()

ilKVPWizardInputGUI::getValueName ( )

Get value name.

Returns
string value name

Definition at line 155 of file class.ilKVPWizardInputGUI.php.

References $value_name.

Referenced by insert().

155  : string
156  {
157  return $this->value_name;
158  }
+ Here is the caller graph for this function:

◆ getValues()

ilKVPWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

Definition at line 195 of file class.ilKVPWizardInputGUI.php.

References $values.

195  : array
196  {
197  return $this->values;
198  }

◆ getValueSize()

ilKVPWizardInputGUI::getValueSize ( )

Get value size.

Returns
integer value size

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

References $value_size.

Referenced by insert().

95  : int
96  {
97  return $this->value_size;
98  }
+ Here is the caller graph for this function:

◆ insert()

ilKVPWizardInputGUI::insert ( ilTemplate  $a_tpl)

Insert property html.

Returns
void Size

Definition at line 267 of file class.ilKVPWizardInputGUI.php.

References $DIC, $i, ilFormPropertyGUI\$lng, $tpl, ilTextInputGUI\$value, ilGlyphGUI\ADD, ilGlyphGUI\DOWN, ilGlyphGUI\get(), getAllowMove(), ilFormPropertyGUI\getFieldId(), getKeyMaxlength(), getKeyName(), getKeySize(), ilFormPropertyGUI\getPostVar(), getValueMaxlength(), getValueName(), getValueSize(), ilTemplate\parseCurrentBlock(), ilLegacyFormElementsUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilGlyphGUI\UP.

267  : void
268  {
269  global $DIC;
270  $lng = $DIC['lng'];
271 
272  $tpl = new ilTemplate("tpl.prop_kvpwizardinput.html", true, true, "Modules/TestQuestionPool");
273  $i = 0;
274  foreach ($this->values as $value) {
275  if (is_array($value)) {
276  $tpl->setCurrentBlock("prop_key_propval");
277  $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value[0]));
278  $tpl->parseCurrentBlock();
279  $tpl->setCurrentBlock("prop_value_propval");
280  $tpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value[1]));
281  $tpl->parseCurrentBlock();
282  }
283  if ($this->getAllowMove()) {
284  $tpl->setCurrentBlock("move");
285  $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
286  $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
287  $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
288  $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
289  $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
290  $tpl->parseCurrentBlock();
291  }
292 
293  $tpl->setCurrentBlock("row");
294  $class = ($i % 2 == 0) ? "even" : "odd";
295  if ($i == 0) {
296  $class .= " first";
297  }
298  if ($i == count($this->values) - 1) {
299  $class .= " last";
300  }
301  $tpl->setVariable("ROW_CLASS", $class);
302  $tpl->setVariable("ROW_NUMBER", $i);
303 
304  $tpl->setVariable("KEY_SIZE", $this->getKeySize());
305  $tpl->setVariable("KEY_ID", $this->getPostVar() . "[key][$i]");
306  $tpl->setVariable("KEY_MAXLENGTH", $this->getKeyMaxlength());
307 
308  $tpl->setVariable("VALUE_SIZE", $this->getValueSize());
309  $tpl->setVariable("VALUE_ID", $this->getPostVar() . "[value][$i]");
310  $tpl->setVariable("VALUE_MAXLENGTH", $this->getValueMaxlength());
311 
312  $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
313  $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
314  $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
315  $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
316  $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
317 
318  $tpl->setVariable("POST_VAR", $this->getPostVar());
319 
320  $tpl->parseCurrentBlock();
321 
322  $i++;
323  }
324  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
325  $tpl->setVariable("KEY_TEXT", $this->getKeyName());
326  $tpl->setVariable("VALUE_TEXT", $this->getValueName());
327 
328  $a_tpl->setCurrentBlock("prop_generic");
329  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
330  $a_tpl->parseCurrentBlock();
331 
332  global $DIC;
333  $tpl = $DIC['tpl'];
334  $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
335  $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/kvpwizard.js");
336  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static get(string $a_glyph, string $a_text="")
getKeyMaxlength()
Get key maxlength.
static prepareFormOutput($a_str, bool $a_strip=false)
global $DIC
Definition: feed.php:28
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
getValueMaxlength()
Get value maxlength.
setCurrentBlock(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
+ Here is the call graph for this function:

◆ setAllowMove()

ilKVPWizardInputGUI::setAllowMove (   $a_allow_move)

Set allow move.

Parameters
boolean$a_allow_moveAllow move

Definition at line 205 of file class.ilKVPWizardInputGUI.php.

205  : void
206  {
207  $this->allowMove = $a_allow_move;
208  }

◆ setKeyMaxlength()

ilKVPWizardInputGUI::setKeyMaxlength (   $a_maxlength)

Set key maxlength.

Parameters
integer$a_sizeKey maxlength

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

105  : void
106  {
107  $this->key_maxlength = $a_maxlength;
108  }

◆ setKeyName()

ilKVPWizardInputGUI::setKeyName (   $a_name)

Set key name.

Parameters
string$a_namevalue name

Definition at line 165 of file class.ilKVPWizardInputGUI.php.

165  : void
166  {
167  $this->key_name = $a_name;
168  }

◆ setKeySize()

ilKVPWizardInputGUI::setKeySize (   $a_size)

Set key size.

Parameters
integer$a_sizeKey size

Definition at line 65 of file class.ilKVPWizardInputGUI.php.

65  : void
66  {
67  $this->key_size = $a_size;
68  }

◆ setValue()

ilKVPWizardInputGUI::setValue (   $a_value)

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

References ILIAS\LTI\ToolProvider\$key.

48  : void
49  {
50  $this->values = array();
51  if (is_array($a_value)) {
52  if (is_array($a_value['key'])) {
53  foreach ($a_value['key'] as $idx => $key) {
54  array_push($this->values, array($key, $a_value['value'][$idx]));
55  }
56  }
57  }
58  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ setValueMaxlength()

ilKVPWizardInputGUI::setValueMaxlength (   $a_maxlength)

Set value maxlength.

Parameters
integer$a_sizevalue maxlength

Definition at line 125 of file class.ilKVPWizardInputGUI.php.

125  : void
126  {
127  $this->value_maxlength = $a_maxlength;
128  }

◆ setValueName()

ilKVPWizardInputGUI::setValueName (   $a_name)

Set value name.

Parameters
string$a_namevalue name

Definition at line 145 of file class.ilKVPWizardInputGUI.php.

145  : void
146  {
147  $this->value_name = $a_name;
148  }

◆ setValues()

ilKVPWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

Definition at line 185 of file class.ilKVPWizardInputGUI.php.

185  : void
186  {
187  $this->values = $a_values;
188  }

◆ setValueSize()

ilKVPWizardInputGUI::setValueSize (   $a_size)

Set value size.

Parameters
integer$a_sizevalue size

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

85  : void
86  {
87  $this->value_size = $a_size;
88  }

Field Documentation

◆ $allowMove

ilKVPWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $key_maxlength

ilKVPWizardInputGUI::$key_maxlength = 255
protected

Definition at line 32 of file class.ilKVPWizardInputGUI.php.

Referenced by getKeyMaxlength().

◆ $key_name

ilKVPWizardInputGUI::$key_name = ""
protected

Definition at line 34 of file class.ilKVPWizardInputGUI.php.

Referenced by getKeyName().

◆ $key_size

ilKVPWizardInputGUI::$key_size = 20
protected

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

Referenced by getKeySize().

◆ $value_maxlength

ilKVPWizardInputGUI::$value_maxlength = 255
protected

Definition at line 33 of file class.ilKVPWizardInputGUI.php.

Referenced by getValueMaxlength().

◆ $value_name

ilKVPWizardInputGUI::$value_name = ""
protected

Definition at line 35 of file class.ilKVPWizardInputGUI.php.

Referenced by getValueName().

◆ $value_size

ilKVPWizardInputGUI::$value_size = 20
protected

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

Referenced by getValueSize().

◆ $values

ilKVPWizardInputGUI::$values = array()
protected

Definition at line 28 of file class.ilKVPWizardInputGUI.php.

Referenced by getValues().


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