Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function loadConfiguration($id)
- {
- $model=UserGroupsConfiguration::model()->findByPk((int)$id);
- if($model===null)
- throw new CHttpException(404,Yii::t('userGroupsModule.admin','The requested rule does not exist.'));
- return $model;
- }
- private function configurationSave($formData)
- {
- if (Yii::app()->user->pbac('userGroups.admin.admin')) {
- $successes = 0;
- foreach($formData as $configuration => $value) {
- $model = $this->loadConfiguration($configuration);
- $model->value = $value;
- if ($model->save())
- $successes++;
- }
- if ($successes == count($formData))
- Yii::app()->user->setFlash('configuration', Yii::t('userGroupsModule.admin','New Configurations Saved'));
- else
- Yii::app()->user->setFlash('configuration', Yii::t('userGroupsModule.admin','A problem occurred during the configuration save action'));
- } else
- Yii::app()->user->setFlash('configuration', Yii::t('userGroupsModule.admin','You are not allowed to change any configuration'));
- $this->redirect(Yii::app()->baseUrl .'/userGroups/admin');
- }
- public function actionIndex()
- {
- $confDataProvider = new CActiveDataProvider('UserGroupsConfiguration', array('pagination'=>array('pageSize' => 20),));
- if(isset($_POST['UserGroupsConfiguration']))
- $this->configurationSave($_POST['UserGroupsConfiguration']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement