From 30a854d1e6dbc5f1bcbbfc09a467620e27506f17 Mon Sep 17 00:00:00 2001 From: Wilmer Ramones Date: Tue, 11 Oct 2016 08:50:39 -0400 Subject: [PATCH] Creada la estructura para mostrar la planificacion creada por el docente a los estudiantes inscritos en la UC. --- app/Resources/views/inscripcion/index.html.twig | 2 +- .../planificacionseccion/estudiante_show.html.twig | 16 ++++ src/AppBundle/Controller/InscripcionController.php | 26 ++++- .../Form/PlanificacionSeccionShowType.php | 106 +++++++++++++++++++++ 4 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 app/Resources/views/planificacionseccion/estudiante_show.html.twig create mode 100644 src/AppBundle/Form/PlanificacionSeccionShowType.php diff --git a/app/Resources/views/inscripcion/index.html.twig b/app/Resources/views/inscripcion/index.html.twig index 5c2fdf8..c67c8fb 100644 --- a/app/Resources/views/inscripcion/index.html.twig +++ b/app/Resources/views/inscripcion/index.html.twig @@ -79,7 +79,7 @@ {% if inscritas.getIdSeccion.getPlanificacion | length > 0 %}
    {% for planificacion in inscritas.getIdSeccion.getPlanificacion %} -
  1. {{ planificacion.idTemaUc.nombre }}
  2. +
  3. {{ planificacion.idTemaUc.nombre }}
  4. {% endfor %}
{% else %} diff --git a/app/Resources/views/planificacionseccion/estudiante_show.html.twig b/app/Resources/views/planificacionseccion/estudiante_show.html.twig new file mode 100644 index 0000000..21092ec --- /dev/null +++ b/app/Resources/views/planificacionseccion/estudiante_show.html.twig @@ -0,0 +1,16 @@ +{% extends 'base.html.twig' %} + +{% block body %} +

PlanificacionSeccion edit

+ + {{ form_start(show_form) }} + {{ form_widget(show_form) }} + {{ form_end(show_form) }} + + +{% endblock %} diff --git a/src/AppBundle/Controller/InscripcionController.php b/src/AppBundle/Controller/InscripcionController.php index 5caa15d..2859c74 100644 --- a/src/AppBundle/Controller/InscripcionController.php +++ b/src/AppBundle/Controller/InscripcionController.php @@ -7,7 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use AppBundle\Entity\Inscripcion; -use AppBundle\Entity\EstadoAcademico; +use AppBundle\Entity\PlanificacionSeccion; /** @@ -78,7 +78,7 @@ class InscripcionController extends Controller /** * Finds and displays a Inscripcion entity. * - * @Route("/{id}", name="ceapp_estudiante_inscripcion_show") + * @Route("/show/{id}", name="ceapp_estudiante_inscripcion_show") * @Method("GET") */ public function showAction(Inscripcion $inscripcion) @@ -90,6 +90,28 @@ class InscripcionController extends Controller 'delete_form' => $deleteForm->createView(), )); } + + + /** + * Displays la planificación creada por el docente. + * + * @Route("/planificacion/{id}", name="ceapp_estudiante_planificacion_show") + * @Method({"GET", "POST"}) + */ + public function showPlanificacionAction(Request $request, PlanificacionSeccion $planificacionSeccion) + { + $seccion = $this->getDoctrine()->getRepository('AppBundle:Seccion')->findOneById($planificacionSeccion->getSeccion()); + + $showForm = $this->createForm('AppBundle\Form\PlanificacionSeccionShowType', $planificacionSeccion, array('seccion' => $seccion)); + + + return $this->render('planificacionseccion/estudiante_show.html.twig', array( + 'planificacionSeccion' => $planificacionSeccion, + 'show_form' => $showForm->createView(), + )); + } + + /** * Displays a form to edit an existing Inscripcion entity. diff --git a/src/AppBundle/Form/PlanificacionSeccionShowType.php b/src/AppBundle/Form/PlanificacionSeccionShowType.php new file mode 100644 index 0000000..6937161 --- /dev/null +++ b/src/AppBundle/Form/PlanificacionSeccionShowType.php @@ -0,0 +1,106 @@ +seccion = $options['seccion']; + //que solo salgan los temas que no han sido planificados de esa 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 + + ->add('idtemaUc', EntityType::class, array( + 'class' => 'AppBundle:UnidadCurricularVolumenTema', + 'multiple' => false, + 'expanded' => false, + 'disabled' => true, + 'query_builder' => function (EntityRepository $er) { + return $er->createQueryBuilder('u') + ->orderBy('u.orden', 'ASC') + ->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() + )); + ;}, + + )) + ->add('seccion', EntityType::class, array( + 'class' => 'AppBundle:Seccion', + 'disabled' => true, + 'query_builder' => function (EntityRepository $er) { + return $er->createQueryBuilder('u') + ->where('u.id = ?1') //que las uc conicidan con la malla del estado academico + ->setParameters(array( + 1 => $this->seccion->getId(), + )); + ;}, + )) + ->add('objetivoEspecifico', CollectionType::class, array( + 'entry_type' => PlanificacionSeccionEspecificoType::class, + 'allow_add' => false, + 'label' => false, + 'disabled' => true, + )) + + ->add('contenido', CollectionType::class, array( + 'entry_type' => PlanificacionSeccionContenidoType::class, + 'allow_add' => true, + 'label' => false, + 'disabled' => true, + )) + + ->add('estrategia', CollectionType::class, array( + 'entry_type' => PlanificacionSeccionEstrategiaType::class, + 'allow_add' => true, + 'label' => false, + 'disabled' => true, + )) + + ->add('evaluacion', CollectionType::class, array( + 'entry_type' => PlanificacionSeccionEvaluacionType::class, + 'allow_add' => true, + 'label' => false, + 'disabled' => true, + )) + + + ; + } + + /** + * @param OptionsResolver $resolver + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'AppBundle\Entity\PlanificacionSeccion', + 'seccion' => null, + 'planificacion' => null, + )); + } +} -- 2.0.0