/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Semesters(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Semesters'])) { $model->attributes = $_POST['Semesters']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->semester_Id)); } } $this->render('create', array('model' => $model)); }
public function actionCreate() { $model = new Semesters('insert'); $call_lists = CHtml::listData(CallLists::model()->findAll(), 'id', 'name'); if (Yii::app()->request->isPostRequest) { $semester = Yii::app()->request->getParam('Semesters'); $model->setAttributes($semester); if ($model->save()) { Yii::app()->user->setFlash('success', 'Семестр успешно создан'); $this->redirect(['index']); } } $this->render('form', ['model' => $model, 'call_lists' => $call_lists]); }