From a10b2c527931dc16e2527f86905094d27eea375b Mon Sep 17 00:00:00 2001 From: Wilmer Ramones Date: Mon, 11 Jul 2016 14:40:47 -0400 Subject: [PATCH] =?UTF-8?q?se=20trabaj=C3=B3=20con=20los=20roles=20para=20?= =?UTF-8?q?asegurar=20la=20aplicacion,=20se=20trabaj=C3=B3=20con=20la=20bu?= =?UTF-8?q?squeda=20de=20adscripcion=20por=20cedula,=20se=20mejoraron=20lo?= =?UTF-8?q?s=20mensajes=20del=20sistema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Resources/views/base_app.html.twig | 135 ++++++++++++++------- app/Resources/views/cea/index.html.twig | 7 +- app/Resources/views/cea/solicitudes.html.twig | 2 +- .../views/cea/solicitudes_mostar.html.twig | 56 ++++++--- src/AppBundle/Controller/AppController.php | 65 ++++++++-- 5 files changed, 193 insertions(+), 72 deletions(-) diff --git a/app/Resources/views/base_app.html.twig b/app/Resources/views/base_app.html.twig index b0d4400..d8ae377 100644 --- a/app/Resources/views/base_app.html.twig +++ b/app/Resources/views/base_app.html.twig @@ -7,34 +7,39 @@ - + {% endblock %} {% block navegacion %} - + {% endblock %} @@ -42,40 +47,82 @@ {% block submenu %} - + {% endblock %} - - + {% block body %} + {% endblock %} - + + + {% block javascripts %} {% endblock %} + + + + + + + + diff --git a/app/Resources/views/cea/index.html.twig b/app/Resources/views/cea/index.html.twig index 5ae085a..8e16239 100644 --- a/app/Resources/views/cea/index.html.twig +++ b/app/Resources/views/cea/index.html.twig @@ -4,7 +4,12 @@
-
+
+ + {% for message in app.session.flashBag.get('danger') %} +
{{ message }}
+ {%endfor %} + {% if not adscrito %}
diff --git a/app/Resources/views/cea/solicitudes.html.twig b/app/Resources/views/cea/solicitudes.html.twig index 6dfbf05..b940b52 100644 --- a/app/Resources/views/cea/solicitudes.html.twig +++ b/app/Resources/views/cea/solicitudes.html.twig @@ -4,7 +4,7 @@
-

Listado de solicitudes de Adscripción Al CEA

+

Listado de Adscripciones: Estatus {{ estatus_adscripciones }}

diff --git a/app/Resources/views/cea/solicitudes_mostar.html.twig b/app/Resources/views/cea/solicitudes_mostar.html.twig index 1797c74..f91dfa9 100644 --- a/app/Resources/views/cea/solicitudes_mostar.html.twig +++ b/app/Resources/views/cea/solicitudes_mostar.html.twig @@ -5,35 +5,53 @@ {% endblock %} {%block body %} - {% for message in app.session.flashBag.get('notice') %} -
{{ message }}
- {%endfor %}
+ {% for message in app.session.flashBag.get('notice') %} +

{{ message }}

+ + {%endfor %}
-
-

Solicitud de Adscripción número {{adscripcion.id}}: {{ adscripcion.idRolInstitucion.idRol.idPersona.primerNombre }}, {{ adscripcion.idRolInstitucion.idRol.idPersona.primerApellido }}

- +
+

Solicitud de Adscripción número {{adscripcion.id}}: + {{ adscripcion.idRolInstitucion.idRol.idPersona.primerNombre }}, + {{ adscripcion.idRolInstitucion.idRol.idPersona.primerApellido }} +

+
+
+ {% if adscripcion.idEstatus.id == 1 %} +

Estatus {{adscripcion.idEstatus}} + {% elseif adscripcion.idEstatus.id == 3 %} +

Estatus {{adscripcion.idEstatus}} + {% else %} +

Estatus {{adscripcion.idEstatus}} + {% endif %} +

- + {% if adscripcion.postgrado is null %} +
+

El Docente al momento de la solicitud informa no haber realizado Concurso de oposición

+
+ {% endif %}
-
+
+
- + {% if escalas is not null %}
@@ -48,9 +66,12 @@ {%endfor %} -
{{escala.idTipoEscala }}
+
+ {% endif %} + + {% if adscripcion.idLineaInvestigacion is not null %}
@@ -60,19 +81,18 @@
{% endif %} - + + + {% if adscripcion.tituloTrabajo is not null %}
- -
- - - + {% endif %} + -  Aprobar -  Rechazar +  Aprobar +  Rechazar

diff --git a/src/AppBundle/Controller/AppController.php b/src/AppBundle/Controller/AppController.php index e1782b9..aa866ed 100644 --- a/src/AppBundle/Controller/AppController.php +++ b/src/AppBundle/Controller/AppController.php @@ -11,6 +11,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; +use Symfony\Component\HttpFoundation\Request; use AppBundle\Entity\Adscripcion; @@ -50,17 +51,57 @@ class AppController extends Controller { /** * Pagina principal de inicio de la session Docente. * - * @Route("/solicitudes", name="cea_solicitudes") - * @Method("GET") + * @Route("/solicitudes/adscripcion/{estatus}", name="cea_adscripciones") + * @Method({"GET", "POST"}) * @Security("has_role('ROLE_COORDINADOR_NACIONAL')") */ - public function verSolicitudesAction() + public function verSolicitudesAction($estatus = 2, Request $request) { - $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findBy(array('idEstatus' => 2)); - + if ($request->getMethod() != 'POST') { + $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findBy(array('idEstatus' => $estatus)); + switch ($estatus){ + case 1: + $mensaje = "activas"; + break; + case 2: + $mensaje = "en espera"; + break; + case 3: + $mensaje = "rechazadas"; + break; + } + }else{ + + $persona = $this->getDoctrine()->getRepository('AppBundle:Persona') + ->findOneByCedulaPasaporte($request->get('docente')); + + if (!$persona) { + $this->addFlash('danger', 'Docente ' . $request->get('docente') . ' no Registrado en la Base de Datos del Centro de Estudios.'); + return $this->render('cea/index.html.twig', array ( + 'adscrito' => true + )); + } + + //1. obtener el rol-institucion-persona + $rol = $this->getDoctrine()->getRepository( + 'AppBundle:RolInstitucion')->findOneByIdRol( + $this->getDoctrine()->getRepository( + 'AppBundle:Rol')->findOneByIdPersona($persona)); + + //si no existe el rol del docente, enviar correo al encargado de la región para verificar. + if (!$rol) { + $this->addFlash('danger', 'Docente no Registrado en la Base de Datos del Centro de Estudios. Por Favor'); + return $this->render('cea/index.html.twig'); + } + + + $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findByIdRolInstitucion($rol->getId()); + $mensaje = "Busqueda : " . $request->get('docente'); + } return $this->render('cea/solicitudes.html.twig', array( - 'adscripciones' => $adscripciones + 'adscripciones' => $adscripciones, + 'estatus_adscripciones' => $mensaje )); } @@ -95,11 +136,19 @@ class AppController extends Controller { $adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneById($adscripcion->getId()); - if($estatus) $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(1)); - else $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(3)); + if($estatus == "true") { + $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(1)); + $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); + $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); + }else{ + $adscripciones->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(3)); + $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); + $user->removeRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); + } $em = $this->getDoctrine()->getManager(); $em->persist($adscripciones); + $em->persist($user); $em->flush(); $this->addFlash('notice', 'Solicitud Actualizada Correctamente'); -- 2.0.0