/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($bid = null) { $model = new BannsResponse(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['banns_id'])) { $model->banns_id = $_POST['banns_id']; $model->res_dt = $_POST['cert_dt']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $banns = BannsRecord::model()->findByPk($bid); $this->render('create', array('model' => $model, 'banns' => $banns, 'now' => date_format(new DateTime(), 'Y-m-d H:i:s'))); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($bid = null) { $model = new BannsRequest(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['banns_id'])) { $model->banns_id = $_POST['banns_id']; $model->req_dt = $_POST['cert_dt']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $banns = BannsRecord::model()->findByPk($bid); $this->render('create', array('model' => $model, 'banns' => $banns, 'now' => Yii::app()->dateFormatter->formatDateTime(time(), 'short', 'medium'))); }
/** * 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 BannsRecord the loaded model * @throws CHttpException */ public function loadModel($id) { $model = BannsRecord::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }