ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilADTEnumFormBridge Class Reference
+ Inheritance diagram for ilADTEnumFormBridge:
+ Collaboration diagram for ilADTEnumFormBridge:

Public Member Functions

 setAutoSort ($a_value)
 
 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
 
 $auto_sort = true
 
- 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 30 of file class.ilADTEnumFormBridge.php.

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

31  {
32  global $lng;
33 
34  $def = $this->getADT()->getCopyOfDefinition();
35  $selection = $this->getADT()->getSelection();
36 
37  $options = $def->getOptions();
38 
39  if((bool)$this->auto_sort)
40  {
41  asort($options);
42  }
43 
44  if(!$this->isRequired())
45  {
46  $options = array("" => "-") + $options;
47  }
48  else if($this->getADT()->isNull())
49  {
50  $options = array("" => $lng->txt("please_select")) + $options;
51  }
52 
53  if(!(bool)$this->force_radio)
54  {
55  $select = new ilSelectInputGUI($this->getTitle(), $this->getElementId());
56 
57  $select->setOptions($options);
58  }
59  else
60  {
61  $select = new ilRadioGroupInputGUI($this->getTitle(), $this->getElementId());
62 
63  foreach($options as $value => $caption)
64  {
65  $option = new ilRadioOption($caption, $value);
66  if(is_array($this->option_infos) && array_key_exists($value, $this->option_infos))
67  {
68  $option->setInfo($this->option_infos[$value]);
69  }
70  $select->addOption($option);
71  }
72  }
73 
74  $this->addBasicFieldProperties($select, $def);
75 
76  $select->setValue($selection);
77 
78  $this->addToParentElement($select);
79  }
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 21 of file class.ilADTEnumFormBridge.php.

22  {
23  $this->force_radio = (bool)$a_value;
24  if($this->force_radio)
25  {
26  $this->option_infos = $a_info;
27  }
28  }

◆ importFromPost()

ilADTEnumFormBridge::importFromPost ( )

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

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

82  {
83  // ilPropertyFormGUI::checkInput() is pre-requisite
84  $this->getADT()->setSelection($this->getForm()->getInput($this->getElementId()));
85 
86  $field = $this->getForm()->getItemByPostvar($this->getElementId());
87  $field->setValue($this->getADT()->getSelection());
88  }
getElementId()
Get element id.
+ Here is the call graph for this function:

◆ isActiveForSubItems()

ilADTEnumFormBridge::isActiveForSubItems (   $a_parent_option = null)
protected

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

References ilADTFormBridge\getADT().

91  {
92  return ($this->getADT()->getSelection() == $a_parent_option);
93  }
+ Here is the call graph for this function:

◆ isValidADT()

ilADTEnumFormBridge::isValidADT ( ilADT  $a_adt)
protected

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

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

◆ setAutoSort()

ilADTEnumFormBridge::setAutoSort (   $a_value)

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

Referenced by ilAdvancedMDFieldDefinitionSelect\prepareElementForEditor().

17  {
18  $this->auto_sort = (bool)$a_value;
19  }
+ Here is the caller graph for this function:

Field Documentation

◆ $auto_sort

ilADTEnumFormBridge::$auto_sort = true
protected

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

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