/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ContractsTmpl(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ContractsTmpl'])) { $model->attributes = $_POST['ContractsTmpl']; if ($model->save()) { $msg = 'Шаблон договора ' . $model->name . ' создан'; Yii::app()->user->setFlash('success', $msg); Yii::app()->logger->write($msg); $this->redirect(array('admin', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }