ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilDclSelectionFieldRepresentation Class Reference
+ Inheritance diagram for ilDclSelectionFieldRepresentation:
+ Collaboration diagram for ilDclSelectionFieldRepresentation:

Public Member Functions

 getInputField (ilPropertyFormGUI $form, ?int $record_id=null)
 
 addFilterInputFieldToTable (ilTable2GUI $table)
 
 getField ()
 
- Public Member Functions inherited from ilDclBaseFieldRepresentation
 __construct (ilDclBaseFieldModel $field)
 
 addFilterInputFieldToTable (ilTable2GUI $table)
 Add filter input to TableGUI. More...
 
 passThroughFilter (ilDclBaseRecordModel $record, $filter)
 Checks if a filter affects a record. More...
 
 parseSortingValue (string $value, bool $link=true)
 
 getInputField (ilPropertyFormGUI $form, ?int $record_id=null)
 Returns field-input. More...
 
 addFieldCreationForm (ilSubEnabledFormPropertyGUI $form, ilObjDataCollection $dcl, string $mode="create")
 Adds the options for the field-types to the field-creation form. More...
 
 getPropertyInputFieldId (string $property)
 Return post-var for property-fields. More...
 
 getField ()
 Return BaseFieldModel. More...
 

Protected Member Functions

 buildFieldCreationInput (ilObjDataCollection $dcl, string $mode='create')
 
 buildOptionsInput ()
 
