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 ()
 
 importFromPost ()
 
- 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)
 
 isActiveForSubItems ($a_parent_option=null)
 
- 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 ( )

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().

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  }
This class represents an option in a radio group.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
This class represents a selection list property in a property form.
isRequired()
Get required.
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
This class represents a property in a property form.
if(!is_array($argv)) $options
getElementId()
Get element id.
global $lng
Definition: privfeed.php:40
+ 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 ( )

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

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

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  }
getElementId()
Get element id.
+ Here is the call graph for this function:

◆ isActiveForSubItems()

ilADTEnumFormBridge::isActiveForSubItems (   $a_parent_option = null)
protected

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

References ilADTFormBridge\getADT().

81  {
82  return ($this->getADT()->getSelection() == $a_parent_option);
83  }
+ Here is the call graph for this function:

◆ isValidADT()

ilADTEnumFormBridge::isValidADT ( ilADT  $a_adt)
protected

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.

Referenced by addToForm().

◆ $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: