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

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 addOption (string $a_value, string $a_text, string $a_html="")
 
 getOptions ()
 
 setValue (string $a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 
 checkInput ()
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
 getOnloadCode ()
 
- 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...
 

Protected Member Functions

 getAdvSelection ()
 
- 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)
 

Protected Attributes

array $options = array()
 
string $value = ""
 
- 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...
 

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 an advanced selection list property in a property form. It can hold graphical selection items, uses javascript and falls back to a normal selection list, when javascript is disabled.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvSelectInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setType().

36  {
37  global $DIC;
38 
39  $this->lng = $DIC->language();
40  parent::__construct($a_title, $a_postvar);
41  $this->setType("advselect");
42  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addOption()

ilAdvSelectInputGUI::addOption ( string  $a_value,
string  $a_text,
string  $a_html = "" 
)

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

48  : void {
49  $this->options[$a_value] = array("value" => $a_value,
50  "txt" => $a_text, "html" => $a_html);
51  }

◆ checkInput()

ilAdvSelectInputGUI::checkInput ( )

Definition at line 73 of file class.ilAdvSelectInputGUI.php.

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), ilFormPropertyGUI\str(), and ilLanguage\txt().

73  : bool
74  {
75  $lng = $this->lng;
76 
77  if ($this->getRequired() && trim($this->str($this->getPostVar())) == "") {
78  $this->setAlert($lng->txt("msg_input_is_required"));
79  return false;
80  }
81  return true;
82  }
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...
+ Here is the call graph for this function:

◆ getAdvSelection()

ilAdvSelectInputGUI::getAdvSelection ( )
protected

Definition at line 89 of file class.ilAdvSelectInputGUI.php.

References ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, getOptions(), ilFormPropertyGUI\getPostVar(), getValue(), and ilAdvancedSelectionListGUI\ON_ITEM_CLICK_FORM_SELECT.

Referenced by getOnloadCode(), and insert().

90  {
91  $selection = new ilAdvancedSelectionListGUI();
92  $selection->setFormSelectMode(
93  $this->getPostVar(),
94  "",
95  false,
96  "",
97  "",
98  "",
99  ""
100  );
101  $selection->setId($this->getPostVar());
102  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
103  $selection->setSelectedValue($this->getValue());
104  $selection->setUseImages(false);
105  $selection->setOnClickMode(ilAdvancedSelectionListGUI::ON_ITEM_CLICK_FORM_SELECT);
106 
107  foreach ($this->getOptions() as $option) {
108  $selection->addItem(
109  $option["txt"],
110  $option["value"],
111  "",
112  "",
113  $option["value"],
114  "",
115  $option["html"]
116  );
117  if ($this->getValue() == $option["value"]) {
118  $selection->setListTitle($option["txt"]);
119  }
120  }
121  return $selection;
122  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInput()

ilAdvSelectInputGUI::getInput ( )

Definition at line 84 of file class.ilAdvSelectInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and ilFormPropertyGUI\str().

84  : string
85  {
86  return $this->str($this->getPostVar());
87  }
+ Here is the call graph for this function:

◆ getOnloadCode()

ilAdvSelectInputGUI::getOnloadCode ( )

Definition at line 132 of file class.ilAdvSelectInputGUI.php.

References getAdvSelection().

132  : array
133  {
134  return $this->getAdvSelection()->getOnloadCode();
135  }
+ Here is the call graph for this function:

◆ getOptions()

ilAdvSelectInputGUI::getOptions ( )

Definition at line 53 of file class.ilAdvSelectInputGUI.php.

References $options.

Referenced by getAdvSelection().

53  : array
54  {
55  return $this->options;
56  }
+ Here is the caller graph for this function:

◆ getValue()

ilAdvSelectInputGUI::getValue ( )

Definition at line 63 of file class.ilAdvSelectInputGUI.php.

References $value.

Referenced by getAdvSelection().

63  : string
64  {
65  return $this->value;
66  }
+ Here is the caller graph for this function:

◆ insert()

ilAdvSelectInputGUI::insert ( ilTemplate  $a_tpl)

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

References getAdvSelection(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

124  : void
125  {
126  $selection = $this->getAdvSelection();
127  $a_tpl->setCurrentBlock("prop_generic");
128  $a_tpl->setVariable("PROP_GENERIC", $selection->getHTML());
129  $a_tpl->parseCurrentBlock();
130  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ setValue()

ilAdvSelectInputGUI::setValue ( string  $a_value)

Definition at line 58 of file class.ilAdvSelectInputGUI.php.

Referenced by setValueByArray().

58  : void
59  {
60  $this->value = $a_value;
61  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilAdvSelectInputGUI::setValueByArray ( array  $a_values)

Definition at line 68 of file class.ilAdvSelectInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and setValue().

68  : void
69  {
70  $this->setValue($a_values[$this->getPostVar()] ?? "");
71  }
+ Here is the call graph for this function:

Field Documentation

◆ $options

array ilAdvSelectInputGUI::$options = array()
protected

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

Referenced by getOptions().

◆ $value

string ilAdvSelectInputGUI::$value = ""
protected

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

Referenced by getValue().


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