public function actionCreate() { $model = new Parametro(); if (isset($_POST['Parametro'])) { $model->setAttributes($_POST['Parametro']); if (length($model->ValorFecha) > 0) { $model->ValorFecha = date('Y-m-d', CDateTimeParser::parse($model->ValorFecha, Yii::app()->locale->dateFormat)); } try { if ($model->save()) { if (isset($_GET['returnUrl'])) { $this->redirect($_GET['returnUrl']); } else { $this->redirect(array('view', 'id' => $model->idParametro)); } } } catch (Exception $e) { $model->addError('', $e->getMessage()); } } elseif (isset($_GET['Parametro'])) { $model->attributes = $_GET['Parametro']; } $this->render('create', array('model' => $model)); }