ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclSelectionFieldRepresentation.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
9 {
10 
11  // those should be overwritten by subclasses
12  const PROP_SELECTION_TYPE = '';
14 
15 
22  protected function buildFieldCreationInput(ilObjDataCollection $dcl, $mode = 'create')
23  {
24  $opt = parent::buildFieldCreationInput($dcl, $mode);
25 
26  $selection_options = $this->buildOptionsInput();
27  $opt->addSubItem($selection_options);
28 
29  $selection_type = new ilRadioGroupInputGUI($this->lng->txt('dcl_selection_type'), 'prop_' . static::PROP_SELECTION_TYPE);
30  $selection_type->setRequired(true);
31 
32  $option_1 = new ilRadioOption(
33  $this->lng->txt('dcl_' . ilDclSelectionFieldModel::SELECTION_TYPE_SINGLE),
35  );
36  $selection_type->addOption($option_1);
37 
38  $option_2 = new ilRadioOption(
39  $this->lng->txt('dcl_' . ilDclSelectionFieldModel::SELECTION_TYPE_MULTI),
41  );
42  $selection_type->addOption($option_2);
43 
44  $option_3 = new ilRadioOption(
45  $this->lng->txt('dcl_' . ilDclSelectionFieldModel::SELECTION_TYPE_COMBOBOX),
47  );
48  $selection_type->addOption($option_3);
49 
50  $opt->addSubItem($selection_type);
51 
52  return $opt;
53  }
54 
55 
62  public function getInputField(ilPropertyFormGUI $form, $record_id = 0)
63  {
66  switch ($this->getField()->getProperty(static::PROP_SELECTION_TYPE)) {
68  $input = new ilRadioGroupInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
69  foreach ($options as $opt) {
70  $input->addOption(new ilRadioOption($opt->getValue(), $opt->getOptId()));
71  }
72  $input->setValue(array_keys($options)[0]);
73  break;
75 // global $DIC;
76 // $DIC->ui()->mainTemplate()->addOnLoadCode('$("#field_' . $this->getField()->getId() . '").removeClass("input")');
77  $input = new ilMultiSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
78 
79 
80  $input->setHeight(100);
81  $input->setHeightUnit('%; max-height: 150px');
82  $input->setWidth(100);
83  $input->setWidthUnit('%');
84 
85  $array = array();
86  foreach ($options as $opt) {
87  $array[$opt->getOptId()] = $opt->getValue();
88  }
89  $input->setOptions($array);
90  break;
92  $input = new ilSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
93  $array = array();
94  foreach ($options as $opt) {
95  $array[$opt->getOptId()] = $opt->getValue();
96  }
97  $input->setOptions(array("" => $this->lng->txt('dcl_please_select')) + $array);
98  break;
99  }
100  $this->setupInputField($input, $this->getField());
101  return $input;
102  }
103 
104 
111  {
112  $input = $table->addFilterItemByMetaType("filter_" . $this->getField()->getId(), ilTable2GUI::FILTER_SELECT, false, $this->getField()->getId());
113 
115  $array = array('' => $this->lng->txt('dcl_any'));
116  foreach ($options as $opt) {
117  $array[$opt->getOptId()] = $opt->getValue();
118  }
119 
120  $input->setOptions($array);
121 
122  $this->setupFilterInputField($input);
123 
124  return $this->getFilterInputFieldValue($input);
125  }
126 
127 
128 
132  abstract protected function buildOptionsInput();
133 }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a property form user interface.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
buildFieldCreationInput(ilObjDataCollection $dcl, $mode='create')
Class ilDclSelectionFieldRepresentation.
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.
Class ilTable2GUI.
if(isset($_POST['submit'])) $form
addSubItem($a_item)
Add Subitem.
setupFilterInputField(ilFormPropertyGUI $input)
Set basic settings for filter-input-gui.
Create styles array
The data for the language used.
getInputField(ilPropertyFormGUI $form, $record_id=0)
Returns field-input.
if(empty($password)) $table
Definition: pwgen.php:24
Class ilDclBaseFieldRepresentation.
Class ilObjDataCollection.
setRequired($a_required)
Set Required.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20