Example #1
0
 /**
  * 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));
 }
Example #2
0
 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);
     }
 }