ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 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.
- Public Member Functions inherited from ilFormPropertyGUI
 getType ()
 Get Type.
 setTitle ($a_title)
 Set Title.
 getTitle ()
 Get Title.
 setPostVar ($a_postvar)
 Set Post Variable.
 getPostVar ()
 Get Post Variable.
 getFieldId ()
 Get Post Variable.
 setInfo ($a_info)
 Set Information Text.
 getInfo ()
 Get Information Text.
 setAlert ($a_alert)
 Set Alert Text.
 getAlert ()
 Get Alert Text.
 setRequired ($a_required)
 Set Required.
 getRequired ()
 Get Required.
 setDisabled ($a_disabled)
 Set Disabled.
 getDisabled ()
 Get Disabled.
 getSubForm ()
 Get sub form html.
 getSubformMode ()

Protected Attributes

 $options = array()
 $value
- Protected Attributes inherited from ilFormPropertyGUI
 $type
 $title
 $postvar
 $info
 $alert
 $required = false

Additional Inherited Members

- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type.

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

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost 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:

Member Function Documentation

ilRadioGroupInputGUI::addOption (   $a_option)

Add Option.

Parameters
object$a_optionRadioOption object

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

Referenced by ilObjForumGUI\editObject(), and ilObjFileAccessSettingsGUI\editSettings().

{
$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.

Returns
boolean Input ok, true/false

Reimplemented from ilFormPropertyGUI.

Definition at line 112 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.

Returns
array Array of RadioOption objects

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

References $options.

Referenced by checkInput(), insert(), and setValueByArray().

{
}

+ Here is the caller graph for this function:

ilRadioGroupInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by insert().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilRadioGroupInputGUI::insert ( $a_tpl)

Insert property html.

Returns
int Size

Definition at line 146 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::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().

{
$this->setValue($a_values[$this->getPostVar()]);
foreach($this->getOptions() as $option)
{
foreach($option->getSubItems() as $item)
{
$item->setValueByArray($a_values);
}
}
}

+ Here is the call graph for this function:

Field Documentation

ilRadioGroupInputGUI::$options = array()
protected

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

Referenced by getOptions().

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: