ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTEnumFormBridge Class Reference
+ Inheritance diagram for ilADTEnumFormBridge:
+ Collaboration diagram for ilADTEnumFormBridge:

Public Member Functions

 forceRadio ($a_value, array $a_info=null)
 addToForm ()
 Add ADT-specific fields to form.
 importFromPost ()
 Import values from form request POST data.
- Public Member Functions inherited from ilADTFormBridge
 __construct (ilADT $a_adt)
 Constructor.
 getADT ()
 Get ADT.
 setForm (ilPropertyFormGUI $a_form)
 Set form.
 getForm ()
 Get form.
 setElementId ($a_value)
 Set element id (aka form field)
 getElementId ()
 Get element id.
 setTitle ($a_value)
 Set title (aka form field caption)
 getTitle ()
 Get title.
 setInfo ($a_value)
 Set info (aka form field info text)
 getInfo ()
 Get info.
 setParentElement ($a_value)
 Set parent element.
 getParentElement ()
 Get parent element.
 setDisabled ($a_value)
 Set disabled.
 isDisabled ()
 Get disabled.
 setRequired ($a_value)
 Set required.
 isRequired ()
 Get required.
 addJS (ilTemplate $a_tpl)
 Add ADT-specific JS-files to template.
 shouldBeImportedFromPost (ilADTFormBridge $a_parent_adt=null)
 Check if incoming values should be imported at all.
 validate ()
 Validate ADT and parse error codes.
 setExternalErrors ($a_errors)

Protected Member Functions

 isValidADT (ilADT $a_adt)
 Check if given ADT is valid.
 isActiveForSubItems ($a_parent_option=null)
 Check if element is currently active for subitem(s)
- Protected Member Functions inherited from ilADTFormBridge
 setADT (ilADT $a_adt)
 Set ADT.
 addBasicFieldProperties (ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
 Helper method to handle generic properties like setRequired(), setInfo()
 findParentElementInForm ()
 Try to find parent element in form (could be option)
 addToParentElement (ilFormPropertyGUI $a_field)
 Add form field to parent element.

Protected Attributes

 $force_radio
 $option_infos
- Protected Attributes inherited from ilADTFormBridge
 $adt
 $form
 $id
 $title
 $info
 $parent_element
 $required
 $disabled

Detailed Description

Definition at line 5 of file class.ilADTEnumFormBridge.php.

Member Function Documentation

ilADTEnumFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

Definition at line 24 of file class.ilADTEnumFormBridge.php.

References $force_radio, $lng, $options, ilADTFormBridge\addBasicFieldProperties(), ilADTFormBridge\addToParentElement(), ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), ilADTFormBridge\getTitle(), and ilADTFormBridge\isRequired().

{
global $lng;
$def = $this->getADT()->getCopyOfDefinition();
$selection = $this->getADT()->getSelection();
$options = $def->getOptions();
asort($options); // ?
if(!$this->isRequired())
{
$options = array("" => "-") + $options;
}
else if($this->getADT()->isNull())
{
$options = array("" => $lng->txt("please_select")) + $options;
}
if(!(bool)$this->force_radio)
{
$select = new ilSelectInputGUI($this->getTitle(), $this->getElementId());
$select->setOptions($options);
}
else
{
$select = new ilRadioGroupInputGUI($this->getTitle(), $this->getElementId());
foreach($options as $value => $caption)
{
$option = new ilRadioOption($caption, $value);
if(is_array($this->option_infos) && array_key_exists($value, $this->option_infos))
{
$option->setInfo($this->option_infos[$value]);
}
$select->addOption($option);
}
}
$this->addBasicFieldProperties($select, $def);
$select->setValue($selection);
$this->addToParentElement($select);
}

+ Here is the call graph for this function:

ilADTEnumFormBridge::forceRadio (   $a_value,
array  $a_info = null 
)

Definition at line 15 of file class.ilADTEnumFormBridge.php.

{
$this->force_radio = (bool)$a_value;
if($this->force_radio)
{
$this->option_infos = $a_info;
}
}
ilADTEnumFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

Definition at line 71 of file class.ilADTEnumFormBridge.php.

References ilADTFormBridge\getADT(), ilADTFormBridge\getElementId(), and ilADTFormBridge\getForm().

{
// ilPropertyFormGUI::checkInput() is pre-requisite
$this->getADT()->setSelection($this->getForm()->getInput($this->getElementId()));
$field = $this->getForm()->getItemByPostvar($this->getElementId());
$field->setValue($this->getADT()->getSelection());
}

+ Here is the call graph for this function:

ilADTEnumFormBridge::isActiveForSubItems (   $a_parent_option = null)
protected

Check if element is currently active for subitem(s)

Parameters
mixed$a_parent_option
Returns
bool

Reimplemented from ilADTFormBridge.

Definition at line 80 of file class.ilADTEnumFormBridge.php.

References ilADTFormBridge\getADT().

{
return ($this->getADT()->getSelection() == $a_parent_option);
}

+ Here is the call graph for this function:

ilADTEnumFormBridge::isValidADT ( ilADT  $a_adt)
protected

Check if given ADT is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADT$a_adt

Reimplemented from ilADTFormBridge.

Definition at line 10 of file class.ilADTEnumFormBridge.php.

{
return ($a_adt instanceof ilADTEnum);
}

Field Documentation

ilADTEnumFormBridge::$force_radio
protected

Definition at line 7 of file class.ilADTEnumFormBridge.php.

Referenced by addToForm().

ilADTEnumFormBridge::$option_infos
protected

Definition at line 8 of file class.ilADTEnumFormBridge.php.


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