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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilDclSelectionFieldModel:
+ Collaboration diagram for ilDclSelectionFieldModel:

Public Member Functions

 getValidFieldProperties ()
 
 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 Returns a query-object for building the record-loader-sql-query. More...
 
 isMulti ()
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 
 storePropertiesFromForm (ilPropertyFormGUI $form)
 called when saving the 'edit field' form More...
 
 fillPropertiesForm (ilPropertyFormGUI &$form)
 
 setProperty (string $key, $value)
 
 reorderExistingValues ()
 sorts record field values by the new order More...
 
 getProperty (string $key)
 
 getRecordQuerySortObject (string $direction="asc", bool $sort_by_status=false)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 doDelete ()
 
 isConfirmationRequired (ilPropertyFormGUI $form)
 
 getConfirmationGUI (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilDclBaseFieldModel
 __construct (int $a_id=0)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId (int $a_id)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle (string $a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setDatatypeId (int $a_id)
 Set datatype id. More...
 
 getDatatypeId ()
 Get datatype_id. More...
 
 isUnique ()
 
 setUnique (?bool $unique)
 
 getDatatype ()
 
 getDatatypeTitle ()
 
 getPresentationTitle ()
 
 getPresentationDescription ()
 
 getStorageLocation ()
 Get storage location for the model. More...
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 
 buildFromDBRecord (array $rec)
 Builds model from db record. More...
 
 doCreate ()
 
 doUpdate ()
 
 updateProperties ()
 Update properties of this field in Database. More...
 
 doDelete ()
 Remove field and properties. More...
 
 getViewSettings ()
 
 getViewSetting (int $tableview_id)
 
 getOrder ()
 
 setOrder (string $order)
 
 hasProperty (string $key)
 Checks if a certain property for a field is set. More...
 
 getProperty (string $key)
 Returns a certain property of a field. More...
 
 getPropertyInstance (string $key)
 Return ActiveRecord of property. More...
 
 setProperty (string $key, $value)
 Set a property for a field (does not save) More...
 
 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 checkValidityFromForm (ilPropertyFormGUI &$form, ?int $record_id=null)
 
 checkValidity ($value, ?int $record_id=null)
 Check if input is valid. More...
 
 cloneStructure (int $original_id)
 
 afterClone (array $records)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 setExportable (bool $exportable)
 
 allowFilterInListView ()
 
 getRecordQuerySortObject (string $direction="asc", bool $sort_by_status=false)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getSortField ()
 Returns the sort-field id. More...
 
 hasNumericSorting ()
 Set to true, when the sorting should be handled numerical. More...
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 Checks input of specific fields befor saving. More...
 
 getStorageLocationOverride ()
 
 setStorageLocationOverride (?int $storage_location_override)
 
 fillHeaderExcel (ilExcel $worksheet, int &$row, int &$col)
 
 checkTitlesForImport (array &$titles, array &$import_fields)
 
 storePropertiesFromForm (ilPropertyFormGUI $form)
 called when saving the 'edit field' form More...
 
 fillPropertiesForm (ilPropertyFormGUI &$form)
 called to fill the 'edit field' form More...
 
 isConfirmationRequired (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI when updating field properties if you overwrite this method, remember to also overwrite getConfirmationGUI More...
 
 getConfirmationGUI (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI if isConfirmationRequired returns true More...
 

Data Fields

const SELECTION_TYPE_SINGLE = 'selection_type_single'
 
const SELECTION_TYPE_MULTI = 'selection_type_multi'
 
const SELECTION_TYPE_COMBOBOX = 'selection_type_combobox'
 
const PROP_SELECTION_TYPE = ''
 
const PROP_SELECTION_OPTIONS = ''
 
- Data Fields inherited from ilDclBaseFieldModel
const PROP_LENGTH = "lenght"
 General properties. More...
 
const PROP_REGEX = "regex"
 
const PROP_REFERENCE = "table_id"
 
const PROP_URL = "url"
 
const PROP_TEXTAREA = "text_area"
 
const PROP_REFERENCE_LINK = "reference_link"
 
const PROP_WIDTH = "width"
 
const PROP_HEIGHT = "height"
 
const PROP_LEARNING_PROGRESS = "learning_progress"
 
const PROP_ILIAS_REFERENCE_LINK = "ILIAS_reference_link"
 
const PROP_N_REFERENCE = "multiple_selection"
 
const PROP_FORMULA_EXPRESSION = "expression"
 
const PROP_DISPLAY_COPY_LINK_ACTION_MENU = "display_action_menu"
 
const PROP_LINK_DETAIL_PAGE_TEXT = "link_detail_page_text"
 
const PROP_LINK_DETAIL_PAGE_MOB = "link_detail_page_mob"
 
const PROP_SUPPORTED_FILE_TYPES = "supported_file_types"
 
const PROP_PLUGIN_HOOK_NAME = "plugin_hook_name"
 
const EDIT_VIEW = 2
 
const EXPORTABLE_VIEW = 4
 

Protected Member Functions

 multiPropertyChanged (bool $is_multi_now)
 changes the values of all record fields, since the property "multi" has changed More...
 
- Protected Member Functions inherited from ilDclBaseFieldModel
 loadDatatype ()
 Load datatype for model. More...
 
 loadTableFieldSetting ()
 loadTableFieldSetting More...
 
 addToTableViews ()
 create ilDclTableViewFieldSettings for this field in each tableview More...
 
 updateTableFieldSetting ()
 update exportable and fieldorder More...
 
 loadProperties ()
 Get all properties of a field. More...
 
 normalizeValue ($value)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilDclBaseFieldModel
static _getTitleInvalidChars (bool $a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle (string $title, int $table_id)
 
- Protected Attributes inherited from ilDclBaseFieldModel
string $id = ""
 
int $table_id = 0
 
string $title = ""
 
string $description = ""
 
int $datatypeId = 0
 
int $order = null
 
bool $unique = false
 
array $property = []
 
bool $exportable = false
 
ilDclDatatype $datatype = null
 
int $storage_location_override = null
 With this property the datatype-storage-location can be overwritten. More...
 
ilDBInterface $db
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilDclSelectionFieldModel.php.

Member Function Documentation

◆ checkFieldCreationInput()

ilDclSelectionFieldModel::checkFieldCreationInput ( ilPropertyFormGUI  $form)

Definition at line 86 of file class.ilDclSelectionFieldModel.php.

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), and ILIAS\Repository\lng().

86  : bool
87  {
88  $options_post_var = "prop_" . static::PROP_SELECTION_OPTIONS;
89  foreach ($form->getInput($options_post_var) as $value) {
90  if ($value["selection_value"] == "") {
91  $inputObj = $form->getItemByPostVar($options_post_var);
92  $inputObj->setAlert($this->lng->txt("msg_input_is_required"));
93  return false;
94  }
95  }
96 
97  return parent::checkFieldCreationInput($form);
98  }
getItemByPostVar(string $a_post_var)
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:

◆ cloneProperties()

ilDclSelectionFieldModel::cloneProperties ( ilDclBaseFieldModel  $originalField)

Definition at line 288 of file class.ilDclSelectionFieldModel.php.

References ilDclSelectionOption\getAllForField(), and ilDclBaseFieldModel\getId().

288  : void
289  {
290  parent::cloneProperties($originalField);
291  $options = ilDclSelectionOption::getAllForField($originalField->getId());
292  foreach ($options as $opt) {
293  $new_opt = new ilDclSelectionOption();
294  $new_opt->cloneOption($opt);
295  $new_opt->setFieldId($this->getId());
296  $new_opt->store();
297  }
298  }
static getAllForField(int $field_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ doDelete()

ilDclSelectionFieldModel::doDelete ( )

Definition at line 300 of file class.ilDclSelectionFieldModel.php.

References ilDclSelectionOption\getAllForField(), and ilDclBaseFieldModel\getId().

300  : void
301  {
302  foreach (ilDclSelectionOption::getAllForField($this->getId()) as $option) {
303  $option->delete();
304  }
305  parent::doDelete();
306  }
static getAllForField(int $field_id)
+ Here is the call graph for this function:

◆ fillPropertiesForm()

ilDclSelectionFieldModel::fillPropertiesForm ( ilPropertyFormGUI $form)
Parameters
ilPropertyFormGUI$form
Returns
bool

Definition at line 133 of file class.ilDclSelectionFieldModel.php.

References ilDclSelectionOption\getAllForField(), ilDclBaseFieldModel\getDatatypeId(), ilDclBaseFieldModel\getDescription(), ilDclBaseFieldModel\getId(), getProperty(), ilDclBaseFieldModel\getTableId(), ilDclBaseFieldModel\getTitle(), getValidFieldProperties(), ilDclBaseFieldModel\isUnique(), and ilPropertyFormGUI\setValuesByArray().

133  : bool
134  {
135  $values = [
136  'table_id' => $this->getTableId(),
137  'field_id' => $this->getId(),
138  'title' => $this->getTitle(),
139  'datatype' => $this->getDatatypeId(),
140  'description' => $this->getDescription(),
141  'unique' => $this->isUnique(),
142  ];
143 
144  $properties = $this->getValidFieldProperties();
145  foreach ($properties as $prop) {
146  if ($prop == static::PROP_SELECTION_OPTIONS) {
147  $options = ilDclSelectionOption::getAllForField($this->getId());
148  $prop_values = [];
149  foreach ($options as $option) {
150  // the 'selection_value' is for a correct input
151  $prop_values[$option->getOptId()] = ['selection_value' => $option->getValue()];
152  }
153 
154  $values['prop_' . $prop] = $prop_values;
155  } else {
156  $values['prop_' . $prop] = $this->getProperty($prop);
157  }
158  }
159 
160  $form->setValuesByArray($values);
161 
162  return true;
163  }
static getAllForField(int $field_id)
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
getDescription()
Get description.
getDatatypeId()
Get datatype_id.
+ Here is the call graph for this function:

◆ getConfirmationGUI()

ilDclSelectionFieldModel::getConfirmationGUI ( ilPropertyFormGUI  $form)

Definition at line 315 of file class.ilDclSelectionFieldModel.php.

References $DIC, ILIAS\LTI\ToolProvider\$key, ilDclFieldFactory\getFieldRepresentationInstance(), and ilPropertyFormGUI\getInput().

316  {
317  global $DIC;
318  $representation = ilDclFieldFactory::getFieldRepresentationInstance($this);
319  $prop_selection_options = $representation->getPropertyInputFieldId(static::PROP_SELECTION_OPTIONS);
320  $prop_selection_type = $representation->getPropertyInputFieldId(static::PROP_SELECTION_TYPE);
321 
322  $ilConfirmationGUI = parent::getConfirmationGUI($form);
323  $ilConfirmationGUI->setHeaderText($DIC->language()->txt('dcl_msg_mc_to_sc_confirmation'));
324  $ilConfirmationGUI->addHiddenItem($prop_selection_type, $form->getInput($prop_selection_type));
325  foreach ($form->getInput($prop_selection_options) as $key => $option) {
326  $ilConfirmationGUI->addHiddenItem(
327  $prop_selection_options . "[$key][selection_value]",
328  $option['selection_value']
329  );
330  }
331 
332  return $ilConfirmationGUI;
333  }
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
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-...
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getProperty()

ilDclSelectionFieldModel::getProperty ( string  $key)
Parameters
$key
Returns
ilDclSelectionOption[]|ilDclFieldProperty|null

Definition at line 250 of file class.ilDclSelectionFieldModel.php.

References ilDclSelectionOption\getAllForField(), and ilDclBaseFieldModel\getId().

Referenced by fillPropertiesForm(), isMulti(), and setProperty().

251  {
252  switch ($key) {
253  case static::PROP_SELECTION_OPTIONS:
255  default:
256  return parent::getProperty($key);
257  }
258  }
string $key
Consumer key/client ID value.
Definition: System.php:193
static getAllForField(int $field_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordQueryFilterObject()

ilDclSelectionFieldModel::getRecordQueryFilterObject (   $filter_value = "",
?ilDclBaseFieldModel  $sort_field = null 
)

Returns a query-object for building the record-loader-sql-query.

Parameters
string | int$filter_value

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

References $DIC, $ilDB, ilDclBaseFieldModel\getId(), and isMulti().

41  global $DIC;
42  $ilDB = $DIC['ilDB'];
43 
44  $join_str
45  = " LEFT JOIN il_dcl_record_field AS filter_record_field_{$this->getId()} ON (filter_record_field_{$this->getId()}.record_id = record.id AND filter_record_field_{$this->getId()}.field_id = "
46  . $ilDB->quote($this->getId(), 'integer') . ") ";
47 
48  $join_str .= " LEFT JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS filter_stloc_{$this->getId()} ON (filter_stloc_{$this->getId()}.record_field_id = filter_record_field_{$this->getId()}.id";
49 
50  $where_str = " AND ";
51  if ($filter_value == 'none') {
52  $where_str .= "("
53  . "filter_stloc_{$this->getId()}.value IS NULL "
54  . " OR filter_stloc_{$this->getId()}.value = " . $ilDB->quote("", 'text')
55  . " OR filter_stloc_{$this->getId()}.value = " . $ilDB->quote("[]", 'text')
56  . ") ";
57  } else {
58  if ($this->isMulti()) {
59  $where_str .= " (" .
60  "filter_stloc_{$this->getId()}.value = " . $ilDB->quote("[$filter_value]", 'text') . " OR " .
61  "filter_stloc_{$this->getId()}.value LIKE " . $ilDB->quote("%\"$filter_value\"%", 'text') . " OR " .
62  "filter_stloc_{$this->getId()}.value LIKE " . $ilDB->quote("%,$filter_value,%", 'text') . " OR " .
63  "filter_stloc_{$this->getId()}.value LIKE " . $ilDB->quote("%[$filter_value,%", 'text') . " OR " .
64  "filter_stloc_{$this->getId()}.value LIKE " . $ilDB->quote("%,$filter_value]%", 'text') .
65  ") ";
66  } else {
67  $where_str .= "filter_stloc_{$this->getId()}.value = "
68  . $ilDB->quote($filter_value, 'integer');
69  }
70  }
71 
72  $join_str .= ") ";
73 
74  $sql_obj = new ilDclRecordQueryObject();
75  $sql_obj->setJoinStatement($join_str);
76  $sql_obj->setWhereStatement($where_str);
77 
78  return $sql_obj;
79  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ getRecordQuerySortObject()

ilDclSelectionFieldModel::getRecordQuerySortObject ( string  $direction = "asc",
bool  $sort_by_status = false 
)

Definition at line 260 of file class.ilDclSelectionFieldModel.php.

References $DIC, $ilDB, ilDclBaseFieldModel\getId(), and isMulti().

264  global $DIC;
265  $ilDB = $DIC['ilDB'];
266 
267  if ($this->isMulti()) {
268  return null;
269  }
270 
271  $sql_obj = new ilDclRecordQueryObject();
272 
273  $select_str = "sel_opts_{$this->getId()}.value AS field_{$this->getId()}";
274  $join_str
275  = "LEFT JOIN il_dcl_record_field AS sort_record_field_{$this->getId()} ON (sort_record_field_{$this->getId()}.record_id = record.id AND sort_record_field_{$this->getId()}.field_id = "
276  . $ilDB->quote($this->getId(), 'integer') . ") ";
277  $join_str .= "LEFT JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS sort_stloc_{$this->getId()} ON (sort_stloc_{$this->getId()}.record_field_id = sort_record_field_{$this->getId()}.id) ";
278  $join_str .= "LEFT JOIN il_dcl_sel_opts as sel_opts_{$this->getId()} ON (sel_opts_{$this->getId()}.opt_id = sort_stloc_{$this->getId()}.value AND sel_opts_{$this->getId()}.field_id = "
279  . $ilDB->quote($this->getId(), 'integer') . ") ";
280 
281  $sql_obj->setSelectStatement($select_str);
282  $sql_obj->setJoinStatement($join_str);
283  $sql_obj->setOrderStatement("field_{$this->getId()} {$direction} , ID ASC");
284 
285  return $sql_obj;
286  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ getValidFieldProperties()

ilDclSelectionFieldModel::getValidFieldProperties ( )

Definition at line 28 of file class.ilDclSelectionFieldModel.php.

Referenced by fillPropertiesForm(), and storePropertiesFromForm().

28  : array
29  {
30  return [static::PROP_SELECTION_OPTIONS, static::PROP_SELECTION_TYPE];
31  }
+ Here is the caller graph for this function:

◆ isConfirmationRequired()

ilDclSelectionFieldModel::isConfirmationRequired ( ilPropertyFormGUI  $form)

Definition at line 308 of file class.ilDclSelectionFieldModel.php.

References ilPropertyFormGUI\getInput(), and isMulti().

308  : bool
309  {
310  $will_be_multi = ($form->getInput('prop_' . static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
311 
312  return $this->isMulti() && !$will_be_multi;
313  }
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:

◆ isMulti()

ilDclSelectionFieldModel::isMulti ( )

Definition at line 81 of file class.ilDclSelectionFieldModel.php.

References getProperty().

Referenced by getRecordQueryFilterObject(), getRecordQuerySortObject(), isConfirmationRequired(), and setProperty().

81  : bool
82  {
83  return ($this->getProperty(static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
84  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ multiPropertyChanged()

ilDclSelectionFieldModel::multiPropertyChanged ( bool  $is_multi_now)
protected

changes the values of all record fields, since the property "multi" has changed

Definition at line 228 of file class.ilDclSelectionFieldModel.php.

References ilDclBaseFieldModel\getId(), ilDclCache\getTableCache(), and ilDclBaseFieldModel\getTableId().

Referenced by setProperty().

228  : void
229  {
230  foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) {
231  $record_field = $record->getRecordField($this->getId());
232  $record_field_value = $record_field->getValue();
233 
234  if ($record_field_value && !is_array($record_field_value) && $is_multi_now) {
235  $record_field->setValue([$record_field_value]);
236  $record_field->doUpdate();
237  } else {
238  if (is_array($record_field_value) && !$is_multi_now) {
239  $record_field->setValue(array_shift($record_field_value));
240  $record_field->doUpdate();
241  }
242  }
243  }
244  }
static getTableCache(int $table_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reorderExistingValues()

ilDclSelectionFieldModel::reorderExistingValues ( )

sorts record field values by the new order

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

References ilDclSelectionOption\getAllForField(), ilDclBaseFieldModel\getId(), ilDclCache\getTableCache(), and ilDclBaseFieldModel\getTableId().

Referenced by setProperty().

203  : void
204  {
205  $options = ilDclSelectionOption::getAllForField($this->getId());
206  // loop each record(-field)
207  foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) {
208  $record_field = $record->getRecordField($this->getId());
209  $record_field_value = $record_field->getValue();
210 
211  if (is_array($record_field_value) && count($record_field_value) > 1) {
212  $sorted_array = [];
213  // $options has the right order, so loop those
214  foreach ($options as $option) {
215  if (in_array($option->getOptId(), $record_field_value)) {
216  $sorted_array[] = $option->getOptId();
217  }
218  }
219  $record_field->setValue($sorted_array);
220  $record_field->doUpdate();
221  }
222  }
223  }
static getTableCache(int $table_id=null)
static getAllForField(int $field_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setProperty()

ilDclSelectionFieldModel::setProperty ( string  $key,
  $value 
)
Parameters
array$value

Definition at line 168 of file class.ilDclSelectionFieldModel.php.

References ilDclBaseFieldModel\$id, ilDclSelectionOption\flushOptions(), ilDclBaseFieldModel\getId(), getProperty(), isMulti(), multiPropertyChanged(), and reorderExistingValues().

Referenced by storePropertiesFromForm().

169  {
170  $is_update = $this->getProperty($key);
171  switch ($key) {
172  case static::PROP_SELECTION_OPTIONS:
173 
175  $sorting = 1;
176  foreach ($value as $id => $val) {
177  ilDclSelectionOption::storeOption($this->getId(), $id, $sorting, $val);
178  $sorting++;
179  }
180  // if the field is not being created reorder the options in the existing record fields
181  if ($is_update) {
182  $this->reorderExistingValues();
183  }
184  break;
185  case static::PROP_SELECTION_TYPE:
186  $will_be_multi = ($value == self::SELECTION_TYPE_MULTI);
187  // if the "Multi" property has changed, adjust the record field values
188  if ($is_update && ($this->isMulti() && !$will_be_multi || !$this->isMulti() && $will_be_multi)) {
189  $this->multiPropertyChanged($will_be_multi);
190  }
191  parent::setProperty($key, $value)->store();
192  break;
193  default:
194  parent::setProperty($key, $value)->store();
195  }
196 
197  return null;
198  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static flushOptions(int $field_id)
string $key
Consumer key/client ID value.
Definition: System.php:193
multiPropertyChanged(bool $is_multi_now)
changes the values of all record fields, since the property "multi" has changed
reorderExistingValues()
sorts record field values by the new order
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storePropertiesFromForm()

ilDclSelectionFieldModel::storePropertiesFromForm ( ilPropertyFormGUI  $form)

called when saving the 'edit field' form

Exceptions
ilDclException

Definition at line 104 of file class.ilDclSelectionFieldModel.php.

References ilDclBaseFieldModel\$property, ilDclFieldFactory\getFieldRepresentationInstance(), ilPropertyFormGUI\getInput(), ilDclBaseFieldModel\getPropertyInstance(), getValidFieldProperties(), and setProperty().

104  : void
105  {
106  $representation = ilDclFieldFactory::getFieldRepresentationInstance($this);
107 
108  $field_props = $this->getValidFieldProperties();
109  foreach ($field_props as $property) {
110  $value = $form->getInput($representation->getPropertyInputFieldId($property));
111 
112  // break down the multidimensional array from the multi input
113  // e.g.: { [0] => { [0] => 'x' }, [1] => { [1] => 'y' } } TO { [0] => 'x', [1] => 'y' }
114  if (is_array($value)) {
115  foreach ($value as $k => $v) {
116  if (is_array($v)) {
117  $value[$k] = array_shift($v);
118  }
119  }
120  }
121 
122  // save non empty values and set them to null, when they already exist. Do not override plugin-hook when already set.
123  if (!empty($value) || ($this->getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
124  $this->setProperty($property, $value);
125  }
126  }
127  }
getPropertyInstance(string $key)
Return ActiveRecord of property.
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
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:

Field Documentation

◆ PROP_SELECTION_OPTIONS

const ilDclSelectionFieldModel::PROP_SELECTION_OPTIONS = ''

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

◆ PROP_SELECTION_TYPE

const ilDclSelectionFieldModel::PROP_SELECTION_TYPE = ''

Definition at line 25 of file class.ilDclSelectionFieldModel.php.

◆ SELECTION_TYPE_COMBOBOX

const ilDclSelectionFieldModel::SELECTION_TYPE_COMBOBOX = 'selection_type_combobox'

◆ SELECTION_TYPE_MULTI

const ilDclSelectionFieldModel::SELECTION_TYPE_MULTI = 'selection_type_multi'

◆ SELECTION_TYPE_SINGLE

const ilDclSelectionFieldModel::SELECTION_TYPE_SINGLE = 'selection_type_single'

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