Commit 0efc00cf6c47fdd7cfa3187ff9cb783001e0adc5

Authored by Wilmer Ramones
1 parent f4469e9f37
Exists in master

creada la pllanificacion de la seccion del docente

app/Resources/views/planificacionseccion/index.html.twig
1   -{% extends 'base.html.twig' %}
  1 +{% extends 'base_app.html.twig' %}
2 2  
3 3 {% block body %}
4   - <h1>PlanificacionSeccion list</h1>
  4 + <h1>Listado de Secciones Sin Planificacion</h1>
5 5  
6   - <table>
  6 + <table class="table table-bordered table-hover table-condensed">
7 7 <thead>
8 8 <tr>
9   - <th>Fecha_creacion</th>
10   - <th>Fecha_ultima_actualizacion</th>
11   - <th>Observacion</th>
12   - <th>Id</th>
13   - <th>Actions</th>
  9 + <th>Unidad Curricular</th>
  10 + <th>Seccion</th>
  11 + <th>Cantidad Planificada</th>
  12 + <th>Acciones</th>
14 13 </tr>
15 14 </thead>
16 15 <tbody>
17   - {% for planificacionSeccion in planificacionSeccions %}
  16 + {% for seccion in secciones %}
18 17 <tr>
19   - <td><a href="{{ path('ceapp_docente_planificacion_show', { 'id': planificacionSeccion.id }) }}">{{ planificacionSeccion.fechacreacion }}</a></td>
20   - <td>{% if planificacionSeccion.fechaultimaactualizacion %}{{ planificacionSeccion.fechaultimaactualizacion|date('Y-m-d H:i:s') }}{% endif %}</td>
21   - <td>{{ planificacionSeccion.observacion }}</td>
22   - <td>{{ planificacionSeccion.id }}</td>
  18 + <td><a href="{{ path('ceapp_docente_planificacion_new', { 'seccion': seccion.id }) }}">{{ seccion.ofertaAcademica }}</a></td>
  19 + <td>{{ seccion.nombre }}</td>
  20 + <td>
  21 + {{ seccion.planificacion | length}} temas de {{ seccion.ofertaAcademica.idMallaCurricularUc.idUnidadCurricularVolumen.temas | length }} a planificar
  22 + {% set porcentaje = 0 %}
  23 + {% if seccion.ofertaAcademica.idMallaCurricularUc.idUnidadCurricularVolumen.temas | length > 0 %}{% set porcentaje = ( seccion.planificacion | length * 100 ) / seccion.ofertaAcademica.idMallaCurricularUc.idUnidadCurricularVolumen.temas | length %}{% endif %}
  24 + <div class="progress">
  25 + <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="{{ seccion.planificacion | length}}" aria-valuemin="0" aria-valuemax="{{ seccion.ofertaAcademica.idMallaCurricularUc.idUnidadCurricularVolumen.temas | length }}" style="width:{{porcentaje}}%; min-width: 2em;" >
  26 + {{ porcentaje }}
  27 + </div>
  28 + </div>
  29 + </td>
23 30 <td>
24 31 <ul>
25 32 <li>
26   - <a href="{{ path('ceapp_docente_planificacion_show', { 'id': planificacionSeccion.id }) }}">show</a>
  33 + <a href="{{ path('ceapp_docente_planificacion_new', { 'seccion': seccion.id }) }}">Planificar</a>
27 34 </li>
28 35 <li>
29   - <a href="{{ path('ceapp_docente_planificacion_edit', { 'id': planificacionSeccion.id }) }}">edit</a>
  36 + <a href="{{ path('ceapp_docente_planificacion_edit', { 'id': seccion.id }) }}">edit</a>
30 37 </li>
31 38 </ul>
32 39 </td>
33   - </tr>
  40 + </tr>
34 41 {% endfor %}
35 42 </tbody>
36 43 </table>
37   -
38   - <ul>
39   - <li>
40   - <a href="{{ path('ceapp_docente_planificacion_new') }}">Create a new entry</a>
41   - </li>
42   - </ul>
  44 +
43 45 {% endblock %}
... ...
app/Resources/views/planificacionseccion/new.html.twig
1   -{% extends 'base.html.twig' %}
  1 +{% extends 'base_app.html.twig' %}
2 2  
3 3 {% block body %}
  4 + {% form_theme form 'bootstrap_3_horizontal_layout.html.twig' %}
4 5 <h1>PlanificacionSeccion creation</h1>
5   -
  6 +
6 7 {{ form_start(form) }}
7   - {{ form_widget(form) }}
  8 + {{ form_row(form.seccion) }}
  9 + {{ form_row(form.idtemaUc) }}
  10 +
  11 + <ul class="contenido" data-prototype="{{ form_widget(form.contenido.vars.prototype)|e('html_attr') }}">
  12 +
  13 + </ul>
  14 +
8 15 <input type="submit" value="Create" />
9 16 {{ form_end(form) }}
10 17  
... ... @@ -14,3 +21,87 @@
14 21 </li>
15 22 </ul>
16 23 {% endblock %}
  24 +
  25 +{% block javascripts %}
  26 + {{ parent() }}
  27 + <script type="text/javascript">
  28 +
  29 + var $collectionHolder;
  30 +
  31 + // setup an "add a tag" link
  32 + var $addContenidoLink = $('<a href="#" class="add_contenido_link">Aรฑadir conceptos</a>');
  33 + var $RemoveContenidoLink = $('<a href="#" class="remove_contenido_link">Quitar Conceptos</a>');
  34 +
  35 + var $newLinkLi = $('<li></li>').append($addContenidoLink);
  36 + //$newLinkLi. = $('<li></li>').append($RemoveContenidoLink);
  37 +
  38 +
  39 + jQuery(document).ready(function() {
  40 + // Get the ul that holds the collection of tags
  41 + $collectionHolder = $('ul.contenido');
  42 +
  43 + // add the "add a tag" anchor and li to the tags ul
  44 + $collectionHolder.append($newLinkLi);
  45 +
  46 + // count the current form inputs we have (e.g. 2), use that as the new
  47 + // index when inserting a new item (e.g. 2)
  48 + $collectionHolder.data('index', $collectionHolder.find(':input').length);
  49 +
  50 + $addContenidoLink.on('click', function(e) {
  51 + // prevent the link from creating a "#" on the URL
  52 + e.preventDefault();
  53 +
  54 + // add a new tag form (see next code block)
  55 + addContenidoForm($collectionHolder, $newLinkLi);
  56 + });
  57 +
  58 +
  59 +
  60 + function addContenidoForm($collectionHolder, $newLinkLi) {
  61 + // Get the data-prototype explained earlier
  62 + var prototype = $collectionHolder.data('prototype');
  63 +
  64 + // get the new index
  65 + var index = $collectionHolder.data('index');
  66 +
  67 + // Replace '$$name$$' in the prototype's HTML to
  68 + // instead be a number based on how many items we have
  69 + var newForm = prototype.replace(/__name__/g, index);
  70 +
  71 + // increase the index with one for the next item
  72 + $collectionHolder.data('index', index + 1);
  73 +
  74 + // Display the form in the page in an li, before the "Add a tag" link li
  75 + var $newFormLi = $('<li></li>').append(newForm);
  76 +
  77 + // also add a remove button, just for this example
  78 + $newFormLi.append('<a href="#" class="remove-tag">x</a>');
  79 +
  80 + $newLinkLi.before($newFormLi);
  81 +
  82 + // handle the removal, just for this example
  83 + $('.remove-tag').click(function(e) {
  84 + e.preventDefault();
  85 +
  86 + $(this).parent().remove();
  87 +
  88 + return false;
  89 + });
  90 +
  91 +
  92 + }
  93 +
  94 +
  95 +
  96 + });
  97 +
  98 +
  99 +
  100 +
  101 +
  102 +
  103 +
  104 +
  105 +
  106 + </script>
  107 +{% endblock %}
... ...
src/AppBundle/Controller/PlanificacionSeccionController.php
... ... @@ -8,7 +8,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8 8 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9 9 use AppBundle\Entity\PlanificacionSeccion;
10 10 use AppBundle\Form\PlanificacionSeccionType;
11   -
  11 +use AppBundle\Entity\Seccion;
12 12 /**
13 13 * PlanificacionSeccion controller.
14 14 *
... ... @@ -25,29 +25,42 @@ class PlanificacionSeccionController extends Controller
25 25 public function indexAction()
26 26 {
27 27 $em = $this->getDoctrine()->getManager();
28   -
  28 + $secciones = $em->getRepository('AppBundle:Seccion')->findBy(array(
  29 + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()
  30 + ));
29 31 $planificacionSeccions = $em->getRepository('AppBundle:PlanificacionSeccion')->findAll();
30 32  
31 33 return $this->render('planificacionseccion/index.html.twig', array(
32 34 'planificacionSeccions' => $planificacionSeccions,
  35 + 'secciones' => $secciones
33 36 ));
34 37 }
35 38  
36 39 /**
37 40 * Creates a new PlanificacionSeccion entity.
38 41 *
39   - * @Route("/new", name="ceapp_docente_planificacion_new")
  42 + * @Route("/new/{seccion}", name="ceapp_docente_planificacion_new")
40 43 * @Method({"GET", "POST"})
41 44 */
42   - public function newAction(Request $request)
  45 + public function newAction(Request $request, Seccion $seccion)
43 46 {
44   - $planificacionSeccion = new PlanificacionSeccion();
45   - $form = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion);
  47 + $planificacionSeccion = new PlanificacionSeccion();
  48 + $form = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion, array('seccion' => $seccion));
46 49 $form->handleRequest($request);
47 50  
48   - if ($form->isSubmitted() && $form->isValid()) {
  51 + if ($form->isSubmitted() && $form->isValid()) {
  52 +
  53 +
  54 +
  55 + // ciclo a traves de las relaciones para cada contenido
  56 + foreach($planificacionSeccion->getContenido() as $contenido){
  57 + $contenido->setPlanificacionSeccionId($planificacionSeccion);
  58 + $seccion->addPlanificacion($planificacionSeccion);
  59 + }
  60 + //var_dump($seccion->getPlanificacion()->count()); exit;
49 61 $em = $this->getDoctrine()->getManager();
50 62 $em->persist($planificacionSeccion);
  63 + //$em->persist($seccion);
51 64 $em->flush();
52 65  
53 66 return $this->redirectToRoute('ceapp_docente_planificacion_show', array('id' => $planificacionSeccion->getId()));
... ... @@ -83,8 +96,9 @@ class PlanificacionSeccionController extends Controller
83 96 */
84 97 public function editAction(Request $request, PlanificacionSeccion $planificacionSeccion)
85 98 {
  99 + $seccion = $this->getDoctrine()->getRepository('AppBundle:Seccion')->findOneById($planificacionSeccion->getSeccion());
86 100 $deleteForm = $this->createDeleteForm($planificacionSeccion);
87   - $editForm = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion);
  101 + $editForm = $this->createForm('AppBundle\Form\PlanificacionSeccionType', $planificacionSeccion, array('seccion' => $seccion));
88 102 $editForm->handleRequest($request);
89 103  
90 104 if ($editForm->isSubmitted() && $editForm->isValid()) {
... ...
src/AppBundle/Entity/PlanificacionSeccion.php
... ... @@ -9,8 +9,8 @@ use Doctrine\ORM\Mapping as ORM;
9 9 *
10 10 * @ORM\Table(name="planificacion_seccion",
11 11 * uniqueConstraints=
12   - * {@ORM\UniqueConstraint(name="uq_tema_uc",
13   - * columns={"id_tema_uc"})
  12 + * {@ORM\UniqueConstraint(name="uq_tema_uc_seccion",
  13 + * columns={"id_tema_uc", "seccion_id"})
14 14 * },
15 15 * indexes={
16 16 * @ORM\Index(name="fki_id_tema_uc",
... ... @@ -18,6 +18,7 @@ use Doctrine\ORM\Mapping as ORM;
18 18 * }
19 19 * )
20 20 * @ORM\Entity
  21 + * @ORM\HasLifecycleCallbacks()
21 22 */
22 23 class PlanificacionSeccion
23 24 {
... ... @@ -25,7 +26,7 @@ class PlanificacionSeccion
25 26 /**
26 27 * @var \AppBundle\Entity\UnidadCurricularVolumenTema
27 28 *
28   - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\UnidadCurricularVolumenTema")
  29 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\UnidadCurricularVolumenTema", inversedBy="hasPlanificacion")
29 30 * @ORM\JoinColumns({
30 31 * @ORM\JoinColumn(name="id_tema_uc", referencedColumnName="id", nullable=false)
31 32 * })
... ... @@ -40,7 +41,8 @@ class PlanificacionSeccion
40 41  
41 42  
42 43 /**
43   - * @ORM\OneToMany(targetEntity="PlanificacionSeccionContenido", mappedBy="idPlanificacionContenido")
  44 + * @ORM\OneToMany(targetEntity="PlanificacionSeccionContenido", mappedBy="planificacionSeccionId", cascade={"all"})
  45 + * @var \Doctrine\Common\Collections\ArrayCollection
44 46 */
45 47 private $contenido;
46 48  
... ... @@ -58,18 +60,18 @@ class PlanificacionSeccion
58 60  
59 61  
60 62  
61   - /** @ORM\Column(type="datetime", nullable=false, options={"comment" = "Fecha de creaciรณn de la solicitud"})
  63 + /** @ORM\Column(name="fecha_creacion", type="datetime", nullable=false, options={"comment" = "Fecha de creaciรณn de la solicitud"})
62 64  
63 65 */
64 66  
65   - private $fecha_creacion;
  67 + private $fechaCreacion;
66 68  
67 69  
68   - /** @ORM\Column(type="datetime", nullable=false, options={"comment" = "Fecha de actualizacion de la solicitud"})
  70 + /** @ORM\Column(name="fecha_ultima_actualizacion", type="datetime", nullable=false, options={"comment" = "Fecha de actualizacion de la solicitud"})
69 71  
70 72 */
71 73  
72   - private $fecha_ultima_actualizacion;
  74 + private $fechaUltimaActualizacion;
73 75  
74 76  
75 77 /** @var text
... ... @@ -109,51 +111,7 @@ class PlanificacionSeccion
109 111 $this->evaluacion = new \Doctrine\Common\Collections\ArrayCollection();
110 112 }
111 113  
112   - /**
113   - * Set fecha_creacion
114   - *
115   - * @param \DateTime $fechaCreacion
116   - * @return PlanificacionSeccion
117   - */
118   - public function setFechaCreacion($fechaCreacion)
119   - {
120   - $this->fecha_creacion = $fechaCreacion;
121   -
122   - return $this;
123   - }
124   -
125   - /**
126   - * Get fecha_creacion
127   - *
128   - * @return \DateTime
129   - */
130   - public function getFechaCreacion()
131   - {
132   - return $this->fecha_creacion;
133   - }
134   -
135   - /**
136   - * Set fecha_ultima_actualizacion
137   - *
138   - * @param \DateTime $fechaUltimaActualizacion
139   - * @return PlanificacionSeccion
140   - */
141   - public function setFechaUltimaActualizacion($fechaUltimaActualizacion)
142   - {
143   - $this->fecha_ultima_actualizacion = $fechaUltimaActualizacion;
144   -
145   - return $this;
146   - }
147   -
148   - /**
149   - * Get fecha_ultima_actualizacion
150   - *
151   - * @return \DateTime
152   - */
153   - public function getFechaUltimaActualizacion()
154   - {
155   - return $this->fecha_ultima_actualizacion;
156   - }
  114 +
157 115  
158 116 /**
159 117 * Set observacion
... ... @@ -252,7 +210,9 @@ class PlanificacionSeccion
252 210 */
253 211 public function addContenido(\AppBundle\Entity\PlanificacionSeccionContenido $contenido)
254 212 {
  213 + $contenido->setPlanificacionSeccionId($this);
255 214 $this->contenido[] = $contenido;
  215 +
256 216  
257 217 return $this;
258 218 }
... ... @@ -365,4 +325,69 @@ class PlanificacionSeccion
365 325 {
366 326 return $this->seccion;
367 327 }
  328 +
  329 + /**
  330 + * @ORM\PrePersist()
  331 + */
  332 + public function prePersist()
  333 + {
  334 + $this->fechaCreacion = new \DateTime();
  335 + $this->fechaUltimaActualizacion = new \DateTime();
  336 + }
  337 +
  338 +
  339 + /**
  340 + * @ORM\PreUpdate()
  341 + */
  342 + public function preUpdate()
  343 + {
  344 + $this->fechaUltimaActualizacion = new \DateTime();
  345 + }
  346 +
  347 + /**
  348 + * Get fechaCreacion
  349 + *
  350 + * @return \DateTime
  351 + */
  352 + public function getFechaCreacion()
  353 + {
  354 + return $this->fechaCreacion;
  355 + }
  356 +
  357 +
  358 + /**
  359 + * Set fechaCreacion
  360 + *
  361 + * @param \DateTime $fechaCreacion
  362 + * @return PlanificacionSeccion
  363 + */
  364 + public function setFechaCreacion($fechaCreacion)
  365 + {
  366 + $this->fechaCreacion = $fechaCreacion;
  367 +
  368 + return $this;
  369 + }
  370 +
  371 + /**
  372 + * Set fechaUltimaActualizacion
  373 + *
  374 + * @param \DateTime $fechaUltimaActualizacion
  375 + * @return PlanificacionSeccion
  376 + */
  377 + public function setFechaUltimaActualizacion($fechaUltimaActualizacion)
  378 + {
  379 + $this->fechaUltimaActualizacion = $fechaUltimaActualizacion;
  380 +
  381 + return $this;
  382 + }
  383 +
  384 + /**
  385 + * Get fechaUltimaActualizacion
  386 + *
  387 + * @return \DateTime
  388 + */
  389 + public function getFechaUltimaActualizacion()
  390 + {
  391 + return $this->fechaUltimaActualizacion;
  392 + }
368 393 }
... ...
src/AppBundle/Entity/PlanificacionSeccion.php~
... ... @@ -18,6 +18,7 @@ use Doctrine\ORM\Mapping as ORM;
18 18 * }
19 19 * )
20 20 * @ORM\Entity
  21 + * @ORM\HasLifecycleCallbacks()
21 22 */
22 23 class PlanificacionSeccion
23 24 {
... ... @@ -40,7 +41,8 @@ class PlanificacionSeccion
40 41  
41 42  
42 43 /**
43   - * @ORM\OneToMany(targetEntity="PlanificacionSeccionContenido", mappedBy="idPlanificacionContenido")
  44 + * @ORM\OneToMany(targetEntity="PlanificacionSeccionContenido", mappedBy="PlanificacionSeccion",cascade={"persist", "remove"})
  45 + * @var \Doctrine\Common\Collections\ArrayCollection
44 46 */
45 47 private $contenido;
46 48  
... ... @@ -58,18 +60,18 @@ class PlanificacionSeccion
58 60  
59 61  
60 62  
61   - /** @ORM\Column(type="datetime", nullable=false, options={"comment" = "Fecha de creaciรณn de la solicitud"})
  63 + /** @ORM\Column(name="fecha_creacion", type="datetime", nullable=false, options={"comment" = "Fecha de creaciรณn de la solicitud"})
62 64  
63 65 */
64 66  
65   - private $fecha_creacion;
  67 + private $fechaCreacion;
66 68  
67 69  
68   - /** @ORM\Column(type="datetime", nullable=false, options={"comment" = "Fecha de actualizacion de la solicitud"})
  70 + /** @ORM\Column(name="fecha_ultima_actualizacion", type="datetime", nullable=false, options={"comment" = "Fecha de actualizacion de la solicitud"})
69 71  
70 72 */
71 73  
72   - private $fecha_ultima_actualizacion;
  74 + private $fechaUltimaActualizacion;
73 75  
74 76  
75 77 /** @var text
... ... @@ -98,4 +100,292 @@ class PlanificacionSeccion
98 100  
99 101  
100 102  
  103 + /**
  104 + * Constructor
  105 + */
  106 + public function __construct()
  107 + {
  108 + $this->objetivoEspecifico = new \Doctrine\Common\Collections\ArrayCollection();
  109 + $this->contenido = new \Doctrine\Common\Collections\ArrayCollection();
  110 + $this->estrategia = new \Doctrine\Common\Collections\ArrayCollection();
  111 + $this->evaluacion = new \Doctrine\Common\Collections\ArrayCollection();
  112 + }
  113 +
  114 +
  115 +
  116 + /**
  117 + * Set observacion
  118 + *
  119 + * @param string $observacion
  120 + * @return PlanificacionSeccion
  121 + */
  122 + public function setObservacion($observacion)
  123 + {
  124 + $this->observacion = $observacion;
  125 +
  126 + return $this;
  127 + }
  128 +
  129 + /**
  130 + * Get observacion
  131 + *
  132 + * @return string
  133 + */
  134 + public function getObservacion()
  135 + {
  136 + return $this->observacion;
  137 + }
  138 +
  139 + /**
  140 + * Get id
  141 + *
  142 + * @return integer
  143 + */
  144 + public function getId()
  145 + {
  146 + return $this->id;
  147 + }
  148 +
  149 + /**
  150 + * Set idtemaUc
  151 + *
  152 + * @param \AppBundle\Entity\UnidadCurricularVolumenTema $idtemaUc
  153 + * @return PlanificacionSeccion
  154 + */
  155 + public function setIdtemaUc(\AppBundle\Entity\UnidadCurricularVolumenTema $idtemaUc)
  156 + {
  157 + $this->idtemaUc = $idtemaUc;
  158 +
  159 + return $this;
  160 + }
  161 +
  162 + /**
  163 + * Get idtemaUc
  164 + *
  165 + * @return \AppBundle\Entity\UnidadCurricularVolumenTema
  166 + */
  167 + public function getIdtemaUc()
  168 + {
  169 + return $this->idtemaUc;
  170 + }
  171 +
  172 + /**
  173 + * Add objetivoEspecifico
  174 + *
  175 + * @param \AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico
  176 + * @return PlanificacionSeccion
  177 + */
  178 + public function addObjetivoEspecifico(\AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico)
  179 + {
  180 + $this->objetivoEspecifico[] = $objetivoEspecifico;
  181 +
  182 + return $this;
  183 + }
  184 +
  185 + /**
  186 + * Remove objetivoEspecifico
  187 + *
  188 + * @param \AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico
  189 + */
  190 + public function removeObjetivoEspecifico(\AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico)
  191 + {
  192 + $this->objetivoEspecifico->removeElement($objetivoEspecifico);
  193 + }
  194 +
  195 + /**
  196 + * Get objetivoEspecifico
  197 + *
  198 + * @return \Doctrine\Common\Collections\Collection
  199 + */
  200 + public function getObjetivoEspecifico()
  201 + {
  202 + return $this->objetivoEspecifico;
  203 + }
  204 +
  205 + /**
  206 + * Add contenido
  207 + *
  208 + * @param \AppBundle\Entity\PlanificacionSeccionContenido $contenido
  209 + * @return PlanificacionSeccion
  210 + */
  211 + public function addContenido(\AppBundle\Entity\PlanificacionSeccionContenido $contenido)
  212 + {
  213 + $this->contenido[] = $contenido;
  214 +
  215 + return $this;
  216 + }
  217 +
  218 + /**
  219 + * Remove contenido
  220 + *
  221 + * @param \AppBundle\Entity\PlanificacionSeccionContenido $contenido
  222 + */
  223 + public function removeContenido(\AppBundle\Entity\PlanificacionSeccionContenido $contenido)
  224 + {
  225 + $this->contenido->removeElement($contenido);
  226 + }
  227 +
  228 + /**
  229 + * Get contenido
  230 + *
  231 + * @return \Doctrine\Common\Collections\Collection
  232 + */
  233 + public function getContenido()
  234 + {
  235 + return $this->contenido;
  236 + }
  237 +
  238 + /**
  239 + * Add estrategia
  240 + *
  241 + * @param \AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia
  242 + * @return PlanificacionSeccion
  243 + */
  244 + public function addEstrategium(\AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia)
  245 + {
  246 + $this->estrategia[] = $estrategia;
  247 +
  248 + return $this;
  249 + }
  250 +
  251 + /**
  252 + * Remove estrategia
  253 + *
  254 + * @param \AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia
  255 + */
  256 + public function removeEstrategium(\AppBundle\Entity\PlanificacionSeccionEstrategia $estrategia)
  257 + {
  258 + $this->estrategia->removeElement($estrategia);
  259 + }
  260 +
  261 + /**
  262 + * Get estrategia
  263 + *
  264 + * @return \Doctrine\Common\Collections\Collection
  265 + */
  266 + public function getEstrategia()
  267 + {
  268 + return $this->estrategia;
  269 + }
  270 +
  271 + /**
  272 + * Add evaluacion
  273 + *
  274 + * @param \AppBundle\Entity\PlanificacionSeccionEvaluacion $evaluacion
  275 + * @return PlanificacionSeccion
  276 + */
  277 + public function addEvaluacion(\AppBundle\Entity\PlanificacionSeccionEvaluacion $evaluacion)
  278 + {
  279 + $this->evaluacion[] = $evaluacion;
  280 +
  281 + return $this;
  282 + }
  283 +
  284 + /**
  285 + * Remove evaluacion
  286 + *
  287 + * @param \AppBundle\Entity\PlanificacionSeccionEvaluacion $evaluacion
  288 + */
  289 + public function removeEvaluacion(\AppBundle\Entity\PlanificacionSeccionEvaluacion $evaluacion)
  290 + {
  291 + $this->evaluacion->removeElement($evaluacion);
  292 + }
  293 +
  294 + /**
  295 + * Get evaluacion
  296 + *
  297 + * @return \Doctrine\Common\Collections\Collection
  298 + */
  299 + public function getEvaluacion()
  300 + {
  301 + return $this->evaluacion;
  302 + }
  303 +
  304 + /**
  305 + * Set seccion
  306 + *
  307 + * @param \AppBundle\Entity\Seccion $seccion
  308 + * @return PlanificacionSeccion
  309 + */
  310 + public function setSeccion(\AppBundle\Entity\Seccion $seccion = null)
  311 + {
  312 + $this->seccion = $seccion;
  313 +
  314 + return $this;
  315 + }
  316 +
  317 + /**
  318 + * Get seccion
  319 + *
  320 + * @return \AppBundle\Entity\Seccion
  321 + */
  322 + public function getSeccion()
  323 + {
  324 + return $this->seccion;
  325 + }
  326 +
  327 + /**
  328 + * @ORM\PrePersist()
  329 + */
  330 + public function prePersist()
  331 + {
  332 + $this->fechaCreacion = new \DateTime();
  333 + $this->fechaUltimaActualizacion = new \DateTime();
  334 + }
  335 +
  336 +
  337 + /**
  338 + * @ORM\PreUpdate()
  339 + */
  340 + public function preUpdate()
  341 + {
  342 + $this->fechaUltimaActualizacion = new \DateTime();
  343 + }
  344 +
  345 + /**
  346 + * Get fechaCreacion
  347 + *
  348 + * @return \DateTime
  349 + */
  350 + public function getFechaCreacion()
  351 + {
  352 + return $this->fechaCreacion;
  353 + }
  354 +
  355 +
  356 + /**
  357 + * Set fechaCreacion
  358 + *
  359 + * @param \DateTime $fechaCreacion
  360 + * @return PlanificacionSeccion
  361 + */
  362 + public function setFechaCreacion($fechaCreacion)
  363 + {
  364 + $this->fechaCreacion = $fechaCreacion;
  365 +
  366 + return $this;
  367 + }
  368 +
  369 + /**
  370 + * Set fechaUltimaActualizacion
  371 + *
  372 + * @param \DateTime $fechaUltimaActualizacion
  373 + * @return PlanificacionSeccion
  374 + */
  375 + public function setFechaUltimaActualizacion($fechaUltimaActualizacion)
  376 + {
  377 + $this->fechaUltimaActualizacion = $fechaUltimaActualizacion;
  378 +
  379 + return $this;
  380 + }
  381 +
  382 + /**
  383 + * Get fechaUltimaActualizacion
  384 + *
  385 + * @return \DateTime
  386 + */
  387 + public function getFechaUltimaActualizacion()
  388 + {
  389 + return $this->fechaUltimaActualizacion;
  390 + }
101 391 }
... ...
src/AppBundle/Entity/PlanificacionSeccionContenido.php
... ... @@ -7,16 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
7 7 /**
8 8 * PlanificacionSeccionContenido
9 9 *
10   - * @ORM\Table(name="planificacion_seccion_contenido",
11   - * uniqueConstraints=
12   - * {@ORM\UniqueConstraint(name="uq_planificacion_seccion_contenido",
13   - * columns={"id_planificacion_seccion"})
14   - * },
15   - * indexes={
16   - * @ORM\Index(name="fki_id_planificacion_seccion",
17   - * columns={"id_planificacion_seccion"})
18   - * }
19   - * )
  10 + * @ORM\Table(name="planificacion_seccion_contenido")
20 11 * @ORM\Entity
21 12 */
22 13 class PlanificacionSeccionContenido
... ... @@ -56,21 +47,12 @@ class PlanificacionSeccionContenido
56 47 */
57 48 private $id;
58 49  
59   - /**
60   - * @var \AppBundle\Entity\PlanificacionSeccion
61   - *
62   - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion")
63   - * @ORM\JoinColumns({
64   - * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false)
65   - * })
66   - */
67   - private $idPlanificacionSeccion;
68 50  
69 51 /**
70 52 * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="contenido")
71   - * @ORM\JoinColumn(name="id_planificacion_contenido", referencedColumnName="id")
  53 + * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id", nullable=FALSE)
72 54 */
73   - private $idPlanificacionContenido;
  55 + protected $planificacionSeccionId;
74 56  
75 57  
76 58  
... ... @@ -153,49 +135,29 @@ class PlanificacionSeccionContenido
153 135 return $this->id;
154 136 }
155 137  
156   - /**
157   - * Set idPlanificacionSeccion
158   - *
159   - * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion
160   - * @return PlanificacionSeccionContenido
161   - */
162   - public function setIdPlanificacionSeccion(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion)
163   - {
164   - $this->idPlanificacionSeccion = $idPlanificacionSeccion;
165   -
166   - return $this;
167   - }
168   -
169   - /**
170   - * Get idPlanificacionSeccion
171   - *
172   - * @return \AppBundle\Entity\PlanificacionSeccion
173   - */
174   - public function getIdPlanificacionSeccion()
175   - {
176   - return $this->idPlanificacionSeccion;
177   - }
  138 +
  139 +
178 140  
179 141 /**
180   - * Set idPlanificacionContenido
  142 + * Set planificacionSeccionId
181 143 *
182   - * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionContenido
  144 + * @param \AppBundle\Entity\PlanificacionSeccion $planificacionSeccionId
183 145 * @return PlanificacionSeccionContenido
184 146 */
185   - public function setIdPlanificacionContenido(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionContenido = null)
  147 + public function setPlanificacionSeccionId(\AppBundle\Entity\PlanificacionSeccion $planificacionSeccionId)
186 148 {
187   - $this->idPlanificacionContenido = $idPlanificacionContenido;
  149 + $this->planificacionSeccionId = $planificacionSeccionId;
188 150  
189 151 return $this;
190 152 }
191 153  
192 154 /**
193   - * Get idPlanificacionContenido
  155 + * Get planificacionSeccionId
194 156 *
195 157 * @return \AppBundle\Entity\PlanificacionSeccion
196 158 */
197   - public function getIdPlanificacionContenido()
  159 + public function getPlanificacionSeccionId()
198 160 {
199   - return $this->idPlanificacionContenido;
  161 + return $this->planificacionSeccionId;
200 162 }
201 163 }
... ...
src/AppBundle/Entity/PlanificacionSeccionContenido.php~
... ... @@ -7,16 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
7 7 /**
8 8 * PlanificacionSeccionContenido
9 9 *
10   - * @ORM\Table(name="planificacion_seccion_contenido",
11   - * uniqueConstraints=
12   - * {@ORM\UniqueConstraint(name="uq_planificacion_seccion_contenido",
13   - * columns={"id_planificacion_seccion"})
14   - * },
15   - * indexes={
16   - * @ORM\Index(name="fki_id_planificacion_seccion",
17   - * columns={"id_planificacion_seccion"})
18   - * }
19   - * )
  10 + * @ORM\Table(name="planificacion_seccion_contenido")
20 11 * @ORM\Entity
21 12 */
22 13 class PlanificacionSeccionContenido
... ... @@ -56,21 +47,94 @@ class PlanificacionSeccionContenido
56 47 */
57 48 private $id;
58 49  
  50 +
59 51 /**
60   - * @var \AppBundle\Entity\PlanificacionSeccion
61   - *
62   - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion")
63   - * @ORM\JoinColumns({
64   - * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false)
65   - * })
  52 + * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="contenido")
  53 + * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id", nullable=FALSE)
66 54 */
67   - private $idPlanificacionSeccion;
  55 + protected $planificacionSeccion;
  56 +
68 57  
  58 +
69 59 /**
70   - * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="contenido")
71   - * @ORM\JoinColumn(name="id_planificacion_contenido", referencedColumnName="id")
  60 + * Set conceptual
  61 + *
  62 + * @param string $conceptual
  63 + * @return PlanificacionSeccionContenido
  64 + */
  65 + public function setConceptual($conceptual)
  66 + {
  67 + $this->conceptual = $conceptual;
  68 +
  69 + return $this;
  70 + }
  71 +
  72 + /**
  73 + * Get conceptual
  74 + *
  75 + * @return string
  76 + */
  77 + public function getConceptual()
  78 + {
  79 + return $this->conceptual;
  80 + }
  81 +
  82 + /**
  83 + * Set procedimental
  84 + *
  85 + * @param string $procedimental
  86 + * @return PlanificacionSeccionContenido
  87 + */
  88 + public function setProcedimental($procedimental)
  89 + {
  90 + $this->procedimental = $procedimental;
  91 +
  92 + return $this;
  93 + }
  94 +
  95 + /**
  96 + * Get procedimental
  97 + *
  98 + * @return string
  99 + */
  100 + public function getProcedimental()
  101 + {
  102 + return $this->procedimental;
  103 + }
  104 +
  105 + /**
  106 + * Set actitudinal
  107 + *
  108 + * @param string $actitudinal
  109 + * @return PlanificacionSeccionContenido
  110 + */
  111 + public function setActitudinal($actitudinal)
  112 + {
  113 + $this->actitudinal = $actitudinal;
  114 +
  115 + return $this;
  116 + }
  117 +
  118 + /**
  119 + * Get actitudinal
  120 + *
  121 + * @return string
  122 + */
  123 + public function getActitudinal()
  124 + {
  125 + return $this->actitudinal;
  126 + }
  127 +
  128 + /**
  129 + * Get id
  130 + *
  131 + * @return integer
72 132 */
73   - private $idPlanificacionContenido;
  133 + public function getId()
  134 + {
  135 + return $this->id;
  136 + }
74 137  
  138 +
75 139  
76 140 }
... ...
src/AppBundle/Entity/Seccion.php
... ... @@ -88,7 +88,7 @@ class Seccion
88 88 private $ofertaAcademica;
89 89  
90 90 /**
91   - * @ORM\OneToMany(targetEntity="PlanificacionSeccion", mappedBy="seccion")
  91 + * @ORM\OneToMany(targetEntity="PlanificacionSeccion", mappedBy="seccion", cascade={"all"})
92 92 */
93 93 private $planificacion;
94 94  
... ...
src/AppBundle/Entity/UnidadCurricularVolumenTema.php
... ... @@ -52,6 +52,13 @@ class UnidadCurricularVolumenTema
52 52 */
53 53 private $id;
54 54  
  55 + /**
  56 + * @ORM\OneToMany(targetEntity="PlanificacionSeccion", mappedBy="idtemaUc")
  57 + */
  58 + private $hasPlanificacion;
  59 +
  60 +
  61 +
55 62  
56 63  
57 64 /**
... ... @@ -169,4 +176,46 @@ class UnidadCurricularVolumenTema
169 176 {
170 177 return $this->orden;
171 178 }
  179 +
  180 +
  181 + /**
  182 + * Constructor
  183 + */
  184 + public function __construct()
  185 + {
  186 + $this->hasPlanificacion = new \Doctrine\Common\Collections\ArrayCollection();
  187 + }
  188 +
  189 + /**
  190 + * Add hasPlanificacion
  191 + *
  192 + * @param \AppBundle\Entity\PlanificacionSeccion $hasPlanificacion
  193 + * @return UnidadCurricularVolumenTema
  194 + */
  195 + public function addHasPlanificacion(\AppBundle\Entity\PlanificacionSeccion $hasPlanificacion)
  196 + {
  197 + $this->hasPlanificacion[] = $hasPlanificacion;
  198 +
  199 + return $this;
  200 + }
  201 +
  202 + /**
  203 + * Remove hasPlanificacion
  204 + *
  205 + * @param \AppBundle\Entity\PlanificacionSeccion $hasPlanificacion
  206 + */
  207 + public function removeHasPlanificacion(\AppBundle\Entity\PlanificacionSeccion $hasPlanificacion)
  208 + {
  209 + $this->hasPlanificacion->removeElement($hasPlanificacion);
  210 + }
  211 +
  212 + /**
  213 + * Get hasPlanificacion
  214 + *
  215 + * @return \Doctrine\Common\Collections\Collection
  216 + */
  217 + public function getHasPlanificacion()
  218 + {
  219 + return $this->hasPlanificacion;
  220 + }
172 221 }
... ...
src/AppBundle/Entity/UnidadCurricularVolumenTema.php~
... ... @@ -14,9 +14,9 @@ use Doctrine\ORM\Mapping as ORM;
14 14 class UnidadCurricularVolumenTema
15 15 {
16 16 /**
17   - * @var string
  17 + * @var text
18 18 *
19   - * @ORM\Column(name="tema", type="string", length=50, nullable=false, options={"comment" = "nombre del estado"})
  19 + * @ORM\Column(name="tema", type="text", nullable=false, options={"comment" = "nombre del estado"})
20 20 */
21 21 private $nombre;
22 22  
... ... @@ -52,6 +52,13 @@ class UnidadCurricularVolumenTema
52 52 */
53 53 private $id;
54 54  
  55 + /**
  56 + * @ORM\OneToMany(targetEntity="PlanificacionSeccion", mappedBy="idtemaUc")
  57 + */
  58 + private $hasPlanificacion;
  59 +
  60 +
  61 +
55 62  
56 63  
57 64 /**
... ... @@ -146,4 +153,29 @@ class UnidadCurricularVolumenTema
146 153 {
147 154 return $this->objetivoGeneral;
148 155 }
  156 +
  157 + /**
  158 + * Set orden
  159 + *
  160 + * @param integer $orden
  161 + * @return UnidadCurricularVolumenTema
  162 + */
  163 + public function setOrden($orden)
  164 + {
  165 + $this->orden = $orden;
  166 +
  167 + return $this;
  168 + }
  169 +
  170 + /**
  171 + * Get orden
  172 + *
  173 + * @return integer
  174 + */
  175 + public function getOrden()
  176 + {
  177 + return $this->orden;
  178 + }
  179 +
  180 +
149 181 }
... ...
src/AppBundle/Form/PlanificacionSeccionContenidoType.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 PlanificacionSeccionContenidoType 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('conceptual')
  19 + ->add('procedimental')
  20 + ->add('actitudinal')
  21 + //->add('planificacionSeccion')
  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\PlanificacionSeccionContenido'
  32 + ));
  33 + }
  34 +}
