/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AdminAdminUserModel(); if (isset($_POST['AdminAdminUserModel'])) { $model->attributes = $_POST['AdminAdminUserModel']; $model->setAttribute("password", Common::endcoderPassword($_POST['AdminAdminUserModel']['password'])); $model->setAttribute("ccp_id", $_POST['AdminAdminUserModel']['ccp_id']); if ($model->save()) { $role = $_POST['role']; $this->setRole($model->id, $role); $this->redirect(array('view', 'id' => $model->id)); } } $cpList = AdminCpModel::model()->findAll(); $roles = AdminAdminAccessItemsModel::model()->getListRoles(); $this->render('create', array('model' => $model, 'cpList' => $cpList, 'roles' => $roles, 'userRole' => '')); }