Commit 3c11f32e619ba7a65ac8228bcc84b72c2e178def

Authored by Wilmer Ramones
1 parent 90aaf1c268
Exists in master

creado los objetivos especificos para la planificacion

app/Resources/views/planificacionseccion/new.html.twig
@@ -12,6 +12,10 @@ @@ -12,6 +12,10 @@
12 12
13 </ul> 13 </ul>
14 14
  15 + <ul class="objetivoEspecifico" data-prototype="{{ form_widget(form.objetivoEspecifico.vars.prototype)|e('html_attr') }}">
  16 +
  17 + </ul>
  18 +
15 <input type="submit" value="Create" /> 19 <input type="submit" value="Create" />
16 {{ form_end(form) }} 20 {{ form_end(form) }}
17 21
@@ -29,55 +33,102 @@ @@ -29,55 +33,102 @@
29 var $collectionHolder; 33 var $collectionHolder;
30 34
31 // setup an "add a tag" link 35 // setup an "add a tag" link
  36 + var $addEspecificoLink = $('<a href="#" class="add_especifico_link">Añadir Objetivos Especificos</a>');
32 var $addContenidoLink = $('<a href="#" class="add_contenido_link">Añadir conceptos</a>'); 37 var $addContenidoLink = $('<a href="#" class="add_contenido_link">Añadir conceptos</a>');
33 var $RemoveContenidoLink = $('<a href="#" class="remove_contenido_link">Quitar Conceptos</a>'); 38 var $RemoveContenidoLink = $('<a href="#" class="remove_contenido_link">Quitar Conceptos</a>');
34 39
35 - var $newLinkLi = $('<li></li>').append($addContenidoLink); 40 + var $newLinkLiContenido = $('<li></li>').append($addContenidoLink);
  41 + var $newLinkLiEspecifico = $('<li></li>').append($addEspecificoLink);
36 //$newLinkLi. = $('<li></li>').append($RemoveContenidoLink); 42 //$newLinkLi. = $('<li></li>').append($RemoveContenidoLink);
37 43
38 44
39 jQuery(document).ready(function() { 45 jQuery(document).ready(function() {
40 // Get the ul that holds the collection of tags 46 // Get the ul that holds the collection of tags
41 - $collectionHolder = $('ul.contenido');  
42 - 47 + $contenidoHolder = $('ul.contenido');
  48 + $especificoHolder = $('ul.objetivoEspecifico');
43 // add the "add a tag" anchor and li to the tags ul 49 // add the "add a tag" anchor and li to the tags ul
44 - $collectionHolder.append($newLinkLi); 50 + $contenidoHolder.append($newLinkLiContenido);
  51 + $especificoHolder.append($newLinkLiEspecifico);
45 52
46 // count the current form inputs we have (e.g. 2), use that as the new 53 // 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) 54 // index when inserting a new item (e.g. 2)
48 - $collectionHolder.data('index', $collectionHolder.find(':input').length); 55 + $contenidoHolder.data('index', $contenidoHolder.find(':input').length);
  56 + $especificoHolder.data('index', $especificoHolder.find(':input').length);
49 57
50 $addContenidoLink.on('click', function(e) { 58 $addContenidoLink.on('click', function(e) {
51 // prevent the link from creating a "#" on the URL 59 // prevent the link from creating a "#" on the URL
52 e.preventDefault(); 60 e.preventDefault();
53 61
54 // add a new tag form (see next code block) 62 // add a new tag form (see next code block)
55 - addContenidoForm($collectionHolder, $newLinkLi); 63 + addContenidoForm($contenidoHolder, $newLinkLiContenido);
  64 + });
  65 +
  66 + $addEspecificoLink.on('click', function(e) {
  67 + // prevent the link from creating a "#" on the URL
  68 + e.preventDefault();
  69 +
  70 + // add a new tag form (see next code block)
  71 + addEspecificoForm($especificoHolder, $newLinkLiEspecifico);
56 }); 72 });
57 73
58 74
59 75
60 - function addContenidoForm($collectionHolder, $newLinkLi) { 76 + function addContenidoForm($contenidoHolder, $newLinkLiContenido) {
  77 + // Get the data-prototype explained earlier
  78 + var prototype = $contenidoHolder.data('prototype');
  79 +
  80 + // get the new index
  81 + var index = $contenidoHolder.data('index');
  82 +
  83 + // Replace '$$name$$' in the prototype's HTML to
  84 + // instead be a number based on how many items we have
  85 + var newFormContenido = prototype.replace(/__name__/g, index);
  86 +
  87 + // increase the index with one for the next item
  88 + $contenidoHolder.data('index', index + 1);
  89 +
  90 + // Display the form in the page in an li, before the "Add a tag" link li
  91 + var $newFormLiContenido = $('<li></li>').append(newFormContenido);
  92 +
  93 + // also add a remove button, just for this example
  94 + $newFormLiContenido.append('<a href="#" class="remove-tag">x</a>');
  95 +
  96 + $newLinkLiContenido.before($newFormLiContenido);
  97 +
  98 + // handle the removal, just for this example
  99 + $('.remove-tag').click(function(e) {
  100 + e.preventDefault();
  101 +
  102 + $(this).parent().remove();
  103 +
  104 + return false;
  105 + });
  106 +
  107 +
  108 + }
  109 +
  110 +
  111 + function addEspecificoForm($especificoHolder, $newLinkLiEspecifico) {
61 // Get the data-prototype explained earlier 112 // Get the data-prototype explained earlier
62 - var prototype = $collectionHolder.data('prototype'); 113 + var prototype = $especificoHolder.data('prototype');
63 114
64 // get the new index 115 // get the new index
65 - var index = $collectionHolder.data('index'); 116 + var index = $especificoHolder.data('index');
66 117
67 // Replace '$$name$$' in the prototype's HTML to 118 // Replace '$$name$$' in the prototype's HTML to
68 // instead be a number based on how many items we have 119 // instead be a number based on how many items we have
69 - var newForm = prototype.replace(/__name__/g, index); 120 + var newFormEspecifico = prototype.replace(/__name__/g, index);
70 121
71 // increase the index with one for the next item 122 // increase the index with one for the next item
72 - $collectionHolder.data('index', index + 1); 123 + $especificoHolder.data('index', index + 1);
73 124
74 // Display the form in the page in an li, before the "Add a tag" link li 125 // Display the form in the page in an li, before the "Add a tag" link li
75 - var $newFormLi = $('<li></li>').append(newForm); 126 + var $newFormLiEspecifico = $('<li></li>').append(newFormEspecifico);
76 127
77 // also add a remove button, just for this example 128 // also add a remove button, just for this example
78 - $newFormLi.append('<a href="#" class="remove-tag">x</a>'); 129 + $newFormLiEspecifico.append('<a href="#" class="remove-tag">x</a>');
79 130
80 - $newLinkLi.before($newFormLi); 131 + $newLinkLiEspecifico.before($newFormLiEspecifico);
81 132
82 // handle the removal, just for this example 133 // handle the removal, just for this example
83 $('.remove-tag').click(function(e) { 134 $('.remove-tag').click(function(e) {
src/AppBundle/Controller/PlanificacionSeccionController.php
@@ -63,6 +63,11 @@ class PlanificacionSeccionController extends Controller @@ -63,6 +63,11 @@ class PlanificacionSeccionController extends Controller
63 $contenido->setPlanificacionSeccionId($planificacionSeccion); 63 $contenido->setPlanificacionSeccionId($planificacionSeccion);
64 $seccion->addPlanificacion($planificacionSeccion); 64 $seccion->addPlanificacion($planificacionSeccion);
65 } 65 }
  66 +
  67 + foreach($planificacionSeccion->getObjetivoEspecifico() as $especifico){
  68 + $especifico->setPlanificacionSeccionId($planificacionSeccion);
  69 + }
  70 +
66 //var_dump($seccion->getPlanificacion()->count()); exit; 71 //var_dump($seccion->getPlanificacion()->count()); exit;
67 $em = $this->getDoctrine()->getManager(); 72 $em = $this->getDoctrine()->getManager();
68 $em->persist($planificacionSeccion); 73 $em->persist($planificacionSeccion);
src/AppBundle/Entity/PlanificacionSeccion.php
@@ -35,7 +35,8 @@ class PlanificacionSeccion @@ -35,7 +35,8 @@ class PlanificacionSeccion
35 35
36 36
37 /** 37 /**
38 - * @ORM\OneToMany(targetEntity="PlanificacionSeccionEspecifico", mappedBy="idPlanificacionEspecifico") 38 + * @ORM\OneToMany(targetEntity="PlanificacionSeccionEspecifico", mappedBy="planificacionSeccionId",cascade={"all"})
  39 + * @var \Doctrine\Common\Collections\ArrayCollection
39 */ 40 */
40 private $objetivoEspecifico; 41 private $objetivoEspecifico;
41 42
@@ -169,38 +170,7 @@ class PlanificacionSeccion @@ -169,38 +170,7 @@ class PlanificacionSeccion
169 return $this->idtemaUc; 170 return $this->idtemaUc;
170 } 171 }
171 172
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 - } 173 +
204 174
205 /** 175 /**
206 * Add contenido 176 * Add contenido
@@ -390,4 +360,37 @@ class PlanificacionSeccion @@ -390,4 +360,37 @@ class PlanificacionSeccion
390 { 360 {
391 return $this->fechaUltimaActualizacion; 361 return $this->fechaUltimaActualizacion;
392 } 362 }
  363 +
  364 + /**
  365 + * Add objetivoEspecifico
  366 + *
  367 + * @param \AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico
  368 + * @return PlanificacionSeccion
  369 + */
  370 + public function addObjetivoEspecifico(\AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico)
  371 + {
  372 + $this->objetivoEspecifico[] = $objetivoEspecifico;
  373 +
  374 + return $this;
  375 + }
  376 +
  377 + /**
  378 + * Remove objetivoEspecifico
  379 + *
  380 + * @param \AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico
  381 + */
  382 + public function removeObjetivoEspecifico(\AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico)
  383 + {
  384 + $this->objetivoEspecifico->removeElement($objetivoEspecifico);
  385 + }
  386 +
  387 + /**
  388 + * Get objetivoEspecifico
  389 + *
  390 + * @return \Doctrine\Common\Collections\Collection
  391 + */
  392 + public function getObjetivoEspecifico()
  393 + {
  394 + return $this->objetivoEspecifico;
  395 + }
393 } 396 }
src/AppBundle/Entity/PlanificacionSeccion.php~
@@ -9,8 +9,8 @@ use Doctrine\ORM\Mapping as ORM; @@ -9,8 +9,8 @@ use Doctrine\ORM\Mapping as ORM;
9 * 9 *
10 * @ORM\Table(name="planificacion_seccion", 10 * @ORM\Table(name="planificacion_seccion",
11 * uniqueConstraints= 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 * indexes={ 15 * indexes={
16 * @ORM\Index(name="fki_id_tema_uc", 16 * @ORM\Index(name="fki_id_tema_uc",
@@ -26,7 +26,7 @@ class PlanificacionSeccion @@ -26,7 +26,7 @@ class PlanificacionSeccion
26 /** 26 /**
27 * @var \AppBundle\Entity\UnidadCurricularVolumenTema 27 * @var \AppBundle\Entity\UnidadCurricularVolumenTema
28 * 28 *
29 - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\UnidadCurricularVolumenTema") 29 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\UnidadCurricularVolumenTema", inversedBy="hasPlanificacion")
30 * @ORM\JoinColumns({ 30 * @ORM\JoinColumns({
31 * @ORM\JoinColumn(name="id_tema_uc", referencedColumnName="id", nullable=false) 31 * @ORM\JoinColumn(name="id_tema_uc", referencedColumnName="id", nullable=false)
32 * }) 32 * })
@@ -35,13 +35,14 @@ class PlanificacionSeccion @@ -35,13 +35,14 @@ class PlanificacionSeccion
35 35
36 36
37 /** 37 /**
38 - * @ORM\OneToMany(targetEntity="PlanificacionSeccionEspecifico", mappedBy="idPlanificacionEspecifico") 38 + * @ORM\OneToMany(targetEntity="PlanificacionSeccionEspecifico", mappedBy="planificacionSeccionId")
  39 + * @var \Doctrine\Common\Collections\ArrayCollection
39 */ 40 */
40 private $objetivoEspecifico; 41 private $objetivoEspecifico;
41 42
42 43
43 /** 44 /**
44 - * @ORM\OneToMany(targetEntity="PlanificacionSeccionContenido", mappedBy="PlanificacionSeccion",cascade={"persist", "remove"}) 45 + * @ORM\OneToMany(targetEntity="PlanificacionSeccionContenido", mappedBy="planificacionSeccionId", cascade={"all"})
45 * @var \Doctrine\Common\Collections\ArrayCollection 46 * @var \Doctrine\Common\Collections\ArrayCollection
46 */ 47 */
47 private $contenido; 48 private $contenido;
@@ -169,38 +170,7 @@ class PlanificacionSeccion @@ -169,38 +170,7 @@ class PlanificacionSeccion
169 return $this->idtemaUc; 170 return $this->idtemaUc;
170 } 171 }
171 172
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 - } 173 +
204 174
205 /** 175 /**
206 * Add contenido 176 * Add contenido
@@ -210,7 +180,9 @@ class PlanificacionSeccion @@ -210,7 +180,9 @@ class PlanificacionSeccion
210 */ 180 */
211 public function addContenido(\AppBundle\Entity\PlanificacionSeccionContenido $contenido) 181 public function addContenido(\AppBundle\Entity\PlanificacionSeccionContenido $contenido)
212 { 182 {
  183 + $contenido->setPlanificacionSeccionId($this);
213 $this->contenido[] = $contenido; 184 $this->contenido[] = $contenido;
  185 +
214 186
215 return $this; 187 return $this;
216 } 188 }
src/AppBundle/Entity/PlanificacionSeccionEspecifico.php
@@ -7,16 +7,7 @@ use Doctrine\ORM\Mapping as ORM; @@ -7,16 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
7 /** 7 /**
8 * PlanificacionSeccionEspecifico 8 * PlanificacionSeccionEspecifico
9 * 9 *
10 - * @ORM\Table(name="planificacion_seccion_especifico",  
11 - * uniqueConstraints=  
12 - * {@ORM\UniqueConstraint(name="uq_planificacion_seccion_especifico",  
13 - * columns={"id_planificacion_seccion"})  
14 - * },  
15 - * indexes={  
16 - * @ORM\Index(name="fki_id_planificacion_especifico",  
17 - * columns={"id_planificacion_seccion"})  
18 - * }  
19 - * ) 10 + * @ORM\Table(name="planificacion_seccion_especifico")
20 * @ORM\Entity 11 * @ORM\Entity
21 */ 12 */
22 class PlanificacionSeccionEspecifico 13 class PlanificacionSeccionEspecifico
@@ -41,23 +32,16 @@ class PlanificacionSeccionEspecifico @@ -41,23 +32,16 @@ class PlanificacionSeccionEspecifico
41 private $id; 32 private $id;
42 33
43 34
44 - /**  
45 - * @var \AppBundle\Entity\PlanificacionSeccion  
46 - *  
47 - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion")  
48 - * @ORM\JoinColumns({  
49 - * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false)  
50 - * })  
51 - */  
52 - private $idPlanificacionSeccion;  
53 - 35 +
54 /** 36 /**
55 * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="objetivoEspecifico") 37 * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="objetivoEspecifico")
56 - * @ORM\JoinColumn(name="id_planificacion_especifico", referencedColumnName="id") 38 + * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id", nullable=FALSE)
57 */ 39 */
58 - private $idPlanificacionEspecifico; 40 + private $planificacionSeccionId;
59 41
60 42
  43 +
  44 +
61 /** 45 /**
62 * Set objetivoEspecifico 46 * Set objetivoEspecifico
63 * 47 *
@@ -92,48 +76,27 @@ class PlanificacionSeccionEspecifico @@ -92,48 +76,27 @@ class PlanificacionSeccionEspecifico
92 } 76 }
93 77
94 /** 78 /**
95 - * Set idPlanificacionSeccion 79 + * Set planificacionSeccionId
96 * 80 *
97 - * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion 81 + * @param \AppBundle\Entity\PlanificacionSeccion $planificacionSeccionId
98 * @return PlanificacionSeccionEspecifico 82 * @return PlanificacionSeccionEspecifico
99 */ 83 */
100 - public function setIdPlanificacionSeccion(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion) 84 + public function setPlanificacionSeccionId(\AppBundle\Entity\PlanificacionSeccion $planificacionSeccionId)
101 { 85 {
102 - $this->idPlanificacionSeccion = $idPlanificacionSeccion; 86 + $this->planificacionSeccionId = $planificacionSeccionId;
103 87
104 return $this; 88 return $this;
105 } 89 }
106 90
107 /** 91 /**
108 - * Get idPlanificacionSeccion 92 + * Get planificacionSeccionId
109 * 93 *
110 * @return \AppBundle\Entity\PlanificacionSeccion 94 * @return \AppBundle\Entity\PlanificacionSeccion
111 */ 95 */
112 - public function getIdPlanificacionSeccion() 96 + public function getPlanificacionSeccionId()
113 { 97 {
114 - return $this->idPlanificacionSeccion;  
115 - }  
116 -  
117 - /**  
118 - * Set idPlanificacionEspecifico  
119 - *  
120 - * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionEspecifico  
121 - * @return PlanificacionSeccionEspecifico  
122 - */  
123 - public function setIdPlanificacionEspecifico(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionEspecifico = null)  
124 - {  
125 - $this->idPlanificacionEspecifico = $idPlanificacionEspecifico;  
126 -  
127 - return $this;  
128 - }  
129 -  
130 - /**  
131 - * Get idPlanificacionEspecifico  
132 - *  
133 - * @return \AppBundle\Entity\PlanificacionSeccion  
134 - */  
135 - public function getIdPlanificacionEspecifico()  
136 - {  
137 - return $this->idPlanificacionEspecifico; 98 + return $this->planificacionSeccionId;
138 } 99 }
  100 +
  101 +
139 } 102 }
src/AppBundle/Entity/PlanificacionSeccionEspecifico.php~
@@ -7,16 +7,7 @@ use Doctrine\ORM\Mapping as ORM; @@ -7,16 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
7 /** 7 /**
8 * PlanificacionSeccionEspecifico 8 * PlanificacionSeccionEspecifico
9 * 9 *
10 - * @ORM\Table(name="planificacion_seccion_especifico",  
11 - * uniqueConstraints=  
12 - * {@ORM\UniqueConstraint(name="uq_planificacion_seccion_especifico",  
13 - * columns={"id_planificacion_seccion"})  
14 - * },  
15 - * indexes={  
16 - * @ORM\Index(name="fki_id_planificacion_especifico",  
17 - * columns={"id_planificacion_seccion"})  
18 - * }  
19 - * ) 10 + * @ORM\Table(name="planificacion_seccion_especifico")
20 * @ORM\Entity 11 * @ORM\Entity
21 */ 12 */
22 class PlanificacionSeccionEspecifico 13 class PlanificacionSeccionEspecifico
@@ -41,23 +32,13 @@ class PlanificacionSeccionEspecifico @@ -41,23 +32,13 @@ class PlanificacionSeccionEspecifico
41 private $id; 32 private $id;
42 33
43 34
44 - /**  
45 - * @var \AppBundle\Entity\PlanificacionSeccion  
46 - *  
47 - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion")  
48 - * @ORM\JoinColumns({  
49 - * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false)  
50 - * })  
51 - */  
52 - private $idPlanificacionSeccion;  
53 - 35 +
54 /** 36 /**
55 * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="objetivoEspecifico") 37 * @ORM\ManyToOne(targetEntity="PlanificacionSeccion", inversedBy="objetivoEspecifico")
56 - * @ORM\JoinColumn(name="id_planificacion_especifico", referencedColumnName="id") 38 + * @ORM\JoinColumn(name="planificacion_seccion_id", referencedColumnName="id", nullable=FALSE)
57 */ 39 */
58 - private $idPlanificacionEspecifico;  
59 - 40 + private $planificacionSeccionId;
60 41
61 - 42 +
62 43
63 } 44 }
src/AppBundle/Form/PlanificacionSeccionEspecificoType.php
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  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 PlanificacionSeccionEspecificoType 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('objetivoEspecifico')
  19 + ;
  20 + }
  21 +
  22 + /**
  23 + * @param OptionsResolver $resolver
  24 + */
  25 + public function configureOptions(OptionsResolver $resolver)
  26 + {
  27 + $resolver->setDefaults(array(
  28 + 'data_class' => 'AppBundle\Entity\PlanificacionSeccionEspecifico'
  29 + ));
  30 + }
  31 +}
