/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Faq(); // Uncomment the following line if AJAX validation is needed //$this->performAjaxValidation($model); if (isset($_POST['Faq'])) { $model->attributes = $_POST['Faq']; if ($model->save()) { if (isset($_POST['savebutton'])) { $this->redirect($this->createUrl('index', array('msg' => '[!] Вопрос-ответ успешно создан', 'msgtype' => 'success'))); } else { $this->redirect($this->createUrl('update', array('id' => $model->id, 'msg' => '[!] Вопрос-ответ успешно создан', 'msgtype' => 'success'))); } } else { $model->date = $model->viewDate(); } } $this->render('create', array('model' => $model)); }