From 405be36e1f4b02a34feadd254d79140862d85a20 Mon Sep 17 00:00:00 2001 From: Wilmer Date: Mon, 27 Mar 2017 08:19:29 -0400 Subject: [PATCH] =?UTF-8?q?a=C3=B1adir=20mensajes=20notificando=20la=20vig?= =?UTF-8?q?encia=20del=20PIDA=20y=20actualizando=20el=20estatus=20si=20est?= =?UTF-8?q?=C3=A1=20vencido?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppBundle/Controller/AppController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/AppBundle/Controller/AppController.php b/src/AppBundle/Controller/AppController.php index 06f7c73..e99bbd9 100644 --- a/src/AppBundle/Controller/AppController.php +++ b/src/AppBundle/Controller/AppController.php @@ -70,7 +70,14 @@ class AppController extends Controller { if($caducidad){ //saber si el pida actual caducó $hoy = new \DateTime("now"); - $vencido = (($hoy->diff($caducidad->getFechaFinal())->invert ? true : false)); + $tiempo = ($hoy->diff($caducidad->getFechaFinal())); + if($tiempo->format('%a%') <= 60 && $tiempo->format('%a%') >= 30){ + $this->addFlash('warning', 'Estimado docente su PIDA estará vigente sólo por ' . $tiempo->format('%a%') . ' días más' ); + }else if($tiempo->format('%a%') <= 29){ + $this->addFlash('danger', 'Estimado docente dentro de ' . $tiempo->format('%a%') . ' días su PIDA caducará y deberá crear uno nuevo'); + } + //var_dump($tiempo); die; + $vencido = ($tiempo->invert ? true : false); if($vencido){ $pida->setIdEstatus($this->getDoctrine()->getRepository("AppBundle:Estatus")->findOneById(5)); $em->persist($pida); -- 2.0.0