ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilADTMultiEnumFormBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumFormBridge:
+ Collaboration diagram for ilADTMultiEnumFormBridge:

Public Member Functions

 setOptionInfos (array $a_info=null)
 
 setAutoSort ($a_value)
 
 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

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

Member Function Documentation

◆ addToForm()

ilADTMultiEnumFormBridge::addToForm ( )

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

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

26  {
27  global $lng;
28 
29  $def = $this->getADT()->getCopyOfDefinition();
30 
31  $options = $def->getOptions();
32 
33  if((bool)$this->auto_sort)
34  {
35  asort($options);
36  }
37 
38  $cbox = new ilCheckboxGroupInputGUI($this->getTitle(), $this->getElementId());
39 
40  foreach($options as $value => $caption)
41  {
42  $option = new ilCheckboxOption($caption, $value);
43  if(is_array($this->option_infos) && array_key_exists($value, $this->option_infos))
44  {
45  $option->setInfo($this->option_infos[$value]);
46  }
47  $cbox->addOption($option);
48  }
49 
50  $this->addBasicFieldProperties($cbox, $def);
51 
52  $cbox->setValue($this->getADT()->getSelections());
53 
54  $this->addToParentElement($cbox);
55  }
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
This class represents an option in a checkbox group.
addBasicFieldProperties(ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
Helper method to handle generic properties like setRequired(), setInfo()
if(!is_array($argv)) $options
This class represents a property in a property form.
getElementId()
Get element id.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ importFromPost()

ilADTMultiEnumFormBridge::importFromPost ( )

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

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

58  {
59  // ilPropertyFormGUI::checkInput() is pre-requisite
60  $this->getADT()->setSelections($this->getForm()->getInput($this->getElementId()));
61 
62  $field = $this->getForm()->getItemByPostvar($this->getElementId());
63  $field->setValue($this->getADT()->getSelections());
64  }
getElementId()
Get element id.
+ Here is the call graph for this function:

◆ isActiveForSubItems()

ilADTMultiEnumFormBridge::isActiveForSubItems (   $a_parent_option = null)
protected

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

References ilADTFormBridge\getADT().

67  {
68  $current = $this->getADT()->getSelections();
69  return (is_array($current) && in_array($a_parent_option, $current));
70  }
+ Here is the call graph for this function:

◆ isValidADT()

ilADTMultiEnumFormBridge::isValidADT ( ilADT  $a_adt)
protected

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

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

◆ setAutoSort()

ilADTMultiEnumFormBridge::setAutoSort (   $a_value)

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

21  {
22  $this->auto_sort = (bool)$a_value;
23  }

◆ setOptionInfos()

ilADTMultiEnumFormBridge::setOptionInfos ( array  $a_info = null)

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

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

Field Documentation

◆ $auto_sort

ilADTMultiEnumFormBridge::$auto_sort = true
protected

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

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