From 91bbebb4b6d51669951fadf0b10e5a55d4d64a17 Mon Sep 17 00:00:00 2001 From: Wilmer Date: Fri, 2 Dec 2016 09:14:17 -0400 Subject: [PATCH] =?UTF-8?q?se=20esta=20calculando=20el=20tiempo=20que=20le?= =?UTF-8?q?=20falta=20para=20ascender,=20pendiente=20con=20los=20cuatro=20?= =?UTF-8?q?a=C3=B1os...=20debe=20ser=20con=20el=20tiempo=20en=20la=20base?= =?UTF-8?q?=20de=20dtos=20en=20appcontroler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppBundle/Controller/AppController.php | 18 ++++++++++++++++++ src/AppBundle/Controller/AscensoController.php | 8 +++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/AppBundle/Controller/AppController.php b/src/AppBundle/Controller/AppController.php index eae6e79..c670eab 100644 --- a/src/AppBundle/Controller/AppController.php +++ b/src/AppBundle/Controller/AppController.php @@ -49,9 +49,27 @@ class AppController extends Controller { findOneBy(array( 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId() )); + if(!$pida){ return $this->redirect($this->generateUrl('solicitud_pida')); } + $escalafon = $this->getDoctrine()->getRepository('AppBundle:DocenteEscala')->findOneBy( + array('idRolInstitucion' => $this->getUser()->getIdRolInstitucion()), + array('id' => 'DESC') + ); + + if ($escalafon){ + $escalafones = $this->getDoctrine()->getRepository("AppBundle:Escalafones")->findOneById($escalafon->getIdEscala()->getId() + 1); //tiempo para el proximo escalafon + if($escalafones){ + //tiempo para el prox escalafon + $tiempoProxEscalafon = $escalafon->getFechaEscala()->modify('+4 years'); + $tiempoTranscurrido = $tiempoProxEscalafon->diff(new \DateTime("now")); + var_dump($tiempoTranscurrido); exit; + } + } + + + //solicitud aprobada está en falso $adscrito = false; diff --git a/src/AppBundle/Controller/AscensoController.php b/src/AppBundle/Controller/AscensoController.php index 85066f2..3b83fee 100644 --- a/src/AppBundle/Controller/AscensoController.php +++ b/src/AppBundle/Controller/AscensoController.php @@ -53,8 +53,14 @@ class AscensoController extends Controller $this->addFlash('danger', 'Estimado Docente, todavia no ha concursado, debe concursar primero para poder realizar una solicitud de ascenso.'); return $this->redirect($this->generateUrl('cea_index')); } + //busca la escala siguiente + $escalafones = $this->getDoctrine()->getRepository("AppBundle:Escalafones")->findOneById($escala->getIdEscala()->getId() + 1); //tiempo para el proximo escalafon + //si no hay escalas siguientes, es debido a que es titular + if(!$escalafones){ + $this->addFlash('notice', 'Ya usted posee el máximo escalfón docente disponible. no puede solicitar este servicio.'); + return $this->redirect($this->generateUrl('servicios_index')); + } - $escalafones = $this->getDoctrine()->getRepository("AppBundle:Escalafones")->findOneById($escala->getIdEscala()->getId() + 1); //tiempo para el proximo escalafon $tiempoProxEscalafon = $escala->getFechaEscala()->diff(new \DateTime("now")); //si no cumple el tiempo para solicitar ascenso -- 2.0.0