Ejemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->hasPrivilege(Acl::ACTION_CREATE);
     $model = new UserRoles();
     $this->pageTitle = Lang::t('Add ' . $this->resourceLabel);
     $model_class_name = $model->getClassName();
     if (isset($_POST[$model_class_name])) {
         $model->attributes = $_POST[$model_class_name];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Lang::t('SUCCESS_MESSAGE'));
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }