19 declare(strict_types=1);
34 $def->setNumeric(
false);
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
79 return array($lng->txt(
"options") => implode(
",", $this->
getOptions()));
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);
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]);
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);
178 abstract public function getTitles(): array;
188 if (array_key_exists($a_option, $this->complex)) {
200 return $tbl->getHTML();
206 foreach (
$adt->getElements() as $title => $element) {
208 $a_item[$title] = $pres->getList();
219 $title->setValue($option);
220 $title->setDisabled(
true);
225 $adt_form->setForm($a_form);
228 foreach ($adt_form->getElements() as
$id => $element) {
229 $element->setTitle($titles[$id]);
232 $adt_form->addToForm();
242 $adt_form->setForm($a_form);
243 if ($adt_form->validate()) {
244 $adt_form->importFromPost();
261 if (md5($item) == $a_id) {
getComplexOptionsOverview(object $a_parent_gui, string $a_parent_cmd)
getValueForXML(ilADT $element)
findOptionById(string $a_id)
importValueFromXML(string $a_cdata)
exportOptionToTableGUI($a_option, array &$a_item)
AMD field abstract base class.
setOptions(?array $a_values=null)
exportStdClass()
Export value as stdClass.
addPropertiesToXML(ilXmlWriter $a_writer)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
importXMLProperty(string $a_key, string $a_value)
getFieldDefinitionForTableGUI(string $content_language)
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language='')
getADTForOption(string $a_option)
importStdClass(?stdClass $a_std)
Import value from stdClass.
Table GUI for complex AdvMD options.
updateComplexOption(ilPropertyFormGUI $a_form, $a_option_id)
importComplexOptionFromForm(string $a_option, ilADT $a_adt)
importFieldDefinition(array $a_def)
addCustomFieldToDefinitionForm(ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
ADT definition base class.
initOptionForm(ilPropertyFormGUI $a_form, $a_option_id)