/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Directline the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Directline::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * 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));
 }