/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { if ($this->menu_use[15]) { $model = new Directline(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Directline'])) { $model->attributes = $_POST['Directline']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->direct_id)); } } $this->render('create', array('model' => $model)); } else { $this->redirect(array('site/index')); } }
/** * Displays the Direct Line page */ public function actionDirectline() { $model = new Directline(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Directline'])) { $model->attributes = $_POST['Directline']; if ($model->save()) { Yii::app()->user->setFlash('contact', 'ส่งข้อความเรียบร้อยแล้ว ทางเราจะติดต่อกลับไปยังท่านโดยเร็วที่สุด ขอบคุณค่ะ'); $this->refresh(); } } $this->render('directline', array('model' => $model)); }