ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAdvancedMDFieldDefinitionSelect Class Reference

AMD field type select. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinitionSelect:
+ Collaboration diagram for ilAdvancedMDFieldDefinitionSelect:

Public Member Functions

 getType ()
 
 setOptions (array $a_values=null)
 Set options. More...
 
 getOptions ()
 Get options. More...
 
 getFieldDefinitionForTableGUI ()
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 update ()
 
 importXMLProperty ($a_key, $a_value)
 
 getValueForXML (ilADT $element)
 
 importValueFromXML ($a_cdata)
 
 prepareElementForEditor (ilADTFormBridge $a_enum)
 
- Public Member Functions inherited from ilAdvancedMDFieldDefinition
 __construct ($a_field_id=null)
 Constructor. More...
 
 getType ()
 Get type. 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 ()
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 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...
 

Data Fields

const REMOVE_ACTION_ID = "-iladvmdrm-"
 
- 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_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 

Protected Member Functions

 initADTDefinition ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 buildConfirmedObjects (ilPropertyFormGUI $a_form)
 Process custom post values from definition form. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
- 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)
 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 = []
 
 $confirm_objects = []
 
 $confirmed_objects
 
- Protected Attributes inherited from ilAdvancedMDFieldDefinition
 $field_id
 
 $record_id
 
 $import_id
 
 $position
 
 $title
 
 $description
 
 $searchable
 
 $required
 
 $adt_def
 
 $adt
 

Additional Inherited Members

- Static Public Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstance ($a_field_id, $a_type=null)
 Get definition instance by type. More...
 
static getInstanceByTypeString ($a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ($a_record_id, $a_only_searchable=false)
 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...
 
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getTypeString ($a_type)
 Get type string. More...
 

Detailed Description

AMD field type select.

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.ilAdvancedMDFieldDefinitionSelect.php.

Member Function Documentation

◆ addCustomFieldToDefinitionForm()

ilAdvancedMDFieldDefinitionSelect::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
  $a_disabled = false 
)

Add input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
bool$a_disabled

Definition at line 113 of file class.ilAdvancedMDFieldDefinitionSelect.php.

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

114  {
115  global $DIC;
116 
117  $lng = $DIC['lng'];
118 
119  $field = new ilTextInputGUI($lng->txt("meta_advmd_select_options"), "opts");
120  $field->setRequired(true);
121  $field->setMulti(true, true);
122  $field->setMaxLength(255); // :TODO:
123  $a_form->addItem($field);
124 
125  $options = $this->getOptions();
126  if ($options) {
127  $field->setMultiValues($options);
128  $field->setValue(array_shift($options));
129  }
130 
131  if ($a_disabled) {
132  $field->setDisabled(true);
133  }
134  }
global $DIC
Definition: saml.php:7
addItem($a_item)
Add Item (Property, SectionHeader).
$lng
This class represents a text property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionSelect::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Definition at line 386 of file class.ilAdvancedMDFieldDefinitionSelect.php.

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

387  {
388  foreach ($this->getOptions() as $value) {
389  $a_writer->xmlElement('FieldValue', null, $value);
390  }
391  }
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:

◆ buildConfirmedObjects()

ilAdvancedMDFieldDefinitionSelect::buildConfirmedObjects ( ilPropertyFormGUI  $a_form)
protected

Process custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Definition at line 141 of file class.ilAdvancedMDFieldDefinitionSelect.php.

References $res, ilAdvancedMDFieldDefinition\getFieldId(), and ilPropertyFormGUI\getInput().

Referenced by ilAdvancedMDFieldDefinitionSelectMulti\importCustomDefinitionFormPostValues(), and importCustomDefinitionFormPostValues().

