/** * Saves the application settings using the given values in the model. * @return boolean whether save is successful */ public function save() { $settings = SBSetting::model()->findAll(array('index' => 'name')); foreach ($this->_data as $name => $value) { $settings[$name]->value = trim($value); $settings[$name]->save(); } return true; }
/** * Returns the SourceBans settings * * @return CAttributeCollection the SourceBans settings */ public function getSettings() { static $_data; if (!isset($_data)) { $_data = new CAttributeCollection(CHtml::listData(SBSetting::model()->findAll(), 'name', 'value'), true); } return $_data; }