public function actionUpdate() { $this->layout = Yum::module()->adminLayout; $model = $this->loadModel(); $this->performAjaxValidation($model, 'yum-role-form'); if (isset($_POST['YumRole'])) { $model->attributes = $_POST['YumRole']; $model->users = $_POST['YumRole']; $model->users = Relation::retrieveValues($_POST); if ($model->validate() && $model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('update', array('model' => $model)); }
public function actionUpdate() { $model = $this->loadUser(); $passwordform = new YumUserChangePassword(); if(isset($_POST['YumUser'])) { $model->attributes = $_POST['YumUser']; if(Yum::hasModule('role')) { Yii::import('application.modules.role.models.*'); // Assign the roles and belonging Users to the model $model->roles = Relation::retrieveValues($_POST); } if(Yum::hasModule('profile')) { $profile = $model->profile; if(isset($_POST['YumProfile']) ) $profile->attributes = $_POST['YumProfile']; } // Password change is requested ? if(isset($_POST['YumUserChangePassword']) && $_POST['YumUserChangePassword']['password'] != '') { $passwordform->attributes = $_POST['YumUserChangePassword']; if($passwordform->validate()) $model->setPassword($_POST['YumUserChangePassword']['password']); } if(!$passwordform->hasErrors() && $model->save()) { if(isset($profile)) $profile->save(); $this->redirect(array('//user/user/view', 'id' => $model->id)); } } $this->render('update', array( 'model'=>$model, 'passwordform' =>$passwordform, 'profile' => isset($profile) ? $profile : false, )); }