ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilAdvancedMDFieldDefinitionSelectMulti.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "Services/AdvancedMetaData/classes/Types/class.ilAdvancedMDFieldDefinitionSelect.php";
5
15{
16 const XML_SEPARATOR = "~|~";
17
18 //
19 // generic types
20 //
21
22 // search
23 public function getSearchQueryParserValue(ilADTSearchBridge $search_bridge)
24 {
25 return $search_bridge->getADT()->getSelections()[0] ?? 0;
26 }
27
28
29 public function getType()
30 {
32 }
33
34
35
36 protected function initADTDefinition()
37 {
38 $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("MultiEnum");
39 $def->setNumeric(false);
40
41 $options = $this->getOptions();
42 $translated_options = [];
43 if (isset($this->getOptionTranslations()[$this->language])) {
44 $translated_options = $this->getOptionTranslations()[$this->language];
45 }
46 $def->setOptions(array_replace($options, $translated_options));
47 return $def;
48 }
49
50
51
52 //
53 // definition (NOT ADT-based)
54 //
55
61 {
62 $this->importNewSelectOptions(false, $a_form, $language);
63 }
64
65
66 //
67 // definition CRUD
68 //
69
70
71
72 //
73 // import/export
74 //
75
76 public function getValueForXML(ilADT $element)
77 {
78 return self::XML_SEPARATOR .
79 implode(self::XML_SEPARATOR, $element->getSelections()) .
81 }
82
83 public function importValueFromXML($a_cdata)
84 {
85 $this->getADT()->setSelections(explode(self::XML_SEPARATOR, $a_cdata));
86 }
87
88
89 //
90 // presentation
91 //
92
94 {
95 assert($a_enum instanceof ilADTMultiEnumFormBridge);
96
97 $a_enum->setAutoSort(false);
98 }
99}
An exception for terminatinating execution or to throw for unit testing.
static getInstance()
Get singleton.
ADT form bridge base class.
ADT search bridge base class.
ADT base class.
Definition: class.ilADT.php:12
getValueForXML(ilADT $element)
Parse ADT value for xml (export)
prepareElementForEditor(ilADTFormBridge $a_enum)
Prepare editor form elements.
getSearchQueryParserValue(ilADTSearchBridge $search_bridge)
Get value for search query parser.
importCustomDefinitionFormPostValues(ilPropertyFormGUI $a_form, string $language='')
importNewSelectOptions(bool $multi, ilPropertyFormGUI $a_form, string $language='')
This class represents a property form user interface.
language()
Definition: language.php:2