ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 ()
 
 getInput ()
 
 insert (ilTemplate $a_tpl)
 
 render ()
 
 getItemByPostVar (string $a_post_var)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 getFormLabelFor ()
 
- 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

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
 symbol ()
 
 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
Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ addOption()

◆ checkInput()

ilRadioGroupInputGUI::checkInput ( )

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

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

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

◆ getFormLabelFor()

ilRadioGroupInputGUI::getFormLabelFor ( )

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

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

◆ getInput()

ilRadioGroupInputGUI::getInput ( )

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

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

Referenced by checkInput().

97  : string
98  {
99  return $this->str($this->getPostVar());
100  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemByPostVar()

ilRadioGroupInputGUI::getItemByPostVar ( string  $a_post_var)

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

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

192  {
193  if ($this->getPostVar() == $a_post_var) {
194  return $this;
195  }
196 
197  foreach ($this->getOptions() as $option) {
198  foreach ($option->getSubItems() as $item) {
199  if ($item->getType() != "section_header") {
200  $ret = $item->getItemByPostVar($a_post_var);
201  if (is_object($ret)) {
202  return $ret;
203  }
204  }
205  }
206  }
207 
208  return null;
209  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getOptions()

ilRadioGroupInputGUI::getOptions ( )

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

References $options.

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

48  : array
49  {
50  return $this->options;
51  }
+ 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 211 of file class.ilRadioGroupInputGUI.php.

References getOptions(), ilSubEnabledFormPropertyGUI\getSubInputItemsRecursive(), and render().

211  : string
212  {
213  return $this->render();
214  }
+ Here is the call graph for this function:

◆ getValue()

ilRadioGroupInputGUI::getValue ( )

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

References $value.

Referenced by ilAdvancedMDFieldDefinitionSelect\addEditOptionsFieldsToDefinitionForm(), and render().

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

◆ insert()

ilRadioGroupInputGUI::insert ( ilTemplate  $a_tpl)

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

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

102  : void
103  {
104  $html = $this->render();
105 
106  $a_tpl->setCurrentBlock("prop_generic");
107  $a_tpl->setVariable("PROP_GENERIC", $html);
108  $a_tpl->parseCurrentBlock();
109  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ render()

ilRadioGroupInputGUI::render ( )

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

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

Referenced by getTableFilterHTML(), and insert().

111  : string
112  {
113  $tpl = new ilTemplate("tpl.prop_radio.html", true, true, "components/ILIAS/Form");
114 
115  foreach ($this->getOptions() as $option) {
116  // information text for option
117  if ($option->getInfo() != "") {
118  $tpl->setCurrentBlock("radio_option_desc");
119  $tpl->setVariable("RADIO_OPTION_DESC", $option->getInfo());
120  if ($option->getInfo() !== '') {
121  $tpl->setVariable('DESCRIPTION_FOR_ID', $this->getFieldId() . "_" . $option->getValue());
122  }
123  $tpl->parseCurrentBlock();
124  }
125 
126 
127  if (count($option->getSubItems()) > 0) {
128  if ($option->getValue() != $this->getValue()) {
129  // #10930
130  if ($this->global_tpl) {
131  $hop_id = $this->getFieldId() . "_" . $option->getValue();
132  $this->global_tpl->addOnloadCode(
133  "il.Form.hideSubForm('subform_$hop_id');"
134  );
135  }
136  if ($this->getParentForm()) {
137  $this->getParentForm()->addAsyncOnloadCode(
138  "il.Form.hideSubForm('subform_$hop_id');"
139  );
140  }
141  }
142  $tpl->setCurrentBlock("radio_option_subform");
143  $pf = new ilPropertyFormGUI();
144  $pf->setMode("subform");
145  $pf->setItems($option->getSubItems());
146  $tpl->setVariable("SUB_FORM", $pf->getContent());
147  $tpl->setVariable("SOP_ID", $this->getFieldId() . "_" . $option->getValue());
148  if ($pf->getMultipart()) {
149  $this->getParentForm()->setMultipart(true);
150  }
151  $tpl->parseCurrentBlock();
152  if ($pf->getMultipart()) {
153  $this->getParentForm()->setMultipart(true);
154  }
155  }
156 
157  $tpl->setCurrentBlock("prop_radio_option");
158  $tpl->setVariable("POST_VAR", $this->getPostVar());
159  $tpl->setVariable("VAL_RADIO_OPTION", $option->getValue());
160  $tpl->setVariable("OP_ID", $this->getFieldId() . "_" . $option->getValue());
161  if ($option->getInfo() !== '') {
162  $tpl->setVariable('DESCRIBED_BY_FIELD_ID', $this->getFieldId() . "_" . $option->getValue());
163  }
164  $tpl->setVariable("FID", $this->getFieldId());
165  if ($this->getDisabled() or $option->getDisabled()) {
166  $tpl->setVariable('DISABLED', 'disabled="disabled" ');
167  }
168  if ($option->getValue() == $this->getValue()) {
169  $tpl->setVariable(
170  "CHK_RADIO_OPTION",
171  'checked="checked"'
172  );
173  }
174  $tpl->setVariable("TXT_RADIO_OPTION", $option->getTitle());
175 
176 
177  $tpl->parseCurrentBlock();
178  }
179  $tpl->setVariable("ID", $this->getFieldId());
180 
181  if ($this->getDisabled()) {
182  $tpl->setVariable(
183  "HIDDEN_INPUT",
184  $this->getHiddenTag($this->getPostVar(), $this->getValue())
185  );
186  }
187 
188  return $tpl->get();
189  }
getHiddenTag(string $a_post_var, string $a_value)
+ 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 53 of file class.ilRadioGroupInputGUI.php.

Referenced by ilObjRemoteGlossaryGUI\addCustomEditForm(), ilObjRemoteLearningModuleGUI\addCustomEditForm(), ilObjRemoteWikiGUI\addCustomEditForm(), ilObjRemoteGroupGUI\addCustomEditForm(), ilObjRemoteTestGUI\addCustomEditForm(), ilObjRemoteCourseGUI\addCustomEditForm(), ilTestRandomQuestionSetGeneralConfigFormGUI\build(), ilECSMappingSettingsGUI\cInitMappingForm(), ilExSubmissionTeamGUI\getAdoptForm(), ilUserStartingPointGUI\getCreateFormSpecificInputs(), ilUserProfile\getRadioInput(), ilImageMapEditorGUI\initAreaEditingForm(), ilExAssignmentEditorGUI\initAssignmentForm(), ilECSSettingsGUI\initCategoryMappingForm(), ilPCGridGUI\initCreationForm(), ilObjCourseGUI\initEditForm(), ilLTIConsumeProviderFormGUI\initForm(), ilObjNotificationSettingsGUI\initForm(), ilPCResourcesGUI\initForm(), ilPCLearningHistoryGUI\initForm(), ilPCTabsGUI\initForm(), ilContainerReferenceGUI\initForm(), ilObjUserGUI\initForm(), ilObjSessionGUI\initForm(), ilObjGroupGUI\initForm(), ilCalendarCategoryGUI\initFormCategory(), ilConditionHandlerGUI\initFormCondition(), ilCourseObjectivesGUI\initFormRandom(), ilAuthShibbolethSettingsGUI\initFormRoleAssignment(), ilRepositorySearchGUI\initFormSearch(), ilObjCalendarSettingsGUI\initFormSettings(), ilContainerGUI\initManualSortingOptionForm(), ilCmiXapiLP\initModeOptions(), ilGlossaryPresentationGUI\initPrintViewSelectionForm(), ilLMPresentationGUI\initPrintViewSelectionForm(), ilObjContentObjectGUI\initPropertiesForm(), ilCalendarUserSettingsGUI\initSettingsForm(), ilOpenIdConnectSettingsGUI\initSettingsForm(), ilECSSettingsGUI\initSettingsForm(), ilLOEditorGUI\initSettingsForm(), ilSearchBaseGUI\initStandardSearchForm(), ilLTIConsumeProviderFormGUI\initToolConfigForm(), assImagemapQuestionGUI\populateQuestionSpecificFormPart(), setValueByArray(), ilObjRoleGUI\showChangeExistingObjectsConfirmation(), and ilConditionHandlerGUI\showObligatoryForm().

53  : void
54  {
55  $this->value = $a_value;
56  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilRadioGroupInputGUI::setValueByArray ( array  $a_values)

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

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

63  : void
64  {
65  $this->setValue((string) ($a_values[$this->getPostVar()] ?? ""));
66  foreach ($this->getOptions() as $option) {
67  foreach ($option->getSubItems() as $item) {
68  $item->setValueByArray($a_values);
69  }
70  }
71  }
+ Here is the call graph for this function:

Field Documentation

◆ $options

array ilRadioGroupInputGUI::$options = array()
protected

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

Referenced by getOptions().

◆ $value

string ilRadioGroupInputGUI::$value = ""
protected

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

Referenced by getValue().


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