ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADTMultiEnumFormBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumFormBridge:
+ Collaboration diagram for ilADTMultiEnumFormBridge:

Public Member Functions

 setOptionInfos (?array $a_info=null)
 
 setAutoSort (bool $a_value)
 
 addToForm ()
 
 importFromPost ()
 
- Public Member Functions inherited from ilADTFormBridge
 __construct (ilADT $a_adt)
 
 getADT ()
 
 setForm (ilPropertyFormGUI $a_form)
 
 getForm ()
 
 setElementId (string $a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 setInfo (string $a_value)
 
 getInfo ()
 
 setParentElement ($a_value)
 
 getParentElement ()
 Get parent element. More...
 
 setDisabled (bool $a_value)
 
 isDisabled ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 addJS (ilGlobalTemplateInterface $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 ()
 
 setExternalErrors (array $a_errors)
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 
 isActiveForSubItems ($a_parent_option=null)
 
- Protected Member Functions inherited from ilADTFormBridge
 isValidADT (ilADT $a_adt)
 
 setADT (ilADT $a_adt)
 
 addBasicFieldProperties (ilFormPropertyGUI $a_field, ilADTDefinition $a_def)
 Helper method to handle generic properties like setRequired(), setInfo() More...
 
 findParentElementInForm ()
 
 addToParentElement (ilFormPropertyGUI $a_field)
 
 isActiveForSubItems ($a_parent_option=null)
 Check if element is currently active for subitem(s) More...
 

Protected Attributes

array $option_infos = []
 
bool $auto_sort = true
 
- Protected Attributes inherited from ilADTFormBridge
ilADT $adt
 
ilPropertyFormGUI $form
 
 $parent
 
string $id = null
 
string $title = ''
 
string $info = ''
 
 $parent_element
 
bool $required = false
 
bool $disabled = false
 
ilLanguage $lng
 

Detailed Description

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

Member Function Documentation

◆ addToForm()

ilADTMultiEnumFormBridge::addToForm ( )

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

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

41  : void
42  {
43  $def = $this->getADT()->getCopyOfDefinition();
44  $options = $def->getOptions();
45 
46  if ($this->auto_sort) {
47  asort($options);
48  }
49 
50  $cbox = new ilCheckboxGroupInputGUI($this->getTitle(), $this->getElementId());
51 
52  foreach ($options as $value => $caption) {
53  $option = new ilCheckboxOption($caption, (string) $value);
54  if (is_array($this->option_infos) && array_key_exists($value, $this->option_infos)) {
55  $option->setInfo($this->option_infos[$value]);
56  }
57  $cbox->addOption($option);
58  }
59 
60  $this->addBasicFieldProperties($cbox, $def);
61 
62  $cbox->setValue($this->getADT()->getSelections());
63 
64  $this->addToParentElement($cbox);
65  }
addToParentElement(ilFormPropertyGUI $a_field)
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()
This class represents a property in a property form.
+ Here is the call graph for this function:

◆ importFromPost()

ilADTMultiEnumFormBridge::importFromPost ( )

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

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

67  : void
68  {
69  // ilPropertyFormGUI::checkInput() is pre-requisite
70 
71  /*
72  * BT 32161: post value is null when no checkbox is selected,
73  * check whether the corresponding form input really exists, just
74  * to be sure.
75  */
76  if (is_object($this->getForm()->getItemByPostVar($this->getElementId()))) {
77  $this->getADT()->setSelections($this->getForm()->getInput($this->getElementId()) ?? []);
78  }
79 
80  $field = $this->getForm()->getItemByPostVar($this->getElementId());
81  $field->setValue($this->getADT()->getSelections());
82  }
+ Here is the call graph for this function:

◆ isActiveForSubItems()

ilADTMultiEnumFormBridge::isActiveForSubItems (   $a_parent_option = null)
protected

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

References ilADTFormBridge\getADT().

84  : bool
85  {
86  $current = $this->getADT()->getSelections();
87  return (is_array($current) && in_array($a_parent_option, $current));
88  }
+ Here is the call graph for this function:

◆ isValidADT()

ilADTMultiEnumFormBridge::isValidADT ( ilADT  $a_adt)
protected

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

26  : bool
27  {
28  return ($a_adt instanceof ilADTMultiEnum);
29  }

◆ setAutoSort()

ilADTMultiEnumFormBridge::setAutoSort ( bool  $a_value)

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

36  : void
37  {
38  $this->auto_sort = $a_value;
39  }

◆ setOptionInfos()

ilADTMultiEnumFormBridge::setOptionInfos ( ?array  $a_info = null)

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

31  : void
32  {
33  $this->option_infos = $a_info;
34  }

Field Documentation

◆ $auto_sort

bool ilADTMultiEnumFormBridge::$auto_sort = true
protected

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

◆ $option_infos

array ilADTMultiEnumFormBridge::$option_infos = []
protected

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


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