142  {
143  // #15719
144  $recipes = $a_form->getInput("conf_det");
145  if (is_array($recipes[$this->getFieldId()])) {
146  $recipes = $recipes[$this->getFieldId()];
147  $sum = $a_form->getInput("conf_det_act");
148  $sum = $sum[$this->getFieldId()];
149  $sgl = $a_form->getInput("conf");
150  $sgl = $sgl[$this->getFieldId()];
151 
152  $res = array();
153  foreach ($recipes as $old_option => $recipe) {
154  $sum_act = $sum[$old_option];
155  $sgl_act = $sgl[$old_option];
156 
157  if ($recipe == "sum") {
158  // #18885
159  if (!$sum_act) {
160  return;
161  }
162 
163  foreach (array_keys($sgl_act) as $obj_idx) {
164  if ($sum_act == self::REMOVE_ACTION_ID) {
165  $sum_act = "";
166  }
167  $res[$old_option][$obj_idx] = $sum_act;
168  }
169  } else {
170  // #18885
171  foreach ($sgl_act as $sgl_index => $sgl_item) {
172  if (!$sgl_item) {
173  return;
174  } elseif ($sgl_item == self::REMOVE_ACTION_ID) {
175  $sgl_act[$sgl_index] = "";
176  }
177  }
178 
179  $res[$old_option] = $sgl_act;
180  }
181  }
182 
183  return $res;
184  }
185  }
foreach($_POST as $key=> $value) $res
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:
+ Here is the caller graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionSelect::getFieldDefinition ( )
protected

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionSelect::getFieldDefinitionForTableGUI ( )

Definition at line 98 of file class.ilAdvancedMDFieldDefinitionSelect.php.

References $DIC, $lng, and getOptions().

99  {
100  global $DIC;
101 
102  $lng = $DIC['lng'];
103 
104  return array($lng->txt("meta_advmd_select_options") => implode(",", $this->getOptions()));
105  }
global $DIC
Definition: saml.php:7
$lng
+ Here is the call graph for this function:

◆ getOptions()

◆ getType()

ilAdvancedMDFieldDefinitionSelect::getType ( )

Definition at line 27 of file class.ilAdvancedMDFieldDefinitionSelect.php.

28  {
29  return self::TYPE_SELECT;
30  }

◆ getValueForXML()

ilAdvancedMDFieldDefinitionSelect::getValueForXML ( ilADT  $element)

Definition at line 403 of file class.ilAdvancedMDFieldDefinitionSelect.php.

404  {
405  return $element->getSelection();
406  }

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinitionSelect::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Definition at line 192 of file class.ilAdvancedMDFieldDefinitionSelect.php.

References buildConfirmedObjects(), ilAdvancedMDFieldDefinition\getFieldId(), ilPropertyFormGUI\getInput(), getOptions(), ilADTFactory\initActiveRecordByType(), ilADTActiveRecordByType\readByPrimary(), setOptions(), and ilADTActiveRecordByType\SINGLE_COLUMN_NAME.

193  {
194  $old = $this->getOptions();
195  $new = $a_form->getInput("opts");
196 
197  $missing = array_diff($old, $new);
198  if (sizeof($missing)) {
199  $this->confirmed_objects = $this->buildConfirmedObjects($a_form);
200  if (!is_array($this->confirmed_objects)) {
202  $primary = array(
203  "field_id" => array("integer", $this->getFieldId()),
204  ilADTActiveRecordByType::SINGLE_COLUMN_NAME => array("text", $missing)
205  );
206  $in_use = ilADTActiveRecordByType::readByPrimary("adv_md_values", $primary, "Enum");
207  if ($in_use) {
208  $this->confirm_objects = [];
209  foreach ($in_use as $item) {
210  $this->confirm_objects[$item[ilADTActiveRecordByType::SINGLE_COLUMN_NAME]][] = array($item["obj_id"], $item["sub_type"], $item["sub_id"]);
211  }
212  }
213  }
214  }
215 
216  $this->setOptions($new);
217  }
static initActiveRecordByType()
Init active record by type.
static readByPrimary($a_table, array $a_primary, $a_type=null)
Read directly.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
buildConfirmedObjects(ilPropertyFormGUI $a_form)
Process custom post values from definition form.
+ Here is the call graph for this function:

◆ importDefinitionFormPostValuesNeedsConfirmation()

ilAdvancedMDFieldDefinitionSelect::importDefinitionFormPostValuesNeedsConfirmation ( )

Definition at line 219 of file class.ilAdvancedMDFieldDefinitionSelect.php.

220  {
221  return is_array($this->confirm_objects) && count($this->confirm_objects) > 0;
222  }

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionSelect::importFieldDefinition ( array  $a_def)
protected

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

References setOptions().

89  {
90  $this->setOptions($a_def);
91  }
+ Here is the call graph for this function:

◆ importValueFromXML()

ilAdvancedMDFieldDefinitionSelect::importValueFromXML (   $a_cdata)

Definition at line 408 of file class.ilAdvancedMDFieldDefinitionSelect.php.

References ilAdvancedMDFieldDefinition\getADT().

409  {
410  $this->getADT()->setSelection($a_cdata);
411  }
+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionSelect::importXMLProperty (   $a_key,
  $a_value 
)

Definition at line 393 of file class.ilAdvancedMDFieldDefinitionSelect.php.

394  {
395  $this->options[] = $a_value;
396  }

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionSelect::initADTDefinition ( )
protected

Definition at line 37 of file class.ilAdvancedMDFieldDefinitionSelect.php.

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

38  {
39  $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("Enum");
40  $def->setNumeric(false);
41 
42  $options = $this->getOptions();
43  $def->setOptions(array_combine($options, $options));
44 
45  return $def;
46  }
static getInstance()
Get singleton.
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:

◆ prepareCustomDefinitionFormConfirmation()

ilAdvancedMDFieldDefinitionSelect::prepareCustomDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

Definition at line 224 of file class.ilAdvancedMDFieldDefinitionSelect.php.

References $_POST, $DIC, $lng, $options, ilAdvancedMDFieldDefinition\$title, $type, ilObject\_lookupTitle(), ilObject\_lookupType(), ilPropertyFormGUI\addItem(), ilAdvancedMDFieldDefinition\getFieldId(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilUtil\sendFailure(), and ilFormPropertyGUI\setRequired().

225  {
226  global $DIC;
227 
228  $lng = $DIC['lng'];
229  $objDefinition = $DIC['objDefinition'];
230 
231  $a_form->getItemByPostVar("opts")->setDisabled(true);
232  if (is_array($this->confirm_objects) && count($this->confirm_objects) > 0) {
233  $new_options = $a_form->getInput("opts");
234 
235  $sec = new ilFormSectionHeaderGUI();
236  $sec->setTitle($lng->txt("md_adv_confirm_definition_select_section"));
237  $a_form->addItem($sec);
238 
239  foreach ($this->confirm_objects as $old_option => $items) {
240  $details = new ilRadioGroupInputGUI($lng->txt("md_adv_confirm_definition_select_option") . ': "' . $old_option . '"', "conf_det[" . $this->getFieldId() . "][" . $old_option . "]");
241  $details->setRequired(true);
242  $details->setValue("sum");
243  $a_form->addItem($details);
244 
245  // automatic reload does not work
246  if (isset($_POST["conf_det"][$this->getFieldId()][$old_option])) {
247  $details->setValue($_POST["conf_det"][$this->getFieldId()][$old_option]);
248  }
249 
250  $sum = new ilRadioOption($lng->txt("md_adv_confirm_definition_select_option_all"), "sum");
251  $details->addOption($sum);
252 
253  $sel = new ilSelectInputGUI(
254  $lng->txt("md_adv_confirm_definition_select_option_all_action"),
255  "conf_det_act[" . $this->getFieldId() . "][" . $old_option . "]"
256  );
257  $sel->setRequired(true);
258  $options = array(
259  "" => $lng->txt("please_select"),
260  self::REMOVE_ACTION_ID => $lng->txt("md_adv_confirm_definition_select_option_remove")
261  );
262  foreach ($new_options as $new_option) {
263  $options[$new_option] = $lng->txt("md_adv_confirm_definition_select_option_overwrite") . ': "' . $new_option . '"';
264  }
265  $sel->setOptions($options);
266  $sum->addSubItem($sel);
267 
268  // automatic reload does not work
269  if (isset($_POST["conf_det_act"][$this->getFieldId()][$old_option])) {
270  if ($_POST["conf_det_act"][$this->getFieldId()][$old_option]) {
271  $sel->setValue($_POST["conf_det_act"][$this->getFieldId()][$old_option]);
272  } elseif ($_POST["conf_det"][$this->getFieldId()][$old_option] == "sum") {
273  $sel->setAlert($lng->txt("msg_input_is_required"));
274  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
275  }
276  }
277  $single = new ilRadioOption($lng->txt("md_adv_confirm_definition_select_option_single"), "sgl");
278  $details->addOption($single);
279  foreach ($items as $item) {
280  $obj_id = $item[0];
281  $sub_type = $item[1];
282  $sub_id = $item[2];
283 
284  $item_id = $obj_id . "_" . $sub_type . "_" . $sub_id;
285 
286  $type = ilObject::_lookupType($obj_id);
287  $type_title = $lng->txt("obj_" . $type);
288  $title = ' "' . ilObject::_lookupTitle($obj_id) . '"';
289 
290  if ($sub_id) {
291  $class = "ilObj" . $objDefinition->getClassName($type);
292  $class_path = $objDefinition->getLocation($type);
293  include_once $class_path . "/class." . $class . ".php";
294  $ints = class_implements($class);
295  if (isset($ints["ilAdvancedMetaDataSubItems"])) {
296  $sub_title = $class::getAdvMDSubItemTitle($obj_id, $sub_type, $sub_id);
297  if ($sub_title) {
298  $title .= ' (' . $sub_title . ')';
299  }
300  }
301  }
302 
303  $sel = new ilSelectInputGUI(
304  $type_title . ' ' . $title,
305  "conf[" . $this->getFieldId() . "][" . $old_option . "][" . $item_id . "]"
306  );
307  $sel->setRequired(true);
308  $options = array(
309  "" => $lng->txt("please_select"),
310  self::REMOVE_ACTION_ID => $lng->txt("md_adv_confirm_definition_select_option_remove")
311  );
312  foreach ($new_options as $new_option) {
313  $options[$new_option] = $lng->txt("md_adv_confirm_definition_select_option_overwrite") . ': "' . $new_option . '"';
314  }
315  $sel->setOptions($options);
316 
317  // automatic reload does not work
318  if (isset($_POST["conf"][$this->getFieldId()][$old_option][$item_id])) {
319  if ($_POST["conf"][$this->getFieldId()][$old_option][$item_id]) {
320  $sel->setValue($_POST["conf"][$this->getFieldId()][$old_option][$item_id]);
321  } elseif ($_POST["conf_det"][$this->getFieldId()][$old_option] == "sgl") {
322  $sel->setAlert($lng->txt("msg_input_is_required"));
323  ilUtil::sendFailure($lng->txt("form_input_not_valid"));
324  }
325  }
326 
327  $single->addSubItem($sel);
328  }
329  }
330  }
331  }
This class represents an option in a radio group.
getItemByPostVar($a_post_var)
Get Item by POST variable.
This class represents a selection list property in a property form.
$type
global $DIC
Definition: saml.php:7
This class represents a section header in a property form.
static _lookupTitle($a_id)
lookup object title
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
$lng
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ prepareElementForEditor()

ilAdvancedMDFieldDefinitionSelect::prepareElementForEditor ( ilADTFormBridge  $a_enum)

Definition at line 418 of file class.ilAdvancedMDFieldDefinitionSelect.php.

419  {
420  assert($a_enum instanceof ilADTEnumFormBridge);
421 
422  $a_enum->setAutoSort(false);
423  }

◆ setOptions()

ilAdvancedMDFieldDefinitionSelect::setOptions ( array  $a_values = null)

Set options.

Parameters
array$a_values

Definition at line 58 of file class.ilAdvancedMDFieldDefinitionSelect.php.

Referenced by ilAdvancedMDFieldDefinitionSelectMulti\importCustomDefinitionFormPostValues(), importCustomDefinitionFormPostValues(), and importFieldDefinition().

59  {
60  if ($a_values !== null) {
61  foreach ($a_values as $idx => $value) {
62  $a_values[$idx] = trim($value);
63  if (!$a_values[$idx]) {
64  unset($a_values[$idx]);
65  }
66  }
67  $a_values = array_unique($a_values);
68  // sort($a_values);
69  }
70  $this->options = $a_values;
71  }
+ Here is the caller graph for this function:

◆ update()

ilAdvancedMDFieldDefinitionSelect::update ( )

Definition at line 338 of file class.ilAdvancedMDFieldDefinitionSelect.php.

References ilADTActiveRecordByType\deleteByPrimary(), ilAdvancedMDFieldDefinition\getFieldId(), ilADTFactory\initActiveRecordByType(), ilPCAMDPageList\migrateField(), League\Flysystem\Adapter\Polyfill\update(), and ilADTActiveRecordByType\writeByPrimary().

339  {
340  parent::update();
341 
342  if (is_array($this->confirmed_objects) && count($this->confirmed_objects) > 0) {
344  foreach ($this->confirmed_objects as $old_option => $item_ids) {
345  foreach ($item_ids as $item => $new_option) {
346  $item = explode("_", $item);
347  $obj_id = $item[0];
348  $sub_type = $item[1];
349  $sub_id = $item[2];
350 
351  if (!$new_option) {
352  // remove existing value
353  $primary = array(
354  "obj_id" => array("integer", $obj_id),
355  "sub_type" => array("text", $sub_type),
356  "sub_id" => array("integer", $sub_id),
357  "field_id" => array("integer", $this->getFieldId())
358  );
359  ilADTActiveRecordByType::deleteByPrimary("adv_md_values", $primary, "Enum");
360  } else {
361  // update existing value
362  $primary = array(
363  "obj_id" => array("integer", $obj_id),
364  "sub_type" => array("text", $sub_type),
365  "sub_id" => array("integer", $sub_id),
366  "field_id" => array("integer", $this->getFieldId())
367  );
368  ilADTActiveRecordByType::writeByPrimary("adv_md_values", $primary, "Enum", $new_option);
369  }
370 
371  if ($sub_type == "wpg") {
372  // #15763 - adapt advmd page lists
373  include_once "Modules/Wiki/classes/class.ilPCAMDPageList.php";
374  ilPCAMDPageList::migrateField($obj_id, $this->getFieldId(), $old_option, $new_option);
375  }
376  }
377  }
378  }
379  }
static initActiveRecordByType()
Init active record by type.
static writeByPrimary($a_table, array $a_primary, $a_type, $a_value)
Write directly.
static deleteByPrimary($a_table, array $a_primary, $a_type=null)
Delete values by (partial) primary key.
static migrateField($a_obj_id, $a_field_id, $old_option, $new_option, $a_is_multi=false)
Migrate search/filter values on advmd change.
update($pash, $contents, Config $config)
+ Here is the call graph for this function:

Field Documentation

◆ $confirm_objects

ilAdvancedMDFieldDefinitionSelect::$confirm_objects = []
protected

Definition at line 17 of file class.ilAdvancedMDFieldDefinitionSelect.php.

◆ $confirmed_objects

ilAdvancedMDFieldDefinitionSelect::$confirmed_objects
protected

Definition at line 18 of file class.ilAdvancedMDFieldDefinitionSelect.php.

◆ $options

◆ REMOVE_ACTION_ID

const ilAdvancedMDFieldDefinitionSelect::REMOVE_ACTION_ID = "-iladvmdrm-"

Definition at line 20 of file class.ilAdvancedMDFieldDefinitionSelect.php.


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