diff --git a/app/Resources/views/cea/solicitudes_mostar.html.twig b/app/Resources/views/cea/solicitudes_mostar.html.twig index f91dfa9..225feba 100644 --- a/app/Resources/views/cea/solicitudes_mostar.html.twig +++ b/app/Resources/views/cea/solicitudes_mostar.html.twig @@ -32,7 +32,7 @@
- {% if adscripcion.postgrado is null %} + {% if adscripcion.oposicion is null %}

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

@@ -151,6 +151,21 @@
{% endif %} + + + + {% if adscripcion.asistente is not null %} +
+
+ + + +
+

Ascenso Asistente

+
+
+
+ {% endif %} diff --git a/app/Resources/views/correos/actualizar_adscripcion.html.twig b/app/Resources/views/correos/actualizar_adscripcion.html.twig new file mode 100644 index 0000000..1699d24 --- /dev/null +++ b/app/Resources/views/correos/actualizar_adscripcion.html.twig @@ -0,0 +1,9 @@ +

Bienvido al CEA@UBV {{ nombres }}Tu adscripcion ha sido {{ estatus }}

+ + +Para hacer login dirigete simplemente a la página de ingreso del Portal del Centro de Estudios Avanzados: Login. + + + +{# Makes an absolute URL to the /images/logo.png file #} + \ No newline at end of file diff --git a/app/Resources/views/portal/index.html.twig b/app/Resources/views/portal/index.html.twig index fe99bea..bb7fbb0 100644 --- a/app/Resources/views/portal/index.html.twig +++ b/app/Resources/views/portal/index.html.twig @@ -248,7 +248,7 @@
diff --git a/app/Resources/views/solicitudes/adscripcion.html.twig b/app/Resources/views/solicitudes/adscripcion.html.twig index 06e3873..18ca113 100644 --- a/app/Resources/views/solicitudes/adscripcion.html.twig +++ b/app/Resources/views/solicitudes/adscripcion.html.twig @@ -39,25 +39,47 @@ $("#user_fecha_oposicion_month").prop('required', $(this).prop("checked")); $("#user_fecha_oposicion_year").prop('required', $(this).prop("checked")); $("#user_documento_oposicion").prop('required', $(this).prop("checked")); + $("#user_lineas_investigacion").prop('required', $(this).prop("checked")); + $("#user_titulo_trabajo").prop('required', $(this).prop("checked")); }); $('#user_ascenso').click(function() { - alert($("#user_escala").val()); + if($("#user_escala").val() == 1) $('.esc_asistente')[this.checked ? "show" : "hide"](); if($("#user_escala").val() == 2) $('.esc_asociado')[this.checked ? "show" : "hide"](); - if($("#user_escala").val() == 3) - $('.esc_agregado')[this.checked ? "show" : "hide"](); - if($("#user_escala").val() == 4) - $('.esc_titular')[this.checked ? "show" : "hide"](); - + if($("#user_escala").val() == 3) + $('.esc_agregado')[this.checked ? "show" : "hide"](); + if($("#user_escala").val() == 4) + $('.esc_titular')[this.checked ? "show" : "hide"](); }); - $('#user_ascenso2').click(function() { - alert($("#user_escala").val()); + + + + $("#user_fecha_oposicion_year").change(function(){ + if ($("#user_fecha_oposicion_year").val() < $("#user_fecha_ingreso_year").val()){ + alert('la fecha de concurso debe ser mayor a la fecha de ingreso'); + $("#user_fecha_oposicion_year").val(""); + + } + }); + + $("#user_fecha_ascenso_asistente_year").change(function(){ + if ($("#user_fecha_ascenso_asistente_year").val() < $("#user_fecha_oposicion_year").val()){ + alert('la fecha de ascenso debe ser mayor a la del Concurso de oposición'); + $("#user_fecha_asistente_year").val(""); + + } + }); + + + + + $('#user_ascenso2').click(function() { $('.esc_asociado')[this.checked ? "show" : "hide"](); }); @@ -74,8 +96,7 @@ }); - $('#user_escala').change(function(){ - alert($('#user_escala').val()) + $('#user_escala').change(function(){ if ($('#user_escala').val() >= 1) $('#user_oposicion').attr('disabled',true); else $('#user_oposicion').attr('disabled',false); }); diff --git a/app/config/security.yml b/app/config/security.yml index a170540..c28dc45 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -37,5 +37,5 @@ security: - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, roles: ROLE_DOCENTE } - { path: ^/ceapp, roles: ROLE_DOCENTE } - - { path: ^/admin, roles: ROLE_ADMINISTRADOR } + - { path: ^/admin, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/src/AppBundle/Controller/AppController.php b/src/AppBundle/Controller/AppController.php index aa866ed..75c835c 100644 --- a/src/AppBundle/Controller/AppController.php +++ b/src/AppBundle/Controller/AppController.php @@ -140,6 +140,7 @@ class AppController extends Controller { $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()); @@ -151,7 +152,24 @@ class AppController extends Controller { $em->persist($user); $em->flush(); - $this->addFlash('notice', 'Solicitud Actualizada Correctamente'); + $message = \Swift_Message::newInstance() + ->setSubject('Resultado Adscripcion CEA@UBV') + ->setFrom('wilmer.ramones@gmail.com') + ->setTo($user->getEmail()) + ->setBody( + $this->renderView( + 'correos/actualizar_adscripcion.html.twig', + array( + 'nombres' => $user->getUsername(), + 'estatus' => $adscripciones->getIdEstatus() + ) + ), + 'text/html' + ) + ; + $this->get('mailer')->send($message); + + $this->addFlash('notice', 'Solicitud Actualizada Correctamente, hemos enviado un correo al docente notificandole los cambios.'); $escala = $this->getDoctrine()->getRepository('AppBundle:DocenteEscala')->findBy(array( 'idRolInstitucion' => $adscripciones->getIdRolInstitucion()->getId() diff --git a/src/AppBundle/Controller/PortalController.php b/src/AppBundle/Controller/PortalController.php index 0badd77..c7091eb 100644 --- a/src/AppBundle/Controller/PortalController.php +++ b/src/AppBundle/Controller/PortalController.php @@ -51,6 +51,7 @@ class PortalController extends Controller if(!$credenciales){ //si no existe, procede a crear usuario y contraseña. $login = new Usuarios(); $login->setUsername($usuario); + $login->setEmail($form->get('correo')->getData()); $login->setPlainPassword($form->get('cedula')->getData()); $password = $this->get('security.password_encoder') ->encodePassword($login, $login->getPlainPassword()); //encripta la contraseña diff --git a/src/AppBundle/Entity/Usuarios.php b/src/AppBundle/Entity/Usuarios.php index 511ed19..656830a 100644 --- a/src/AppBundle/Entity/Usuarios.php +++ b/src/AppBundle/Entity/Usuarios.php @@ -30,6 +30,14 @@ class Usuarios implements UserInterface, \Serializable * @ORM\Column(name="username", type="string", length=255, nullable=false, options={"comment" = "nombre de usuariro"}) */ protected $username; + + /** + * @ORM\Column(type="string") + * @Assert\NotBlank() + * @Assert\Email + * @var string + */ + protected $email; /** * @var string @@ -112,6 +120,32 @@ class Usuarios implements UserInterface, \Serializable { return $this->username; } + + + + /** + * Set username + * + * @param string $email + * @return Usuarios + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + /** * Set password diff --git a/src/AppBundle/Form/UserType.php b/src/AppBundle/Form/UserType.php index 750ebc8..76c4a86 100644 --- a/src/AppBundle/Form/UserType.php +++ b/src/AppBundle/Form/UserType.php @@ -30,21 +30,43 @@ class UserType extends AbstractType { $builder ->add('fecha_ingreso', BirthdayType::class, array( + 'widget' => 'choice', 'label' => 'Fecha de Ingreso UBV', - 'data' => new \DateTime("01/01/2003") + 'data' => new \DateTime("01/01/2003"), + 'years' => range(2003, date("Y")) )) ->add('trabajo', FileType::class, array( 'label' => 'Digital Constancia Trabajo', 'constraints' => array( new NotBlank(), - new File(array('maxSize' => '1024K')) + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) ->add('pregrado', FileType::class, array( 'label' => 'Digital Título de Pregrado', 'constraints' => array( new NotBlank(), - new File(array('maxSize' => '1024K')) + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) @@ -52,7 +74,17 @@ class UserType extends AbstractType 'label' => 'Digital Título de Postgrado', 'required' => false, 'constraints' => array( - new File(array('maxSize' => '1024K')) + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) ->add('oposicion', CheckboxType::class, array( @@ -75,7 +107,8 @@ class UserType extends AbstractType 'required' => false, 'attr' => array( 'class' => 'esc_oposicion' - ) + ), + 'years' => range(2003, date("Y")) )) ->add('documento_oposicion', FileType::class, array( 'label' => 'Digital Documento Oposición', @@ -84,6 +117,19 @@ class UserType extends AbstractType 'attr' => array( 'style' => 'display:none;', 'class' => 'esc_oposicion' + ), + 'constraints' => array( + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) @@ -125,7 +171,8 @@ class UserType extends AbstractType 'label_attr' => array( 'class' => 'esc_asistente'), 'attr' => array( 'class' => 'esc_asistente' - ) + ), + 'years' => range(2003, date("Y")) )) ->add('documento_asistente', FileType::class, array( @@ -135,6 +182,19 @@ class UserType extends AbstractType 'attr' => array( 'style' => 'display:none;', 'class' => 'esc_asistente' + ), + 'constraints' => array( + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) @@ -156,7 +216,8 @@ class UserType extends AbstractType 'required' => false, 'attr' => array( 'class' => 'esc_asociado' - ) + ), + 'years' => range(2003, date("Y")) )) ->add('documento_asociado', FileType::class, array( @@ -166,6 +227,19 @@ class UserType extends AbstractType 'attr' => array( 'style' => 'display:none;', 'class' => 'esc_asociado' + ), + 'constraints' => array( + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) @@ -185,7 +259,8 @@ class UserType extends AbstractType 'required' => false, 'attr' => array( 'class' => 'esc_agregado' - ) + ), + 'years' => range(2003, date("Y")) )) ->add('documento_agregado', FileType::class, array( @@ -195,6 +270,19 @@ class UserType extends AbstractType 'attr' => array( 'style' => 'display:none;', 'class' => 'esc_agregado' + ), + 'constraints' => array( + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) )) @@ -215,7 +303,8 @@ class UserType extends AbstractType 'required' => false, 'attr' => array( 'class' => 'esc_titular' - ) + ), + 'years' => range(2003, date("Y")) )) ->add('documento_titular', FileType::class, array( @@ -225,6 +314,19 @@ class UserType extends AbstractType 'attr' => array( 'style' => 'display:none;', 'class' => 'esc_titular' + ), + 'constraints' => array( + new File(array( + 'maxSize' => '1024K', + 'mimeTypes' => [ + 'application/pdf', + 'application/x-pdf', + 'image/png', + 'image/jpg', + 'image/jpeg' + ], + 'mimeTypesMessage' => 'Sólo se permiten extensiones png, jpeg y pdf' + )) ) ))