Example #1
0
 public function updateGalleryConfig()
 {
     if (isset($_POST['Cfg']['predefinedTitle'])) {
         $_POST['Cfg']['predefinedTitle'] = operations::purifiedTtext($_POST['Cfg']['predefinedTitle']);
     }
     $type = $_POST['scenario'];
     $model = new Cfg($type);
     $model->attributes = $_POST['Cfg'];
     if ($model->validate()) {
         $record = GalleryConfig::model()->find(array('condition' => "type='{$type}'"));
         $attributes = array("config" => serialize($_POST['Cfg']));
         $record->saveAttributes($attributes);
         Yii::app()->user->setFlash('succes', $this->tr('successUpdate'));
     } else {
         Yii::app()->user->setFlash('error', $this->tr('errorUpdate'));
     }
 }