Commit 4f91917833b993f385076a8d5741f16aff64c988

Authored by Wilmer Ramones
1 parent e9e59b1dce
Exists in master

lograda la inscripcion a groso modo... falta mejorarla, depurarla y validarla

app/Resources/views/base_app.html.twig
... ... @@ -74,8 +74,7 @@
74 74 <span>Serv. docentes</span> <b class="caret"></b>
75 75 </a>
76 76 <ul class="dropdown-menu">
77   - <li><a href="{{ path('servicios_index') }}">Mis Unidades Curriculaes</a></li>
78   - <li><a href="#">Mi Planificacion</a></li>
  77 + <li><a href="{{ path('ceapp_docente_planificacion_index') }}">Mis Unidades Curriculaes</a></li>
79 78 </ul>
80 79 </li>
81 80 {% endif %}
... ...
app/Resources/views/planificacioncalificacion/edit.html.twig
... ... @@ -0,0 +1,21 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>PlanificacionCalificacion edit</h1>
  5 +
  6 + {{ form_start(edit_form) }}
  7 + {{ form_widget(edit_form) }}
  8 + <input type="submit" value="Edit" />
  9 + {{ form_end(edit_form) }}
  10 +
  11 + <ul>
  12 + <li>
  13 + <a href="{{ path('ceapp_docente_calificar_index') }}">Back to the list</a>
  14 + </li>
  15 + <li>
  16 + {{ form_start(delete_form) }}
  17 + <input type="submit" value="Delete">
  18 + {{ form_end(delete_form) }}
  19 + </li>
  20 + </ul>
  21 +{% endblock %}
... ...
app/Resources/views/planificacioncalificacion/index.html.twig
... ... @@ -0,0 +1,37 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>PlanificacionCalificacion list</h1>
  5 +
  6 + <table>
  7 + <thead>
  8 + <tr>
  9 + <th>Id</th>
  10 + <th>Actions</th>
  11 + </tr>
  12 + </thead>
  13 + <tbody>
  14 + {% for planificacionCalificacion in planificacionCalificacions %}
  15 + <tr>
  16 + <td><a href="{{ path('ceapp_docente_calificar_show', { 'id': planificacionCalificacion.id }) }}">{{ planificacionCalificacion.id }}</a></td>
  17 + <td>
  18 + <ul>
  19 + <li>
  20 + <a href="{{ path('ceapp_docente_calificar_show', { 'id': planificacionCalificacion.id }) }}">show</a>
  21 + </li>
  22 + <li>
  23 + <a href="{{ path('ceapp_docente_calificar_edit', { 'id': planificacionCalificacion.id }) }}">edit</a>
  24 + </li>
  25 + </ul>
  26 + </td>
  27 + </tr>
  28 + {% endfor %}
  29 + </tbody>
  30 + </table>
  31 +
  32 + <ul>
  33 + <li>
  34 + <a href="{{ path('ceapp_docente_calificar_new') }}">Create a new entry</a>
  35 + </li>
  36 + </ul>
  37 +{% endblock %}
... ...
app/Resources/views/planificacioncalificacion/new.html.twig
... ... @@ -0,0 +1,27 @@
  1 +{% extends 'base_app.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>Registro Calificacion Planificacion</h1>
  5 + <h3>{{planificacion.idtemaUc}}</h3>
  6 +
  7 +<form class="form-inline" method="post" name="planificacion_calificacion">
  8 + <div id="seccion">
  9 + <ul>
  10 + {% for o in planificacion.seccion.hasInscripcion %}
  11 +
  12 + <li>
  13 + {{o}}
  14 + <input type="hidden" id="planificacion_calificacion_idInscripcion_{{o.id}}" name="planificacion_calificacion[idInscripcion][inscripcion_{{o.id}}]" value ="{{o.id}}"/>
  15 + <input type="text" id="planificacion_calificacion_idCalificacion" name="planificacion_calificacion[idInscripcion][calificacion_{{o.id}}]" />
  16 + <input type="text" id="planificacion_calificacion_idCalificacion" name="planificacion_calificacion[idInscripcion][porcentaje_{{o.id}}]" />
  17 + </li>
  18 + {% endfor %}<br>
  19 + </ul>
  20 +</div>
  21 +<input id="seccion__token" type="hidden" value="WbDyIPXIxm9WxU4oOf2a4_4CnXg3rxuY46e_TbVAggY" name="seccion[_token]">
  22 +<input type="submit" value="Create" />
  23 +</form>
  24 +
  25 +{% endblock %}
  26 +
  27 +
... ...
app/Resources/views/planificacioncalificacion/show.html.twig
... ... @@ -0,0 +1,28 @@
  1 +{% extends 'base.html.twig' %}
  2 +
  3 +{% block body %}
  4 + <h1>PlanificacionCalificacion</h1>
  5 +
  6 + <table>
  7 + <tbody>
  8 + <tr>
  9 + <th>Id</th>
  10 + <td>{{ planificacionCalificacion.id }}</td>
  11 + </tr>
  12 + </tbody>
  13 + </table>
  14 +
  15 + <ul>
  16 + <li>
  17 + <a href="{{ path('ceapp_docente_calificar_index') }}">Back to the list</a>
  18 + </li>
  19 + <li>
  20 + <a href="{{ path('ceapp_docente_calificar_edit', { 'id': planificacionCalificacion.id }) }}">Edit</a>
  21 + </li>
  22 + <li>
  23 + {{ form_start(delete_form) }}
  24 + <input type="submit" value="Delete">
  25 + {{ form_end(delete_form) }}
  26 + </li>
  27 + </ul>
  28 +{% endblock %}
... ...
app/Resources/views/planificacionseccion/index.html.twig
... ... @@ -35,6 +35,11 @@
35 35 <li>
36 36 <a href="{{ path('ceapp_docente_planificacion_edit', { 'id': seccion.id }) }}">edit</a>
37 37 </li>
  38 + {% if porcentaje == 100 %}
  39 + <li>
  40 + <a href="{{ path('ceapp_docente_planificacion_show', { 'id': seccion.id, 'porcentaje' : porcentaje }) }}">Calificar</a>
  41 + </li>
  42 + {% endif %}
38 43 </ul>
39 44 </td>
40 45 </tr>
... ...
app/Resources/views/planificacionseccion/show.html.twig
... ... @@ -2,39 +2,43 @@
2 2  
3 3 {% block body %}
4 4 <h1>PlanificacionSeccion</h1>
5   -
  5 + {% for planificacion in planificacionSeccion %}
6 6 <table>
7 7 <tbody>
8 8 <tr>
9 9 <th>Fecha_creacion</th>
10   - <td>{% if planificacionSeccion.fechacreacion %}{{ planificacionSeccion.fechacreacion|date('Y-m-d H:i:s') }}{% endif %}</td>
  10 + <td>{% if planificacion.fechacreacion %}{{ planificacion.fechacreacion|date('Y-m-d H:i:s') }}{% endif %}</td>
11 11 </tr>
12 12 <tr>
13 13 <th>Fecha_ultima_actualizacion</th>
14   - <td>{% if planificacionSeccion.fechaultimaactualizacion %}{{ planificacionSeccion.fechaultimaactualizacion|date('Y-m-d H:i:s') }}{% endif %}</td>
  14 + <td>{% if planificacion.fechaultimaactualizacion %}{{ planificacion.fechaultimaactualizacion|date('Y-m-d H:i:s') }}{% endif %}</td>
15 15 </tr>
16 16 <tr>
17 17 <th>Observacion</th>
18   - <td>{{ planificacionSeccion.observacion }}</td>
  18 + <td>{{ planificacion.observacion }}</td>
19 19 </tr>
20 20 <tr>
21 21 <th>Id</th>
22   - <td>{{ planificacionSeccion.id }}</td>
  22 + <td>{{ planificacion.id }}</td>
23 23 </tr>
24 24 </tbody>
25 25 </table>
26   -
27 26 <ul>
28 27 <li>
29 28 <a href="{{ path('ceapp_docente_planificacion_index') }}">Back to the list</a>
30 29 </li>
31 30 <li>
32   - <a href="{{ path('ceapp_docente_planificacion_edit', { 'id': planificacionSeccion.id }) }}">Edit</a>
33   - </li>
34   - <li>
35   - {{ form_start(delete_form) }}
36   - <input type="submit" value="Delete">
37   - {{ form_end(delete_form) }}
  31 + <a href="{{ path('ceapp_docente_planificacion_edit', { 'id': planificacion.id }) }}">Edit</a>
38 32 </li>
  33 + {% if porcentaje == 100 %}
  34 + <li>
  35 + <a href="{{ path('ceapp_docente_calificar_new', { 'planificacion': planificacion.id }) }}">Calificar</a>
  36 + </li>
  37 + {% endif %}
39 38 </ul>
  39 +
  40 +
  41 + {% endfor %}
  42 +
  43 +
40 44 {% endblock %}
... ...
src/AppBundle/Controller/InscripcionController.php
... ... @@ -50,9 +50,7 @@ class InscripcionController extends Controller
50 50  
51 51 $seccion = $this->getDoctrine()->getRepository('AppBundle:Seccion')->findAll();
52 52  
53   -
54   - $form = $this->createForm('AppBundle\Form\InscripcionType', $ea, array('inscripcion' => $ea,));
55   - $form->handleRequest($request);
  53 +
56 54  
57 55 if ($request->isMethod("POST")) {
58 56 //var_dump($request->request->get('seccion')['idSeccion']); exit;
... ... @@ -73,8 +71,7 @@ class InscripcionController extends Controller
73 71 return $this->render('inscripcion/new.html.twig', array(
74 72 'estado_academico' => $ea,
75 73 'oferta' => $oferta,
76   - 'seccion' => $seccion,
77   - 'form' => $form->createView()
  74 + 'seccion' => $seccion,
78 75 ));
79 76 }
80 77  
... ...
src/AppBundle/Controller/PlanificacionCalificacionController.php
... ... @@ -0,0 +1,166 @@
  1 +<?php
  2 +
  3 +namespace AppBundle\Controller;
  4 +
  5 +use Symfony\Component\HttpFoundation\Request;
  6 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  7 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9 +use AppBundle\Entity\PlanificacionCalificacion;
  10 +use AppBundle\Entity\PlanificacionSeccion;
  11 +use AppBundle\Form\PlanificacionCalificacionType;
  12 +use AppBundle\Entity\Seccion;
  13 +
  14 +/**
  15 + * PlanificacionCalificacion controller.
  16 + *
  17 + * @Route("/ceapp/docente/calificar")
  18 + */
  19 +class PlanificacionCalificacionController extends Controller
  20 +{
  21 + /**
  22 + * Lists all PlanificacionCalificacion entities.
  23 + *
  24 + * @Route("/", name="ceapp_docente_calificar_index")
  25 + * @Method("GET")
  26 + */
  27 + public function indexAction()
  28 + {
  29 + $em = $this->getDoctrine()->getManager();
  30 +
  31 + $planificacionCalificacions = $em->getRepository('AppBundle:PlanificacionCalificacion')->findAll();
  32 +
  33 + return $this->render('planificacioncalificacion/index.html.twig', array(
  34 + 'planificacionCalificacions' => $planificacionCalificacions,
  35 + ));
  36 + }
  37 +
  38 + /**
  39 + * Creates a new PlanificacionCalificacion entity.
  40 + *
  41 + * @Route("/new/{planificacion}", name="ceapp_docente_calificar_new")
  42 + * @Method({"GET", "POST"})
  43 + */
  44 + public function newAction(Request $request, PlanificacionSeccion $planificacion)
  45 + {
  46 + $planificacionCalificacion = new PlanificacionCalificacion();
  47 +
  48 + if ($request->isMethod("POST")) {
  49 + $em = $this->getDoctrine()->getManager();
  50 + //var_dump($request->request->get('planificacion_calificacion')); exit;
  51 + foreach ($request->request->get('planificacion_calificacion')['idInscripcion'] as $key => $value ){
  52 +
  53 +
  54 + $insertar = explode("_", $key);
  55 +
  56 + if($insertar[0] == 'inscripcion'){
  57 + $planificacionCalificacion = new PlanificacionCalificacion();
  58 + $idInscripcion = $em->getRepository('AppBundle:Inscripcion')->findOneById($value);
  59 + $planificacionCalificacion->setIdInscripcion($idInscripcion);
  60 + }else if ($insertar[0] == 'calificacion'){
  61 + $cal = $value;
  62 + }else if ($insertar[0] == 'porcentaje'){
  63 + $idCalificacion = $em->getRepository('AppBundle:Calificacion')->findOneBy(array(
  64 + 'idNota' => $cal,
  65 + 'idPorcentaje' => $value
  66 + ));
  67 + $planificacionCalificacion->setIdCalificacion($idCalificacion);
  68 + $planificacionCalificacion->setIdEstatusNota($em->getRepository('AppBundle:EstatusNota')->findOneById(1));
  69 + $planificacionCalificacion->setIdPlanificacionSeccion($planificacion);
  70 + $em->persist($planificacionCalificacion);
  71 + $em->flush();
  72 + }
  73 +
  74 +
  75 + }
  76 +
  77 +
  78 +
  79 +
  80 + return $this->redirectToRoute('ceapp_docente_calificar_show', array('id' => $planificacionCalificacion->getId()));
  81 + }
  82 +
  83 + return $this->render('planificacioncalificacion/new.html.twig', array(
  84 + 'planificacion' => $planificacion,
  85 + ));
  86 + }
  87 +
  88 + /**
  89 + * Finds and displays a PlanificacionCalificacion entity.
  90 + *
  91 + * @Route("/{id}", name="ceapp_docente_calificar_show")
  92 + * @Method("GET")
  93 + */
  94 + public function showAction(PlanificacionCalificacion $planificacionCalificacion)
  95 + {
  96 + $deleteForm = $this->createDeleteForm($planificacionCalificacion);
  97 +
  98 + return $this->render('planificacioncalificacion/show.html.twig', array(
  99 + 'planificacionCalificacion' => $planificacionCalificacion,
  100 + 'delete_form' => $deleteForm->createView(),
  101 + ));
  102 + }
  103 +
  104 + /**
  105 + * Displays a form to edit an existing PlanificacionCalificacion entity.
  106 + *
  107 + * @Route("/{id}/edit", name="ceapp_docente_calificar_edit")
  108 + * @Method({"GET", "POST"})
  109 + */
  110 + public function editAction(Request $request, PlanificacionCalificacion $planificacionCalificacion)
  111 + {
  112 + $deleteForm = $this->createDeleteForm($planificacionCalificacion);
  113 + $editForm = $this->createForm('AppBundle\Form\PlanificacionCalificacionType', $planificacionCalificacion);
  114 + $editForm->handleRequest($request);
  115 +
  116 + if ($editForm->isSubmitted() && $editForm->isValid()) {
  117 + $em = $this->getDoctrine()->getManager();
  118 + $em->persist($planificacionCalificacion);
  119 + $em->flush();
  120 +
  121 + return $this->redirectToRoute('ceapp_docente_calificar_edit', array('id' => $planificacionCalificacion->getId()));
  122 + }
  123 +
  124 + return $this->render('planificacioncalificacion/edit.html.twig', array(
  125 + 'planificacionCalificacion' => $planificacionCalificacion,
  126 + 'edit_form' => $editForm->createView(),
  127 + 'delete_form' => $deleteForm->createView(),
  128 + ));
  129 + }
  130 +
  131 + /**
  132 + * Deletes a PlanificacionCalificacion entity.
  133 + *
  134 + * @Route("/{id}", name="ceapp_docente_calificar_delete")
  135 + * @Method("DELETE")
  136 + */
  137 + public function deleteAction(Request $request, PlanificacionCalificacion $planificacionCalificacion)
  138 + {
  139 + $form = $this->createDeleteForm($planificacionCalificacion);
  140 + $form->handleRequest($request);
  141 +
  142 + if ($form->isSubmitted() && $form->isValid()) {
  143 + $em = $this->getDoctrine()->getManager();
  144 + $em->remove($planificacionCalificacion);
  145 + $em->flush();
  146 + }
  147 +
  148 + return $this->redirectToRoute('ceapp_docente_calificar_index');
  149 + }
  150 +
  151 + /**
  152 + * Creates a form to delete a PlanificacionCalificacion entity.
  153 + *
  154 + * @param PlanificacionCalificacion $planificacionCalificacion The PlanificacionCalificacion entity
  155 + *
  156 + * @return \Symfony\Component\Form\Form The form
  157 + */
  158 + private function createDeleteForm(PlanificacionCalificacion $planificacionCalificacion)
  159 + {
  160 + return $this->createFormBuilder()
  161 + ->setAction($this->generateUrl('ceapp_docente_calificar_delete', array('id' => $planificacionCalificacion->getId())))
  162 + ->setMethod('DELETE')
  163 + ->getForm()
  164 + ;
  165 + }
  166 +}
... ...
src/AppBundle/Controller/PlanificacionSeccionController.php
... ... @@ -94,16 +94,17 @@ class PlanificacionSeccionController extends Controller
94 94 /**
95 95 * Finds and displays a PlanificacionSeccion entity.
96 96 *
97   - * @Route("/{id}", name="ceapp_docente_planificacion_show")
  97 + * @Route("/{id}/{porcentaje}", name="ceapp_docente_planificacion_show")
98 98 * @Method("GET")
99 99 */
100   - public function showAction(PlanificacionSeccion $planificacionSeccion)
  100 + public function showAction(Seccion $seccion, $porcentaje = null)
101 101 {
102   - $deleteForm = $this->createDeleteForm($planificacionSeccion);
103   -
  102 + $planificacionSeccion = $this->getDoctrine()->getRepository('AppBundle:PlanificacionSeccion')->findBySeccion($seccion);
  103 + //$deleteForm = $this->createDeleteForm($planificacionSeccion);
  104 +
104 105 return $this->render('planificacionseccion/show.html.twig', array(
105 106 'planificacionSeccion' => $planificacionSeccion,
106   - 'delete_form' => $deleteForm->createView(),
  107 + 'porcentaje' => $porcentaje
107 108 ));
108 109 }
109 110  
... ...
src/AppBundle/Entity/Calificacion.php
... ... @@ -135,4 +135,11 @@ class Calificacion
135 135 {
136 136 return $this->idCondicionCalificacion;
137 137 }
  138 +
  139 + /**
  140 + * @return string
  141 + */
  142 + public function __toString() {
  143 + return $this->getIdNota()->getIdNomenclaturaNota()->getNombre();
  144 + }
138 145 }
139 146 \ No newline at end of file
... ...
src/AppBundle/Entity/EstadoAcademico.php
... ... @@ -313,4 +313,14 @@ class EstadoAcademico
313 313  
314 314  
315 315 }
  316 +
  317 + /**
  318 + * @return string
  319 + *
  320 + */
  321 + public function __toString() {
  322 + return $this->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre();
  323 + }
  324 +
  325 +
316 326 }
... ...
src/AppBundle/Entity/EstatusNota.php
... ... @@ -63,4 +63,11 @@ class EstatusNota
63 63 {
64 64 return $this->id;
65 65 }
  66 +
  67 + /**
  68 + * @return string
  69 + */
  70 + public function __toString() {
  71 + return $this->getNombre();
  72 + }
66 73 }
67 74 \ No newline at end of file
... ...
src/AppBundle/Entity/Inscripcion.php
... ... @@ -214,4 +214,12 @@ class Inscripcion
214 214 {
215 215 return $this->modified;
216 216 }
  217 +
  218 + /**
  219 + * @return string
  220 + *
  221 + */
  222 + public function __toString() {
  223 + return $this->getIdEstadoAcademico()->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre();
  224 + }
217 225 }
... ...
src/AppBundle/Entity/PlanificacionSeccion.php
... ... @@ -393,4 +393,8 @@ class PlanificacionSeccion
393 393 {
394 394 return $this->objetivoEspecifico;
395 395 }
  396 +
  397 + public function __toString() {
  398 + return $this->getSeccion()->getNombre();
  399 + }
396 400 }
... ...
src/AppBundle/Form/PlanificacionCalificacionType.php
... ... @@ -0,0 +1,34 @@
  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 +
  9 +class PlanificacionCalificacionType extends AbstractType
  10 +{
  11 + /**
  12 + * @param FormBuilderInterface $builder
  13 + * @param array $options
  14 + */
  15 + public function buildForm(FormBuilderInterface $builder, array $options)
  16 + {
  17 + $builder
  18 + ->add('idPlanificacionSeccion')
  19 + ->add('idInscripcion')
  20 + ->add('idCalificacion')
  21 + ->add('idEstatusNota')
  22 + ;
  23 + }
  24 +
  25 + /**
  26 + * @param OptionsResolver $resolver
  27 + */
  28 + public function configureOptions(OptionsResolver $resolver)
  29 + {
  30 + $resolver->setDefaults(array(
  31 + 'data_class' => 'AppBundle\Entity\PlanificacionCalificacion'
  32 + ));
  33 + }
  34 +}
