ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDclSelectionFieldModel Class Reference
+ Inheritance diagram for ilDclSelectionFieldModel:
+ Collaboration diagram for ilDclSelectionFieldModel:

Public Member Functions

 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 Returns a query-object for building the record-loader-sql-query. More...
 
 isMulti ()
 
 setProperty (string $key, $value)
 
 sanitizeOptionValue (string $value)
 
 personalizeOptionValue (string $value, ilObjUser $user)
 
 getProperty (string $key)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 doDelete ()
 Remove field and properties. More...
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 Checks input of specific fields befor saving. More...
 
 checkValidity ($value, ?int $record_id)
 Check if input is valid. More...
 
- 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...
 
 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)
 
 checkValidity ($value, ?int $record_id)
 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...
 
 checkUniqueProp (ilPropertyFormGUI $form)
 
 checkUnique ($value, ?int $record_id)
 
 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 string SELECTION_TYPE_SINGLE = 'selection_type_single'
 
const string SELECTION_TYPE_MULTI = 'selection_type_multi'
 
const string 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_REFERENCE_LINK = "reference_link"
 
const PROP_UNIQUE = "unique"
 
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
 

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 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...
 
 areEqual ($value_1, $value_2)
 
 normalizeValue (mixed $value)
 
- Protected Attributes inherited from ilDclBaseFieldModel
string $id = ""
 
int $table_id = 0
 
string $title = ""
 
string $description = ""
 
int $datatype_id = 0
 
int $order = null
 
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)

Checks input of specific fields befor saving.

Parameters
ilPropertyFormGUI$form
Returns
bool if checkInput was successful

Reimplemented from ilDclBaseFieldModel.

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

140 : bool
141 {
142 return $this->checkUniqueProp($form) && parent::checkFieldCreationInput($form);
143 }
checkUniqueProp(ilPropertyFormGUI $form)

◆ checkValidity()

ilDclSelectionFieldModel::checkValidity (   $value,
?int  $record_id 
)

Check if input is valid.

Parameters
float | int | string | array | null$value
Exceptions
ilDclInputException

Reimplemented from ilDclBaseFieldModel.

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

145 : bool
146 {
147 $this->checkUnique($value, $record_id);
148 return parent::checkValidity($value, $record_id);
149 }
checkUnique($value, ?int $record_id)

◆ cloneProperties()

ilDclSelectionFieldModel::cloneProperties ( ilDclBaseFieldModel  $originalField)

Reimplemented from ilDclBaseFieldModel.

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

120 : void
121 {
122 parent::cloneProperties($originalField);
123 $options = ilDclSelectionOption::getAllForField((int) $originalField->getId());
124 foreach ($options as $opt) {
125 $new_opt = new ilDclSelectionOption();
126 $new_opt->cloneOption($opt);
127 $new_opt->setFieldId((int) $this->getId());
128 $new_opt->store();
129 }
130 }
static getAllForField(int $field_id)

