ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 Set options. More...
 
 getOptions ()
 Get options. More...
 
 getFieldDefinitionForTableGUI (string $content_language)
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form, string $language='')
 Import custom post values from definition form. More...
 
 importXMLProperty ($a_key, $a_value)
 
 getValueForXML (ilADT $element)
 
 importValueFromXML ($a_cdata)
 
 getADTGroup ()
 
 getTitles ()
 
 hasComplexOptions ()
 
 getComplexOptionsOverview ($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 ($a_field_id=null, string $language='')
 Constructor. More...
 
 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 ()
 Get type title (lang id) More...
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 Get ADT instance. More...
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId ($a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId ($a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition ($a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle ($a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable ($a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired ($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 ($a_field_id)
 Generate unique record id. More...
 
 save ($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 ($a_key, $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML ($a_cdata)
 Import value from xml. More...
 
 importFromECS ($a_ecs_type, $a_value, $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)
 Get value for search persistence. More...
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 searchSubObjects (ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $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 ($a_new_record_id)
 Clone field definition. More...
 
 hasComplexOptions ()
 
 getComplexOptionsOverview ($a_parent_gui, string $parent_cmd)
 

Protected Member Functions

 initADTDefinition ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false, string $language='')
 Add input elements to definition form. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
 getADTForOption ($a_option)
 
 importComplexOptionFromForm ($a_option, ilADT $a_adt)
 
 findOptionById ($a_id)
 
- Protected Member Functions inherited from ilAdvancedMDFieldDefinition
 init ()
 Init properties. More...
 
 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 setFieldId ($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, $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 ($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 = array()
 
 $complex = array()
 
- Protected Attributes inherited from ilAdvancedMDFieldDefinition
 $field_id
 
 $record_id
 
 $import_id
 
 $position
 
 $title
 
 $description
 
 $searchable
 
 $required
 
 $adt_def
 
 $adt
 
 $language = ''
 
 $logger
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstance ($a_field_id, $a_type=null, string $language='')
 Get definition instance by type. More...
 
static exists ($a_field_id)
 Check if field exists. More...
 
static getInstanceByTypeString ($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 ($a_import_id)
 Get definition instance by import id. More...
 
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 ($a_type)
 Is given type valid. More...
 
- 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 ($a_type)
 Get type 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
Version
$Id$

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

Member Function Documentation

◆ addCustomFieldToDefinitionForm()

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

Add input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
bool$a_disabled
string$language
Exceptions
ilFormException

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

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

103  {
104  global $lng;
105 
106  $field = new ilTextInputGUI($lng->txt("options"), "opts");
107  $field->setRequired(true);
108  $field->setMulti(true);
109  $field->setMaxLength(255); // :TODO:
110  $a_form->addItem($field);
111 
112  $options = $this->getOptions();
113  if ($options) {
114  $field->setMultiValues($options);
115  $field->setValue(array_shift($options));
116  }
117 
118  if ($a_disabled) {
119  $field->setDisabled(true);
120  }
121  }
addItem($a_item)
Add Item (Property, SectionHeader).
$lng
+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionGroupBased::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

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

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

151  {
152  foreach ($this->getOptions() as $value) {
153  $a_writer->xmlElement('FieldValue', null, $value);
154  }
155  }
xmlElement($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 212 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

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

213  {
214  $adt = $this->getADTForOption($a_option);
215  foreach ($adt->getElements() as $title => $element) {
216  $pres = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
217  $a_item[$title] = $pres->getList();
218  }
219  }
static getInstance()
Get singleton.
+ Here is the call graph for this function:

◆ findOptionById()

ilAdvancedMDFieldDefinitionGroupBased::findOptionById (   $a_id)
protected

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

References getOptions().

Referenced by initOptionForm(), and updateComplexOption().

270  {
271  foreach ($this->getOptions() as $item) {
272  if (md5($item) == $a_id) {
273  return $item;
274  }
275  }
276  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getADTForOption()

ilAdvancedMDFieldDefinitionGroupBased::getADTForOption (   $a_option)
protected

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

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

Referenced by exportOptionToTableGUI(), and initOptionForm().

192  {
193  $adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTGroup());
194  if (array_key_exists($a_option, $this->complex)) {
195  $adt->importStdClass($this->complex[$a_option]);
196  }
197  return $adt;
198  }
static getInstance()
Get singleton.
+ 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 (   $a_parent_gui,
string  $a_parent_cmd 
)

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

205  : ?string
206  {
207  include_once "Services/AdvancedMetaData/classes/Types/class.ilAdvancedMDFieldDefinitionGroupTableGUI.php";
208  $tbl = new ilAdvancedMDFieldDefinitionGroupTableGUI($a_parent_gui, $a_parent_cmd, $this);
209  return $tbl->getHTML();
210  }

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionGroupBased::getFieldDefinition ( )
protected

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

81  {
82  return array(
83  "options" => $this->options,
84  "complex" => $this->complex
85  );
86  }

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionGroupBased::getFieldDefinitionForTableGUI ( string  $content_language)

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

References $lng, and getOptions().

89  {
90  global $lng;
91 
92  return array($lng->txt("options") => implode(",", $this->getOptions()));
93  }
$lng
+ 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 167 of file class.ilAdvancedMDFieldDefinitionGroupBased.php.

Referenced by ilAdvancedMDFieldDefinitionText\importXMLProperty().

168  {
169  return $element->getSelection();
170  }
+ Here is the caller graph for this function:

◆ hasComplexOptions()

ilAdvancedMDFieldDefinitionGroupBased::hasComplexOptions ( )

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

187  {
188  return true;
189  }

◆ importComplexOptionFromForm()

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

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

References ilADT\exportStdClass().

Referenced by updateComplexOption().

265  {
266  $this->complex[$a_option] = $a_adt->exportStdClass();
267  }
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 = '' 
)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form
string$language

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

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

129  {
130  $old = $this->getOptions();
131  $new = $a_form->getInput("opts");
132 
133  if (is_array($old)) {
134  $missing = array_diff($old, $new);
135  if (sizeof($missing)) {
136  foreach ($missing as $item) {
137  unset($this->complex[$item]);
138  }
139  }
140  }
141 
142  $this->setOptions($new);
143  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionGroupBased::importFieldDefinition ( array  $a_def)
protected

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

References setOptions().

75  {
76  $this->setOptions($a_def["options"]);
77  $this->complex = $a_def["complex"];
78  }
+ Here is the call graph for this function:

◆ importValueFromXML()

ilAdvancedMDFieldDefinitionGroupBased::importValueFromXML (   $a_cdata)

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

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

173  {
174  $this->getADT()->setSelection($a_cdata);
175  }
+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionGroupBased::importXMLProperty (   $a_key,
  $a_value 
)

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

158  {
159  $this->options[] = $a_value;
160  }

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionGroupBased::initADTDefinition ( )
protected

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

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

25  {
26  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("Enum");
27  $def->setNumeric(false);
28 
29  $options = $this->getOptions();
30  $def->setOptions($options);
31  return $def;
32  }
static getInstance()
Get singleton.
+ Here is the call graph for this function:

◆ initOptionForm()

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

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

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

224  {
225  global $lng;
226 
227  $option = $this->findOptionById($a_option_id);
228  if ($option) {
229  $title = new ilTextInputGUI($lng->txt("option"), "option");
230  $title->setValue($option);
231  $title->setDisabled(true);
232  $a_form->addItem($title);
233 
234  $adt = $this->getADTForOption($option);
235  $adt_form = ilADTFactory::getInstance()->getFormBridgeForInstance($adt);
236  $adt_form->setForm($a_form);
237 
238  $titles = $this->getTitles();
239  foreach ($adt_form->getElements() as $id => $element) {
240  $element->setTitle($titles[$id]);
241  }
242 
243  $adt_form->addToForm();
244  }
245  }
addItem($a_item)
Add Item (Property, SectionHeader).
static getInstance()
Get singleton.
$lng
+ Here is the call graph for this function:

◆ setOptions()

ilAdvancedMDFieldDefinitionGroupBased::setOptions ( array  $a_values = null)

Set options.

Parameters
array$a_values

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

Referenced by importCustomDefinitionFormPostValues(), and importFieldDefinition().

45  {
46  if ($a_values !== null) {
47  foreach ($a_values as $idx => $value) {
48  $a_values[$idx] = trim($value);
49  if (!$a_values[$idx]) {
50  unset($a_values[$idx]);
51  }
52  }
53  $a_values = array_unique($a_values);
54  // sort($a_values);
55  }
56  $this->options = $a_values;
57  }
+ Here is the caller graph for this function:

◆ updateComplexOption()

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

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

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

248  {
249  $option = $this->findOptionById($a_option_id);
250  if ($option) {
251  $adt = ilADTFactory::getInstance()->getInstanceByDefinition($this->getADTGroup());
252  $adt_form = ilADTFactory::getInstance()->getFormBridgeForInstance($adt);
253  $adt_form->setForm($a_form);
254  if ($adt_form->validate()) {
255  $adt_form->importFromPost();
256  $this->importComplexOptionFromForm($option, $adt);
257  return true;
258  }
259  }
260 
261  return false;
262  }
static getInstance()
Get singleton.
+ Here is the call graph for this function:

Field Documentation

◆ $complex

ilAdvancedMDFieldDefinitionGroupBased::$complex = array()
protected

◆ $options

ilAdvancedMDFieldDefinitionGroupBased::$options = array()
protected

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