Commit 90aaf1c2688fd4b9c0dfc22503458dc09e135444

Authored by Wilmer Ramones
1 parent 0efc00cf6c
Exists in master

por fin logrado hacer que salgan los temas de la unidad curricular y que no haya…

…n sido planificados ..... :) :) ;)   20 puntos....
src/AppBundle/Controller/PlanificacionSeccionController.php
... ... @@ -44,8 +44,14 @@ class PlanificacionSeccionController extends Controller
44 44 */
45 45 public function newAction(Request $request, Seccion $seccion)
46 46 {
47   - $planificacionSeccion = new PlanificacionSeccion();
48   - $form = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion, array('seccion' => $seccion));
  47 + $em = $this->getDoctrine()->getManager();
  48 + $planificacionSeccion = new PlanificacionSeccion();
  49 + $planificacion = $em->getRepository('AppBundle:PlanificacionSeccion')->findBySeccion($seccion);
  50 + //var_dump($planificacion->getIdtemaUc()->getId()); exit;
  51 + $form = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion, array(
  52 + 'seccion' => $seccion,
  53 + 'planificacion' => $planificacion
  54 + ));
49 55 $form->handleRequest($request);
50 56  
51 57 if ($form->isSubmitted() && $form->isValid()) {
... ...
src/AppBundle/Form/PlanificacionSeccionType.php
... ... @@ -18,6 +18,15 @@ class PlanificacionSeccionType extends AbstractType
18 18 public function buildForm(FormBuilderInterface $builder, array $options)
19 19 {
20 20 $this->seccion = $options['seccion'];
  21 + $this->planificacion = $options['planificacion'];
  22 + if (!$this->planificacion){
  23 + $this->planes[] = 0;
  24 + }else{
  25 + foreach ($this->planificacion as $p){
  26 + $this->planes[] = $p->getIdtemaUc()->getId();
  27 + }
  28 +
  29 + }
21 30 //var_dump($this->seccion); exit;
22 31 $builder
23 32  
... ... @@ -26,8 +35,10 @@ class PlanificacionSeccionType extends AbstractType
26 35 'query_builder' => function (EntityRepository $er) {
27 36 return $er->createQueryBuilder('u')
28 37 ->orderBy('u.orden', 'ASC')
29   - ->where('u.idUnidadCurricularVolumen = ?1') //que las uc conicidan con la malla del estado academico
  38 + ->where('u.id not in (:query)') //que las uc conicidan con la malla del estado academico
  39 + ->andWhere('u.idUnidadCurricularVolumen = ?1')
30 40 ->setParameters(array(
  41 + 'query' => $this->planes,
31 42 1 => $this->seccion->getOfertaAcademica()->getIdMallaCurricularUc()->getIdUnidadCurricularVolumen()->getId()
32 43 ));
33 44 ;},
... ... @@ -59,7 +70,8 @@ class PlanificacionSeccionType extends AbstractType
59 70 {
60 71 $resolver->setDefaults(array(
61 72 'data_class' => 'AppBundle\Entity\PlanificacionSeccion',
62   - 'seccion' => null
  73 + 'seccion' => null,
  74 + 'planificacion' => null,
63 75 ));
64 76 }
65 77 }
... ...