References ilDclSelectionOption\getAllForField(), ilDclBaseFieldModel\getId(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ doDelete()

ilDclSelectionFieldModel::doDelete ( )

Remove field and properties.

Reimplemented from ilDclBaseFieldModel.

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

132 : void
133 {
134 foreach (ilDclSelectionOption::getAllForField((int) $this->getId()) as $option) {
135 $option->delete();
136 }
137 parent::doDelete();
138 }

References ilDclSelectionOption\getAllForField(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getProperty()

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

Reimplemented from ilDclBaseFieldModel.

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

107 : mixed
108 {
109 if ($key == $this::PROP_SELECTION_OPTIONS) {
110 $prop_values = [];
111 foreach (ilDclSelectionOption::getAllForField((int) $this->getId()) as $option) {
112 $prop_values[$option->getOptId()] = $option->getValue();
113 }
114
115 return $prop_values;
116 }
117 return parent::getProperty($key);
118 }

References ilDclSelectionOption\getAllForField(), and ILIAS\Survey\Mode\getId().

+ Here is the call 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

Reimplemented from ilDclBaseFieldModel.

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

38
39 $join_str
40 = " 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 = "
41 . $this->db->quote($this->getId(), 'integer') . ") ";
42
43 $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";
44
45 $where_str = " AND ";
46 if ($filter_value == 'none') {
47 $where_str .= "("
48 . "filter_stloc_{$this->getId()}.value IS NULL "
49 . " OR filter_stloc_{$this->getId()}.value = " . $this->db->quote("", 'text')
50 . " OR filter_stloc_{$this->getId()}.value = " . $this->db->quote("[]", 'text')
51 . ") ";
52 } else {
53 if ($this->isMulti()) {
54 $where_str .= " (" .
55 "filter_stloc_{$this->getId()}.value LIKE " . $this->db->quote("%\"$filter_value\"%", 'text') .
56 ") ";
57 } else {
58 $where_str .= "filter_stloc_{$this->getId()}.value = "
59 . $this->db->quote($filter_value, 'integer');
60 }
61 }
62
63 $join_str .= ") ";
64
65 $sql_obj = new ilDclRecordQueryObject();
66 $sql_obj->setJoinStatement($join_str);
67 $sql_obj->setWhereStatement($where_str);
68
69 return $sql_obj;
70 }

◆ getValidFieldProperties()

ilDclSelectionFieldModel::getValidFieldProperties ( )

Returns all valid properties for a field-type.

Reimplemented from ilDclBaseFieldModel.

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

29 : array
30 {
31 return [$this::PROP_SELECTION_OPTIONS, $this::PROP_SELECTION_TYPE, $this::PROP_UNIQUE];
32 }

◆ isMulti()

ilDclSelectionFieldModel::isMulti ( )

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

72 : bool
73 {
74 return ($this->getProperty($this::PROP_SELECTION_TYPE) === $this::SELECTION_TYPE_MULTI);
75 }

◆ personalizeOptionValue()

ilDclSelectionFieldModel::personalizeOptionValue ( string  $value,
ilObjUser  $user 
)

Reimplemented in ilDclDateSelectionFieldModel, and ilDclDatetimeSelectionFieldModel.

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

99 : string
100 {
101 return $value;
102 }

◆ sanitizeOptionValue()

ilDclSelectionFieldModel::sanitizeOptionValue ( string  $value)

Reimplemented in ilDclDatetimeSelectionFieldModel.

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

94 : string
95 {
96 return $value;
97 }

◆ setProperty()

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

Reimplemented from ilDclBaseFieldModel.

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

81 {
82 if ($key === $this::PROP_SELECTION_OPTIONS) {
84 $sorting = 1;
85 foreach ($value as $id => $val) {
86 ilDclSelectionOption::storeOption((int) $this->getId(), $id, $sorting, $this->sanitizeOptionValue($val));
87 $sorting++;
88 }
89 return null;
90 }
91 return parent::setProperty($key, $value);
92 }
static flushOptions(int $field_id)

References $id, ilDclSelectionOption\flushOptions(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

Field Documentation

◆ PROP_SELECTION_OPTIONS

const ilDclSelectionFieldModel::PROP_SELECTION_OPTIONS = ''

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

◆ PROP_SELECTION_TYPE

const ilDclSelectionFieldModel::PROP_SELECTION_TYPE = ''

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

◆ SELECTION_TYPE_COMBOBOX

const string ilDclSelectionFieldModel::SELECTION_TYPE_COMBOBOX = 'selection_type_combobox'

◆ SELECTION_TYPE_MULTI

const string ilDclSelectionFieldModel::SELECTION_TYPE_MULTI = 'selection_type_multi'

◆ SELECTION_TYPE_SINGLE

const string ilDclSelectionFieldModel::SELECTION_TYPE_SINGLE = 'selection_type_single'

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