/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $fecha = date("YmdHis"); if ($fecha < Yii::app()->params->fecha_termino) { $usuario = Usuarios::model()->findByPk(Yii::app()->user->id_usuario); $puede_subir = Fotos::conCategoriasDisponibles(); if (isset($usuario->edad)) { if ($puede_subir) { $adulto = $usuario->edad > 17 ? '1' : '0'; $this->render('create', array('adulto' => $adulto)); } else { throw new CHttpException(NULL, "Lo sentimos pero ya has subido el límite de fotografías permitidas. Para más información consulta la convocatoria."); } } else { throw new CHttpException(NULL, "Ocurrió un error, por favor inténtalo de nuevo."); } } else { throw new CHttpException(NULL, "El tiempo para registrar tus fotografias/videos ha terminado. Para más información consulta la convocatoria."); } }