Commit 55ffb4bc479ff30069a3fbbef487a89ab4c505d2
1 parent
fe4aebf5c7
Exists in
master
intentando crear la inscripcion con botones de radio... cerca
Showing
3 changed files
with
20 additions
and
14 deletions
Show diff stats
app/Resources/views/inscripcion/new.html.twig
| 1 | -{% extends 'base.html.twig' %} | |
| 1 | +{% extends 'base_app.html.twig' %} | |
| 2 | 2 | |
| 3 | 3 | {% block body %} |
| 4 | 4 | <h1>Inscripcion creation</h1> |
| 5 | +{{ dump(form.children.idOfertaAcademica.children) }} | |
| 5 | 6 | {% form_theme form 'bootstrap_3_horizontal_layout.html.twig' %} |
| 6 | 7 | {{ form_start(form) }} |
| 7 | - {{ form_widget(form) }} | |
| 8 | + {{ form_widget(form.children.idOfertaAcademica.children.1) }} | |
| 8 | 9 | <input type="submit" value="Create" /> |
| 9 | 10 | {{ form_end(form) }} |
| 10 | 11 | ... | ... |
src/AppBundle/Controller/InscripcionController.php
| ... | ... | @@ -42,23 +42,28 @@ class InscripcionController extends Controller |
| 42 | 42 | */ |
| 43 | 43 | public function newAction(Request $request) |
| 44 | 44 | { |
| 45 | - $inscripcion = $this->getDoctrine()->getRepository('AppBundle:EstadoAcademico')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
| 46 | - $form = $this->createForm('AppBundle\Form\InscripcionType', $inscripcion, array( | |
| 47 | - 'inscripcion' => $inscripcion | |
| 48 | - )); | |
| 45 | + $ea = $this->getDoctrine()->getRepository('AppBundle:EstadoAcademico')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
| 46 | + $oferta = $this->getDoctrine()->getRepository('AppBundle:OfertaAcademica')->findBy( | |
| 47 | + array('idOfertaMallaCurricular' => $ea->getIdOfertaMallaCurricular()), | |
| 48 | + array('idMallaCurricularUc' => 'ASC') | |
| 49 | + ); | |
| 50 | + | |
| 51 | + | |
| 52 | + $form = $this->createForm('AppBundle\Form\InscripcionType', $ea, array('inscripcion' => $ea,)); | |
| 49 | 53 | $form->handleRequest($request); |
| 50 | 54 | |
| 51 | 55 | if ($form->isSubmitted() && $form->isValid()) { |
| 52 | 56 | $em = $this->getDoctrine()->getManager(); |
| 53 | - $em->persist($inscripcion); | |
| 57 | + $em->persist($ea); | |
| 54 | 58 | $em->flush(); |
| 55 | 59 | |
| 56 | 60 | return $this->redirectToRoute('inscripcion_index'); |
| 57 | 61 | } |
| 58 | 62 | |
| 59 | 63 | return $this->render('inscripcion/new.html.twig', array( |
| 60 | - 'inscripcion' => $inscripcion, | |
| 61 | - 'form' => $form->createView(), | |
| 64 | + 'estado_academico' => $ea, | |
| 65 | + 'oferta' => $oferta, | |
| 66 | + 'form' => $form->createView() | |
| 62 | 67 | )); |
| 63 | 68 | } |
| 64 | 69 | ... | ... |
src/AppBundle/Form/InscripcionType.php
| ... | ... | @@ -25,7 +25,7 @@ class InscripcionType extends AbstractType |
| 25 | 25 | $builder |
| 26 | 26 | /*->add('idRolInstitucion') |
| 27 | 27 | ->add('idOfertaAcademica') |
| 28 | - ->add('idEstatus')*/ | |
| 28 | + ->add('idEstatus')*/ | |
| 29 | 29 | ->add('idOfertaAcademica', EntityType::class, array( |
| 30 | 30 | 'class' => 'AppBundle:OfertaAcademica', |
| 31 | 31 | 'expanded' => true, |
| ... | ... | @@ -33,16 +33,16 @@ class InscripcionType extends AbstractType |
| 33 | 33 | 'query_builder' => function (EntityRepository $er) { |
| 34 | 34 | return $er->createQueryBuilder('u') |
| 35 | 35 | ->orderBy('u.idMallaCurricularUc', 'ASC') |
| 36 | - ->innerJoin('u.idMallaCurricularUc', 'm', 'WITH', 'm.idTrayectoTramoModalidadTipoUc = ?2') | |
| 37 | - ->innerJoin('m.idTrayectoTramoModalidadTipoUc', 't', 'WITH', 't.idTrayecto = ?3') | |
| 38 | - ->where('u.idOfertaMallaCurricular = ?1 ') //que las uc conicidan con la malla del estado academico | |
| 36 | + ->innerJoin('u.idMallaCurricularUc', 'm', 'WITH', 'm.idTrayectoTramoModalidadTipoUc = ?2') | |
| 37 | + ->where('u.idOfertaMallaCurricular = ?1') //que las uc conicidan con la malla del estado academico | |
| 39 | 38 | ->setParameters(array( |
| 40 | 39 | 1 => $this->estado_academico->getIdOfertaMallaCurricular(), |
| 41 | 40 | 2 => 1, |
| 42 | - 3 => 1 | |
| 43 | 41 | )); |
| 44 | 42 | ;}, |
| 43 | + 'group_by' => 'idSeccion' | |
| 45 | 44 | )) |
| 45 | + | |
| 46 | 46 | ; |
| 47 | 47 | } |
| 48 | 48 | ... | ... |