예제 #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);
     $this->pageTitle = 'Add ' . $this->resourceLabel;
     $model = new UserLevels();
     $model_class_name = $model->getClassName();
     if (isset($_POST[$model_class_name])) {
         $model->attributes = $_POST[$model_class_name];
         if (!empty($model->banned_resources)) {
             $model->banned_resources = implode(',', $model->banned_resources);
         }
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }