ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDclSelectionFieldModel Class Reference
+ 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 (int $order)
 
 hasProperty (string $key)
 Checks if a certain property for a field is set. More...
 
 getProperty (string $key)
 
 getPropertyInstance (string $key)
 
 setProperty (string $key, $value)
 
 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 (mixed $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 $datatype_id = 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

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

Member Function Documentation

◆ checkFieldCreationInput()

ilDclSelectionFieldModel::checkFieldCreationInput ( ilPropertyFormGUI  $form)

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

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

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

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

287  : void
288  {
289  parent::cloneProperties($originalField);
290  $options = ilDclSelectionOption::getAllForField((int) $originalField->getId());
291  foreach ($options as $opt) {
292  $new_opt = new ilDclSelectionOption();
293  $new_opt->cloneOption($opt);
294  $new_opt->setFieldId((int) $this->getId());
295  $new_opt->store();
296  }
297  }
static getAllForField(int $field_id)
+ Here is the call graph for this function:

◆ doDelete()

ilDclSelectionFieldModel::doDelete ( )

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

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

299  : void
300  {
301  foreach (ilDclSelectionOption::getAllForField((int) $this->getId()) as $option) {
302  $option->delete();
303  }
304  parent::doDelete();
305  }
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 135 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().

135  : bool
136  {
137  $values = [
138  'table_id' => $this->getTableId(),
139  'field_id' => $this->getId(),
140  'title' => $this->getTitle(),
141  'datatype' => $this->getDatatypeId(),
142  'description' => $this->getDescription(),
143  'unique' => $this->isUnique(),
144  ];
145 
146  $properties = $this->getValidFieldProperties();
147  foreach ($properties as $prop) {
148  if ($prop == static::PROP_SELECTION_OPTIONS) {
149  $options = ilDclSelectionOption::getAllForField((int) $this->getId());
150  $prop_values = [];
151  foreach ($options as $option) {
152  // the 'selection_value' is for a correct input
153  $prop_values[$option->getOptId()] = ['selection_value' => $option->getValue()];
154  }
155 
156  $values['prop_' . $prop] = $prop_values;
157  } else {
158  $values['prop_' . $prop] = $this->getProperty($prop);
159  }
160  }
161 
162  $form->setValuesByArray($values);
163 
164  return true;
165  }
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 314 of file class.ilDclSelectionFieldModel.php.

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

315  {
316  $representation = ilDclFieldFactory::getFieldRepresentationInstance($this);
317  $prop_selection_options = $representation->getPropertyInputFieldId(static::PROP_SELECTION_OPTIONS);
318  $prop_selection_type = $representation->getPropertyInputFieldId(static::PROP_SELECTION_TYPE);
319 
320  $ilConfirmationGUI = parent::getConfirmationGUI($form);
321  $ilConfirmationGUI->setHeaderText($this->lng->txt('dcl_msg_mc_to_sc_confirmation'));
322  $ilConfirmationGUI->addHiddenItem($prop_selection_type, $form->getInput($prop_selection_type));
323  foreach ($form->getInput($prop_selection_options) as $key => $option) {
324  $ilConfirmationGUI->addHiddenItem(
325  $prop_selection_options . "[$key][selection_value]",
326  $option['selection_value']
327  );
328  }
329 
330  return $ilConfirmationGUI;
331  }
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:

◆ getProperty()

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

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

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

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

252  : mixed
253  {
254  switch ($key) {
255  case static::PROP_SELECTION_OPTIONS:
256  return ilDclSelectionOption::getAllForField((int) $this->getId());
257  default:
258  return parent::getProperty($key);
259  }
260  }
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 39 of file class.ilDclSelectionFieldModel.php.

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

43  global $DIC;
44  $ilDB = $DIC['ilDB'];
45 
46  $join_str
47  = " 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 = "
48  . $ilDB->quote($this->getId(), 'integer') . ") ";
49 
50  $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";
51 
52  $where_str = " AND ";
53  if ($filter_value == 'none') {
54  $where_str .= "("
55  . "filter_stloc_{$this->getId()}.value IS NULL "
56  . " OR filter_stloc_{$this->getId()}.value = " . $ilDB->quote("", 'text')
57  . " OR filter_stloc_{$this->getId()}.value = " . $ilDB->quote("[]", 'text')
58  . ") ";
59  } else {
60  if ($this->isMulti()) {
61  $where_str .= " (" .
62  "filter_stloc_{$this->getId()}.value = " . $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') . " OR " .
65  "filter_stloc_{$this->getId()}.value LIKE " . $ilDB->quote("%[$filter_value,%", 'text') . " OR " .
66  "filter_stloc_{$this->getId()}.value LIKE " . $ilDB->quote("%,$filter_value]%", 'text') .
67  ") ";
68  } else {
69  $where_str .= "filter_stloc_{$this->getId()}.value = "
70  . $ilDB->quote($filter_value, 'integer');
71  }
72  }
73 
74  $join_str .= ") ";
75 
76  $sql_obj = new ilDclRecordQueryObject();
77  $sql_obj->setJoinStatement($join_str);
78  $sql_obj->setWhereStatement($where_str);
79 
80  return $sql_obj;
81  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getRecordQuerySortObject()

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

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

References ilDclBaseFieldModel\getId(), isMulti(), and null.

266  if ($this->isMulti()) {
267  return null;
268  }
269 
270  $sql_obj = new ilDclRecordQueryObject();
271 
272  $select_str = "sel_opts_{$this->getId()}.value AS field_{$this->getId()}";
273  $join_str
274  = "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 = "
275  . $this->db->quote($this->getId(), 'integer') . ") ";
276  $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) ";
277  $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 = "
278  . $this->db->quote($this->getId(), 'integer') . ") ";
279 
280  $sql_obj->setSelectStatement($select_str);
281  $sql_obj->setJoinStatement($join_str);
282  $sql_obj->setOrderStatement("field_{$this->getId()} $direction , ID ASC");
283 
284  return $sql_obj;
285  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getValidFieldProperties()

ilDclSelectionFieldModel::getValidFieldProperties ( )

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

Referenced by fillPropertiesForm(), and storePropertiesFromForm().

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

◆ isConfirmationRequired()

ilDclSelectionFieldModel::isConfirmationRequired ( ilPropertyFormGUI  $form)

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

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

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

References getProperty().

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

83  : bool
84  {
85  return ($this->getProperty(static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
86  }
+ 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 230 of file class.ilDclSelectionFieldModel.php.

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

Referenced by setProperty().

230  : void
231  {
232  foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) {
233  $record_field = $record->getRecordField((int) $this->getId());
234  $record_field_value = $record_field->getValue();
235 
236  if ($record_field_value && !is_array($record_field_value) && $is_multi_now) {
237  $record_field->setValue([$record_field_value]);
238  $record_field->doUpdate();
239  } else {
240  if (is_array($record_field_value) && !$is_multi_now) {
241  $record_field->setValue(array_shift($record_field_value));
242  $record_field->doUpdate();
243  }
244  }
245  }
246  }
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 205 of file class.ilDclSelectionFieldModel.php.

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

Referenced by setProperty().

205  : void
206  {
207  $options = ilDclSelectionOption::getAllForField((int) $this->getId());
208  // loop each record(-field)
209  foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) {
210  $record_field = $record->getRecordField((int) $this->getId());
211  $record_field_value = $record_field->getValue();
212 
213  if (is_array($record_field_value) && count($record_field_value) > 1) {
214  $sorted_array = [];
215  // $options has the right order, so loop those
216  foreach ($options as $option) {
217  if (in_array($option->getOptId(), $record_field_value)) {
218  $sorted_array[] = $option->getOptId();
219  }
220  }
221  $record_field->setValue($sorted_array);
222  $record_field->doUpdate();
223  }
224  }
225  }
static getAllForField(int $field_id)
static getTableCache(?int $table_id=null)
+ 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 170 of file class.ilDclSelectionFieldModel.php.

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

Referenced by storePropertiesFromForm().

171  {
172  $is_update = $this->getProperty($key);
173  switch ($key) {
174  case static::PROP_SELECTION_OPTIONS:
175 
177  $sorting = 1;
178  foreach ($value as $id => $val) {
179  ilDclSelectionOption::storeOption((int) $this->getId(), $id, $sorting, $val);
180  $sorting++;
181  }
182  // if the field is not being created reorder the options in the existing record fields
183  if ($is_update) {
184  $this->reorderExistingValues();
185  }
186  break;
187  case static::PROP_SELECTION_TYPE:
188  $will_be_multi = ($value == self::SELECTION_TYPE_MULTI);
189  // if the "Multi" property has changed, adjust the record field values
190  if ($is_update && ($this->isMulti() && !$will_be_multi || !$this->isMulti() && $will_be_multi)) {
191  $this->multiPropertyChanged($will_be_multi);
192  }
193  parent::setProperty($key, $value)->store();
194  break;
195  default:
196  parent::setProperty($key, $value)->store();
197  }
198 
199  return null;
200  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static flushOptions(int $field_id)
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 106 of file class.ilDclSelectionFieldModel.php.

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

106  : void
107  {
108  $representation = ilDclFieldFactory::getFieldRepresentationInstance($this);
109 
110  $field_props = $this->getValidFieldProperties();
111  foreach ($field_props as $property) {
112  $value = $form->getInput($representation->getPropertyInputFieldId($property));
113 
114  // break down the multidimensional array from the multi input
115  // e.g.: { [0] => { [0] => 'x' }, [1] => { [1] => 'y' } } TO { [0] => 'x', [1] => 'y' }
116  if (is_array($value)) {
117  foreach ($value as $k => $v) {
118  if (is_array($v)) {
119  $value[$k] = array_shift($v);
120  }
121  }
122  }
123 
124  // save non empty values and set them to null, when they already exist. Do not override plugin-hook when already set.
125  if (!empty($value) || ($this->getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
126  $this->setProperty($property, $value);
127  }
128  }
129  }
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-...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

Field Documentation

◆ PROP_SELECTION_OPTIONS

const ilDclSelectionFieldModel::PROP_SELECTION_OPTIONS = ''

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

◆ PROP_SELECTION_TYPE

const ilDclSelectionFieldModel::PROP_SELECTION_TYPE = ''

Definition at line 27 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: