Commit 30a854d1e6dbc5f1bcbbfc09a467620e27506f17

Authored by Wilmer Ramones
1 parent e8b243cb44
Exists in master

Creada la estructura para mostrar la planificacion creada por el docente a los e…

…studiantes inscritos en la UC.
app/Resources/views/inscripcion/index.html.twig
@@ -79,7 +79,7 @@ @@ -79,7 +79,7 @@
79 {% if inscritas.getIdSeccion.getPlanificacion | length > 0 %} 79 {% if inscritas.getIdSeccion.getPlanificacion | length > 0 %}
80 <ol> 80 <ol>
81 {% for planificacion in inscritas.getIdSeccion.getPlanificacion %} 81 {% for planificacion in inscritas.getIdSeccion.getPlanificacion %}
82 - <li> <a href="{{ path('ceapp_docente_planificacion_edit', { 'id': planificacion.id }) }}">{{ planificacion.idTemaUc.nombre }}</a></li> 82 + <li> <a href="{{ path('ceapp_estudiante_planificacion_show', { 'id': planificacion.id }) }}">{{ planificacion.idTemaUc.nombre }}</a></li>
83 {% endfor %} 83 {% endfor %}
84 </ol> 84 </ol>
85 {% else %} 85 {% else %}
app/Resources/views/planificacionseccion/estudiante_show.html.twig
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>PlanificacionSeccion edit</h1>
  5 +
  6 + {{ form_start(show_form) }}
  7 + {{ form_widget(show_form) }}
  8 + {{ form_end(show_form) }}
  9 +
  10 + <ul>
  11 + <li>
  12 + <a href="{{ path('inscripcion_index') }}">Back to the list</a>
  13 + </li>
  14 +
  15 + </ul>
  16 +{% endblock %}
src/AppBundle/Controller/InscripcionController.php
@@ -7,7 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; @@ -7,7 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; 7 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 8 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9 use AppBundle\Entity\Inscripcion; 9 use AppBundle\Entity\Inscripcion;
10 -use AppBundle\Entity\EstadoAcademico; 10 +use AppBundle\Entity\PlanificacionSeccion;
11 11
12 12
13 /** 13 /**
@@ -78,7 +78,7 @@ class InscripcionController extends Controller @@ -78,7 +78,7 @@ class InscripcionController extends Controller
78 /** 78 /**
79 * Finds and displays a Inscripcion entity. 79 * Finds and displays a Inscripcion entity.
80 * 80 *
81 - * @Route("/{id}", name="ceapp_estudiante_inscripcion_show") 81 + * @Route("/show/{id}", name="ceapp_estudiante_inscripcion_show")
82 * @Method("GET") 82 * @Method("GET")
83 */ 83 */
84 public function showAction(Inscripcion $inscripcion) 84 public function showAction(Inscripcion $inscripcion)
@@ -90,6 +90,28 @@ class InscripcionController extends Controller @@ -90,6 +90,28 @@ class InscripcionController extends Controller
90 'delete_form' => $deleteForm->createView(), 90 'delete_form' => $deleteForm->createView(),
91 )); 91 ));
92 } 92 }
  93 +
  94 +
  95 + /**
  96 + * Displays la planificación creada por el docente.
  97 + *
  98 + * @Route("/planificacion/{id}", name="ceapp_estudiante_planificacion_show")
  99 + * @Method({"GET", "POST"})
  100 + */
  101 + public function showPlanificacionAction(Request $request, PlanificacionSeccion $planificacionSeccion)
  102 + {
  103 + $seccion = $this->getDoctrine()->getRepository('AppBundle:Seccion')->findOneById($planificacionSeccion->getSeccion());
  104 +
  105 + $showForm = $this->createForm('AppBundle\Form\PlanificacionSeccionShowType', $planificacionSeccion, array('seccion' => $seccion));
  106 +
  107 +
  108 + return $this->render('planificacionseccion/estudiante_show.html.twig', array(
  109 + 'planificacionSeccion' => $planificacionSeccion,
  110 + 'show_form' => $showForm->createView(),
  111 + ));
  112 + }
  113 +
  114 +
