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);
108 $field_props = $this->getValidFieldProperties();
109 foreach ($field_props as $property) {
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)) {
124 $this->setProperty($property, $value);
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(),
144 $properties = $this->getValidFieldProperties();
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);
170 $is_update = $this->getProperty(
$key);
172 case static::PROP_SELECTION_OPTIONS:
176 foreach ($value as
$id => $val) {
177 ilDclSelectionOption::storeOption($this->
getId(),
$id, $sorting, $val);
182 $this->reorderExistingValues();
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)) {
189 $this->multiPropertyChanged($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
267 if ($this->isMulti()) {
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;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getTableCache(int $table_id=null)
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PROP_SELECTION_OPTIONS
getRecordQuerySortObject(string $direction="asc", bool $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
fillPropertiesForm(ilPropertyFormGUI &$form)
doDelete()
Remove field and properties.
cloneProperties(ilDclBaseFieldModel $originalField)
const PROP_SELECTION_TYPE
const SELECTION_TYPE_COMBOBOX
const SELECTION_TYPE_SINGLE
reorderExistingValues()
sorts record field values by the new order
checkFieldCreationInput(ilPropertyFormGUI $form)
Checks input of specific fields befor saving.
getConfirmationGUI(ilPropertyFormGUI $form)
called by ilDclFieldEditGUI if isConfirmationRequired returns true
multiPropertyChanged(bool $is_multi_now)
changes the values of all record fields, since the property "multi" has changed
storePropertiesFromForm(ilPropertyFormGUI $form)
called when saving the 'edit field' form
setProperty(string $key, $value)
const SELECTION_TYPE_MULTI
getValidFieldProperties()
Returns all valid properties for a field-type.
getRecordQueryFilterObject( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
isConfirmationRequired(ilPropertyFormGUI $form)
called by ilDclFieldEditGUI when updating field properties if you overwrite this method,...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllForField(int $field_id)
static flushOptions(int $field_id)