Commit ea074776e5739755674fa169580eaea6ab03e7aa
1 parent
93ea29315d
Exists in
master
controla el permiso sabatico de los docentes
Showing
8 changed files
with
291 additions
and
34 deletions
Show diff stats
app/Resources/views/cea/servicios.html.twig
| ... | ... | @@ -86,6 +86,13 @@ |
| 86 | 86 | <a href="{{ path('cea_reconocimientoEscala_show', { 'id': servicio.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye"> </i></a> |
| 87 | 87 | {% elseif servicio.idServicioCe.id == 7 %} |
| 88 | 88 | <a href="{{ path('cea_acta_defensa_show', { 'id': servicio.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye"> </i></a> |
| 89 | + {% elseif servicio.idServicioCe.id == 6 %} | |
| 90 | + <a href="{{ path('cea_reconocimientoEscala_show', { 'id': servicio.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye"> </i></a> | |
| 91 | + {% elseif servicio.idServicioCe.id == 7 %} | |
| 92 | + <a href="{{ path('cea_acta_defensa_show', { 'id': servicio.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye"> </i></a> | |
| 93 | + {% elseif servicio.idServicioCe.id > 7 %} | |
| 94 | + <a href="{{ path('cea_servicio_show', { 'id': servicio.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye"> </i> | |
| 95 | + | |
| 89 | 96 | {% endif %} |
| 90 | 97 | </td> |
| 91 | 98 | </tr> | ... | ... |
app/Resources/views/cea/servicios_mostar.html.twig
| ... | ... | @@ -284,7 +284,7 @@ |
| 284 | 284 | <div class="wrapper"> |
| 285 | 285 | <label for="yes_radio{{ loop.index }}" class="yes-lbl"><i class="fa fa-check"></i> |
| 286 | 286 | </label> |
| 287 | - <input type="radio" value="1" name="{{ documento.idTipoDocumentos.identificador }}" class="yes_radio" id="yes_radio{{ loop.index }}" {% if documento.idEstatus.id == 1 %} checked="checked" {% endif %} disabled> | |
| 287 | + <input type="radio" value="1" name="{{ documento.idTipoDocumentos.identificador }}" class="yes_radio" id="yes_radio{{ loop.index }}" {% if documento.idEstatus.id == 1 %} checked="checked" {% endif %} > | |
| 288 | 288 | <label for="maybe_radio{{ loop.index }}" class="maybe-lbl"> |
| 289 | 289 | <i class="fa fa-question"></i> |
| 290 | 290 | </label> |
| ... | ... | @@ -293,7 +293,7 @@ |
| 293 | 293 | class="fa fa-close"></i></label><input type="radio" value="3" |
| 294 | 294 | name="{{ documento.idTipoDocumentos.identificador }}" |
| 295 | 295 | class="no_radio" |
| 296 | - id="no_radio{{ loop.index }}" {% if documento.idEstatus.id == 3 %} checked="checked" {% endif %} disabled> | |
| 296 | + id="no_radio{{ loop.index }}" {% if documento.idEstatus.id == 3 %} checked="checked" {% endif %} > | |
| 297 | 297 | |
| 298 | 298 | <div class="toggle"></div> |
| 299 | 299 | </div> |
| ... | ... | @@ -324,7 +324,29 @@ |
| 324 | 324 | var buttonpressed; |
| 325 | 325 | $('#aprobado').click(function() { |
| 326 | 326 | //alert("click"); return false; |
| 327 | - buttonpressed = $(this).attr('name') | |
| 327 | + buttonpressed = $(this).attr('name'); | |
| 328 | + console.log($(':radio:checked').length); | |
| 329 | + for (var i = 0; i < $(':radio:checked').length; i ++){ | |
| 330 | + console.log($(':radio:checked')[i]); | |
| 331 | + if ( ($(':radio:checked')[i].value == "")) { | |
| 332 | + alert('Debes revisar todos los documentos para poder enviar la solicitud!'); | |
| 333 | + $("#aprobado").button('reset'); | |
| 334 | + return false; | |
| 335 | + } | |
| 336 | + | |
| 337 | + } | |
| 338 | + console.log($("input[type=submit][clicked=true]").val()); | |
| 339 | + if (buttonpressed == "aprobado") { | |
| 340 | + for (var i = 0; i < $(':radio:checked').length; i++) { | |
| 341 | + console.log($(':radio:checked')[i]); | |
| 342 | + if (($(':radio:checked')[i].value == "3")) { | |
| 343 | + alert('No puedes aprobar una solicitud con documentos en estatus de rechazado'); | |
| 344 | + $("#aprobado").button('reset'); | |
| 345 | + return false; | |
| 346 | + } | |
| 347 | + | |
| 348 | + } | |
| 349 | + } | |
| 328 | 350 | }); |
| 329 | 351 | |
| 330 | 352 | $('#rechazar').click(function() { | ... | ... |
app/Resources/views/solicitudes/index.html.twig
| ... | ... | @@ -74,6 +74,9 @@ |
| 74 | 74 | <a href="{{ path('servicio_defensa_imprimir', { 'id': servicio.id }) }}" target="_blank" class="btn btn-xs btn-info"><i class="fa fa-print"> </i></a> |
| 75 | 75 | {% endif %} |
| 76 | 76 | {%endif%} |
| 77 | + {% if servicio.idServicioCe.id > 7 %} | |
| 78 | + <a href="{{ path('adscripcion_show', { 'id': servicio.id }) }}" class="btn btn-xs btn-info"><i class="fa fa-eye"> </i></a> | |
| 79 | + {% endif %} | |
| 77 | 80 | </td> |
| 78 | 81 | </tr> |
| 79 | 82 | {% endfor %} | ... | ... |
app/Resources/views/solicitudes/permisos_index.html.twig
| ... | ... | @@ -2,9 +2,17 @@ |
| 2 | 2 | {% block body %} |
| 3 | 3 | |
| 4 | 4 | <div class="container"> |
| 5 | - {% for message in app.session.flashBag.get('notice') %} | |
| 5 | + {% for message in app.session.flashBag.get('success') %} | |
| 6 | 6 | <h4 class="alert alert-success">{{ message }}</h4> |
| 7 | 7 | {%endfor %} |
| 8 | + | |
| 9 | + {% for message in app.session.flashBag.get('warning') %} | |
| 10 | + <h4 class="alert alert-warning">{{ message }}</h4> | |
| 11 | + {%endfor %} | |
| 12 | + | |
| 13 | + {% for message in app.session.flashBag.get('danger') %} | |
| 14 | + <h4 class="alert alert-danger">{{ message }}</h4> | |
| 15 | + {%endfor %} | |
| 8 | 16 | <hr> |
| 9 | 17 | <div class="col-md-5"> |
| 10 | 18 | <div class="panel panel-default"> |
| ... | ... | @@ -74,7 +82,14 @@ |
| 74 | 82 | <div id="3" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree3"> |
| 75 | 83 | <div class="panel-body"> |
| 76 | 84 | Al tener el escalafón de asistente, puedes solicitar tu año sabático, siempre y |
| 77 | - cuando lo hayas contemplado dentro de tus actividades del PIDA | |
| 85 | + cuando lo hayas contemplado dentro de tus actividades del PIDA y | |
| 86 | + nos incluyas una exposición de motivos | |
| 87 | + <br><br> | |
| 88 | + | |
| 89 | + {% form_theme formSabatico 'bootstrap_3_layout.html.twig' %} | |
| 90 | + {{ form_start(formSabatico, {'attr': {'novalidate': 'novalidate'}}) }} | |
| 91 | + {{ form_widget(formSabatico) }} | |
| 92 | + {{ form_end(formSabatico) }} | |
| 78 | 93 | </div> |
| 79 | 94 | </div> |
| 80 | 95 | </div> | ... | ... |
src/AppBundle/Controller/AdscripcionController.php
| ... | ... | @@ -434,21 +434,24 @@ class AdscripcionController extends Controller |
| 434 | 434 | array('form' => $form->createView()) |
| 435 | 435 | ); |
| 436 | 436 | } |
| 437 | - | |
| 438 | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 439 | 440 | /** |
| 440 | 441 | * Solicita información al docente sobre su PIDA |
| 441 | 442 | * |
| 442 | - * @Route("/solicitud/pida/{id}", name="solicitud_pida") | |
| 443 | + * @Route("/solicitud/pida/", name="solicitud_pida") | |
| 443 | 444 | * @Method({"GET", "POST"}) |
| 444 | 445 | */ |
| 445 | - public function pidaAction(DocenteServicio $servicio, Request $request) | |
| 446 | + public function pidaAction(Request $request) | |
| 446 | 447 | { |
| 447 | - | |
| 448 | + | |
| 449 | + //var_dump($servicio->getId()); exit; | |
| 450 | + | |
| 448 | 451 | //verificar en las solicitudes la adscripcion del docente |
| 449 | 452 | $adscripcion = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')-> |
| 450 | 453 | findOneBy(array( |
| 451 | - 'idRolInstitucion' => $servicio->getIdRolInstitucion()->getId(), | |
| 454 | + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId(), | |
| 452 | 455 | 'idServicioCe' => 2 |
| 453 | 456 | )); |
| 454 | 457 | //si no ha solicitado adscripción regresa a la pagina de adscripcion |
| ... | ... | @@ -458,6 +461,11 @@ class AdscripcionController extends Controller |
| 458 | 461 | |
| 459 | 462 | |
| 460 | 463 | $pid = false; |
| 464 | + $servicio = $this->getDoctrine()->getRepository("AppBundle:DocenteServicio")->findOneBy(array( | |
| 465 | + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId(), | |
| 466 | + 'idServicioCe' => 4 | |
| 467 | + )); | |
| 468 | + | |
| 461 | 469 | if($servicio) { |
| 462 | 470 | //si el servicio está cadudado, debe solicitar uno nuevo |
| 463 | 471 | if ($servicio->getIdEstatus()->getId() == 5) { |
| ... | ... | @@ -501,19 +509,19 @@ class AdscripcionController extends Controller |
| 501 | 509 | $em = $this->getDoctrine()->getManager(); |
| 502 | 510 | //Crear la solicitud de Servicio |
| 503 | 511 | if(!$servicio) { |
| 504 | - $serv = new DocenteServicio(); | |
| 512 | + $servicio = new DocenteServicio(); | |
| 505 | 513 | |
| 506 | - $serv->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
| 507 | - $serv->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4)); | |
| 508 | - $serv->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2)); | |
| 509 | - $em->persist($serv); | |
| 514 | + $servicio->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
| 515 | + $servicio->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4)); | |
| 516 | + $servicio->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2)); | |
| 517 | + $em->persist($servicio); | |
| 510 | 518 | } |
| 511 | 519 | |
| 512 | 520 | |
| 513 | 521 | |
| 514 | 522 | $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); |
| 515 | 523 | $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2)); |
| 516 | - $pida->setIdDocenteServicio($serv); | |
| 524 | + $pida->setIdDocenteServicio($servicio); | |
| 517 | 525 | foreach($pida->getPidaTareaEspecifico() as $especifico){ |
| 518 | 526 | //var_dump($especifico); exit; |
| 519 | 527 | $especifico->setAdscripcionPidaId($pida); | ... | ... |
src/AppBundle/Controller/AppController.php
| ... | ... | @@ -65,7 +65,7 @@ class AppController extends Controller { |
| 65 | 65 | $em = $this->getDoctrine()->getManager(); |
| 66 | 66 | if(!$pida){ |
| 67 | 67 | $this->addFlash('warning', 'Estimado Docente Mientras se verifica su adscripción, le solicitamos que por favor cree su PIDA.'); |
| 68 | - return $this->redirectToRoute('solicitud_pida', array('id' => $servicioAdscripcion->getId())); | |
| 68 | + return $this->redirectToRoute('solicitud_pida'); | |
| 69 | 69 | }else{ |
| 70 | 70 | $caducidad = $this->getDoctrine()->getRepository("AppBundle:PidaCaducidad")->findOneByIdDocenteServicio($pida); |
| 71 | 71 | if($caducidad){ |
| ... | ... | @@ -265,6 +265,14 @@ class AppController extends Controller { |
| 265 | 265 | $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ESTUDIANTE")); |
| 266 | 266 | $em->persist($user); |
| 267 | 267 | } |
| 268 | + | |
| 269 | + $parametros = $request->request->all(); | |
| 270 | + | |
| 271 | + //Guardar el resultado de la verificación de Documentos de los permisos sabaticos | |
| 272 | + if($servicios->getIdServicioCe()->getId() == 8){ | |
| 273 | + verificar_documentos4($servicios->getIdRolInstitucion(), 18, 1, $em, "", $servicios); | |
| 274 | + } | |
| 275 | + | |
| 268 | 276 | |
| 269 | 277 | |
| 270 | 278 | }else{ |
| ... | ... | @@ -275,6 +283,11 @@ class AppController extends Controller { |
| 275 | 283 | $user->removeRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ESTUDIANTE")); |
| 276 | 284 | $em->persist($user); |
| 277 | 285 | } |
| 286 | + | |
| 287 | + //Guardar el resultado de la verificación de Documentos de los permisos sabaticos | |
| 288 | + if($servicios->getIdServicioCe()->getId() == 8){ | |
| 289 | + verificar_documentos4($servicios->getIdRolInstitucion(), 18, 3, $em, "", $servicios); | |
| 290 | + } | |
| 278 | 291 | } |
| 279 | 292 | |
| 280 | 293 | $em->persist($servicios); |
| ... | ... | @@ -282,7 +295,7 @@ class AppController extends Controller { |
| 282 | 295 | |
| 283 | 296 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($servicios->getIdRolInstitucion()); |
| 284 | 297 | |
| 285 | - $message = \Swift_Message::newInstance() | |
| 298 | + /*$message = \Swift_Message::newInstance() | |
| 286 | 299 | ->setSubject('Resultado Solicitud de Servicio Docente CEA@UBV') |
| 287 | 300 | ->setFrom('wilmer.ramones@gmail.com') |
| 288 | 301 | ->setTo($user->getEmail()) |
| ... | ... | @@ -299,7 +312,7 @@ class AppController extends Controller { |
| 299 | 312 | 'text/html' |
| 300 | 313 | ) |
| 301 | 314 | ; |
| 302 | - $this->get('mailer')->send($message); | |
| 315 | + $this->get('mailer')->send($message);*/ | |
| 303 | 316 | |
| 304 | 317 | $this->addFlash('notice', 'Servicio Actualizada Correctamente, hemos enviado un correo al docente notificandole los cambios.'); |
| 305 | 318 | |
| ... | ... | @@ -320,10 +333,31 @@ class AppController extends Controller { |
| 320 | 333 | |
| 321 | 334 | } |
| 322 | 335 | |
| 336 | + | |
| 323 | 337 | |
| 324 | - | |
| 325 | - | |
| 326 | - | |
| 327 | - | |
| 328 | 338 | } |
| 329 | - | |
| 330 | 339 | \ No newline at end of file |
| 340 | + | |
| 341 | +function verificar_documentos4($idRolInstitucion, $tipo, $estatus, $em, $ubicacion="", $servicio){ | |
| 342 | + $existe = $em->getRepository("AppBundle:DocumentosVerificados")->findOneBy(array( | |
| 343 | + 'idRolInstitucion' => $idRolInstitucion, | |
| 344 | + 'idTipoDocumentos' => $tipo | |
| 345 | + )); | |
| 346 | + | |
| 347 | + if(!$existe) { | |
| 348 | + $verificacion = new DocumentosVerificados(); | |
| 349 | + $verificacion->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById($estatus)); | |
| 350 | + $verificacion->setIdRolInstitucion($idRolInstitucion); | |
| 351 | + $verificacion->setIdServicio($servicio); | |
| 352 | + $verificacion->setIdTipoDocumentos($em->getRepository("AppBundle:TipoDocumentos")->findOneById($tipo)); | |
| 353 | + $verificacion->setUbicacion($ubicacion); | |
| 354 | + $em->persist($verificacion); | |
| 355 | + $em->flush(); | |
| 356 | + }else{ | |
| 357 | + $existe->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById($estatus)); | |
| 358 | + $em->persist($existe); | |
| 359 | + $em->flush(); | |
| 360 | + } | |
| 361 | + | |
| 362 | +} | |
| 363 | + | |
| 364 | + | ... | ... |
src/AppBundle/Controller/PermisosController.php
| ... | ... | @@ -34,15 +34,185 @@ class PermisosController extends Controller |
| 34 | 34 | /** |
| 35 | 35 | * @Route("/solicitud/permisos", name="permisos_index") |
| 36 | 36 | */ |
| 37 | - public function permisosIndexAction() | |
| 37 | + public function permisosIndexAction( Request $request) | |
| 38 | 38 | { |
| 39 | + $em = $this->getDoctrine()->getManager(); | |
| 40 | + $docente = $this->getUser()->getIdRolInstitucion(); | |
| 41 | + $escalafones = $em->getRepository("AppBundle:DocenteEscala")->findOneBy(array( | |
| 42 | + 'idRolInstitucion' => $docente, | |
| 43 | + 'idEscala' => $em->getRepository("AppBundle:Escalafones")->findOneById(2) | |
| 44 | + )); | |
| 45 | + | |
| 46 | + if(!$escalafones){ | |
| 47 | + $this->addFlash('danger', 'Estimado Docente, debe ser mínimo Asistente para poder realizar esta solicitud'); | |
| 48 | + return $this->redirect($this->generateUrl('permisos_index')); | |
| 49 | + } | |
| 50 | + | |
| 51 | + | |
| 52 | + /* Permiso sabatico */ | |
| 53 | + $sabatico = $this->getDoctrine()->getRepository("AppBundle:DocenteServicio")->findOneBy(array( | |
| 54 | + 'idRolInstitucion' => $docente, 'idServicioCe' => 8 ), | |
| 55 | + array('id' => 'DESC') | |
| 56 | + ); | |
| 57 | + | |
| 58 | + if($sabatico && ($sabatico->getIdEstatus()->getId() == 1 || $sabatico->getIdEstatus()->getId() == 2 )){ | |
| 59 | + $tiempoEspera = $sabatico->getFechaSolicitud()->diff(new \DateTime("now")); | |
| 60 | + if($tiempoEspera->y >= 7 && $sabatico->getIdEstatus()->getId() == 1){ | |
| 61 | + $sabatico->setIdEstatus($this->getDoctrine()->getRepository("AppBundle:Estatus")->findOneById(4)); | |
| 62 | + $em->persist($sabatico); | |
| 63 | + $em->flush(); | |
| 64 | + }else { | |
| 65 | + $this->addFlash('warning', 'Ya posee una solicitud en espera o activa, no puede realizar otra solicitud.'); | |
| 66 | + return $this->redirect($this->generateUrl('servicios_index')); | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + | |
| 71 | + $formSabatico = $this->createForm('AppBundle\Form\PermisoSabaticoType'); | |
| 72 | + $formSabatico->handleRequest($request); | |
| 73 | + if ($formSabatico->isSubmitted() && $formSabatico->isValid()) { | |
| 74 | + | |
| 75 | + $servicios = new DocenteServicio(); | |
| 76 | + | |
| 77 | + $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
| 78 | + $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(8)); | |
| 79 | + $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2)); | |
| 80 | + $em->persist($servicios); | |
| 81 | + $em->flush(); | |
| 82 | + | |
| 83 | + $motivo = $formSabatico->get('motivo')->getData(); | |
| 84 | + $nombreMotivo = md5(uniqid()).'.'.$motivo->guessExtension(); | |
| 85 | + | |
| 86 | + $motivo->move( | |
| 87 | + $this->container->getParameter('permiso_directory'), | |
| 88 | + $nombreMotivo | |
| 89 | + ); | |
| 90 | + thumbnail3($nombreMotivo, $this->container->getParameter('permiso_directory'), $this->container->getParameter('permiso_thumb_directory')); | |
| 91 | + | |
| 92 | + verificar_documentos3($servicios->getIdRolInstitucion(),18,2,$em,$nombreMotivo, $servicios); | |
| 93 | + $this->addFlash('success', 'Permiso solicitado satisfactoriamente'); | |
| 94 | + return $this->redirect($this->generateUrl('servicios_index')); | |
| 95 | + } | |
| 96 | + | |
| 97 | + /* Fin Sabatico */ | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + /* Permiso Estudio */ | |
| 104 | + $estudio = $this->getDoctrine()->getRepository("AppBundle:DocenteServicio")->findOneBy(array( | |
| 105 | + 'idRolInstitucion' => $docente, 'idServicioCe' => 9 ), | |
| 106 | + array('id' => 'DESC') | |
| 107 | + ); | |
| 108 | + | |
| 109 | + if($estudio && ($estudio->getIdEstatus()->getId() == 1 || $estudio->getIdEstatus()->getId() == 2 )){ | |
| 110 | + $tiempoEspera = $estudio->getFechaSolicitud()->diff(new \DateTime("now")); | |
| 111 | + if($tiempoEspera->y >= 1 && $estudio->getIdEstatus()->getId() == 1){ | |
| 112 | + $estudio->setIdEstatus($this->getDoctrine()->getRepository("AppBundle:Estatus")->findOneById(4)); | |
| 113 | + $em->persist($estudio); | |
| 114 | + $em->flush(); | |
| 115 | + }else { | |
| 116 | + $this->addFlash('warning', 'Ya posee una solicitud en espera o activa, no puede realizar otra solicitud.'); | |
| 117 | + return $this->redirect($this->generateUrl('servicios_index')); | |
| 118 | + } | |
| 119 | + } | |
| 120 | + | |
| 121 | + | |
| 122 | + $formSabatico = $this->createForm('AppBundle\Form\PermisoSabaticoType'); | |
| 123 | + $formSabatico->handleRequest($request); | |
| 124 | + if ($formSabatico->isSubmitted() && $formSabatico->isValid()) { | |
| 125 | + | |
| 126 | + $servicios = new DocenteServicio(); | |
| 127 | + | |
| 128 | + $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
| 129 | + $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(8)); | |
| 130 | + $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2)); | |
| 131 | + $em->persist($servicios); | |
| 132 | + $em->flush(); | |
| 133 | + | |
| 134 | + $motivo = $formSabatico->get('motivo')->getData(); | |
| 135 | + $nombreMotivo = md5(uniqid()).'.'.$motivo->guessExtension(); | |
| 136 | + | |
| 137 | + $motivo->move( | |
| 138 | + $this->container->getParameter('permiso_directory'), | |
| 139 | + $nombreMotivo | |
| 140 | + ); | |
| 141 | + thumbnail3($nombreMotivo, $this->container->getParameter('permiso_directory'), $this->container->getParameter('permiso_thumb_directory')); | |
| 142 | + | |
| 143 | + verificar_documentos3($servicios->getIdRolInstitucion(),18,2,$em, $nombreMotivo, $servicios); | |
| 144 | + $this->addFlash('success', 'Permiso solicitado satisfactoriamente'); | |
| 145 | + return $this->redirect($this->generateUrl('servicios_index')); | |
| 146 | + } | |
| 147 | + | |
| 148 | + /* Fin Estudio */ | |
| 149 | + | |
| 150 | + | |
| 39 | 151 | return $this->render('solicitudes/permisos_index.html.twig', array( |
| 152 | + 'formSabatico' => $formSabatico->createView() | |
| 40 | 153 | |
| 41 | 154 | )); |
| 42 | 155 | } |
| 43 | 156 | |
| 44 | 157 | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | +} | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | +function thumbnail3 ($filename, $fuente, $destino){ | |
| 167 | + $im = false; | |
| 168 | + if(preg_match('/[.](jpeg)$/', $filename)) { | |
| 169 | + $im = imagecreatefromjpeg($fuente . "/" . $filename); | |
| 170 | + } else if (preg_match('/[.](jpg)$/', $filename)) { | |
| 171 | + $im = imagecreatefromjpeg($fuente . "/" . $filename); | |
| 172 | + }else if (preg_match('/[.](gif)$/', $filename)) { | |
| 173 | + $im = imagecreatefromgif($fuente . "/" . $filename); | |
| 174 | + } else if (preg_match('/[.](png)$/', $filename)) { | |
| 175 | + $im = imagecreatefrompng($fuente . "/" . $filename); | |
| 176 | + } | |
| 177 | + if($im){ | |
| 178 | + $ox = imagesx($im); | |
| 179 | + $oy = imagesy($im); | |
| 180 | + | |
| 181 | + $nx = 80; | |
| 182 | + $ny = 80; | |
| 183 | + | |
| 184 | + $nm = imagecreatetruecolor($nx, $ny); | |
| 185 | + | |
| 186 | + imagecopyresized($nm, $im, 0,0,0,0,$nx,$ny,$ox,$oy); | |
| 187 | + | |
| 188 | + imagejpeg($nm, $destino . "/" . $filename); | |
| 189 | + }else{ | |
| 190 | + move_uploaded_file($filename, $destino); | |
| 191 | + } | |
| 45 | 192 | } |
| 46 | 193 | |
| 47 | - | |
| 48 | - | |
| 194 | + | |
| 195 | + | |
| 196 | +function verificar_documentos3($idRolInstitucion, $tipo, $estatus, $em, $ubicacion="", $servicio = 2){ | |
| 197 | + $existe = $em->getRepository("AppBundle:DocumentosVerificados")->findOneBy(array( | |
| 198 | + 'idRolInstitucion' => $idRolInstitucion, | |
| 199 | + 'idTipoDocumentos' => $tipo, | |
| 200 | + 'idServicio' => $servicio | |
| 201 | + )); | |
| 202 | + | |
| 203 | + if(!$existe) { | |
| 204 | + $verificacion = new DocumentosVerificados(); | |
| 205 | + $verificacion->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById($estatus)); | |
| 206 | + $verificacion->setIdRolInstitucion($idRolInstitucion); | |
| 207 | + $verificacion->setIdServicio($servicio); | |
| 208 | + $verificacion->setIdTipoDocumentos($em->getRepository("AppBundle:TipoDocumentos")->findOneById($tipo)); | |
| 209 | + $verificacion->setUbicacion($ubicacion); | |
| 210 | + $em->persist($verificacion); | |
| 211 | + $em->flush(); | |
| 212 | + }else{ | |
| 213 | + $existe->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById($estatus)); | |
| 214 | + $em->persist($existe); | |
| 215 | + $em->flush(); | |
| 216 | + } | |
| 217 | + | |
| 218 | +} | |
| 49 | 219 | \ No newline at end of file | ... | ... |
src/AppBundle/Form/PermisoSabaticoType.php
| ... | ... | @@ -11,23 +11,21 @@ namespace AppBundle\Form; |
| 11 | 11 | |
| 12 | 12 | use Symfony\Component\Form\AbstractType; |
| 13 | 13 | use Symfony\Component\Form\FormBuilderInterface; |
| 14 | -use Symfony\Component\OptionsResolver\OptionsResolver; | |
| 15 | 14 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
| 16 | 15 | |
| 17 | 16 | use Symfony\Component\Validator\Constraints\File; |
| 18 | 17 | use Symfony\Component\Validator\Constraints\NotBlank; |
| 19 | 18 | use Symfony\Component\Form\Extension\Core\Type\FileType; |
| 20 | 19 | |
| 21 | -use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |
| 22 | 20 | |
| 23 | -class ReconocimientoEscalaType extends AbstractType | |
| 21 | +class PermisoSabaticoType extends AbstractType | |
| 24 | 22 | { |
| 25 | 23 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 26 | 24 | { |
| 27 | 25 | $builder |
| 28 | 26 | |
| 29 | - ->add('reconocimiento', FileType::class, array( | |
| 30 | - 'label' => 'Digital Aprobación de Escala', | |
| 27 | + ->add('motivo', FileType::class, array( | |
| 28 | + 'label' => 'Digital Carta Exposición de Motivos', | |
| 31 | 29 | 'constraints' => array( |
| 32 | 30 | new NotBlank(), |
| 33 | 31 | new File(array( |
| ... | ... | @@ -44,7 +42,7 @@ class ReconocimientoEscalaType extends AbstractType |
| 44 | 42 | ) |
| 45 | 43 | )) |
| 46 | 44 | ->add('send', SubmitType::class, array( |
| 47 | - 'label' => 'Enviar reconocimiento de Escala', | |
| 45 | + 'label' => 'Enviar motivo', | |
| 48 | 46 | 'attr' => array( |
| 49 | 47 | 'class' => 'btn btn-success btn-block', |
| 50 | 48 | 'data-loading-text' => "<i class='fa fa-circle-o-notch fa-spin'></i> Procesando Solicitud..." | ... | ... |