93 115
94 /** 116 /**
95 * Displays a form to edit an existing Inscripcion entity. 117 * Displays a form to edit an existing Inscripcion entity.
src/AppBundle/Form/PlanificacionSeccionShowType.php
@@ -0,0 +1,106 @@ @@ -0,0 +1,106 @@
  1 +<?php
  2 +
  3 +namespace AppBundle\Form;
  4 +
  5 +use Symfony\Component\Form\AbstractType;
  6 +use Symfony\Component\Form\FormBuilderInterface;
  7 +use Symfony\Component\OptionsResolver\OptionsResolver;
  8 +use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  9 +use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  10 +use Doctrine\ORM\EntityRepository;
  11 +
  12 +class PlanificacionSeccionShowType extends AbstractType
  13 +{
  14 + /**
  15 + * @param FormBuilderInterface $builder
  16 + * @param array $options
  17 + */
  18 + public function buildForm(FormBuilderInterface $builder, array $options)
  19 + {
  20 + //que solo salga la seccion que estamos planificando
  21 + $this->seccion = $options['seccion'];
  22 + //que solo salgan los temas que no han sido planificados de esa seccion
  23 + $this->planificacion = $options['planificacion'];
  24 + if (!$this->planificacion){
  25 + $this->planes[] = 0;
  26 + }else{
  27 + foreach ($this->planificacion as $p){
  28 + $this->planes[] = $p->getIdtemaUc()->getId();
  29 + }
  30 +
  31 + }
  32 + //var_dump($this->seccion); exit;
  33 + $builder
  34 +
  35 + ->add('idtemaUc', EntityType::class, array(
  36 + 'class' => 'AppBundle:UnidadCurricularVolumenTema',
  37 + 'multiple' => false,
  38 + 'expanded' => false,
  39 + 'disabled' => true,
  40 + 'query_builder' => function (EntityRepository $er) {
  41 + return $er->createQueryBuilder('u')
  42 + ->orderBy('u.orden', 'ASC')
  43 + ->where('u.id not in (:query)') //que las uc conicidan con la malla del estado academico
  44 + ->andWhere('u.idUnidadCurricularVolumen = ?1 ')
  45 + ->setParameters(array(
  46 + 'query' => $this->planes,
  47 + 1 => $this->seccion->getOfertaAcademica()->getIdMallaCurricularUc()->getIdUnidadCurricularVolumen()->getId()
  48 + ));
  49 + ;},
  50 +
  51 + ))
  52 + ->add('seccion', EntityType::class, array(
  53 + 'class' => 'AppBundle:Seccion',
  54 + 'disabled' => true,
  55 + 'query_builder' => function (EntityRepository $er) {
  56 + return $er->createQueryBuilder('u')
  57 + ->where('u.id = ?1') //que las uc conicidan con la malla del estado academico
  58 + ->setParameters(array(
  59 + 1 => $this->seccion->getId(),
  60 + ));
  61 + ;},
  62 + ))
  63 + ->add('objetivoEspecifico', CollectionType::class, array(
  64 + 'entry_type' => PlanificacionSeccionEspecificoType::class,
  65 + 'allow_add' => false,
  66 + 'label' => false,
  67 + 'disabled' => true,
  68 + ))
  69 +
  70 + ->add('contenido', CollectionType::class, array(
  71 + 'entry_type' => PlanificacionSeccionContenidoType::class,
  72 + 'allow_add' => true,
  73 + 'label' => false,
  74 + 'disabled' => true,
  75 + ))
  76 +
  77 + ->add('estrategia', CollectionType::class, array(
  78 + 'entry_type' => PlanificacionSeccionEstrategiaType::class,
  79 + 'allow_add' => true,
  80 + 'label' => false,
  81 + 'disabled' => true,
  82 + ))
  83 +
  84 + ->add('evaluacion', CollectionType::class, array(
  85 + 'entry_type' => PlanificacionSeccionEvaluacionType::class,
  86 + 'allow_add' => true,
  87 + 'label' => false,
  88 + 'disabled' => true,
  89 + ))
  90 +
  91 +
  92 + ;
  93 + }
  94 +
  95 + /**
  96 + * @param OptionsResolver $resolver
  97 + */
  98 + public function configureOptions(OptionsResolver $resolver)
  99 + {
  100 + $resolver->setDefaults(array(
  101 + 'data_class' => 'AppBundle\Entity\PlanificacionSeccion',
  102 + 'seccion' => null,
  103 + 'planificacion' => null,
  104 + ));
  105 + }
  106 +}