/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'show' page. */ public function actionCreate() { $model = new FriendGroup(); if (isset($_POST['FriendGroup'])) { $model->attributes = $_POST['FriendGroup']; if ($model->save()) { $this->redirect(array('admin', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionAddGroup() { $model = new FriendGroup(); $model->scenario = 'add'; if (isset($_POST['FriendGroup'])) { $model->attributes = $_POST['FriendGroup']; if ($model->save()) { $this->redirect(array('index')); } } $data = array('model' => $model); if (Yii::app()->request->isAjaxRequest) { $this->renderPartial('friendGroup', $data, '', TRUE, TRUE); } else { $this->render('friendGroup', $data); } }