ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 */
3
10{
11
12 // those should be overwritten by subclasses
15
16
23 protected function buildFieldCreationInput(ilObjDataCollection $dcl, $mode = 'create')
24 {
25 $opt = parent::buildFieldCreationInput($dcl, $mode);
26
27 $selection_options = $this->buildOptionsInput();
28 $opt->addSubItem($selection_options);
29
30 $selection_type = new ilRadioGroupInputGUI($this->lng->txt('dcl_selection_type'), 'prop_' . static::PROP_SELECTION_TYPE);
31 $selection_type->setRequired(true);
32
33 $option_1 = new ilRadioOption(
36 );
37 $selection_type->addOption($option_1);
38
39 $option_2 = new ilRadioOption(
40 $this->lng->txt('dcl_' . ilDclSelectionFieldModel::SELECTION_TYPE_MULTI),
42 );
43 $selection_type->addOption($option_2);
44
45 $option_3 = new ilRadioOption(
48 );
49 $selection_type->addOption($option_3);
50
51 $opt->addSubItem($selection_type);
52
53 return $opt;
54 }
55
56
63 public function getInputField(ilPropertyFormGUI $form, $record_id = 0)
64 {
67 switch ($this->getField()->getProperty(static::PROP_SELECTION_TYPE)) {
69 $input = new ilRadioGroupInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
70 foreach ($options as $opt) {
71 $input->addOption(new ilRadioOption($opt->getValue(), $opt->getOptId()));
72 }
73 $input->setValue(array_keys($options)[0]);
74 break;
76 // global $DIC;
77 // $DIC->ui()->mainTemplate()->addOnLoadCode('$("#field_' . $this->getField()->getId() . '").removeClass("input")');
78 $input = new ilMultiSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
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
102 return $input;
103 }
104
105
112 {
113 $input = $table->addFilterItemByMetaType("filter_" . $this->getField()->getId(), ilTable2GUI::FILTER_SELECT, false, $this->getField()->getId());
114
116 $array = array('' => $this->lng->txt('dcl_any'));
117 foreach ($options as $opt) {
118 $array[$opt->getOptId()] = $opt->getValue();
119 }
120
121 $input->setOptions($array);
122
124
125 return $this->getFilterInputFieldValue($input);
126 }
127
128
132 abstract protected function buildOptionsInput();
133}
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldRepresentation.
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
setupFilterInputField(ilFormPropertyGUI $input)
Set basic settings for filter-input-gui.
getInputField(ilPropertyFormGUI $form, $record_id=0)
Returns field-input.
buildFieldCreationInput(ilObjDataCollection $dcl, $mode='create')
This class represents a multi selection list property in a property form.
Class ilObjDataCollection.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
Class ilTable2GUI.
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form