24 return array(static::PROP_SELECTION_OPTIONS, static::PROP_SELECTION_TYPE);
41 =
" INNER 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 = " 42 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
45 $join_str .=
" INNER 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 AND (" .
46 "filter_stloc_{$this->getId()}.value = " .
$ilDB->quote(
"[$filter_value]",
'text') .
" OR " .
47 "filter_stloc_{$this->getId()}.value LIKE " .
$ilDB->quote(
"%\"$filter_value\"%",
'text') .
" OR " .
48 "filter_stloc_{$this->getId()}.value LIKE " .
$ilDB->quote(
"%,$filter_value,%",
'text') .
" OR " .
49 "filter_stloc_{$this->getId()}.value LIKE " .
$ilDB->quote(
"%[$filter_value,%",
'text') .
" OR " .
50 "filter_stloc_{$this->getId()}.value LIKE " .
$ilDB->quote(
"%,$filter_value]%",
'text') .
53 $join_str .=
" INNER 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 AND filter_stloc_{$this->getId()}.value = " 54 .
$ilDB->quote($filter_value,
'integer') .
") ";
58 $sql_obj->setJoinStatement($join_str);
66 return ($this->
getProperty(static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
81 $value = $form->
getInput($representation->getPropertyInputFieldId($property));
85 if (is_array($value)) {
86 foreach ($value as $k => $v) {
88 $value[$k] = array_shift($v);
94 if (!empty($value) || ($this->
getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
110 'field_id' => $this->
getId(),
119 foreach ($properties as $prop) {
120 if ($prop == static::PROP_SELECTION_OPTIONS) {
122 $prop_values = array();
125 $prop_values[$option->getOptId()] = array(
'selection_value' => $option->getValue());
128 $values[
'prop_' . $prop] = $prop_values;
148 case static::PROP_SELECTION_OPTIONS:
152 foreach ($value as
$id => $val) {
153 ilDclSelectionOption::storeOption($this->
getId(),
$id, $sorting, $val);
161 case static::PROP_SELECTION_TYPE:
162 $will_be_multi = ($value == self::SELECTION_TYPE_MULTI);
164 if ($is_update && ($this->
isMulti() && !$will_be_multi || !$this->
isMulti() && $will_be_multi)) {
167 parent::setProperty(
$key, $value)->store();
170 parent::setProperty(
$key, $value)->store();
183 $record_field = $record->getRecordField($this->
getId());
184 $record_field_value = $record_field->getValue();
186 if (is_array($record_field_value) && count($record_field_value) > 1) {
187 $sorted_array = array();
190 if (in_array($option->getOptId(), $record_field_value)) {
191 $sorted_array[] = $option->getOptId();
194 $record_field->setValue($sorted_array);
195 $record_field->doUpdate();
209 $record_field = $record->getRecordField($this->
getId());
210 $record_field_value = $record_field->getValue();
212 if ($record_field_value && !is_array($record_field_value) && $is_multi_now) {
213 $record_field->setValue(array($record_field_value));
214 $record_field->doUpdate();
216 if (is_array($record_field_value) && !$is_multi_now) {
217 $record_field->setValue(array_shift($record_field_value));
218 $record_field->doUpdate();
233 case static::PROP_SELECTION_OPTIONS:
237 return parent::getProperty(
$key);
251 $ilDB = $DIC[
'ilDB'];
259 $select_str =
"sel_opts_{$this->getId()}.value AS field_{$this->getId()}";
261 =
"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 = " 262 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
263 $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) ";
267 $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 = " 268 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
271 $sql_obj->setSelectStatement($select_str);
272 $sql_obj->setJoinStatement($join_str);
273 $sql_obj->setOrderStatement(
"field_{$this->getId()} {$direction}");
281 parent::cloneProperties($originalField);
285 $new_opt->cloneOption($opt);
286 $new_opt->setFieldId($this->
getId());
309 $will_be_multi = ($form->
getInput(
'prop_' . static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
311 return $this->
isMulti() && !$will_be_multi;
322 $prop_selection_options = $representation->getPropertyInputFieldId(static::PROP_SELECTION_OPTIONS);
323 $prop_selection_type = $representation->getPropertyInputFieldId(static::PROP_SELECTION_TYPE);
325 $ilConfirmationGUI = parent::getConfirmationGUI($form);
326 $ilConfirmationGUI->setHeaderText($DIC->language()->txt(
'dcl_msg_mc_to_sc_confirmation'));
327 $ilConfirmationGUI->addHiddenItem($prop_selection_type, $form->
getInput($prop_selection_type));
328 foreach ($form->
getInput($prop_selection_options) as
$key => $option) {
329 $ilConfirmationGUI->addHiddenItem($prop_selection_options .
"[$key][selection_value]", $option[
'selection_value']);
332 return $ilConfirmationGUI;
Class ilDclBaseFieldModel.
const SELECTION_TYPE_SINGLE
Class ilDclRecordQueryObject.
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
const SELECTION_TYPE_MULTI
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
const PROP_SELECTION_OPTIONS
getPropertyInstance($key)
Return ActiveRecord of property.
cloneProperties(ilDclBaseFieldModel $originalField)
static getTableCache($table_id=0)
static flushOptions($field_id)
const PROP_SELECTION_TYPE
getTableId()
Get table id.
fillPropertiesForm(ilPropertyFormGUI &$form)
static getAllForField($field_id)
getValidFieldProperties()
if(isset($_POST['submit'])) $form
Class ilDclSelectionFieldModel.
const SELECTION_TYPE_COMBOBOX
getRequired()
Get Required Required.
multiPropertyChanged($is_multi_now)
changes the values of all record fields, since the property "multi" has changed
getDescription()
Get description.
storePropertiesFromForm(ilPropertyFormGUI $form)
called when saving the 'edit field' form
isConfirmationRequired(ilPropertyFormGUI $form)
getRecordQuerySortObject($direction="asc", $sort_by_status=false)
setProperty($key, $value)
Class ilDclSelectionOption.
reorderExistingValues()
sorts record field values by the new order
getDatatypeId()
Get datatype_id.
getConfirmationGUI(ilPropertyFormGUI $form)