ILIAS  release_7 Revision v7.30-3-g800a261c036
ilKVPWizardInputGUI Class Reference

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

+ Inheritance diagram for ilKVPWizardInputGUI:
+ Collaboration diagram for ilKVPWizardInputGUI:

Public Member Functions

 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 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 ($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...
 
 stripSlashesAddSpaceFallback ($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...
 
- 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

 $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
 
 $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
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- 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.ilKVPWizardInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

Reimplemented from ilTextInputGUI.

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

31 {
32 parent::__construct($a_title, $a_postvar);
33 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ 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

Reimplemented from ilTextInputGUI.

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

218 {
219 global $DIC;
220 $lng = $DIC['lng'];
221
222 if (is_array($_POST[$this->getPostVar()])) {
224 }
225 $foundvalues = $_POST[$this->getPostVar()];
226 if (is_array($foundvalues)) {
227 // check answers
228 if (is_array($foundvalues['key']) && is_array($foundvalues['value'])) {
229 foreach ($foundvalues['key'] as $val) {
230 if ($this->getRequired() && (strlen($val)) == 0) {
231 $this->setAlert($lng->txt("msg_input_is_required"));
232 return false;
233 }
234 }
235 foreach ($foundvalues['value'] as $val) {
236 if ($this->getRequired() && (strlen($val)) == 0) {
237 $this->setAlert($lng->txt("msg_input_is_required"));
238 return false;
239 }
240 }
241 } else {
242 if ($this->getRequired()) {
243 $this->setAlert($lng->txt("msg_input_is_required"));
244 return false;
245 }
246 }
247 } else {
248 if ($this->getRequired()) {
249 $this->setAlert($lng->txt("msg_input_is_required"));
250 return false;
251 }
252 }
253 return $this->checkSubItemsInput();
254 }
$_POST["username"]
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.
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

◆ getAllowMove()

ilKVPWizardInputGUI::getAllowMove ( )

Get allow move.

Returns
boolean Allow move

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

References $allowMove.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getKeyMaxlength()

ilKVPWizardInputGUI::getKeyMaxlength ( )

Get key maxlength.

Returns
integer Key maxlength

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

References $key_maxlength.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getKeyName()

ilKVPWizardInputGUI::getKeyName ( )

Get key name.

Returns
string value name

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

References $key_name.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getKeySize()

ilKVPWizardInputGUI::getKeySize ( )

Get key size.

Returns
integer Key size

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

References $key_size.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getValueMaxlength()

ilKVPWizardInputGUI::getValueMaxlength ( )

Get value maxlength.

Returns
integer value maxlength

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

References $value_maxlength.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getValueName()

ilKVPWizardInputGUI::getValueName ( )

Get value name.

Returns
string value name

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

References $value_name.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getValues()

ilKVPWizardInputGUI::getValues ( )

Get Values.

Returns
array Values

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

References $values.

◆ getValueSize()

ilKVPWizardInputGUI::getValueSize ( )

Get value size.

Returns
integer value size

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

References $value_size.

Referenced by insert().

+ Here is the caller graph for this function:

◆ insert()

ilKVPWizardInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

Reimplemented from ilTextInputGUI.

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

262 {
263 global $DIC;
264 $lng = $DIC['lng'];
265
266 $tpl = new ilTemplate("tpl.prop_kvpwizardinput.html", true, true, "Modules/TestQuestionPool");
267 $i = 0;
268 foreach ($this->values as $value) {
269 if (is_array($value)) {
270 $tpl->setCurrentBlock("prop_key_propval");
271 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value[0]));
272 $tpl->parseCurrentBlock();
273 $tpl->setCurrentBlock("prop_value_propval");
274 $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value[1]));
275 $tpl->parseCurrentBlock();
276 }
277 if ($this->getAllowMove()) {
278 $tpl->setCurrentBlock("move");
279 $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][$i]");
280 $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][$i]");
281 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
282 $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP));
283 $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN));
284 $tpl->parseCurrentBlock();
285 }
286
287 $tpl->setCurrentBlock("row");
288 $class = ($i % 2 == 0) ? "even" : "odd";
289 if ($i == 0) {
290 $class .= " first";
291 }
292 if ($i == count($this->values) - 1) {
293 $class .= " last";
294 }
295 $tpl->setVariable("ROW_CLASS", $class);
296 $tpl->setVariable("ROW_NUMBER", $i);
297
298 $tpl->setVariable("KEY_SIZE", $this->getKeySize());
299 $tpl->setVariable("KEY_ID", $this->getPostVar() . "[key][$i]");
300 $tpl->setVariable("KEY_MAXLENGTH", $this->getKeyMaxlength());
301
302 $tpl->setVariable("VALUE_SIZE", $this->getValueSize());
303 $tpl->setVariable("VALUE_ID", $this->getPostVar() . "[value][$i]");
304 $tpl->setVariable("VALUE_MAXLENGTH", $this->getValueMaxlength());
305
306 $tpl->setVariable("ID", $this->getPostVar() . "[$i]");
307 $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][$i]");
308 $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][$i]");
309 $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD));
310 $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE));
311
312 $tpl->setVariable("POST_VAR", $this->getPostVar());
313
314 $tpl->parseCurrentBlock();
315
316 $i++;
317 }
318 $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
319 $tpl->setVariable("KEY_TEXT", $this->getKeyName());
320 $tpl->setVariable("VALUE_TEXT", $this->getValueName());
321
322 $a_tpl->setCurrentBlock("prop_generic");
323 $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
324 $a_tpl->parseCurrentBlock();
325
326 global $DIC;
327 $tpl = $DIC['tpl'];
328 $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js");
329 $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/kvpwizard.js");
330 }
getFieldId()
Get Post Variable.
static get($a_glyph, $a_text="")
Get glyph html.
getValueMaxlength()
Get value maxlength.
getKeyMaxlength()
Get key maxlength.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:24

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(), ilUtil\prepareFormOutput(), ilGlyphGUI\REMOVE, and ilGlyphGUI\UP.

+ 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 197 of file class.ilKVPWizardInputGUI.php.

198 {
199 $this->allowMove = $a_allow_move;
200 }

◆ setKeyMaxlength()

ilKVPWizardInputGUI::setKeyMaxlength (   $a_maxlength)

Set key maxlength.

Parameters
integer$a_sizeKey maxlength

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

98 {
99 $this->key_maxlength = $a_maxlength;
100 }

◆ setKeyName()

ilKVPWizardInputGUI::setKeyName (   $a_name)

Set key name.

Parameters
string$a_namevalue name

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

158 {
159 $this->key_name = $a_name;
160 }

◆ setKeySize()

ilKVPWizardInputGUI::setKeySize (   $a_size)

Set key size.

Parameters
integer$a_sizeKey size

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

58 {
59 $this->key_size = $a_size;
60 }

◆ setValue()

ilKVPWizardInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

Reimplemented from ilTextInputGUI.

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

41 {
42 $this->values = array();
43 if (is_array($a_value)) {
44 if (is_array($a_value['key'])) {
45 foreach ($a_value['key'] as $idx => $key) {
46 array_push($this->values, array($key, $a_value['value'][$idx]));
47 }
48 }
49 }
50 }

◆ setValueMaxlength()

ilKVPWizardInputGUI::setValueMaxlength (   $a_maxlength)

Set value maxlength.

Parameters
integer$a_sizevalue maxlength

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

118 {
119 $this->value_maxlength = $a_maxlength;
120 }

◆ setValueName()

ilKVPWizardInputGUI::setValueName (   $a_name)

Set value name.

Parameters
string$a_namevalue name

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

138 {
139 $this->value_name = $a_name;
140 }

◆ setValues()

ilKVPWizardInputGUI::setValues (   $a_values)

Set Values.

Parameters
array$a_valueValue

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

178 {
179 $this->values = $a_values;
180 }

◆ setValueSize()

ilKVPWizardInputGUI::setValueSize (   $a_size)

Set value size.

Parameters
integer$a_sizevalue size

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

78 {
79 $this->value_size = $a_size;
80 }

Field Documentation

◆ $allowMove

ilKVPWizardInputGUI::$allowMove = false
protected

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

Referenced by getAllowMove().

◆ $key_maxlength

ilKVPWizardInputGUI::$key_maxlength = 255
protected

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

Referenced by getKeyMaxlength().

◆ $key_name

ilKVPWizardInputGUI::$key_name = ""
protected

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

Referenced by getKeyName().

◆ $key_size

ilKVPWizardInputGUI::$key_size = 20
protected

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

Referenced by getKeySize().

◆ $value_maxlength

ilKVPWizardInputGUI::$value_maxlength = 255
protected

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

Referenced by getValueMaxlength().

◆ $value_name

ilKVPWizardInputGUI::$value_name = ""
protected

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

Referenced by getValueName().

◆ $value_size

ilKVPWizardInputGUI::$value_size = 20
protected

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

Referenced by getValueSize().

◆ $values

ilKVPWizardInputGUI::$values = array()
protected

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

Referenced by getValues().


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