ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAdvancedMDFieldDefinitionGroupBased Class Reference

AMD field type address. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinitionGroupBased:
+ Collaboration diagram for ilAdvancedMDFieldDefinitionGroupBased:

Public Member Functions

 setOptions (array $a_values=null)
 
 getOptions ()
 
 getFieldDefinitionForTableGUI (string $content_language)
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 
 importXMLProperty (string $a_key, string $a_value)
 
 getValueForXML (ilADT $element)
 
 importValueFromXML (string $a_cdata)
 
 getADTGroup ()
 
 getTitles ()
 
 hasComplexOptions ()
 
 getComplexOptionsOverview (object $a_parent_gui, string $a_parent_cmd)
 
 exportOptionToTableGUI ($a_option, array &$a_item)
 
 initOptionForm (ilPropertyFormGUI $a_form, $a_option_id)
 
 updateComplexOption (ilPropertyFormGUI $a_form, $a_option_id)
 
- Public Member Functions inherited from ilAdvancedMDFieldDefinition
 __construct (?int $a_field_id=null, string $language='')
 
 getType ()
 Get type. More...
 
 useDefaultLanguageMode (string $language)
 Check if default language mode has to be used: no language given or language equals default language. More...
 
 getTypeTitle ()
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId (int $a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId (string $a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition (int $a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle (string $a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable (bool $a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired (bool $a_status)
 Toggle required. More...
 
 isRequired ()
 Is required field. More...
 
 getFieldDefinitionForTableGUI (string $content_language)
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $language='')
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions, string $active_language)
 Import post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 generateImportId (int $a_field_id)
 Generate unique record id. More...
 
 save (bool $a_keep_pos=false)
 Create new field entry. More...
 
 update ()
 Update field entry. More...
 
 delete ()
 Delete field entry. More...
 
 toXML (ilXmlWriter $a_writer)
 To Xml. More...
 
 importXMLProperty (string $a_key, string $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML (string $a_cdata)
 Import value from xml. More...
 
 importFromECS (string $a_ecs_type, $a_value, string $a_sub_id)
 Import meta data from ECS. More...
 
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements. More...
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser. More...
 
 getSearchValueSerialized (ilADTSearchBridge $a_adt_search)
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 searchSubObjects (ilADTSearchBridge $a_adt_search, int $a_obj_id, string $sub_obj_type)
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, string $a_locate, string $a_search_type)
 Search objects. More...
 
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax. More...
 
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements. More...
 
 _clone (int $a_new_record_id)
 Clone field definition. More...
 
 hasComplexOptions ()
 
 getComplexOptionsOverview (object $a_parent_gui, string $parent_cmd)
 

Protected Member Functions

 initADTDefinition ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
 getADTForOption (string $a_option)
 
 importComplexOptionFromForm (string $a_option, ilADT $a_adt)
 
 findOptionById (string $a_id)
 
- Protected Member Functions inherited from ilAdvancedMDFieldDefinition
 init ()
 
 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 setFieldId (int $a_id)
 Set field_id. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, bool $a_disabled=false, string $language='')
 Add custom input elements to definition form. More...
 
 getLastPosition ()
 Get last position of record. More...
 
 getDBProperties ()
 Get all definition properties for DB. More...
 
 import (array $a_data)
 Import from DB. More...
 
 read (?int $a_field_id)
 Read field definition. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export. More...
 
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results. More...
 

Protected Attributes

 $options = []
 
 $complex = []
 
- Protected Attributes inherited from ilAdvancedMDFieldDefinition
int $field_id = null
 
int $record_id = 0
 
string $import_id = ''
 
int $position = 0
 
string $title = ''
 
string $description = ''
 
bool $searchable = false
 
bool $required = false
 
ilADTDefinition $adt_def = null
 
ilADT $adt = null
 
string $language = ''
 
ilDBInterface $db
 
ilLanguage $lng
 
ilLogger $logger
 
GlobalHttpState $http
 
RefineryFactory $refinery
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstance (?int $a_field_id, ?int $a_type=null, string $language='')
 
static exists (int $a_field_id)
 
static getInstanceByTypeString (string $a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ( $a_record_id, $a_only_searchable=false, string $language='')
 Get definitions by record id. More...
 
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
 
static getInstanceByImportId (string $a_import_id)
 
static getSearchableDefinitionIds ()
 Get searchable definition ids (performance is key) More...
 
static getADTGroupForDefinitions (array $a_defs)
 Init ADTGroup for definitions. More...
 
static getValidTypes ()
 Get all valid types. More...
 
static isValidType (int $a_type)
 
- Data Fields inherited from ilAdvancedMDFieldDefinition
const TYPE_SELECT = 1
 
const TYPE_TEXT = 2
 
const TYPE_DATE = 3
 
const TYPE_DATETIME = 4
 
const TYPE_INTEGER = 5
 
const TYPE_FLOAT = 6
 
const TYPE_LOCATION = 7
 
const TYPE_SELECT_MULTI = 8
 
const TYPE_ADDRESS = 99
 
const TYPE_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getTypeString (int $a_type)
 Get type as string. More...
 

Detailed Description

AMD field type address.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 26 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

Member Function Documentation

◆ addCustomFieldToDefinitionForm()

ilAdvancedMDFieldDefinitionGroupBased::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
bool  $a_disabled = false,
string  $language = '' 
)
protected

Definition at line 85 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\$lng, $options, ilPropertyFormGUI\addItem(), and getOptions().

89  : void {
90  global $lng;
91 
92  $field = new ilTextInputGUI($lng->txt("options"), "opts");
93  $field->setRequired(true);
94  $field->setMulti(true);
95  $field->setMaxLength(255); // :TODO:
96  $a_form->addItem($field);
97 
98  $options = $this->getOptions();
99  if ($options) {
100  $field->setMultiValues($options);
101  $field->setValue(array_shift($options));
102  }
103 
104  if ($a_disabled) {
105  $field->setDisabled(true);
106  }
107  }
+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionGroupBased::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Definition at line 129 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References getOptions(), and ilXmlWriter\xmlElement().

129  : void
130  {
131  foreach ($this->getOptions() as $value) {
132  $a_writer->xmlElement('FieldValue', null, $value);
133  }
134  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ exportOptionToTableGUI()

ilAdvancedMDFieldDefinitionGroupBased::exportOptionToTableGUI (   $a_option,
array &  $a_item 
)

Definition at line 203 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\$adt, ilAdvancedMDFieldDefinition\$title, getADTForOption(), and ilADTFactory\getInstance().

203  : void
204  {
205  $adt = $this->getADTForOption($a_option);
206  foreach ($adt->getElements() as $title => $element) {
207  $pres = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
208  $a_item[$title] = $pres->getList();
209  }
210  }
+ Here is the call graph for this function:

◆ findOptionById()

ilAdvancedMDFieldDefinitionGroupBased::findOptionById ( string  $a_id)
protected

Definition at line 258 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References getOptions().

Referenced by initOptionForm(), and updateComplexOption().

258  : ?string
259  {
260  foreach ($this->getOptions() as $item) {
261  if (md5($item) == $a_id) {
262  return $item;
263  }
264  }
265  return null;
266  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getADTForOption()

ilAdvancedMDFieldDefinitionGroupBased::getADTForOption ( string  $a_option)
protected

Definition at line 185 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\$adt, getADTGroup(), ilADTFactory\getInstance(), and ilADT\importStdClass().

Referenced by exportOptionToTableGUI(), and initOptionForm().

185  : ilADT
186  {
187  $adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTGroup());
188  if (array_key_exists($a_option, $this->complex)) {
189  $adt->importStdClass($this->complex[$a_option]);
190  }
191  return $adt;
192  }
ADT base class.
Definition: class.ilADT.php:11
importStdClass(?stdClass $a_std)
Import value from stdClass.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getADTGroup()

ilAdvancedMDFieldDefinitionGroupBased::getADTGroup ( )
abstract

Referenced by getADTForOption(), importValueFromXML(), and updateComplexOption().

+ Here is the caller graph for this function:

◆ getComplexOptionsOverview()

ilAdvancedMDFieldDefinitionGroupBased::getComplexOptionsOverview ( object  $a_parent_gui,
string  $a_parent_cmd 
)

Definition at line 197 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

197  : ?string
198  {
199  $tbl = new ilAdvancedMDFieldDefinitionGroupTableGUI($a_parent_gui, $a_parent_cmd, $this);
200  return $tbl->getHTML();
201  }

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionGroupBased::getFieldDefinition ( )
protected

Definition at line 67 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

67  : array
68  {
69  return array(
70  "options" => $this->options,
71  "complex" => $this->complex
72  );
73  }

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionGroupBased::getFieldDefinitionForTableGUI ( string  $content_language)

Definition at line 75 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\$lng, and getOptions().

75  : array
76  {
77  global $lng;
78 
79  return array($lng->txt("options") => implode(",", $this->getOptions()));
80  }
+ Here is the call graph for this function:

◆ getOptions()

ilAdvancedMDFieldDefinitionGroupBased::getOptions ( )

◆ getTitles()

ilAdvancedMDFieldDefinitionGroupBased::getTitles ( )
abstract

Referenced by importValueFromXML(), and initOptionForm().

+ Here is the caller graph for this function:

◆ getValueForXML()

ilAdvancedMDFieldDefinitionGroupBased::getValueForXML ( ilADT  $element)

Definition at line 146 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

Referenced by ilAdvancedMDFieldDefinitionText\importXMLProperty().

146  : string
147  {
148  return $element->getSelection();
149  }
+ Here is the caller graph for this function:

◆ hasComplexOptions()

ilAdvancedMDFieldDefinitionGroupBased::hasComplexOptions ( )

Definition at line 180 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

180  : bool
181  {
182  return true;
183  }

◆ importComplexOptionFromForm()

ilAdvancedMDFieldDefinitionGroupBased::importComplexOptionFromForm ( string  $a_option,
ilADT  $a_adt 
)
protected

Definition at line 253 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilADT\exportStdClass().

Referenced by updateComplexOption().

254  {
255  $this->complex[$a_option] = $a_adt->exportStdClass();
256  }
exportStdClass()
Export value as stdClass.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinitionGroupBased::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form,
string  $language = '' 
)

Definition at line 112 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilPropertyFormGUI\getInput(), getOptions(), and setOptions().

112  : void
113  {
114  $old = $this->getOptions();
115  $new = $a_form->getInput("opts");
116 
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]);
122  }
123  }
124  }
125 
126  $this->setOptions($new);
127  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionGroupBased::importFieldDefinition ( array  $a_def)
protected

