ILIAS  release_8 Revision v8.24
ilRadioGroupInputGUI Class Reference

This class represents a property in a property form. More...

+ Inheritance diagram for ilRadioGroupInputGUI:
+ Collaboration diagram for ilRadioGroupInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 addOption (ilRadioOption $a_option)
 
 getOptions ()
 
 setValue (string $a_value)
 
 getValue ()
 
 setValueByArray (array $a_values)
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
 render ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
- 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...
 

Protected Attributes

array $options = array()
 
string $value = ""
 
- 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 class represents a property in a property form.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

Reimplemented in ilCharSelectorRadioGroupInputGUI.

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

34 {
35 global $DIC;
36
37 $this->lng = $DIC->language();
38 parent::__construct($a_title, $a_postvar);
39 $this->setType("radio");
40 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addOption()

◆ checkInput()

ilRadioGroupInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

Reimplemented in ilIncomingMailInputGUI, and ilCharSelectorRadioGroupInputGUI.

Definition at line 72 of file class.ilRadioGroupInputGUI.php.

72 : bool
73 {
75
76 $val = $this->getInput();
77 if ($this->getRequired() && trim($val) == "") {
78 $this->setAlert($lng->txt("msg_input_is_required"));
79 return false;
80 }
81
82 $ok = true;
83 $value = $this->getInput();
84 foreach ($this->getOptions() as $option) {
85 foreach ($option->getSubItems() as $item) {
86 if ($value == $option->getValue()) {
87 if (!$item->checkInput()) {
88 $ok = false;
89 }
90 }
91 }
92 }
93 return $ok;
94 }
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...

References ilFormPropertyGUI\$lng, $value, getInput(), getOptions(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getFormLabelFor()

ilRadioGroupInputGUI::getFormLabelFor ( )

Get label "for" attribute value for form.

Reimplemented from ilFormPropertyGUI.

Definition at line 228 of file class.ilRadioGroupInputGUI.php.

228 : string
229 {
230 return "";
231 }

◆ getInput()

ilRadioGroupInputGUI::getInput ( )

Definition at line 96 of file class.ilRadioGroupInputGUI.php.

96 : string
97 {
98 return $this->str($this->getPostVar());
99 }

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

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemByPostVar()

ilRadioGroupInputGUI::getItemByPostVar ( string  $a_post_var)

Get item by post var.

Reimplemented from ilSubEnabledFormPropertyGUI.

Reimplemented in ilIncomingMailInputGUI.

Definition at line 190 of file class.ilRadioGroupInputGUI.php.

191 {
192 if ($this->getPostVar() == $a_post_var) {
193 return $this;
194 }
195
196 foreach ($this->getOptions() as $option) {
197 foreach ($option->getSubItems() as $item) {
198 if ($item->getType() != "section_header") {
199 $ret = $item->getItemByPostVar($a_post_var);
200 if (is_object($ret)) {
201 return $ret;
202 }
203 }
204 }
205 }
206
207 return null;
208 }
This class represents a property in a property form.
getItemByPostVar(string $a_post_var)
Get item by post var.

References ilFormPropertyGUI\getItemByPostVar(), getOptions(), and ilFormPropertyGUI\getPostVar().

+ Here is the call graph for this function:

◆ getOptions()

ilRadioGroupInputGUI::getOptions ( )

Reimplemented in ilIncomingMailInputGUI.

Definition at line 47 of file class.ilRadioGroupInputGUI.php.

47 : array
48 {
49 return $this->options;
50 }

References $options.

Referenced by checkInput(), getItemByPostVar(), render(), and setValueByArray().

+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilRadioGroupInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

Definition at line 210 of file class.ilRadioGroupInputGUI.php.

210 : string
211 {
212 return $this->render();
213 }

References render().

+ Here is the call graph for this function:

◆ getValue()

ilRadioGroupInputGUI::getValue ( )

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

57 : string
58 {
59 return $this->value;
60 }

References $value.

Referenced by render().

+ Here is the caller graph for this function:

◆ insert()

ilRadioGroupInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 101 of file class.ilRadioGroupInputGUI.php.

101 : void
102 {
103 $html = $this->render();
104
105 $a_tpl->setCurrentBlock("prop_generic");
106 $a_tpl->setVariable("PROP_GENERIC", $html);
107 $a_tpl->parseCurrentBlock();
108 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

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

+ Here is the call graph for this function:

◆ render()

ilRadioGroupInputGUI::render ( )

Reimplemented in ilIncomingMailInputGUI.

Definition at line 110 of file class.ilRadioGroupInputGUI.php.

110 : string
111 {
112 $tpl = new ilTemplate("tpl.prop_radio.html", true, true, "Services/Form");
113
114 foreach ($this->getOptions() as $option) {
115 // information text for option
116 if ($option->getInfo() != "") {
117 $tpl->setCurrentBlock("radio_option_desc");
118 $tpl->setVariable("RADIO_OPTION_DESC", $option->getInfo());
119 if ($option->getInfo() !== '') {
120 $tpl->setVariable('DESCRIPTION_FOR_ID', $this->getFieldId() . "_" . $option->getValue());
121 }
122 $tpl->parseCurrentBlock();
123 }
124
125
126 if (count($option->getSubItems()) > 0) {
127 if ($option->getValue() != $this->getValue()) {
128 // #10930
129 if ($this->global_tpl) {
130 $hop_id = $this->getFieldId() . "_" . $option->getValue();
131 $this->global_tpl->addOnloadCode(
132 "il.Form.hideSubForm('subform_$hop_id');"
133 );
134 }
135 if ($this->getParentForm()) {
136 $this->getParentForm()->addAsyncOnloadCode(
137 "il.Form.hideSubForm('subform_$hop_id');"
138 );
139 }
140 }
141 $tpl->setCurrentBlock("radio_option_subform");
142 $pf = new ilPropertyFormGUI();
143 $pf->setMode("subform");
144 $pf->setItems($option->getSubItems());
145 $tpl->setVariable("SUB_FORM", $pf->getContent());
146 $tpl->setVariable("SOP_ID", $this->getFieldId() . "_" . $option->getValue());
147 if ($pf->getMultipart()) {
148 $this->getParentForm()->setMultipart(true);
149 }
150 $tpl->parseCurrentBlock();
151 if ($pf->getMultipart()) {
152 $this->getParentForm()->setMultipart(true);
153 }
154 }
155
156 $tpl->setCurrentBlock("prop_radio_option");
157 $tpl->setVariable("POST_VAR", $this->getPostVar());
158 $tpl->setVariable("VAL_RADIO_OPTION", $option->getValue());
159 $tpl->setVariable("OP_ID", $this->getFieldId() . "_" . $option->getValue());
160 if ($option->getInfo() !== '') {
161 $tpl->setVariable('DESCRIBED_BY_FIELD_ID', $this->getFieldId() . "_" . $option->getValue());
162 }
163 $tpl->setVariable("FID", $this->getFieldId());
164 if ($this->getDisabled() or $option->getDisabled()) {
165 $tpl->setVariable('DISABLED', 'disabled="disabled" ');
166 }
167 if ($option->getValue() == $this->getValue()) {
168 $tpl->setVariable(
169 "CHK_RADIO_OPTION",
170 'checked="checked"'
171 );
172 }
173 $tpl->setVariable("TXT_RADIO_OPTION", $option->getTitle());
174
175
176 $tpl->parseCurrentBlock();
177 }
178 $tpl->setVariable("ID", $this->getFieldId());
179
180 if ($this->getDisabled()) {
181 $tpl->setVariable(
182 "HIDDEN_INPUT",
183 $this->getHiddenTag($this->getPostVar(), $this->getValue())
184 );
185 }
186
187 return $tpl->get();
188 }
getHiddenTag(string $a_post_var, string $a_value)
This class represents a property form user interface.
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References $tpl, ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getHiddenTag(), getOptions(), ilFormPropertyGUI\getParentForm(), ilFormPropertyGUI\getPostVar(), and getValue().

Referenced by getTableFilterHTML(), and insert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

ilRadioGroupInputGUI::setValue ( string  $a_value)

Definition at line 52 of file class.ilRadioGroupInputGUI.php.

52 : void
53 {
54 $this->value = $a_value;
55 }

Referenced by ilCmiXapiLP\initModeOptions(), and setValueByArray().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilRadioGroupInputGUI::setValueByArray ( array  $a_values)

Definition at line 62 of file class.ilRadioGroupInputGUI.php.

62 : void
63 {
64 $this->setValue((string) ($a_values[$this->getPostVar()] ?? ""));
65 foreach ($this->getOptions() as $option) {
66 foreach ($option->getSubItems() as $item) {
67 $item->setValueByArray($a_values);
68 }
69 }
70 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $options

array ilRadioGroupInputGUI::$options = array()
protected

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

Referenced by getOptions().

◆ $value

string ilRadioGroupInputGUI::$value = ""
protected

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

Referenced by checkInput(), and getValue().


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