- Protected Member Functions inherited from ilDclBaseFieldRepresentation
 setupFilterInputField (?ilTableFilterItem $input)
 Set basic settings for filter-input-gui. More...
 
 setupInputField (ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
 Sets basic settings on field-input. More...
 
 getFilterInputFieldValue (ilTableFilterItem $input)
 
 buildFieldCreationInput (ilObjDataCollection $dcl, string $mode='create')
 Build the creation-input-field. More...
 

Protected Attributes

ilDclBaseFieldModel $field
 
- Protected Attributes inherited from ilDclBaseFieldRepresentation
ilDclBaseFieldModel $field
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilObjUser $user
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilComponentRepository $component_repository
 
ilComponentFactory $component_factory
 

Detailed Description

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

Member Function Documentation

◆ addFilterInputFieldToTable()

ilDclSelectionFieldRepresentation::addFilterInputFieldToTable ( ilTable2GUI  $table)

Definition at line 99 of file class.ilDclSelectionFieldRepresentation.php.

References ilTable2GUI\addFilterItemByMetaType(), ilTable2GUI\FILTER_SELECT, ilDclSelectionOption\getAllForField(), getField(), ilDclBaseFieldRepresentation\getFilterInputFieldValue(), ILIAS\Survey\Mode\getId(), ILIAS\Repository\lng(), and ilDclBaseFieldRepresentation\setupFilterInputField().

100  {
101  $input = $table->addFilterItemByMetaType(
102  "filter_" . $this->getField()->getId(),
104  false,
105  $this->getField()->getId()
106  );
107 
108  $options = ilDclSelectionOption::getAllForField((int) $this->getField()->getId());
109  $array = ['' => $this->lng->txt('dcl_all_entries')];
110  foreach ($options as $opt) {
111  $array[$opt->getOptId()] = $opt->getValue();
112  }
113 
114  $array['none'] = $this->lng->txt('dcl_no_entry');
115 
116  $input->setOptions($array);
117 
118  $this->setupFilterInputField($input);
119 
120  return $this->getFilterInputFieldValue($input);
121  }
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
static getAllForField(int $field_id)
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
+ Here is the call graph for this function:

◆ buildFieldCreationInput()

ilDclSelectionFieldRepresentation::buildFieldCreationInput ( ilObjDataCollection  $dcl,
string  $mode = 'create' 
)
protected

Definition at line 28 of file class.ilDclSelectionFieldRepresentation.php.

References buildOptionsInput(), ilDclBaseFieldRepresentation\getPropertyInputFieldId(), ILIAS\Repository\lng(), ilDclBaseFieldModel\PROP_UNIQUE, ilDclSelectionFieldModel\SELECTION_TYPE_COMBOBOX, ilDclSelectionFieldModel\SELECTION_TYPE_MULTI, ilDclSelectionFieldModel\SELECTION_TYPE_SINGLE, ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

29  {
30  $opt = parent::buildFieldCreationInput($dcl, $mode);
31 
32  $selection_options = $this->buildOptionsInput();
33  $opt->addSubItem($selection_options);
34 
35  $selection_type = new ilRadioGroupInputGUI(
36  $this->lng->txt('dcl_selection_type'),
37  'prop_' . $this->field::PROP_SELECTION_TYPE
38  );
39  $selection_type->setRequired(true);
40 
41  $options = [
45  ];
46 
47  foreach ($options as $option) {
48  $selection_type->addOption(new ilRadioOption($this->lng->txt('dcl_' . $option), $option));
49  }
50 
51  $opt->addSubItem($selection_type);
52 
53  $prop_unique = new ilDclCheckboxInputGUI(
54  $this->lng->txt('dcl_unique'),
56  );
57  $prop_unique->setInfo($this->lng->txt('dcl_unique_desc'));
58  $opt->addSubItem($prop_unique);
59 
60  return $opt;
61  }
This class represents an option in a radio group.
This class represents a property in a property form.
getPropertyInputFieldId(string $property)
Return post-var for property-fields.
setRequired(bool $a_required)
+ Here is the call graph for this function:

◆ buildOptionsInput()

ilDclSelectionFieldRepresentation::buildOptionsInput ( )
abstractprotected

Referenced by buildFieldCreationInput(), and getField().

+ Here is the caller graph for this function:

◆ getField()

ilDclSelectionFieldRepresentation::getField ( )

Definition at line 123 of file class.ilDclSelectionFieldRepresentation.php.

References $field, and buildOptionsInput().

Referenced by addFilterInputFieldToTable(), and getInputField().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInputField()

ilDclSelectionFieldRepresentation::getInputField ( ilPropertyFormGUI  $form,
?int  $record_id = null 
)

Definition at line 63 of file class.ilDclSelectionFieldRepresentation.php.

References ilDclBaseFieldRepresentation\$user, ilDclSelectionOption\getAllForField(), getField(), ILIAS\Survey\Mode\getId(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\Repository\lng(), ilDclSelectionFieldModel\SELECTION_TYPE_COMBOBOX, ilDclSelectionFieldModel\SELECTION_TYPE_MULTI, ilDclSelectionFieldModel\SELECTION_TYPE_SINGLE, and ilDclBaseFieldRepresentation\setupInputField().

64  {
65  $options = [];
66  foreach (ilDclSelectionOption::getAllForField((int) $this->getField()->getId()) as $opt) {
67  $options[$opt->getOptId()] = $this->getField()->personalizeOptionValue($opt->getValue(), $this->user);
68  }
69  switch ($this->getField()->getProperty($this->field::PROP_SELECTION_TYPE)) {
71  $input = new ilMultiSelectInputGUI(
72  $this->getField()->getTitle(),
73  'field_' . $this->getField()->getId()
74  );
75  $input->setWidth(100);
76  $input->setWidthUnit('%');
77  $input->setHeight(32 * min(5, max(1, count($options))));
78 
79  $input->setOptions($options);
80  break;
82  $input = new ilSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
83  $input->setOptions(["" => $this->lng->txt('dcl_please_select')] + $options);
84  break;
86  default:
87  $input = new ilRadioGroupInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
88  foreach ($options as $key => $opt) {
89  $input->addOption(new ilRadioOption($opt, (string) $key));
90  }
91  $input->setValue((string) array_key_first($options));
92  break;
93  }
94  $this->setupInputField($input, $this->getField());
95 
96  return $input;
97  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
This class represents a multi selection list property in a property form.
This class represents a property in a property form.
static getAllForField(int $field_id)
+ Here is the call graph for this function:

Field Documentation

◆ $field

ilDclBaseFieldModel ilDclSelectionFieldRepresentation::$field
protected

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

Referenced by getField().


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