/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new TipoCarrera(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['TipoCarrera'])) { $model->attributes = $_POST['TipoCarrera']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->idTipoCarrera)); } } $this->render('create', array('model' => $model)); }
public function actionCrearTipoCarrera() { date_default_timezone_set('America/Tegucigalpa'); $model = new TipoCarrera(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Nombre'])) { $model->Nombre = $_POST['Nombre']; $model->Activo = 1; $model->CreadoPor = Yii::app()->user->name; $model->FechaCreacion = date('Y-m-d H:i:s'); if ($model->save()) { Yii::app()->user->setFlash("success", "<strong>Excelente! </strong> Se ha creado una nuevo tipo de carrera llamado <strong>" . $model->Nombre . "</strong>"); $this->redirect(Yii::app()->request->urlReferrer . "#tipoCarrera"); } } }