19declare(strict_types=1);
34 $def->setNumeric(
false);
41 public function setOptions(?array $a_values =
null): void
43 if ($a_values !==
null) {
44 foreach ($a_values as $idx => $value) {
45 $a_values[$idx] = trim($value);
46 if (!$a_values[$idx]) {
47 unset($a_values[$idx]);
50 $a_values = array_unique($a_values);
53 $this->options = $a_values;
64 $this->complex = $a_def[
"complex"] ?? [];
70 "options" => $this->options,
71 "complex" => $this->complex
87 bool $a_disabled =
false,
93 $field->setRequired(
true);
94 $field->setMulti(
true);
95 $field->setMaxLength(255);
101 $field->setValue(array_shift(
$options));
105 $field->setDisabled(
true);
114 $old = $this->getOptions();
117 if (is_array($old)) {
118 $missing = array_diff($old, $new);
119 if (
sizeof($missing)) {
120 foreach ($missing as $item) {
121 unset($this->complex[$item]);
126 $this->setOptions($new);
131 foreach ($this->getOptions() as $value) {
132 $a_writer->
xmlElement(
'FieldValue',
null, $value);
138 $this->options[] = $a_value;
148 return $element->getSelection();
163 !in_array($a_cdata, array_keys($this->options)) &&
164 in_array($a_cdata, $this->options)
166 $a_cdata = (string) array_search($a_cdata, $this->options);
168 $this->getADT()->setSelection($a_cdata);
188 if (array_key_exists($a_option, $this->complex)) {
189 $adt->importStdClass($this->complex[$a_option]);
200 return $tbl->getHTML();
205 $adt = $this->getADTForOption($a_option);
206 foreach ($adt->getElements() as $title => $element) {
208 $a_item[$title] = $pres->getList();
216 $option = $this->findOptionById($a_option_id);
219 $title->setValue($option);
220 $title->setDisabled(
true);
223 $adt = $this->getADTForOption($option);
225 $adt_form->setForm($a_form);
227 $titles = $this->getTitles();
228 foreach ($adt_form->getElements() as
$id => $element) {
229 $element->setTitle($titles[
$id]);
232 $adt_form->addToForm();
238 $option = $this->findOptionById($a_option_id);
242 $adt_form->setForm($a_form);
243 if ($adt_form->validate()) {
244 $adt_form->importFromPost();
245 $this->importComplexOptionFromForm($option, $adt);
260 foreach ($this->getOptions() as $item) {
261 if (md5($item) == $a_id) {
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ADT definition base class.
exportStdClass()
Export value as stdClass.
findOptionById(string $a_id)
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
Add custom input elements to definition form.
exportOptionToTableGUI($a_option, array &$a_item)
importFieldDefinition(array $a_def)
Import (type-specific) field definition from DB.
getADTForOption(string $a_option)
setOptions(?array $a_values=null)
getValueForXML(ilADT $element)
Parse ADT value for xml (export)
importComplexOptionFromForm(string $a_option, ilADT $a_adt)
importValueFromXML(string $a_cdata)
Import value from xml.
updateComplexOption(ilPropertyFormGUI $a_form, $a_option_id)
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language='')
Import custom post values from definition form.
getFieldDefinitionForTableGUI(string $content_language)
Parse properties for table gui.
addPropertiesToXML(ilXmlWriter $a_writer)
Add (type-specific) properties to xml export.
initADTDefinition()
Init adt instance.
getComplexOptionsOverview(object $a_parent_gui, string $a_parent_cmd)
null
importXMLProperty(string $a_key, string $a_value)
Import property from XML.
getFieldDefinition()
Get (type-specific) field definition.
initOptionForm(ilPropertyFormGUI $a_form, $a_option_id)
Table GUI for complex AdvMD options.
AMD field abstract base class.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)