コード例 #1
0
ファイル: SupportController.php プロジェクト: petrospe/frog
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Support();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Support'])) {
         $model->attributes = $_POST['Support'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #2
0
 public function actionCreate()
 {
     $model = new Support();
     if (isset($_POST['Support'])) {
         $model->attributes = $_POST['Support'];
         $model->created = time();
         $model->group_support_id = $_POST['Support']['group_support_id'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Thêm nhóm hỗ trợ thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/support/index'));
         }
     }
     $groupSupport = GroupSupport::model()->getGroupSupport();
     $this->render('create', array('model' => $model, 'groupSupport' => $groupSupport));
 }