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

Protected Member Functions

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

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

◆ addToForm()

ilADTEnumFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

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

25 {
26 global $lng;
27
28 $def = $this->getADT()->getCopyOfDefinition();
29 $selection = $this->getADT()->getSelection();
30
31 $options = $def->getOptions();
32 asort($options); // ?
33
34 if(!$this->isRequired())
35 {
36 $options = array("" => "-") + $options;
37 }
38 else if($this->getADT()->isNull())
39 {
40 $options = array("" => $lng->txt("please_select")) + $options;
41 }
42
43 if(!(bool)$this->force_radio)
44 {
45 $select = new ilSelectInputGUI($this->getTitle(), $this->getElementId());
46
47 $select->setOptions($options);
48 }
49 else
50 {
51 $select = new ilRadioGroupInputGUI($this->getTitle(), $this->getElementId());
52
53 foreach($options as $value => $caption)
54 {
55 $option = new ilRadioOption($caption, $value);
56 if(is_array($this->option_infos) && array_key_exists($value, $this->option_infos))
57 {
58 $option->setInfo($this->option_infos[$value]);
59 }
60 $select->addOption($option);
61 }
62 }
63
64 $this->addBasicFieldProperties($select, $def);
65
66 $select->setValue($selection);
67
68 $this->addToParentElement($select);
69 }
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
isRequired()
Get required.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
global $lng
Definition: privfeed.php:40
if(!is_array($argv)) $options

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

+ Here is the call graph for this function:

◆ forceRadio()

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

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

16 {
17 $this->force_radio = (bool)$a_value;
18 if($this->force_radio)
19 {
20 $this->option_infos = $a_info;
21 }
22 }

◆ importFromPost()

ilADTEnumFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

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

72 {
73 // ilPropertyFormGUI::checkInput() is pre-requisite
74 $this->getADT()->setSelection($this->getForm()->getInput($this->getElementId()));
75
76 $field = $this->getForm()->getItemByPostvar($this->getElementId());
77 $field->setValue($this->getADT()->getSelection());
78 }

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

+ Here is the call graph for this function:

◆ isActiveForSubItems()

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.

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

References ilADTFormBridge\getADT().

+ Here is the call graph for this function:

◆ isValidADT()

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.

11 {
12 return ($a_adt instanceof ilADTEnum);
13 }

Field Documentation

◆ $force_radio

ilADTEnumFormBridge::$force_radio
protected

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

◆ $option_infos

ilADTEnumFormBridge::$option_infos
protected

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


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