From 90aaf1c2688fd4b9c0dfc22503458dc09e135444 Mon Sep 17 00:00:00 2001 From: Wilmer Ramones Date: Thu, 28 Jul 2016 09:40:09 -0400 Subject: [PATCH] por fin logrado hacer que salgan los temas de la unidad curricular y que no hayan sido planificados ..... :) :) ;) 20 puntos.... --- .../Controller/PlanificacionSeccionController.php | 10 ++++++++-- src/AppBundle/Form/PlanificacionSeccionType.php | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/AppBundle/Controller/PlanificacionSeccionController.php b/src/AppBundle/Controller/PlanificacionSeccionController.php index 270d0d6..90505d9 100644 --- a/src/AppBundle/Controller/PlanificacionSeccionController.php +++ b/src/AppBundle/Controller/PlanificacionSeccionController.php @@ -44,8 +44,14 @@ class PlanificacionSeccionController extends Controller */ public function newAction(Request $request, Seccion $seccion) { - $planificacionSeccion = new PlanificacionSeccion(); - $form = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion, array('seccion' => $seccion)); + $em = $this->getDoctrine()->getManager(); + $planificacionSeccion = new PlanificacionSeccion(); + $planificacion = $em->getRepository('AppBundle:PlanificacionSeccion')->findBySeccion($seccion); + //var_dump($planificacion->getIdtemaUc()->getId()); exit; + $form = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion, array( + 'seccion' => $seccion, + 'planificacion' => $planificacion + )); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { diff --git a/src/AppBundle/Form/PlanificacionSeccionType.php b/src/AppBundle/Form/PlanificacionSeccionType.php index 262096f..986894f 100644 --- a/src/AppBundle/Form/PlanificacionSeccionType.php +++ b/src/AppBundle/Form/PlanificacionSeccionType.php @@ -18,6 +18,15 @@ class PlanificacionSeccionType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $this->seccion = $options['seccion']; + $this->planificacion = $options['planificacion']; + if (!$this->planificacion){ + $this->planes[] = 0; + }else{ + foreach ($this->planificacion as $p){ + $this->planes[] = $p->getIdtemaUc()->getId(); + } + + } //var_dump($this->seccion); exit; $builder @@ -26,8 +35,10 @@ class PlanificacionSeccionType extends AbstractType 'query_builder' => function (EntityRepository $er) { return $er->createQueryBuilder('u') ->orderBy('u.orden', 'ASC') - ->where('u.idUnidadCurricularVolumen = ?1') //que las uc conicidan con la malla del estado academico + ->where('u.id not in (:query)') //que las uc conicidan con la malla del estado academico + ->andWhere('u.idUnidadCurricularVolumen = ?1') ->setParameters(array( + 'query' => $this->planes, 1 => $this->seccion->getOfertaAcademica()->getIdMallaCurricularUc()->getIdUnidadCurricularVolumen()->getId() )); ;}, @@ -59,7 +70,8 @@ class PlanificacionSeccionType extends AbstractType { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\PlanificacionSeccion', - 'seccion' => null + 'seccion' => null, + 'planificacion' => null, )); } } -- 2.0.0