... ...
src/AppBundle/Tests/Controller/PlanificacionCalificacionControllerTest.php
... ... @@ -0,0 +1,55 @@
  1 +<?php
  2 +
  3 +namespace AppBundle\Tests\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  6 +
  7 +class PlanificacionCalificacionControllerTest extends WebTestCase
  8 +{
  9 + /*
  10 + public function testCompleteScenario()
  11 + {
  12 + // Create a new client to browse the application
  13 + $client = static::createClient();
  14 +
  15 + // Create a new entry in the database
  16 + $crawler = $client->request('GET', '/ceapp/docente/calificar/');
  17 + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /ceapp/docente/calificar/");
  18 + $crawler = $client->click($crawler->selectLink('Create a new entry')->link());
  19 +
  20 + // Fill in the form and submit it
  21 + $form = $crawler->selectButton('Create')->form(array(
  22 + 'appbundle_planificacioncalificacion[field_name]' => 'Test',
  23 + // ... other fields to fill
  24 + ));
  25 +
  26 + $client->submit($form);
  27 + $crawler = $client->followRedirect();
  28 +
  29 + // Check data in the show view
  30 + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
  31 +
  32 + // Edit the entity
  33 + $crawler = $client->click($crawler->selectLink('Edit')->link());
  34 +
  35 + $form = $crawler->selectButton('Update')->form(array(
  36 + 'appbundle_planificacioncalificacion[field_name]' => 'Foo',
  37 + // ... other fields to fill
  38 + ));
  39 +
  40 + $client->submit($form);
  41 + $crawler = $client->followRedirect();
  42 +
  43 + // Check the element contains an attribute with value equals "Foo"
  44 + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
  45 +
  46 + // Delete the entity
  47 + $client->submit($crawler->selectButton('Delete')->form());
  48 + $crawler = $client->followRedirect();
  49 +
  50 + // Check the entity has been delete on the list
  51 + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
  52 + }
  53 +
  54 + */
  55 +}
... ...