30 return [static::PROP_SELECTION_OPTIONS, static::PROP_SELECTION_TYPE];
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') .
") ";
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";
51 if ($filter_value ==
'none') {
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')
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') .
67 $where_str .=
"filter_stloc_{$this->getId()}.value = " 68 .
$ilDB->quote($filter_value,
'integer');
75 $sql_obj->setJoinStatement($join_str);
76 $sql_obj->setWhereStatement($where_str);
83 return ($this->
getProperty(static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
88 $options_post_var =
"prop_" . static::PROP_SELECTION_OPTIONS;
89 foreach ($form->
getInput($options_post_var) as $value) {
90 if ($value[
"selection_value"] ==
"") {
92 $inputObj->setAlert($this->
lng->txt(
"msg_input_is_required"));
97 return parent::checkFieldCreationInput($form);
110 $value = $form->
getInput($representation->getPropertyInputFieldId($property));
114 if (is_array($value)) {
115 foreach ($value as $k => $v) {
117 $value[$k] = array_shift($v);
123 if (!empty($value) || ($this->
getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
137 'field_id' => $this->
getId(),
145 foreach ($properties as $prop) {
146 if ($prop == static::PROP_SELECTION_OPTIONS) {
149 foreach ($options as $option) {
151 $prop_values[$option->getOptId()] = [
'selection_value' => $option->getValue()];
154 $values[
'prop_' . $prop] = $prop_values;
156 $values[
'prop_' . $prop] = $this->
getProperty($prop);
172 case static::PROP_SELECTION_OPTIONS:
176 foreach ($value as
$id => $val) {
177 ilDclSelectionOption::storeOption($this->
getId(),
$id, $sorting, $val);
185 case static::PROP_SELECTION_TYPE:
186 $will_be_multi = ($value == self::SELECTION_TYPE_MULTI);
188 if ($is_update && ($this->
isMulti() && !$will_be_multi || !$this->
isMulti() && $will_be_multi)) {
191 parent::setProperty($key, $value)->store();
194 parent::setProperty($key, $value)->store();
208 $record_field = $record->getRecordField($this->
getId());
209 $record_field_value = $record_field->getValue();
211 if (is_array($record_field_value) && count($record_field_value) > 1) {
214 foreach ($options as $option) {
215 if (in_array($option->getOptId(), $record_field_value)) {
216 $sorted_array[] = $option->getOptId();
219 $record_field->setValue($sorted_array);
220 $record_field->doUpdate();
231 $record_field = $record->getRecordField($this->
getId());
232 $record_field_value = $record_field->getValue();
234 if ($record_field_value && !is_array($record_field_value) && $is_multi_now) {
235 $record_field->setValue([$record_field_value]);
236 $record_field->doUpdate();
238 if (is_array($record_field_value) && !$is_multi_now) {
239 $record_field->setValue(array_shift($record_field_value));
240 $record_field->doUpdate();
253 case static::PROP_SELECTION_OPTIONS:
256 return parent::getProperty($key);
261 string $direction =
"asc",
262 bool $sort_by_status =
false 265 $ilDB = $DIC[
'ilDB'];
273 $select_str =
"sel_opts_{$this->getId()}.value AS field_{$this->getId()}";
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') .
") ";
281 $sql_obj->setSelectStatement($select_str);
282 $sql_obj->setJoinStatement($join_str);
283 $sql_obj->setOrderStatement(
"field_{$this->getId()} {$direction} , ID ASC");
290 parent::cloneProperties($originalField);
292 foreach ($options as $opt) {
294 $new_opt->cloneOption($opt);
295 $new_opt->setFieldId($this->
getId());
310 $will_be_multi = ($form->
getInput(
'prop_' . static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
312 return $this->
isMulti() && !$will_be_multi;
319 $prop_selection_options = $representation->getPropertyInputFieldId(static::PROP_SELECTION_OPTIONS);
320 $prop_selection_type = $representation->getPropertyInputFieldId(static::PROP_SELECTION_TYPE);
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']
332 return $ilConfirmationGUI;
getPropertyInstance(string $key)
Return ActiveRecord of property.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SELECTION_TYPE_SINGLE
setProperty(string $key, $value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRecordQuerySortObject(string $direction="asc", bool $sort_by_status=false)
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
const SELECTION_TYPE_MULTI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PROP_SELECTION_OPTIONS
cloneProperties(ilDclBaseFieldModel $originalField)
checkFieldCreationInput(ilPropertyFormGUI $form)
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
const PROP_SELECTION_TYPE
getTableId()
Get table id.
fillPropertiesForm(ilPropertyFormGUI &$form)
static flushOptions(int $field_id)
getValidFieldProperties()
static getTableCache(int $table_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SELECTION_TYPE_COMBOBOX
static getAllForField(int $field_id)
getDescription()
Get description.
storePropertiesFromForm(ilPropertyFormGUI $form)
called when saving the 'edit field' form
isConfirmationRequired(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
getDatatypeId()
Get datatype_id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getConfirmationGUI(ilPropertyFormGUI $form)