23 return array(static::PROP_SELECTION_OPTIONS, static::PROP_SELECTION_TYPE);
39 " 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 = " 40 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
43 $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 (" .
44 "filter_stloc_{$this->getId()}.value = " .
$ilDB->quote(
"[$filter_value]",
'text') .
" OR " .
45 "filter_stloc_{$this->getId()}.value LIKE " .
$ilDB->quote(
"%\"$filter_value\"%",
'text') .
" OR " .
46 "filter_stloc_{$this->getId()}.value LIKE " .
$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') .
52 " 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 = " 53 .
$ilDB->quote($filter_value,
'integer') .
") ";
57 $sql_obj->setJoinStatement($join_str);
64 return ($this->
getProperty(static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
78 $value = $form->
getInput($representation->getPropertyInputFieldId($property));
82 if (is_array($value)) {
83 foreach ($value as $k => $v) {
85 $value[$k] = array_shift($v);
91 if (!empty($value) || ($this->
getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
107 'field_id' => $this->
getId(),
116 foreach ($properties as $prop) {
117 if ($prop == static::PROP_SELECTION_OPTIONS) {
119 $prop_values =
array();
122 $prop_values[$option->getOptId()] =
array(
'selection_value' => $option->getValue());
125 $values[
'prop_' . $prop] = $prop_values;
127 $values[
'prop_' . $prop] = $this->
getProperty($prop);
145 case static::PROP_SELECTION_OPTIONS:
149 foreach ($value as
$id => $val) {
150 ilDclSelectionOption::storeOption($this->
getId(),
$id, $sorting, $val);
158 case static::PROP_SELECTION_TYPE:
159 $will_be_multi = ($value == self::SELECTION_TYPE_MULTI);
161 if ($is_update && ($this->
isMulti() && !$will_be_multi || !$this->
isMulti() && $will_be_multi)) {
164 parent::setProperty(
$key, $value)->store();
167 parent::setProperty(
$key, $value)->store();
180 $record_field = $record->getRecordField($this->
getId());
181 $record_field_value = $record_field->getValue();
183 if (is_array($record_field_value) && count($record_field_value) > 1) {
184 $sorted_array =
array();
187 if (in_array($option->getOptId(), $record_field_value)) {
188 $sorted_array[] = $option->getOptId();
191 $record_field->setValue($sorted_array);
192 $record_field->doUpdate();
206 $record_field = $record->getRecordField($this->
getId());
207 $record_field_value = $record_field->getValue();
209 if ($record_field_value && !is_array($record_field_value) && $is_multi_now) {
210 $record_field->setValue(
array($record_field_value));
211 $record_field->doUpdate();
212 } elseif (is_array($record_field_value) && !$is_multi_now) {
213 $record_field->setValue(array_shift($record_field_value));
214 $record_field->doUpdate();
227 case static::PROP_SELECTION_OPTIONS:
231 return parent::getProperty(
$key);
245 $ilDB = $DIC[
'ilDB'];
253 $select_str =
"sel_opts_{$this->getId()}.value AS field_{$this->getId()}";
254 $join_str =
"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 = " 255 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
256 $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) ";
260 $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 = " .
$ilDB->quote($this->
getId(),
'integer') .
") ";
265 $sql_obj->setSelectStatement($select_str);
266 $sql_obj->setJoinStatement($join_str);
267 $sql_obj->setOrderStatement(
"field_{$this->getId()} {$direction}");
276 parent::cloneProperties($originalField);
280 $new_opt->cloneOption($opt);
281 $new_opt->setFieldId($this->
getId());
304 $will_be_multi = ($form->
getInput(
'prop_' . static::PROP_SELECTION_TYPE) == self::SELECTION_TYPE_MULTI);
305 return $this->
isMulti() && !$will_be_multi;
316 $prop_selection_options = $representation->getPropertyInputFieldId(static::PROP_SELECTION_OPTIONS);
317 $prop_selection_type = $representation->getPropertyInputFieldId(static::PROP_SELECTION_TYPE);
319 $ilConfirmationGUI = parent::getConfirmationGUI($form);
320 $ilConfirmationGUI->setHeaderText($DIC->language()->txt(
'dcl_msg_mc_to_sc_confirmation'));
321 $ilConfirmationGUI->addHiddenItem($prop_selection_type, $form->
getInput($prop_selection_type));
322 foreach ($form->
getInput($prop_selection_options) as
$key => $option) {
323 $ilConfirmationGUI->addHiddenItem($prop_selection_options .
"[$key][selection_value]", $option[
'selection_value']);
325 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
Create styles array
The data for the language used.
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
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
getDatatypeId()
Get datatype_id.
getConfirmationGUI(ilPropertyFormGUI $form)