src/AppBundle/Form/PlanificacionSeccionType.php
@@ -17,7 +17,9 @@ class PlanificacionSeccionType extends AbstractType @@ -17,7 +17,9 @@ class PlanificacionSeccionType extends AbstractType
17 */ 17 */
18 public function buildForm(FormBuilderInterface $builder, array $options) 18 public function buildForm(FormBuilderInterface $builder, array $options)
19 { 19 {
  20 + //que solo salga la seccion que estamos planificando
20 $this->seccion = $options['seccion']; 21 $this->seccion = $options['seccion'];
  22 + //que solo salgan los temas que no han sido planificados de esa seccion
21 $this->planificacion = $options['planificacion']; 23 $this->planificacion = $options['planificacion'];
22 if (!$this->planificacion){ 24 if (!$this->planificacion){
23 $this->planes[] = 0; 25 $this->planes[] = 0;
@@ -54,12 +56,17 @@ class PlanificacionSeccionType extends AbstractType @@ -54,12 +56,17 @@ class PlanificacionSeccionType extends AbstractType
54 )); 56 ));
55 ;}, 57 ;},
56 )) 58 ))
  59 + ->add('objetivoEspecifico', CollectionType::class, array(
  60 + 'entry_type' => PlanificacionSeccionEspecificoType::class,
  61 + 'allow_add' => true,
  62 + 'label' => false
  63 + ))
  64 +
57 ->add('contenido', CollectionType::class, array( 65 ->add('contenido', CollectionType::class, array(
58 'entry_type' => PlanificacionSeccionContenidoType::class, 66 'entry_type' => PlanificacionSeccionContenidoType::class,
59 'allow_add' => true, 67 'allow_add' => true,
60 'label' => false 68 'label' => false
61 )) 69 ))
62 -  
63 ; 70 ;
64 } 71 }
65 72