From c41fbb45eacbf7062776688f8f3dafca3fd62e5d Mon Sep 17 00:00:00 2001 From: Wilmer Ramones Date: Tue, 5 Jul 2016 18:23:02 -0400 Subject: [PATCH] Trabajando en la adscripcion con symfony casi terminada --- .../views/registration/register.html.twig | 18 +- .../views/registration/register.html.twig~ | 44 ++++ app/config/parameters.yml~ | 13 + app/config/security.yml | 3 +- app/config/security.yml~ | 39 +++ app/sessions/sess_3d9kmj192tt5lorj0urd93edj4 | 1 - app/sessions/sess_3sotc5qph321r5hcomt4aehth3 | 1 - app/sessions/sess_b7cg3j7u2h7vmm5hs6fpq885p6 | 1 + src/AppBundle/Controller/DefaultController.php | 2 +- src/AppBundle/Controller/DefaultController.php~ | 137 +++++++++++ .../Controller/RegistrationController.php | 67 ++++- .../Controller/RegistrationController.php~ | 92 +++++++ src/AppBundle/Entity/Adscripcion.php | 198 +++++++++++++++ src/AppBundle/Entity/Adscripcion.php~ | 249 +++++++++++++++++++ src/AppBundle/Entity/CrearAdscripcion.php~ | 89 +++++++ src/AppBundle/Entity/DocenteEscala.php | 163 ++++++++++++ src/AppBundle/Entity/DocenteEscala.php~ | 185 ++++++++++++++ src/AppBundle/Entity/Escalafones.php | 6 +- src/AppBundle/Entity/Escalafones.php~ | 134 ++++++++++ src/AppBundle/Entity/Usuarios.php | 4 +- src/AppBundle/Entity/Usuarios.php~ | 274 +++++++++++++++++++++ src/AppBundle/Form/UserType.php | 101 ++++++-- src/AppBundle/Form/UserType.php~ | 154 ++++++++++++ web/config.php | 2 +- .../0f73622d80d47d2b14626adb569b6ce4.pdf | Bin 0 -> 9549 bytes .../272c38f8ae45950d92c0124ba5fad4ba.pdf | Bin 0 -> 9549 bytes .../48ea9e6b16711dc1d828ef68c677fd3f.pdf | Bin 0 -> 9549 bytes .../6136ca9e761a3599b2a77ebee65c8b2a.pdf | Bin 0 -> 9549 bytes .../8c950955bd236e465e905833e69599f5.pdf | Bin 0 -> 9549 bytes .../e368295d84924b1576f0003a2412f65b.pdf | Bin 0 -> 9549 bytes 30 files changed, 1942 insertions(+), 35 deletions(-) create mode 100644 app/Resources/views/registration/register.html.twig~ create mode 100644 app/config/parameters.yml~ create mode 100644 app/config/security.yml~ delete mode 100644 app/sessions/sess_3d9kmj192tt5lorj0urd93edj4 delete mode 100644 app/sessions/sess_3sotc5qph321r5hcomt4aehth3 create mode 100644 app/sessions/sess_b7cg3j7u2h7vmm5hs6fpq885p6 create mode 100644 src/AppBundle/Controller/DefaultController.php~ create mode 100644 src/AppBundle/Controller/RegistrationController.php~ create mode 100644 src/AppBundle/Entity/Adscripcion.php create mode 100644 src/AppBundle/Entity/Adscripcion.php~ create mode 100644 src/AppBundle/Entity/CrearAdscripcion.php~ create mode 100644 src/AppBundle/Entity/DocenteEscala.php create mode 100644 src/AppBundle/Entity/DocenteEscala.php~ create mode 100644 src/AppBundle/Entity/Escalafones.php~ create mode 100644 src/AppBundle/Entity/Usuarios.php~ create mode 100644 src/AppBundle/Form/UserType.php~ create mode 100644 web/uploads/adscripcion/0f73622d80d47d2b14626adb569b6ce4.pdf create mode 100644 web/uploads/adscripcion/272c38f8ae45950d92c0124ba5fad4ba.pdf create mode 100644 web/uploads/adscripcion/48ea9e6b16711dc1d828ef68c677fd3f.pdf create mode 100644 web/uploads/adscripcion/6136ca9e761a3599b2a77ebee65c8b2a.pdf create mode 100644 web/uploads/adscripcion/8c950955bd236e465e905833e69599f5.pdf create mode 100644 web/uploads/adscripcion/e368295d84924b1576f0003a2412f65b.pdf diff --git a/app/Resources/views/registration/register.html.twig b/app/Resources/views/registration/register.html.twig index 558261d..4381f39 100644 --- a/app/Resources/views/registration/register.html.twig +++ b/app/Resources/views/registration/register.html.twig @@ -11,7 +11,7 @@ {% block stylesheets %} {{ parent() }} @@ -26,7 +26,19 @@ }); $('#user_ascenso').click(function() { - $('.esc_ascenso')[this.checked ? "show" : "hide"](); + //alert($("#user_escalafones").val()); + if($("#user_escalafones").val() == 1) + $('.esc_asistente')[this.checked ? "show" : "hide"](); + if($("#user_escalafones").val() == 2) + $('.esc_agregado')[this.checked ? "show" : "hide"](); }); + + + $('#user_ascenso2').click(function() { + + if($("#user_escalafones").val() == 1) + $('.esc_agregado')[this.checked ? "show" : "hide"](); + }); + -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Resources/views/registration/register.html.twig~ b/app/Resources/views/registration/register.html.twig~ new file mode 100644 index 0000000..2da806d --- /dev/null +++ b/app/Resources/views/registration/register.html.twig~ @@ -0,0 +1,44 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {% form_theme form 'bootstrap_3_horizontal_layout.html.twig' %} + {{ form_start(form) }} + {{ form_widget(form) }} + + +{% endblock %} + +{% block stylesheets %} + {{ parent() }} + +{% endblock %} + + +{% block javascripts %} + {{ parent() }} + +{% endblock %} diff --git a/app/config/parameters.yml~ b/app/config/parameters.yml~ new file mode 100644 index 0000000..524562b --- /dev/null +++ b/app/config/parameters.yml~ @@ -0,0 +1,13 @@ +# This file is auto-generated during the composer install +parameters: + adscripcion_directory: '%kernel.root_dir%/../web/uploads/solicitudes' + database_host: 127.0.0.1 + database_port: null + database_name: cea_db_sym + database_user: wilmer + database_password: 17135525 + mailer_transport: gmail + mailer_host: smtp.gmail.com + mailer_user: wilmer.ramones@gmail.com + mailer_password: 07102009RR + secret: as47d657ew8r74654j8974k51sd4fg65a4s984 diff --git a/app/config/security.yml b/app/config/security.yml index 4111066..5c75cc2 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -35,5 +35,6 @@ security: # http://symfony.com/doc/current/cookbook/security/form_login_setup.html access_control: - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/register, roles: ROLE_DOCENTE } - { path: ^/admin, roles: ROLE_ADMINISTRADOR } - - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } \ No newline at end of file + - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/app/config/security.yml~ b/app/config/security.yml~ new file mode 100644 index 0000000..792d5ab --- /dev/null +++ b/app/config/security.yml~ @@ -0,0 +1,39 @@ +# To get started with security, check out the documentation: +# http://symfony.com/doc/current/book/security.html +security: + encoders: + AppBundle\Entity\Usuarios: + algorithm: bcrypt + + # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers + providers: + our_db_provider: + entity: + class: AppBundle:Usuarios + property: username + + firewalls: + main: + anonymous: ~ + http_basic: ~ + provider: our_db_provider + form_login: + login_path: /login + check_path: /login + csrf_token_generator: security.csrf.token_manager + logout: + path: /logout + target: / + + + # activate different ways to authenticate + + # http_basic: ~ + # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate + + # form_login: ~ + # http://symfony.com/doc/current/cookbook/security/form_login_setup.html + access_control: + - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/admin, roles: ROLE_ADMINISTRADOR } + - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/app/sessions/sess_3d9kmj192tt5lorj0urd93edj4 b/app/sessions/sess_3d9kmj192tt5lorj0urd93edj4 deleted file mode 100644 index edab6cf..0000000 --- a/app/sessions/sess_3d9kmj192tt5lorj0urd93edj4 +++ /dev/null @@ -1 +0,0 @@ -_sf2_attributes|a:4:{s:15:"_csrf/solicitar";s:43:"MP2A8aTFnMygUhUGTe5l1wmfZ3jaYTwCrmRhKBJZBWo";s:18:"_csrf/authenticate";s:43:"T1PXJXEK9uLQJgSe1MNFRtWiARHKnAX2lXlGrzIRHmk";s:14:"_security_main";s:387:"C:74:"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":299:{a:3:{i:0;N;i:1;s:4:"main";i:2;s:259:"a:4:{i:0;C:25:"AppBundle\Entity\Usuarios":106:{a:3:{i:0;i:11;i:1;s:8:"wramones";i:2;s:60:"$2y$13$UN60aw0H6QLaO5k.ghyvIOrQjW1UPt210b6ReDJUgQGZ7VK9SwoeK";}}i:1;b:1;i:2;a:1:{i:0;C:21:"AppBundle\Entity\Role":38:{a:2:{i:0;i:3;i:1;s:12:"ROLE_DOCENTE";}}}i:3;a:0:{}}";}}";s:10:"_csrf/user";s:43:"GU0sZN1sPT352oXxrvAd9f_EWBvNjGTgnfdsCYis1Aw";}_sf2_flashes|a:0:{}_sf2_meta|a:3:{s:1:"u";i:1467397203;s:1:"c";i:1467393544;s:1:"l";s:1:"0";} \ No newline at end of file diff --git a/app/sessions/sess_3sotc5qph321r5hcomt4aehth3 b/app/sessions/sess_3sotc5qph321r5hcomt4aehth3 deleted file mode 100644 index 35c4588..0000000 --- a/app/sessions/sess_3sotc5qph321r5hcomt4aehth3 +++ /dev/null @@ -1 +0,0 @@ -_sf2_attributes|a:4:{s:15:"_csrf/solicitar";s:43:"XZ1SchlUnun6-CVChkyqxC-lGZP1gElUH9bvN6zmGoY";s:18:"_csrf/authenticate";s:43:"0SYNksltRL1m0aa23y1X6Vya4sspIT8knwKjFZ2TnMA";s:14:"_security_main";s:387:"C:74:"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":299:{a:3:{i:0;N;i:1;s:4:"main";i:2;s:259:"a:4:{i:0;C:25:"AppBundle\Entity\Usuarios":106:{a:3:{i:0;i:11;i:1;s:8:"wramones";i:2;s:60:"$2y$13$UN60aw0H6QLaO5k.ghyvIOrQjW1UPt210b6ReDJUgQGZ7VK9SwoeK";}}i:1;b:1;i:2;a:1:{i:0;C:21:"AppBundle\Entity\Role":38:{a:2:{i:0;i:3;i:1;s:12:"ROLE_DOCENTE";}}}i:3;a:0:{}}";}}";s:10:"_csrf/user";s:43:"k4cJ2inc0yIn3qdkSv9caczRonO1lYkX19RyY1gcAUY";}_sf2_flashes|a:0:{}_sf2_meta|a:3:{s:1:"u";i:1467646430;s:1:"c";i:1467637261;s:1:"l";s:1:"0";} \ No newline at end of file diff --git a/app/sessions/sess_b7cg3j7u2h7vmm5hs6fpq885p6 b/app/sessions/sess_b7cg3j7u2h7vmm5hs6fpq885p6 new file mode 100644 index 0000000..93fb7ca --- /dev/null +++ b/app/sessions/sess_b7cg3j7u2h7vmm5hs6fpq885p6 @@ -0,0 +1 @@ +_sf2_attributes|a:4:{s:26:"_security.main.target_path";s:30:"http://localhost:8000/register";s:18:"_csrf/authenticate";s:43:"UQ6zMyyvroC7RDUqoinJjUIuMqhAIEW0UnGThan_ACc";s:14:"_security_main";s:386:"C:74:"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":298:{a:3:{i:0;N;i:1;s:4:"main";i:2;s:258:"a:4:{i:0;C:25:"AppBundle\Entity\Usuarios":105:{a:3:{i:0;i:1;i:1;s:8:"wramones";i:2;s:60:"$2y$13$BdGlK17e5E0JKPeYjc6khOC0YcR.5M5G9VpzAe1/zx8nOZExCwpqu";}}i:1;b:1;i:2;a:1:{i:0;C:21:"AppBundle\Entity\Role":38:{a:2:{i:0;i:1;i:1;s:12:"ROLE_DOCENTE";}}}i:3;a:0:{}}";}}";s:10:"_csrf/user";s:43:"Bhz7lOqWcj-kkbA4sEIFGGCd88lwqn2cyW7Nz2gjqmM";}_sf2_flashes|a:0:{}_sf2_meta|a:3:{s:1:"u";i:1467757191;s:1:"c";i:1467713451;s:1:"l";s:1:"0";} \ No newline at end of file diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php index 5d797a2..2772d97 100644 --- a/src/AppBundle/Controller/DefaultController.php +++ b/src/AppBundle/Controller/DefaultController.php @@ -47,7 +47,7 @@ class DefaultController extends Controller ->encodePassword($login, $login->getPlainPassword()); //encripta la contraseña $login->setPassword($password); $login->setIdRolInstitucion($rol); - $permiso = $this->getDoctrine()->getRepository('AppBundle:Role')->findOneById(3); + $permiso = $this->getDoctrine()->getRepository('AppBundle:Role')->findOneById(1); $login->addRol($permiso); //le añade la permisología básica de docente $em = $this->getDoctrine()->getManager(); $em->persist($login); diff --git a/src/AppBundle/Controller/DefaultController.php~ b/src/AppBundle/Controller/DefaultController.php~ new file mode 100644 index 0000000..5d797a2 --- /dev/null +++ b/src/AppBundle/Controller/DefaultController.php~ @@ -0,0 +1,137 @@ +createForm('AppBundle\Form\SolicitarType'); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + + //1. obtener el rol-institucion-persona + $rol = $this->getDoctrine()->getRepository( + 'AppBundle:RolInstitucion')->findOneByIdRol( + $this->getDoctrine()->getRepository( + 'AppBundle:Rol')->findOneByIdPersona( + $this->getDoctrine()->getRepository('AppBundle:Persona') + ->findOneByCedulaPasaporte($form->get('cedula')->getData())->getId())); + + //si no existe el rol del docente, enviar correo al encargado de la región para verificar. + if (!$rol) { + throw $this->createNotFoundException( + 'No product found for id '. $form->get('cedula')->getData() + ); + } + + //si el docente existe, crea el nombre de usuario. + $usuario = mb_strtolower($rol->getIdRol()->getIdPersona()->getPrimerNombre()[0] .$rol->getIdRol()->getIdPersona()->getPrimerApellido()); + //busca en la base de datos para ver si ese nombre de usuario ya existe + $credenciales = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByUsername($usuario); + if(!$credenciales){ //si no existe, procede a crear usuario y contraseña. + $login = new Usuarios(); + $login->setUsername($usuario); + $login->setPlainPassword($form->get('cedula')->getData()); + $password = $this->get('security.password_encoder') + ->encodePassword($login, $login->getPlainPassword()); //encripta la contraseña + $login->setPassword($password); + $login->setIdRolInstitucion($rol); + $permiso = $this->getDoctrine()->getRepository('AppBundle:Role')->findOneById(3); + $login->addRol($permiso); //le añade la permisología básica de docente + $em = $this->getDoctrine()->getManager(); + $em->persist($login); + $em->flush(); //guarda en la base de datos + + + $message = \Swift_Message::newInstance() + ->setSubject('Bienvenido al sistema CEA@UBV') + ->setFrom('wilmer.ramones@gmail.com') + ->setTo($form->get('correo')->getData()) + ->setBody( + $this->renderView( + 'correos/solicitud_adscripcion.html.twig', + array( + 'nombres' => $form->get('nombres')->getData(), + 'apellidos' => $form->get('apellidos')->getData(), + 'usuario' => $login->getUsername(), + 'contra' => $login->getPlainPassword(), + + ) + ), + 'text/html' + ) + /* + * If you also want to include a plaintext version of the message + ->addPart( + $this->renderView( + 'Emails/registration.txt.twig', + array('name' => $name) + ), + 'text/plain' + ) + */ + ; + $this->get('mailer')->send($message); + + + + }else{ + throw $this->createNotFoundException( + 'Ya tiene usuario y contraseña '. $form->get('cedula')->getData() + ); + } + throw $this->createNotFoundException( + 'Docente Encontrado '. $form->get('cedula')->getData() + ); + + + + $message = \Swift_Message::newInstance() + ->setSubject('Hello Email') + ->setFrom('send@example.com') + ->setTo('wilmer.ramones@gmail.com') + ->setBody( + $this->renderView( + 'correos/solicitud_adscripcion.html.twig', + array( + 'nombres' => $form->get('nombres')->getData(), + 'apellidos' => $form->get('apellidos')->getData(), + + ) + ), + 'text/html' + ) + /* + * If you also want to include a plaintext version of the message + ->addPart( + $this->renderView( + 'Emails/registration.txt.twig', + array('name' => $name) + ), + 'text/plain' + ) + */ + ; + //$this->get('mailer')->send($message); + + //$request->getSession()->getFlashBag()->add('success', 'Your email has been sent! Thanks!'); + } + + // replace this example code with whatever you need + return $this->render('default/index.html.twig', array( + 'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'), + 'form' => $form->createView(), + )); + } +} diff --git a/src/AppBundle/Controller/RegistrationController.php b/src/AppBundle/Controller/RegistrationController.php index ca11125..c9b4a96 100644 --- a/src/AppBundle/Controller/RegistrationController.php +++ b/src/AppBundle/Controller/RegistrationController.php @@ -13,6 +13,8 @@ use AppBundle\Entity\Usuarios; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; +use AppBundle\Entity\Adscripcion; +use AppBundle\Entity\DocenteEscala; class RegistrationController extends Controller { @@ -21,15 +23,66 @@ class RegistrationController extends Controller */ public function registerAction(Request $request) { - // 1) build the form - + + $adscripcion = new Adscripcion(); + $escala = new DocenteEscala(); $form = $this->createForm('AppBundle\Form\UserType'); - - // 2) handle the submit (will only happen on POST) - $form->handleRequest($request); - //var_dump($form->isValid()); + $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { + //var_dump($user = $this->getUser()->getIdRolInstitucion()->getId()); exit; + // $file stores the uploaded PDF file + /** @var Symfony\Component\HttpFoundation\File\UploadedFile $file */ + $constanciaTrabajo = $form->get('trabajo')->getData(); + $constanciaPregrado = $form->get('pregrado')->getData(); + + + + // Generate a unique name for the file before saving it + $nombreTrabajo = md5(uniqid()).'.'.$constanciaTrabajo->guessExtension(); + $nombrePregrado = md5(uniqid()).'.'.$constanciaPregrado->guessExtension(); + + // Move the file to the directory where brochures are stored + $constanciaTrabajo->move( + $this->container->getParameter('adscripcion_directory'), + $nombreTrabajo + ); + + $constanciaPregrado->move( + $this->container->getParameter('adscripcion_directory'), + $nombrePregrado + ); + + if($form->get('postgrado')->getData()) { + $constanciaPostgrado = $form->get('postgrado')->getData(); + $nombrePostgrado = md5(uniqid()).'.'.$constanciaPregrado->guessExtension(); + $constanciaPostgrado->move( + $this->container->getParameter('adscripcion_directory'), + $nombrePostgrado + ); + } + + // Update the 'brochure' property to store the PDF file name + // instead of its contents + $adscripcion->setTrabajo($nombreTrabajo); + $adscripcion->setPregrado($nombrePregrado); + $adscripcion->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); + $escala->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); + $escala->setFechaEscala($form->get('fecha_oposicion')->getData()); + $escala->setIdEscala($form->get('escala')->getData()); + + + + $em = $this->getDoctrine()->getManager(); + $em->persist($adscripcion); + $em->persist($escala); + + $em->flush(); //guarda en la base de datos + + + + //return $this->redirect($this->generateUrl('app_product_list')); } return $this->render( @@ -37,4 +90,4 @@ class RegistrationController extends Controller array('form' => $form->createView()) ); } -} \ No newline at end of file +} diff --git a/src/AppBundle/Controller/RegistrationController.php~ b/src/AppBundle/Controller/RegistrationController.php~ new file mode 100644 index 0000000..746f003 --- /dev/null +++ b/src/AppBundle/Controller/RegistrationController.php~ @@ -0,0 +1,92 @@ +createForm('AppBundle\Form\UserType'); + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + //var_dump($user = $this->getUser()->getIdRolInstitucion()->getId()); exit; + // $file stores the uploaded PDF file + /** @var Symfony\Component\HttpFoundation\File\UploadedFile $file */ + $constanciaTrabajo = $form->get('trabajo')->getData(); + $constanciaPregrado = $form->get('pregrado')->getData(); + + + + // Generate a unique name for the file before saving it + $nombreTrabajo = md5(uniqid()).'.'.$constanciaTrabajo->guessExtension(); + $nombrePregrado = md5(uniqid()).'.'.$constanciaPregrado->guessExtension(); + + // Move the file to the directory where brochures are stored + $constanciaTrabajo->move( + $this->container->getParameter('adscripcion_directory'), + $nombreTrabajo + ); + + $constanciaPregrado->move( + $this->container->getParameter('adscripcion_directory'), + $nombrePregrado + ); + + if($form->get('postgrado')->getData()) { + $constanciaPostgrado = $form->get('postgrado')->getData(); + $nombrePostgrado = md5(uniqid()).'.'.$constanciaPregrado->guessExtension(); + $constanciaPostgrado->move( + $this->container->getParameter('adscripcion_directory'), + $nombrePostgrado + ); + } + + // Update the 'brochure' property to store the PDF file name + // instead of its contents + $adscripcion->setTrabajo($nombreTrabajo); + $adscripcion->setPregrado($nombrePregrado); + $adscripcion->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); + $escala->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); + $escala->setFechaEscala($form->get('fecha_oposicion')->getData()); + + + + $em = $this->getDoctrine()->getManager(); + $em->persist($adscripcion); + $em->persist($escala); + + $em->flush(); //guarda en la base de datos + + + + + //return $this->redirect($this->generateUrl('app_product_list')); + } + + return $this->render( + 'registration/register.html.twig', + array('form' => $form->createView()) + ); + } +} diff --git a/src/AppBundle/Entity/Adscripcion.php b/src/AppBundle/Entity/Adscripcion.php new file mode 100644 index 0000000..3496525 --- /dev/null +++ b/src/AppBundle/Entity/Adscripcion.php @@ -0,0 +1,198 @@ +trabajo; + } + + public function setTrabajo($trabajo) + { + $this->trabajo = $trabajo; + + return $this; + } + + public function getPregrado() + { + return $this->pregrado; + } + + public function setPregrado($pregrado) + { + $this->pregrado = $pregrado; + + return $this; + } + + public function getPostgrado() + { + return $this->postgrado; + } + + public function setPostgrado($postgrado) + { + $this->postgrado = $postgrado; + + return $this; + } + + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Get nombre + * + * @return string + */ + public function __toString() + { + return $this->trabajo; + } + + /** + * Set idRolInstitucion + * + * @param \AppBundle\Entity\RolInstitucion $idRolInstitucion + * @return Usuarios + */ + public function setIdRolInstitucion(\AppBundle\Entity\RolInstitucion $idRolInstitucion = null) + { + $this->idRolInstitucion = $idRolInstitucion; + + return $this; + } + + /** + * Get idRolInstitucion + * + * @return \AppBundle\Entity\RolInstitucion + */ + public function getIdRolInstitucion() + { + return $this->idRolInstitucion; + } + + /** + * @ORM\PrePersist + */ + public function setFechaCreacion() + { + $this->fecha_creacion = new \DateTime(); + $this->fecha_ultima_actualizacion = new \DateTime(); + } + + /** + * @ORM\PreUpdate + */ + public function setFechaUltimaActualizacion() + { + $this->fecha_utlima_actualizacion = new \DateTime(); + } + + + + + + + + +} diff --git a/src/AppBundle/Entity/Adscripcion.php~ b/src/AppBundle/Entity/Adscripcion.php~ new file mode 100644 index 0000000..defbe34 --- /dev/null +++ b/src/AppBundle/Entity/Adscripcion.php~ @@ -0,0 +1,249 @@ +escala = new ArrayCollection(); + } + + + + + + + public function getTrabajo() + { + return $this->trabajo; + } + + public function setTrabajo($trabajo) + { + $this->trabajo = $trabajo; + + return $this; + } + + public function getPregrado() + { + return $this->pregrado; + } + + public function setPregrado($pregrado) + { + $this->pregrado = $pregrado; + + return $this; + } + + public function getPostgrado() + { + return $this->postgrado; + } + + public function setPostgrado($postgrado) + { + $this->postgrado = $postgrado; + + return $this; + } + + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Get nombre + * + * @return string + */ + public function __toString() + { + return $this->trabajo; + } + + /** + * Set idRolInstitucion + * + * @param \AppBundle\Entity\RolInstitucion $idRolInstitucion + * @return Usuarios + */ + public function setIdRolInstitucion(\AppBundle\Entity\RolInstitucion $idRolInstitucion = null) + { + $this->idRolInstitucion = $idRolInstitucion; + + return $this; + } + + /** + * Get idRolInstitucion + * + * @return \AppBundle\Entity\RolInstitucion + */ + public function getIdRolInstitucion() + { + return $this->idRolInstitucion; + } + + /** + * @ORM\PrePersist + */ + public function setFechaCreacion() + { + $this->fecha_creacion = new \DateTime(); + $this->fecha_ultima_actualizacion = new \DateTime(); + } + + /** + * @ORM\PreUpdate + */ + public function setFechaUltimaActualizacion() + { + $this->fecha_utlima_actualizacion = new \DateTime(); + } + + + + /** + * Add escala + * + * @param \AppBundle\Entity\DocenteEscala $escala + * @return DocenteEscala + */ + public function addEscala(\AppBundle\Entity\DocenteEscala $escala) + { + $this->escala[] = $escala; + + return $this; + } + + /** + * Remove escala + * + * @param \AppBundle\Entity\DocenteEscala $escala + */ + public function removeEscala(\AppBundle\Entity\DocenteEscala $escala) + { + $this->escala->removeElement($escala); + } + + /** + * Get Escala + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getEscala() + { + return $this->escala; + } + + + public function getEscalafones() + { + return $this->escala->toArray(); /*IMPORTANTE: el mecanismo de seguridad de Sf2 requiere ésto como un array*/ + } + + + + + +} diff --git a/src/AppBundle/Entity/CrearAdscripcion.php~ b/src/AppBundle/Entity/CrearAdscripcion.php~ new file mode 100644 index 0000000..759c854 --- /dev/null +++ b/src/AppBundle/Entity/CrearAdscripcion.php~ @@ -0,0 +1,89 @@ +trabajo; + } + + public function setBrochure($trabajo) + { + $this->trabajo = $trabajo; + + return $this; + } + + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Get nombre + * + * @return string + */ + public function __toString() + { + return $this->trabajo; + } + + +} diff --git a/src/AppBundle/Entity/DocenteEscala.php b/src/AppBundle/Entity/DocenteEscala.php new file mode 100644 index 0000000..46430b7 --- /dev/null +++ b/src/AppBundle/Entity/DocenteEscala.php @@ -0,0 +1,163 @@ +idEscala = $idEscala; + + return $this; + } + + /** + * Get idEscala + * + * @return \AppBundle\Entity\Escalafones + */ + public function getidEscala() + { + return $this->idEscala; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + + /** + * @ORM\PrePersist + */ + public function setFechaCreacion() + { + $this->fecha_creacion = new \DateTime(); + } + + /** + * Set fecha_escala + * + * @param \DateTime $fecha_escala + * @return Comment + */ +public function setFechaEscala($fecha_escala) +{ + $this->fecha_escala = $fecha_escala; + + return $this; +} + +/** + * Get fecha_escala + * + * @return \DateTime + */ +public function getFechaEscala() +{ + return $this->postedon; +} + + /** + * Set idRolInstitucion + * + * @param \AppBundle\Entity\RolInstitucion $idRolInstitucion + * @return Usuarios + */ + public function setIdRolInstitucion(\AppBundle\Entity\RolInstitucion $idRolInstitucion = null) + { + $this->idRolInstitucion = $idRolInstitucion; + + return $this; + } + + /** + * Get idRolInstitucion + * + * @return \AppBundle\Entity\RolInstitucion + */ + public function getIdRolInstitucion() + { + return $this->idRolInstitucion; + } + + + + + + + +} diff --git a/src/AppBundle/Entity/DocenteEscala.php~ b/src/AppBundle/Entity/DocenteEscala.php~ new file mode 100644 index 0000000..09f7ea7 --- /dev/null +++ b/src/AppBundle/Entity/DocenteEscala.php~ @@ -0,0 +1,185 @@ +idEscala = $idEscala; + + return $this; + } + + /** + * Get idEscala + * + * @return \AppBundle\Entity\Escalafones + */ + public function getidEscala() + { + return $this->idEscala; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + + /** + * @ORM\PrePersist + */ + public function setFechaCreacion() + { + $this->fecha_creacion = new \DateTime(); + } + + /** + * Set fecha_escala + * + * @param \DateTime $fecha_escala + * @return Comment + */ +public function setFechaEscala($fecha_escala) +{ + $this->fecha_escala = $fecha_escala; + + return $this; +} + +/** + * Get fecha_escala + * + * @return \DateTime + */ +public function getFechaEscala() +{ + return $this->postedon; +} + + /** + * Set idRolInstitucion + * + * @param \AppBundle\Entity\RolInstitucion $idRolInstitucion + * @return Usuarios + */ + public function setIdRolInstitucion(\AppBundle\Entity\RolInstitucion $idRolInstitucion = null) + { + $this->idRolInstitucion = $idRolInstitucion; + + return $this; + } + + /** + * Get idRolInstitucion + * + * @return \AppBundle\Entity\RolInstitucion + */ + public function getIdRolInstitucion() + { + return $this->idRolInstitucion; + } + + + + /** + * Set idEscala + * + * @param \AppBundle\Entity\Escalafones $idEscala + * @return Usuarios + */ + public function setIdEscala(\AppBundle\Entity\Escalafones $idEscala = null) + { + $this->idEscala = $idEscala; + + return $this; + } + + /** + * Get idEscala + * + * @return \AppBundle\Entity\Escalafones + */ + public function getidEscala() + { + return $this->idEscala; + } + + + + +} diff --git a/src/AppBundle/Entity/Escalafones.php b/src/AppBundle/Entity/Escalafones.php index 6e0352b..b00ba34 100644 --- a/src/AppBundle/Entity/Escalafones.php +++ b/src/AppBundle/Entity/Escalafones.php @@ -34,7 +34,9 @@ class Escalafones * @ORM\SequenceGenerator(sequenceName="escalafon_id_seq", allocationSize=1, initialValue=1) */ private $id; - + + + /** @@ -79,6 +81,8 @@ class Escalafones { return $this->nombre; } + + } diff --git a/src/AppBundle/Entity/Escalafones.php~ b/src/AppBundle/Entity/Escalafones.php~ new file mode 100644 index 0000000..bcaeefd --- /dev/null +++ b/src/AppBundle/Entity/Escalafones.php~ @@ -0,0 +1,134 @@ +docente = new \Doctrine\Common\Collections\ArrayCollection(); + } + + + + /** + * Set nombre + * + * @param string $nombre + * @return Escalafon + */ + public function setNombre($nombre) + { + $this->nombre = $nombre; + + return $this; + } + + /** + * Get nombre + * + * @return string + */ + public function getNombre() + { + return $this->nombre; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Get nombre + * + * @return string + */ + public function __toString() + { + return $this->nombre; + } + + + + /** + * Add docente + * + * @param \AppBundle\Entity\Adscripcion $docente + * @return Adscripcion + */ + public function addDocente(\AppBundle\Entity\Adscripcion $docente) + { + $this->docente[] = $docente; + + return $this; + } + + /** + * Remove docente + * + * @param \AppBundle\Entity\Adscripcion $docente + */ + public function removeDocente(\AppBundle\Entity\Adscripcion $docente) + { + $this->docente->removeElement($docente); + } + + /** + * Get docente + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getDocente() + { + return $this->docente; + } + + + +} diff --git a/src/AppBundle/Entity/Usuarios.php b/src/AppBundle/Entity/Usuarios.php index caee48b..fd2abe5 100644 --- a/src/AppBundle/Entity/Usuarios.php +++ b/src/AppBundle/Entity/Usuarios.php @@ -20,7 +20,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * * @ORM\Table(name="usuarios", uniqueConstraints={@ORM\UniqueConstraint(name="usuarios_id_rol_institucion_key", columns={"id_rol_institucion"})}) * @ORM\Entity(repositoryClass="UsuariosRepository") - * @UniqueEntity(fields="username", message="Username already taken") + * @UniqueEntity(fields="username", message="Nombre de usuario ya Existe") */ class Usuarios implements UserInterface, \Serializable { @@ -271,4 +271,4 @@ class Usuarios implements UserInterface, \Serializable { // TODO: Implement getSalt() method. } -} \ No newline at end of file +} diff --git a/src/AppBundle/Entity/Usuarios.php~ b/src/AppBundle/Entity/Usuarios.php~ new file mode 100644 index 0000000..caee48b --- /dev/null +++ b/src/AppBundle/Entity/Usuarios.php~ @@ -0,0 +1,274 @@ +rol = new \Doctrine\Common\Collections\ArrayCollection(); + } + + + /** + * Set username + * + * @param string $username + * @return Usuarios + */ + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Set password + * + * @param string $password + * @return Usuarios + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Get password + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set idRolInstitucion + * + * @param \AppBundle\Entity\RolInstitucion $idRolInstitucion + * @return Usuarios + */ + public function setIdRolInstitucion(\AppBundle\Entity\RolInstitucion $idRolInstitucion = null) + { + $this->idRolInstitucion = $idRolInstitucion; + + return $this; + } + + /** + * Get idRolInstitucion + * + * @return \AppBundle\Entity\RolInstitucion + */ + public function getIdRolInstitucion() + { + return $this->idRolInstitucion; + } + + /** + * Add rol + * + * @param \AppBundle\Entity\Role $rol + * @return Role + */ + public function addRol(\AppBundle\Entity\Role $rol) + { + $this->rol[] = $rol; + + return $this; + } + + /** + * Remove rol + * + * @param \AppBundle\Entity\Role $rol + */ + public function removeRol(\AppBundle\Entity\Role $rol) + { + $this->rol->removeElement($rol); + } + + /** + * Get rol + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getRol() + { + return $this->rol; + } + + + public function getRoles() + { + return $this->rol->toArray(); /*IMPORTANTE: el mecanismo de seguridad de Sf2 requiere ésto como un array*/ + } + + public function equals(UserInterface $user) { + return md5($this->getUsername()) == md5($user->getUsername()); + + } + + /** + * Erases the user credentials. + */ + public function eraseCredentials() { + + } + + public function serialize() + { + /* + * ! Don't serialize $roles field ! + */ + return \serialize(array( + $this->id, + $this->username, + $this->password, + )); + } + + /** + * @see \Serializable::unserialize() + */ + public function unserialize($serialized) + { + list ( + $this->id, + $this->username, + $this->password, + ) = \unserialize($serialized); + } + + public function __toString() { + return $this->getuserName(); + } + + public function getPlainPassword() + { + return $this->plainPassword; + } + + public function setPlainPassword($password) + { + $this->plainPassword = $password; + } + + + /** + * Returns the salt that was originally used to encode the password. + * + * This can return null if the password was not encoded using a salt. + * + * @return string|null The salt + */ + public function getSalt() + { + // TODO: Implement getSalt() method. + } +} \ No newline at end of file diff --git a/src/AppBundle/Form/UserType.php b/src/AppBundle/Form/UserType.php index 28a46ad..fd39fa1 100644 --- a/src/AppBundle/Form/UserType.php +++ b/src/AppBundle/Form/UserType.php @@ -9,8 +9,7 @@ namespace AppBundle\Form; -use Symfony\Component\Form\FormEvent; -use Symfony\Component\Form\FormEvents; + use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -18,7 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\BirthdayType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\FileType; -use Symfony\Component\Form\Extension\Core\Type\PasswordType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Bridge\Doctrine\Form\Type\EntityType; class UserType extends AbstractType @@ -26,33 +25,39 @@ class UserType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('fecha_ingreso', BirthdayType::class, array( - 'label' => 'Fecha de Ingreso UBV', - )) + /* ->add('fecha_ingreso', BirthdayType::class, array( + 'label' => 'Fecha de Ingreso UBV', + ))*/ ->add('trabajo', FileType::class, array('label' => 'Digital Constancia Trabajo')) - ->add('oposicion', CheckboxType::class, array( + ->add('pregrado', FileType::class, array('label' => 'Digital Título de Pregrado')) + + ->add('postgrado', FileType::class, array('label' => 'Digital Título de Postgrado','required' => false)) + /*->add('oposicion', CheckboxType::class, array( 'label' => '¿Tiene Concurso de Oposición?', 'required' => false, - )) - ->add('escalafones', EntityType::class, array( + ))*/ + ->add('escala', EntityType::class, array( 'label' => false, 'placeholder' => 'Seleccione escala a la que concurso', - 'attr' => array( + 'required' => false, + /*'attr' => array( 'class' => 'esc_oposicion' - ), + ),*/ 'class' => 'AppBundle:Escalafones', 'choice_label' => 'getNombre', )) ->add('fecha_oposicion', BirthdayType::class, array( 'label' => 'fecha Concurso', - 'label_attr' => array( 'class' => 'esc_oposicion'), - 'attr' => array( + //'label_attr' => array( 'class' => 'esc_oposicion'), + 'required' => false, + /* 'attr' => array( 'class' => 'esc_oposicion' - ) + )*/ )) - ->add('documento_oposicion', FileType::class, array( + /*->add('documento_oposicion', FileType::class, array( 'label' => 'Digital Documento Oposición', 'label_attr' => array( 'class' => 'esc_oposicion'), + 'required' => false, 'attr' => array( 'style' => 'display:none;', 'class' => 'esc_oposicion' @@ -64,6 +69,7 @@ class UserType extends AbstractType 'class' => 'esc_oposicion' ), 'placeholder' => 'Seleccione Area de Investigacion', + 'required' => false, 'class' => 'AppBundle:AreasInvestigacion', 'choice_label' => 'getNombre', )) @@ -75,13 +81,74 @@ class UserType extends AbstractType 'class' => 'esc_oposicion' ) )) - + //Ascensos: + //Asistente + ->add('fecha_ascenso_asistente', BirthdayType::class, array( + 'label' => 'fecha ascenso ASISTENTE', + 'required' => false, + 'label_attr' => array( 'class' => 'esc_asistente'), + 'attr' => array( + 'class' => 'esc_asistente' + ) + )) + + ->add('documento_asistente', FileType::class, array( + 'label' => 'Digital Documento Asistente', + 'label_attr' => array( 'class' => 'esc_asistente'), + 'required' => false, + 'attr' => array( + 'style' => 'display:none;', + 'class' => 'esc_asistente' + ) + )) + + ->add('ascenso2', CheckboxType::class, array( + 'label' => '¿otro Ascenso?', + 'label_attr' => array( 'class' => 'esc_asistente'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_asistente' + ) + )) + + //Agregado + ->add('fecha_ascenso_agregado', BirthdayType::class, array( + 'label' => 'fecha ascenso AGREGADO', + 'label_attr' => array( 'class' => 'esc_agregado'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_agregado' + ) + )) + + ->add('documento_agregado', FileType::class, array( + 'label' => 'Digital Documento agregado', + 'label_attr' => array( 'class' => 'esc_agregado'), + 'required' => false, + 'attr' => array( + 'style' => 'display:none;', + 'class' => 'esc_agregado' + ) + )) + + ->add('ascenso3', CheckboxType::class, array( + 'label' => '¿Otro Ascenso?', + 'label_attr' => array( 'class' => 'esc_agregado'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_agregado' + ) + ))*/ + + ->add('send', SubmitType::class, array('label' => 'Enviar Solicitud')); ; } + + -} \ No newline at end of file +} diff --git a/src/AppBundle/Form/UserType.php~ b/src/AppBundle/Form/UserType.php~ new file mode 100644 index 0000000..e9a5ca3 --- /dev/null +++ b/src/AppBundle/Form/UserType.php~ @@ -0,0 +1,154 @@ +add('fecha_ingreso', BirthdayType::class, array( + 'label' => 'Fecha de Ingreso UBV', + ))*/ + ->add('trabajo', FileType::class, array('label' => 'Digital Constancia Trabajo')) + ->add('pregrado', FileType::class, array('label' => 'Digital Título de Pregrado')) + + ->add('postgrado', FileType::class, array('label' => 'Digital Título de Postgrado','required' => false)) + /*->add('oposicion', CheckboxType::class, array( + 'label' => '¿Tiene Concurso de Oposición?', + 'required' => false, + ))*/ + ->add('escala', EntityType::class, array( + 'label' => false, + 'placeholder' => 'Seleccione escala a la que concurso', + 'required' => false, + /*'attr' => array( + 'class' => 'esc_oposicion' + ),*/ + 'class' => 'AppBundle:Escalafones', + 'choice_label' => 'getNombre', + )) + ->add('fecha_oposicion', BirthdayType::class, array( + 'label' => 'fecha Concurso', + 'label_attr' => array( 'class' => 'esc_oposicion'), + 'required' => false, + /* 'attr' => array( + 'class' => 'esc_oposicion' + )*/ + )) + /*->add('documento_oposicion', FileType::class, array( + 'label' => 'Digital Documento Oposición', + 'label_attr' => array( 'class' => 'esc_oposicion'), + 'required' => false, + 'attr' => array( + 'style' => 'display:none;', + 'class' => 'esc_oposicion' + ) + )) + ->add('area_investigacion', EntityType::class, array( + 'label' => false, + 'attr' => array( + 'class' => 'esc_oposicion' + ), + 'placeholder' => 'Seleccione Area de Investigacion', + 'required' => false, + 'class' => 'AppBundle:AreasInvestigacion', + 'choice_label' => 'getNombre', + )) + ->add('ascenso', CheckboxType::class, array( + 'label' => '¿Ha tenido Ascenso luego del Concurso?', + 'label_attr' => array( 'class' => 'esc_oposicion'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_oposicion' + ) + )) + //Ascensos: + //Asistente + ->add('fecha_ascenso_asistente', BirthdayType::class, array( + 'label' => 'fecha ascenso ASISTENTE', + 'required' => false, + 'label_attr' => array( 'class' => 'esc_asistente'), + 'attr' => array( + 'class' => 'esc_asistente' + ) + )) + + ->add('documento_asistente', FileType::class, array( + 'label' => 'Digital Documento Asistente', + 'label_attr' => array( 'class' => 'esc_asistente'), + 'required' => false, + 'attr' => array( + 'style' => 'display:none;', + 'class' => 'esc_asistente' + ) + )) + + ->add('ascenso2', CheckboxType::class, array( + 'label' => '¿otro Ascenso?', + 'label_attr' => array( 'class' => 'esc_asistente'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_asistente' + ) + )) + + //Agregado + ->add('fecha_ascenso_agregado', BirthdayType::class, array( + 'label' => 'fecha ascenso AGREGADO', + 'label_attr' => array( 'class' => 'esc_agregado'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_agregado' + ) + )) + + ->add('documento_agregado', FileType::class, array( + 'label' => 'Digital Documento agregado', + 'label_attr' => array( 'class' => 'esc_agregado'), + 'required' => false, + 'attr' => array( + 'style' => 'display:none;', + 'class' => 'esc_agregado' + ) + )) + + ->add('ascenso3', CheckboxType::class, array( + 'label' => '¿Otro Ascenso?', + 'label_attr' => array( 'class' => 'esc_agregado'), + 'required' => false, + 'attr' => array( + 'class' => 'esc_agregado' + ) + ))*/ + + ->add('send', SubmitType::class, array('label' => 'Enviar Solicitud')); + + + ; + + + } + + + + +} diff --git a/web/config.php b/web/config.php index c704155..2e15309 100644 --- a/web/config.php +++ b/web/config.php @@ -120,7 +120,7 @@ $minorProblems = $symfonyRequirements->getFailedRecommendations();