ILIAS  release_4-4 Revision
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 addOption ($a_option)
 Add Option. More...
 
 getOptions ()
 Get Options. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 insert (&$a_tpl)
 Insert property html. More...
 
 render ()
 Insert property html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
- 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...
 

Protected Attributes

 $options = array()
 
 $value
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- 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 property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References ilFormPropertyGUI\setType().

45  {
46  parent::__construct($a_title, $a_postvar);
47  $this->setType("radio");
48  }
setType($a_type)
Set Type.
+ 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.

Returns
boolean Input ok, true/false

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

References $_POST, $lng, $ok, getOptions(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

113  {
114  global $lng;
115 
116  $_POST[$this->getPostVar()] =
118  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
119  {
120  $this->setAlert($lng->txt("msg_input_is_required"));
121 
122  return false;
123  }
124 
125  $ok = true;
126  foreach($this->getOptions() as $option)
127  {
128  foreach($option->getSubItems() as $item)
129  {
130  $item_ok = $item->checkInput();
131  if (!$item_ok && ($_POST[$this->getPostVar()] == $option->getValue()))
132  {
133  $ok = false;
134  }
135  }
136  }
137  return $ok;
138  }
$_POST['username']
Definition: cron.php:12
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ getItemByPostVar()

ilRadioGroupInputGUI::getItemByPostVar (   $a_post_var)

Get item by post var.

Returns
mixed false or item object

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

References $ret, getOptions(), and ilFormPropertyGUI\getPostVar().

237  {
238  if ($this->getPostVar() == $a_post_var)
239  {
240  return $this;
241  }
242 
243  foreach($this->getOptions() as $option)
244  {
245  foreach($option->getSubItems() as $item)
246  {
247  if ($item->getType() != "section_header")
248  {
249  $ret = $item->getItemByPostVar($a_post_var);
250  if (is_object($ret))
251  {
252  return $ret;
253  }
254  }
255  }
256  }
257 
258  return false;
259  }
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:

◆ getOptions()

ilRadioGroupInputGUI::getOptions ( )

Get Options.

Returns
array Array of RadioOption objects

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

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.

Returns
string

Implements ilTableFilterItem.

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

References render().

262  {
263  return $this->render();
264  }
render()
Insert property html.
+ Here is the call graph for this function:

◆ getValue()

ilRadioGroupInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by render().

+ Here is the caller graph for this function:

◆ insert()

ilRadioGroupInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

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

References render().

146  {
147  $html = $this->render();
148 
149  $a_tpl->setCurrentBlock("prop_generic");
150  $a_tpl->setVariable("PROP_GENERIC", $html);
151  $a_tpl->parseCurrentBlock();
152  }
render()
Insert property html.
+ Here is the call graph for this function:

◆ render()

ilRadioGroupInputGUI::render ( )

Insert property html.

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

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

Referenced by getTableFilterHTML(), and insert().

158  {
159  $tpl = new ilTemplate("tpl.prop_radio.html", true, true, "Services/Form");
160 
161  foreach($this->getOptions() as $option)
162  {
163  // information text for option
164  if ($option->getInfo() != "")
165  {
166  $tpl->setCurrentBlock("radio_option_desc");
167  $tpl->setVariable("RADIO_OPTION_DESC", $option->getInfo());
168  $tpl->parseCurrentBlock();
169  }
170 
171 
172  if (count($option->getSubItems()) > 0)
173  {
174  if ($option->getValue() != $this->getValue())
175  {
176  // #10930
177  $tpl->setCurrentBlock("prop_radio_opt_hide");
178  $tpl->setVariable("HOP_ID", $this->getFieldId()."_".$option->getValue());
179  $tpl->parseCurrentBlock();
180  }
181  $tpl->setCurrentBlock("radio_option_subform");
182  $pf = new ilPropertyFormGUI();
183  $pf->setMode("subform");
184  $pf->setItems($option->getSubItems());
185  $tpl->setVariable("SUB_FORM", $pf->getContent());
186  $tpl->setVariable("SOP_ID", $this->getFieldId()."_".$option->getValue());
187  if ($pf->getMultipart())
188  {
189  $this->getParentForm()->setMultipart(true);
190  }
191  $tpl->parseCurrentBlock();
192  if ($pf->getMultipart())
193  {
194  $this->getParentForm()->setMultipart(true);
195  }
196  }
197 
198  $tpl->setCurrentBlock("prop_radio_option");
199  if (!$this->getDisabled())
200  {
201  $tpl->setVariable("POST_VAR", $this->getPostVar());
202  }
203  $tpl->setVariable("VAL_RADIO_OPTION", $option->getValue());
204  $tpl->setVariable("OP_ID", $this->getFieldId()."_".$option->getValue());
205  $tpl->setVariable("FID", $this->getFieldId());
206  if($this->getDisabled() or $option->getDisabled())
207  {
208  $tpl->setVariable('DISABLED','disabled="disabled" ');
209  }
210  if ($option->getValue() == $this->getValue())
211  {
212  $tpl->setVariable("CHK_RADIO_OPTION",
213  'checked="checked"');
214  }
215  $tpl->setVariable("TXT_RADIO_OPTION", $option->getTitle());
216 
217 
218  $tpl->parseCurrentBlock();
219  }
220  $tpl->setVariable("ID", $this->getFieldId());
221 
222  if ($this->getDisabled())
223  {
224  $tpl->setVariable("HIDDEN_INPUT",
225  $this->getHiddenTag($this->getPostVar(), $this->getValue()));
226  }
227 
228  return $tpl->get();
229  }
getHiddenTag($a_post_var, $a_value)
Get hidden tag (used for disabled properties)
This class represents a property form user interface.
getPostVar()
Get Post Variable.
getParentForm()
Get Parent Form.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

ilRadioGroupInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

Referenced by ilObjRemoteGlossaryGUI\addCustomEditForm(), ilObjRemoteLearningModuleGUI\addCustomEditForm(), ilObjRemoteWikiGUI\addCustomEditForm(), ilObjRemoteCourseGUI\addCustomEditForm(), ilObjRemoteGroupGUI\addCustomEditForm(), ilObjRemoteTestGUI\addCustomEditForm(), ilUserProfile\addStandardFieldsToForm(), ilTestRandomQuestionSetGeneralConfigFormGUI\build(), ilObjTestDynamicQuestionSetConfigGUI\buildForm(), ilObjSystemFolderGUI\checkObject(), ilSetupGUI\displaySessions(), ilPCResourcesGUI\edit(), ilImageMapEditorGUI\initAreaEditingForm(), ilECSSettingsGUI\initCategoryMappingForm(), ilObjPortfolioGUI\initCreateForm(), ilObjectGUI\initDidacticTemplate(), ilObjCourseGUI\initEditForm(), ilAdvancedMDSettingsGUI\initFieldForm(), ilPCTabsGUI\initForm(), ilObjUserGUI\initForm(), ilObjGroupGUI\initForm(), ilCalendarCategoryGUI\initFormCategory(), ilConditionHandlerInterface\initFormCondition(), ilAuthShibbolethSettingsGUI\initFormRoleAssignment(), ilRepositorySearchGUI\initFormSearch(), ilCalendarCategoryGUI\initFormSearch(), ilObjSearchSettingsGUI\initFormSettings(), ilObjCalendarSettingsGUI\initFormSettings(), ilContainerReferenceGUI\initFormTitle(), ilWikiPageGUI\initPrintViewSelectionForm(), ilGlossaryPresentationGUI\initPrintViewSelectionForm(), ilLMPresentationGUI\initPrintViewSelectionForm(), ilObjSurveyGUI\initPropertiesForm(), ilPersonalProfileGUI\initPublicProfileForm(), ilSetupGUI\initRegistrationForm(), ilObjRepositorySettingsGUI\initSettingsForm(), ilCalendarUserSettingsGUI\initSettingsForm(), ilObjiLincClassroomGUI\initSettingsForm(), ilECSSettingsGUI\initSettingsForm(), ilObjGlossaryGUI\initSettingsForm(), ilSearchBaseGUI\initStandardSearchForm(), ilObjSAHSLearningModuleGUI\initUploadForm(), assImagemapQuestionGUI\populateQuestionSpecificFormPart(), ilStartUpGUI\purgePlaceholders(), setValueByArray(), ilObjRoleGUI\showChangeExistingObjectsConfirmation(), and ilConditionHandlerInterface\showObligatoryForm().

76  {
77  $this->value = $a_value;
78  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilRadioGroupInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

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

96  {
97  $this->setValue($a_values[$this->getPostVar()]);
98  foreach($this->getOptions() as $option)
99  {
100  foreach($option->getSubItems() as $item)
101  {
102  $item->setValueByArray($a_values);
103  }
104  }
105  }
getPostVar()
Get Post Variable.
+ Here is the call graph for this function:

Field Documentation

◆ $options

ilRadioGroupInputGUI::$options = array()
protected

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

Referenced by getOptions().

◆ $value

ilRadioGroupInputGUI::$value
protected

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

Referenced by getValue().


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