コード例 #1
0
	/**
	 * Creates a new model.
	 * If creation is successful, the browser will be redirected to the 'view' page.
	 */
	public function actionCreate()
	{
		$model=new RoleAttribute;

		// Uncomment the following line if AJAX validation is needed
		// $this->performAjaxValidation($model);

		if(isset($_POST['RoleAttribute']))
		{
			$model->attributes=$_POST['RoleAttribute'];
			if($model->save())
				$this->redirect(array('view','id'=>$model->id));
		}

		$this->render('create',array(
			'model'=>$model,
		));
	}
コード例 #2
0
 public function actionAddRoleAttribute($role){
     $model=new RoleAttribute;
     if(isset($_POST['RoleAttribute']))
     {
         $model->attributes=$_POST['RoleAttribute'];
         if($model->save())
             $this->redirect(array('viewRoleAttribute','id'=>$model->id));
     }
     $model->role = $role;
     $this->render('addRoleAttribute',array(
         'model'=>$model,
     ));
 }