/** * Get groups array */ public function getGroups() { $groups = SettingsCats::model()->findAll(); $_temp = array(); if (count($groups)) { foreach ($groups as $value) { $_temp[$value->id] = $value->title; } } return $_temp; }
/** * Edit setting action */ public function actioneditsetting() { // Perms if (!Yii::app()->user->checkAccess('op_settings_edit_settings')) { throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section')); } if (isset($_GET['id']) && ($model = Settings::model()->findByPk($_GET['id']))) { if ($category = SettingsCats::model()->findByPk($model->category)) { $model->category = $category->id; $this->breadcrumbs[Yii::t('adminglobal', $category->title)] = array('settings/index', 'id' => $category->id); $this->pageTitle[] = Yii::t('adminglobal', $category->title); } if (isset($_POST['Settings'])) { $model->attributes = $_POST['Settings']; if ($model->save()) { // Clear cache Yii::app()->settings->clearCache(); Yii::app()->user->setFlash('success', Yii::t('adminsettings', 'Setting edited.')); $this->redirect(array('settings/viewgroup', 'id' => $model->category)); } } $this->breadcrumbs[Yii::t('adminglobal', 'Editing Setting')] = ''; $this->pageTitle[] = Yii::t('adminglobal', 'Editing Setting'); // Display form $this->render('setting_form', array('model' => $model, 'label' => Yii::t('adminsettings', 'Editing Setting'))); } else { Yii::app()->user->setFlash('error', Yii::t('adminerror', 'Could not find that ID.')); $this->redirect(array('settings/index')); } }