... ...
src/AppBundle/Form/PlanificacionSeccionType.php
... ... @@ -5,6 +5,9 @@ namespace AppBundle\Form;
5 5 use Symfony\Component\Form\AbstractType;
6 6 use Symfony\Component\Form\FormBuilderInterface;
7 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;
8 11  
9 12 class PlanificacionSeccionType extends AbstractType
10 13 {
... ... @@ -14,10 +17,38 @@ class PlanificacionSeccionType extends AbstractType
14 17 */
15 18 public function buildForm(FormBuilderInterface $builder, array $options)
16 19 {
  20 + $this->seccion = $options['seccion'];
  21 + //var_dump($this->seccion); exit;
17 22 $builder
18   - ->add('idtemaUc')
19   - ->add('observacion')
20   - ->add('seccion')
  23 +
  24 + ->add('idtemaUc', EntityType::class, array(
  25 + 'class' => 'AppBundle:UnidadCurricularVolumenTema',
  26 + 'query_builder' => function (EntityRepository $er) {
  27 + return $er->createQueryBuilder('u')
  28 + ->orderBy('u.orden', 'ASC')
  29 + ->where('u.idUnidadCurricularVolumen = ?1') //que las uc conicidan con la malla del estado academico
  30 + ->setParameters(array(
  31 + 1 => $this->seccion->getOfertaAcademica()->getIdMallaCurricularUc()->getIdUnidadCurricularVolumen()->getId()
  32 + ));
  33 + ;},
  34 +
  35 + ))
  36 + ->add('seccion', EntityType::class, array(
  37 + 'class' => 'AppBundle:Seccion',
  38 + 'query_builder' => function (EntityRepository $er) {
  39 + return $er->createQueryBuilder('u')
  40 + ->where('u.id = ?1') //que las uc conicidan con la malla del estado academico
  41 + ->setParameters(array(
  42 + 1 => $this->seccion->getId(),
  43 + ));
  44 + ;},
  45 + ))
  46 + ->add('contenido', CollectionType::class, array(
  47 + 'entry_type' => PlanificacionSeccionContenidoType::class,
  48 + 'allow_add' => true,
  49 + 'label' => false
  50 + ))
  51 +
21 52 ;
22 53 }
23 54  
... ... @@ -27,7 +58,8 @@ class PlanificacionSeccionType extends AbstractType
27 58 public function configureOptions(OptionsResolver $resolver)
28 59 {
29 60 $resolver->setDefaults(array(
30   - 'data_class' => 'AppBundle\Entity\PlanificacionSeccion'
  61 + 'data_class' => 'AppBundle\Entity\PlanificacionSeccion',
  62 + 'seccion' => null
31 63 ));
32 64 }
33 65 }
... ...