public function setCustomPreset($dc_id, $PostFieldsArr) { $ftcPM = new PresetsModel(); $strClass = $ftcPM->getStrClass(); $DoModel = $strClass::findByID($dc_id); if ($DoModel->ftc_preset_add_custom == '1') { $arrPreset = $PostFieldsArr; $DoModel->ftc_preset_custom = $arrPreset; $DoModel->save(true); } }
public function setPresets($Preset, $id, $dc, $val, $isDefault = false) { $key = $this->getKey(); $DCAArr = $this->getFieldsDCA($key); $strClass = $this->getStrClass(); $DoModel = $strClass::findByID($id); if ($DoModel === NULL) { return; } $fieldCombined = $DCAArr[$dc->field]['combined']; $field = $dc->field; $updateFieldsArr = array(); $Preset = is_array($Preset) ? serialize($Preset) : $Preset; if ($isDefault === false) { $PresetModel = PresetsModel::findByID($val); if ($PresetModel === NULL) { return; } else { $Preset = $PresetModel->row(); } //problems with uuid binary in serialize() unset($Preset['preview']); $Preset = is_array($Preset) ? serialize($Preset) : $Preset; } $dc->__get('activeRecord')->__set($fieldCombined, $Preset); $DoModel->{$fieldCombined} = $Preset; $DoModel->save(); return; }