/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionSolicita() { $model = new Noticias(); $model->setscenario('solicita'); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Noticias'])) { $model->attributes = $_POST['Noticias']; if ($model->save()) { Yii::app()->user->setFlash('success', 'La noticia se ha grabado correctamente, Tiene que esperar a que el administrador apruebe su solicitud, un correo ha sido enviado a su buzon'); Yii::app()->crugemailer->mail_general(Confignoticias::getMailAdminTablon(), 'Nueva solicitud de Noticia', $model->mensaje, $model, array('fecha', 'expira', 'fechapublicacion')); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('solicita', array('model' => $model)); }