Definition at line 61 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References setOptions().

61  : void
62  {
63  $this->setOptions($a_def["options"]);
64  $this->complex = $a_def["complex"];
65  }
+ Here is the call graph for this function:

◆ importValueFromXML()

ilAdvancedMDFieldDefinitionGroupBased::importValueFromXML ( string  $a_cdata)

Definition at line 151 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\getADT(), getADTGroup(), and getTitles().

151  : void
152  {
153  /*
154  * On import from <7 options are not given by index but by
155  * their label. There is nothing in the XML by which one could
156  * tell apart legacy and standard imports, so we have to
157  * make a best guess here (32410).
158  *
159  * Might fail for enums where the labels are integers.
160  * See also ilAdvancedMDFieldDefinitionSelect::translateLegacyImportValueFromXML.
161  */
162  if (
163  !in_array($a_cdata, array_keys($this->options)) &&
164  in_array($a_cdata, $this->options)
165  ) {
166  $a_cdata = (string) array_search($a_cdata, $this->options);
167  }
168  $this->getADT()->setSelection($a_cdata);
169  }
+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionGroupBased::importXMLProperty ( string  $a_key,
string  $a_value 
)

Definition at line 136 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

136  : void
137  {
138  $this->options[] = $a_value;
139  }

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionGroupBased::initADTDefinition ( )
protected

Definition at line 31 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References $options, ilADTFactory\getInstance(), and getOptions().

32  {
33  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("Enum");
34  $def->setNumeric(false);
35 
36  $options = $this->getOptions();
37  $def->setOptions($options);
38  return $def;
39  }
ADT definition base class.
+ Here is the call graph for this function:

◆ initOptionForm()

ilAdvancedMDFieldDefinitionGroupBased::initOptionForm ( ilPropertyFormGUI  $a_form,
  $a_option_id 
)

Definition at line 212 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\$adt, $id, ilAdvancedMDFieldDefinition\$lng, ilAdvancedMDFieldDefinition\$title, ilPropertyFormGUI\addItem(), findOptionById(), getADTForOption(), ilADTFactory\getInstance(), and getTitles().

213  {
214  global $lng;
215 
216  $option = $this->findOptionById($a_option_id);
217  if ($option) {
218  $title = new ilTextInputGUI($lng->txt("option"), "option");
219  $title->setValue($option);
220  $title->setDisabled(true);
221  $a_form->addItem($title);
222 
223  $adt = $this->getADTForOption($option);
224  $adt_form = ilADTFactory::getInstance()->getFormBridgeForInstance($adt);
225  $adt_form->setForm($a_form);
226 
227  $titles = $this->getTitles();
228  foreach ($adt_form->getElements() as $id => $element) {
229  $element->setTitle($titles[$id]);
230  }
231 
232  $adt_form->addToForm();
233  }
234  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ setOptions()

ilAdvancedMDFieldDefinitionGroupBased::setOptions ( array  $a_values = null)

Definition at line 41 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

Referenced by importCustomDefinitionFormPostValues(), and importFieldDefinition().

41  : void
42  {
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]);
48  }
49  }
50  $a_values = array_unique($a_values);
51  // sort($a_values);
52  }
53  $this->options = $a_values;
54  }
+ Here is the caller graph for this function:

◆ updateComplexOption()

ilAdvancedMDFieldDefinitionGroupBased::updateComplexOption ( ilPropertyFormGUI  $a_form,
  $a_option_id 
)

Definition at line 236 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

References ilAdvancedMDFieldDefinition\$adt, findOptionById(), getADTGroup(), ilADTFactory\getInstance(), and importComplexOptionFromForm().

237  {
238  $option = $this->findOptionById($a_option_id);
239  if ($option) {
240  $adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTGroup());
241  $adt_form = ilADTFactory::getInstance()->getFormBridgeForInstance($adt);
242  $adt_form->setForm($a_form);
243  if ($adt_form->validate()) {
244  $adt_form->importFromPost();
245  $this->importComplexOptionFromForm($option, $adt);
246  return true;
247  }
248  }
249 
250  return false;
251  }
+ Here is the call graph for this function:

Field Documentation

◆ $complex

ilAdvancedMDFieldDefinitionGroupBased::$complex = []
protected

◆ $options

ilAdvancedMDFieldDefinitionGroupBased::$options = []
protected

The documentation for this class was generated from the following file: