ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilADTMultiEnumFormBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumFormBridge:
+ Collaboration diagram for ilADTMultiEnumFormBridge:

Public Member Functions

 setOptionInfos (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

 $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.ilADTMultiEnumFormBridge.php.

Member Function Documentation

◆ addToForm()

ilADTMultiEnumFormBridge::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTFormBridge.

Definition at line 19 of file class.ilADTMultiEnumFormBridge.php.

20 {
21 global $lng;
22
23 $def = $this->getADT()->getCopyOfDefinition();
24
25 $options = $def->getOptions();
26 // asort($options); // ?
27
28 $cbox = new ilCheckboxGroupInputGUI($this->getTitle(), $this->getElementId());
29
30 foreach($options as $value => $caption)
31 {
32 $option = new ilCheckboxOption($caption, $value);
33 if(is_array($this->option_infos) && array_key_exists($value, $this->option_infos))
34 {
35 $option->setInfo($this->option_infos[$value]);
36 }
37 $cbox->addOption($option);
38 }
39
40 $this->addBasicFieldProperties($cbox, $def);
41
42 $cbox->setValue($this->getADT()->getSelections());
43
44 $this->addToParentElement($cbox);
45 }
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.
This class represents a property in a property form.
This class represents an option in a checkbox group.
global $lng
Definition: privfeed.php:40
if(!is_array($argv)) $options

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

+ Here is the call graph for this function:

◆ importFromPost()

ilADTMultiEnumFormBridge::importFromPost ( )

Import values from form request POST data.

Reimplemented from ilADTFormBridge.

Definition at line 47 of file class.ilADTMultiEnumFormBridge.php.

48 {
49 // ilPropertyFormGUI::checkInput() is pre-requisite
50 $this->getADT()->setSelections($this->getForm()->getInput($this->getElementId()));
51
52 $field = $this->getForm()->getItemByPostvar($this->getElementId());
53 $field->setValue($this->getADT()->getSelections());
54 }

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

+ Here is the call graph for this function:

◆ isActiveForSubItems()

ilADTMultiEnumFormBridge::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 56 of file class.ilADTMultiEnumFormBridge.php.

57 {
58 $current = $this->getADT()->getSelections();
59 return (is_array($current) && in_array($a_parent_option, $current));
60 }

References ilADTFormBridge\getADT().

+ Here is the call graph for this function:

◆ isValidADT()

ilADTMultiEnumFormBridge::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 9 of file class.ilADTMultiEnumFormBridge.php.

10 {
11 return ($a_adt instanceof ilADTMultiEnum);
12 }

◆ setOptionInfos()

ilADTMultiEnumFormBridge::setOptionInfos ( array  $a_info = null)

Definition at line 14 of file class.ilADTMultiEnumFormBridge.php.

15 {
16 $this->option_infos = $a_info;
17 }

Field Documentation

◆ $option_infos

ilADTMultiEnumFormBridge::$option_infos
protected

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


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