public function loadDefaultConfig() { $type = $_POST['loadDefaultConfig']; switch ($type) { case 'Gallery': $config = serialize(Cfg::defaultGalleryConfig()); break; case 'Fancybox': $config = serialize(Cfg::defaultFancyBoxConfig()); break; case 'Uploader': $config = serialize(Cfg::defaultUploaderConfig()); break; } $record = GalleryConfig::model()->find(array('condition' => "type='{$type}'")); $attributes = array("config" => $config); $record->saveAttributes($attributes); $this->owner->refresh(); }
public function getDefaultValue($type, $setting) { switch ($type) { case 'gallery': $f = Cfg::defaultGalleryConfig(); break; case 'album': $f = Cfg::defaultAlbumConfig(); break; case 'collection': $f = Cfg::defaultCollectionConfig(); break; case 'fancybox': $f = Cfg::defaultFancyBoxConfig(); break; case 'uploader': $f = Cfg::defaultUploaderConfig(); break; } return CHtml::tag('div', array('class' => 'fbLoadDefault sttip', 'data-default' => $f[$setting], 'title' => $this->tr('clickLoadDefault')), ''); }