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. | |
| addOption ($a_option) | |
| Add Option. | |
| getOptions () | |
| Get Options. | |
| setValue ($a_value) | |
| Set Value. | |
| getValue () | |
| Get Value. | |
| setValueByArray ($a_values) | |
| Set value by array. | |
| checkInput () | |
| Check input, strip slashes etc. | |
| insert (&$a_tpl) | |
| Insert property html. | |
Protected Attributes | |
| $options = array() | |
| $value | |
This class represents a property in a property form.
Definition at line 33 of file class.ilRadioGroupInputGUI.php.
| ilRadioGroupInputGUI::__construct | ( | $ | a_title = "", |
|
| $ | a_postvar = "" | |||
| ) |
Constructor.
| string | $a_title Title | |
| string | $a_postvar Post Variable |
Reimplemented from ilFormPropertyGUI.
Definition at line 44 of file class.ilRadioGroupInputGUI.php.
References ilFormPropertyGUI::setType().
{
parent::__construct($a_title, $a_postvar);
$this->setType("radio");
}
Here is the call graph for this function:| ilRadioGroupInputGUI::addOption | ( | $ | a_option | ) |
Add Option.
| object | $a_option RadioOption object |
Definition at line 55 of file class.ilRadioGroupInputGUI.php.
Referenced by ilObjNewsSettingsGUI::editSettings(), ilObjMediaCastGUI::initAddCastItemForm(), ilNewsItemGUIGen::initFormNewsItem(), and ilNewsForContextBlockGUI::initSettingsForm().
{
$this->options[] = $a_option;
}
Here is the caller graph for this function:| ilRadioGroupInputGUI::checkInput | ( | ) |
Check input, strip slashes etc.
set alert, if input is not ok.
Reimplemented from ilFormPropertyGUI.
Definition at line 105 of file class.ilRadioGroupInputGUI.php.
References $lng, $ok, getOptions(), ilFormPropertyGUI::getPostVar(), ilFormPropertyGUI::getRequired(), ilFormPropertyGUI::setAlert(), and ilUtil::stripSlashes().
{
global $lng;
$_POST[$this->getPostVar()] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]);
if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
$ok = true;
foreach($this->getOptions() as $option)
{
foreach($option->getSubItems() as $item)
{
$item_ok = $item->checkInput();
if (!$item_ok && ($_POST[$this->getPostVar()] == $option->getValue()))
{
$ok = false;
}
}
}
return $ok;
}
Here is the call graph for this function:| ilRadioGroupInputGUI::getOptions | ( | ) |
Get Options.
Definition at line 65 of file class.ilRadioGroupInputGUI.php.
Referenced by checkInput(), and insert().
{
return $this->options;
}
Here is the caller graph for this function:| ilRadioGroupInputGUI::getValue | ( | ) |
Get Value.
Definition at line 85 of file class.ilRadioGroupInputGUI.php.
Referenced by insert().
{
return $this->value;
}
Here is the caller graph for this function:| ilRadioGroupInputGUI::insert | ( | &$ | a_tpl | ) |
Insert property html.
Definition at line 139 of file class.ilRadioGroupInputGUI.php.
References ilFormPropertyGUI::getDisabled(), ilFormPropertyGUI::getFieldId(), getOptions(), ilFormPropertyGUI::getPostVar(), and getValue().
{
foreach($this->getOptions() as $option)
{
// information text for option
if ($option->getInfo() != "")
{
$a_tpl->setCurrentBlock("radio_option_desc");
$a_tpl->setVariable("RADIO_OPTION_DESC", $option->getInfo());
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("prop_radio_option");
$a_tpl->setVariable("POST_VAR", $this->getPostVar());
$a_tpl->setVariable("VAL_RADIO_OPTION", $option->getValue());
$a_tpl->setVariable("OP_ID", $this->getFieldId()."_".$option->getValue());
if($this->getDisabled())
{
$a_tpl->setVariable('DISABLED','disabled="disabled" ');
}
if ($option->getValue() == $this->getValue())
{
$a_tpl->setVariable("CHK_RADIO_OPTION",
'checked="checked"');
}
$a_tpl->setVariable("TXT_RADIO_OPTION", $option->getTitle());
if (count($option->getSubItems()) > 0)
{
$pf = new ilPropertyFormGUI();
$pf->setMode("subform");
$pf->setItems($option->getSubItems());
$a_tpl->setVariable("SUB_FORM", $pf->getContent());
}
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("prop_radio");
$a_tpl->parseCurrentBlock();
}
Here is the call graph for this function:| ilRadioGroupInputGUI::setValue | ( | $ | a_value | ) |
Set Value.
| string | $a_value Value |
Definition at line 75 of file class.ilRadioGroupInputGUI.php.
Referenced by setValueByArray().
{
$this->value = $a_value;
}
Here is the caller graph for this function:| ilRadioGroupInputGUI::setValueByArray | ( | $ | a_values | ) |
Set value by array.
| array | $a_values value array |
Definition at line 95 of file class.ilRadioGroupInputGUI.php.
References ilFormPropertyGUI::getPostVar(), and setValue().
{
$this->setValue($a_values[$this->getPostVar()]);
}
Here is the call graph for this function:ilRadioGroupInputGUI::$options = array() [protected] |
Definition at line 35 of file class.ilRadioGroupInputGUI.php.
ilRadioGroupInputGUI::$value [protected] |
Definition at line 36 of file class.ilRadioGroupInputGUI.php.
1.7.1