Commit a334fa1e7213c87920676a9c59918dd2115dd71f
1 parent
b7e9858dcf
Exists in
master
creada la propiedad de hasCalificacion dentro de la planificacion de la sección …
…para verficiar si esa planificación tiene notas registradas. Luego se procede a chequear para permitir cargar o no las notas y si ya estan cargadas, mostrar la nota registrada
Showing
6 changed files
with
211 additions
and
11 deletions
Show diff stats
app/Resources/views/planificacioncalificacion/new.html.twig
... | ... | @@ -3,23 +3,38 @@ |
3 | 3 | {% block body %} |
4 | 4 | <h1>Registro Calificacion Planificacion</h1> |
5 | 5 | <h3>{{planificacion.idtemaUc}}</h3> |
6 | + | |
7 | + | |
6 | 8 | |
7 | 9 | <form class="form-inline" method="post" name="planificacion_calificacion"> |
8 | 10 | <div id="seccion"> |
9 | 11 | <ul> |
10 | 12 | {% for o in planificacion.seccion.hasInscripcion %} |
11 | - | |
13 | + {% if planificacion.hasCalificacion | length < 1 %} | |
12 | 14 | <li> |
13 | 15 | {{o}} |
14 | 16 | <input type="hidden" id="planificacion_calificacion_idInscripcion_{{o.id}}" name="planificacion_calificacion[idInscripcion][inscripcion_{{o.id}}]" value ="{{o.id}}"/> |
15 | 17 | <input type="text" id="planificacion_calificacion_idCalificacion" name="planificacion_calificacion[idInscripcion][calificacion_{{o.id}}]" /> |
16 | 18 | <input type="text" id="planificacion_calificacion_idCalificacion" name="planificacion_calificacion[idInscripcion][porcentaje_{{o.id}}]" /> |
17 | - </li> | |
19 | + </li> | |
20 | + {% else %} | |
21 | + <li> | |
22 | + {% for p in planificacion.hasCalificacion %} | |
23 | + {{o}} | |
24 | + <input type="text" id="planificacion_calificacion_idCalificacion" name="planificacion_calificacion[idInscripcion][calificacion_{{o.id}}]" value="{{ p.idCalificacion.idNota.idNomenclaturaNota.nombre }}" disabled /> | |
25 | + <input type="text" id="planificacion_calificacion_idCalificacion" name="planificacion_calificacion[idInscripcion][porcentaje_{{o.id}}]" value="{{ p.idCalificacion.idPorcentaje.nombre }}" disabled /> | |
26 | + {% endfor %} | |
27 | + </li> | |
28 | + | |
29 | + | |
30 | + {% endif %} | |
18 | 31 | {% endfor %}<br> |
19 | 32 | </ul> |
20 | 33 | </div> |
21 | -<input id="seccion__token" type="hidden" value="WbDyIPXIxm9WxU4oOf2a4_4CnXg3rxuY46e_TbVAggY" name="seccion[_token]"> | |
22 | -<input type="submit" value="Create" /> | |
34 | + {% if planificacion.hasCalificacion | length < 1 %} | |
35 | + <input id="seccion__token" type="hidden" value="WbDyIPXIxm9WxU4oOf2a4_4CnXg3rxuY46e_TbVAggY" name="seccion[_token]"> | |
36 | + <input type="submit" value="Create" /> | |
37 | + {% endif %} | |
23 | 38 | </form> |
24 | 39 | |
25 | 40 | {% endblock %} | ... | ... |
src/AppBundle/Controller/PlanificacionCalificacionController.php
... | ... | @@ -43,9 +43,10 @@ class PlanificacionCalificacionController extends Controller |
43 | 43 | */ |
44 | 44 | public function newAction(Request $request, PlanificacionSeccion $planificacion) |
45 | 45 | { |
46 | - $planificacionCalificacion = new PlanificacionCalificacion(); | |
46 | + | |
47 | 47 | |
48 | 48 | if ($request->isMethod("POST")) { |
49 | + $planificacionCalificacion = new PlanificacionCalificacion(); | |
49 | 50 | $em = $this->getDoctrine()->getManager(); |
50 | 51 | //var_dump($request->request->get('planificacion_calificacion')); exit; |
51 | 52 | foreach ($request->request->get('planificacion_calificacion')['idInscripcion'] as $key => $value ){ | ... | ... |
src/AppBundle/Entity/PlanificacionCalificacion.php
... | ... | @@ -26,7 +26,7 @@ class PlanificacionCalificacion |
26 | 26 | /** |
27 | 27 | * @var \AppBundle\Entity\PlanificacionSeccion |
28 | 28 | * |
29 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion") | |
29 | + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion", inversedBy="hasCalificacion") | |
30 | 30 | * @ORM\JoinColumns({ |
31 | 31 | * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false) |
32 | 32 | * }) | ... | ... |
src/AppBundle/Entity/PlanificacionCalificacion.php~
... | ... | @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; |
7 | 7 | /** |
8 | 8 | * PlanificacionCalificacion |
9 | 9 | * |
10 | - * @ORM\Table(name="planificacion_calificacion", uniqueConstraints={@ORM\UniqueConstraint(name="i_registro_nota", columns={"id_inscripcion", "id_calificacion"})}, indexes={@ORM\Index(name="fki_id_inscripcion", columns={"id_inscripcion"}), @ORM\Index(name="fki_id_calificacion", columns={"id_calificacion"}), @ORM\Index(name="fki_id_estatus_nota", columns={"id_estatus_nota"}), @ORM\Index(name="fki_id_planificacion_seccion", columns={"id_planificacion_seccion"})}) | |
10 | + * @ORM\Table(name="planificacion_calificacion", uniqueConstraints={@ORM\UniqueConstraint(name="i_registro_nota_planificacion", columns={"id_inscripcion", "id_calificacion", "id_planificacion_seccion"})}, indexes={@ORM\Index(name="fki_id_inscripcion_planificacion", columns={"id_inscripcion"}), @ORM\Index(name="fki_id_calificacion_planificacion", columns={"id_calificacion"}), @ORM\Index(name="fki_id_estatus_nota_planificacion", columns={"id_estatus_nota"}), @ORM\Index(name="fki_id_planificacion_seccion", columns={"id_planificacion_seccion"})}) | |
11 | 11 | * @ORM\Entity |
12 | 12 | */ |
13 | 13 | class PlanificacionCalificacion |
... | ... | @@ -26,7 +26,7 @@ class PlanificacionCalificacion |
26 | 26 | /** |
27 | 27 | * @var \AppBundle\Entity\PlanificacionSeccion |
28 | 28 | * |
29 | - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion") | |
29 | + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PlanificacionSeccion", inversedBy="hasCalificacion") | |
30 | 30 | * @ORM\JoinColumns({ |
31 | 31 | * @ORM\JoinColumn(name="id_planificacion_seccion", referencedColumnName="id", nullable=false) |
32 | 32 | * }) |
... | ... | @@ -67,4 +67,106 @@ class PlanificacionCalificacion |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | + | |
71 | + /** | |
72 | + * Get id | |
73 | + * | |
74 | + * @return integer | |
75 | + */ | |
76 | + public function getId() | |
77 | + { | |
78 | + return $this->id; | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * Set idPlanificacionSeccion | |
83 | + * | |
84 | + * @param \AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion | |
85 | + * @return PlanificacionCalificacion | |
86 | + */ | |
87 | + public function setIdPlanificacionSeccion(\AppBundle\Entity\PlanificacionSeccion $idPlanificacionSeccion) | |
88 | + { | |
89 | + $this->idPlanificacionSeccion = $idPlanificacionSeccion; | |
90 | + | |
91 | + return $this; | |
92 | + } | |
93 | + | |
94 | + /** | |
95 | + * Get idPlanificacionSeccion | |
96 | + * | |
97 | + * @return \AppBundle\Entity\PlanificacionSeccion | |
98 | + */ | |
99 | + public function getIdPlanificacionSeccion() | |
100 | + { | |
101 | + return $this->idPlanificacionSeccion; | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * Set idInscripcion | |
106 | + * | |
107 | + * @param \AppBundle\Entity\Inscripcion $idInscripcion | |
108 | + * @return PlanificacionCalificacion | |
109 | + */ | |
110 | + public function setIdInscripcion(\AppBundle\Entity\Inscripcion $idInscripcion) | |
111 | + { | |
112 | + $this->idInscripcion = $idInscripcion; | |
113 | + | |
114 | + return $this; | |
115 | + } | |
116 | + | |
117 | + /** | |
118 | + * Get idInscripcion | |
119 | + * | |
120 | + * @return \AppBundle\Entity\Inscripcion | |
121 | + */ | |
122 | + public function getIdInscripcion() | |
123 | + { | |
124 | + return $this->idInscripcion; | |
125 | + } | |
126 | + | |
127 | + /** | |
128 | + * Set idCalificacion | |
129 | + * | |
130 | + * @param \AppBundle\Entity\Calificacion $idCalificacion | |
131 | + * @return PlanificacionCalificacion | |
132 | + */ | |
133 | + public function setIdCalificacion(\AppBundle\Entity\Calificacion $idCalificacion) | |
134 | + { | |
135 | + $this->idCalificacion = $idCalificacion; | |
136 | + | |
137 | + return $this; | |
138 | + } | |
139 | + | |
140 | + /** | |
141 | + * Get idCalificacion | |
142 | + * | |
143 | + * @return \AppBundle\Entity\Calificacion | |
144 | + */ | |
145 | + public function getIdCalificacion() | |
146 | + { | |
147 | + return $this->idCalificacion; | |
148 | + } | |
149 | + | |
150 | + /** | |
151 | + * Set idEstatusNota | |
152 | + * | |
153 | + * @param \AppBundle\Entity\EstatusNota $idEstatusNota | |
154 | + * @return PlanificacionCalificacion | |
155 | + */ | |
156 | + public function setIdEstatusNota(\AppBundle\Entity\EstatusNota $idEstatusNota) | |
157 | + { | |
158 | + $this->idEstatusNota = $idEstatusNota; | |
159 | + | |
160 | + return $this; | |
161 | + } | |
162 | + | |
163 | + /** | |
164 | + * Get idEstatusNota | |
165 | + * | |
166 | + * @return \AppBundle\Entity\EstatusNota | |
167 | + */ | |
168 | + public function getIdEstatusNota() | |
169 | + { | |
170 | + return $this->idEstatusNota; | |
171 | + } | |
70 | 172 | } | ... | ... |
src/AppBundle/Entity/PlanificacionSeccion.php
... | ... | @@ -99,6 +99,11 @@ class PlanificacionSeccion |
99 | 99 | */ |
100 | 100 | private $seccion; |
101 | 101 | |
102 | + /** | |
103 | + * @ORM\OneToMany(targetEntity="AppBundle\Entity\PlanificacionCalificacion", mappedBy="idPlanificacionSeccion", cascade={"all"}) | |
104 | + * */ | |
105 | + protected $hasCalificacion; | |
106 | + | |
102 | 107 | |
103 | 108 | |
104 | 109 | /** |
... | ... | @@ -110,6 +115,7 @@ class PlanificacionSeccion |
110 | 115 | $this->contenido = new \Doctrine\Common\Collections\ArrayCollection(); |
111 | 116 | $this->estrategia = new \Doctrine\Common\Collections\ArrayCollection(); |
112 | 117 | $this->evaluacion = new \Doctrine\Common\Collections\ArrayCollection(); |
118 | + $this->hasCalificacion = new \Doctrine\Common\Collections\ArrayCollection(); | |
113 | 119 | } |
114 | 120 | |
115 | 121 | |
... | ... | @@ -397,4 +403,37 @@ class PlanificacionSeccion |
397 | 403 | public function __toString() { |
398 | 404 | return $this->getSeccion()->getNombre(); |
399 | 405 | } |
406 | + | |
407 | + /** | |
408 | + * Add hasCalificacion | |
409 | + * | |
410 | + * @param \AppBundle\Entity\PlanificacionCalificacion $hasCalificacion | |
411 | + * @return PlanificacionSeccion | |
412 | + */ | |
413 | + public function addHasCalificacion(\AppBundle\Entity\PlanificacionCalificacion $hasCalificacion) | |
414 | + { | |
415 | + $this->hasCalificacion[] = $hasCalificacion; | |
416 | + | |
417 | + return $this; | |
418 | + } | |
419 | + | |
420 | + /** | |
421 | + * Remove hasCalificacion | |
422 | + * | |
423 | + * @param \AppBundle\Entity\PlanificacionCalificacion $hasCalificacion | |
424 | + */ | |
425 | + public function removeHasCalificacion(\AppBundle\Entity\PlanificacionCalificacion $hasCalificacion) | |
426 | + { | |
427 | + $this->hasCalificacion->removeElement($hasCalificacion); | |
428 | + } | |
429 | + | |
430 | + /** | |
431 | + * Get hasCalificacion | |
432 | + * | |
433 | + * @return \Doctrine\Common\Collections\Collection | |
434 | + */ | |
435 | + public function getHasCalificacion() | |
436 | + { | |
437 | + return $this->hasCalificacion; | |
438 | + } | |
400 | 439 | } | ... | ... |
src/AppBundle/Entity/PlanificacionSeccion.php~
... | ... | @@ -35,7 +35,7 @@ class PlanificacionSeccion |
35 | 35 | |
36 | 36 | |
37 | 37 | /** |
38 | - * @ORM\OneToMany(targetEntity="PlanificacionSeccionEspecifico", mappedBy="planificacionSeccionId") | |
38 | + * @ORM\OneToMany(targetEntity="PlanificacionSeccionEspecifico", mappedBy="planificacionSeccionId",cascade={"all"}) | |
39 | 39 | * @var \Doctrine\Common\Collections\ArrayCollection |
40 | 40 | */ |
41 | 41 | private $objetivoEspecifico; |
... | ... | @@ -49,13 +49,13 @@ class PlanificacionSeccion |
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
52 | - * @ORM\OneToMany(targetEntity="PlanificacionSeccionEstrategia", mappedBy="idPlanificacionEstrategia") | |
52 | + * @ORM\OneToMany(targetEntity="PlanificacionSeccionEstrategia", mappedBy="planificacionSeccionId", cascade={"all"}) | |
53 | 53 | */ |
54 | 54 | private $estrategia; |
55 | 55 | |
56 | 56 | |
57 | 57 | /** |
58 | - * @ORM\OneToMany(targetEntity="PlanificacionSeccionEvaluacion", mappedBy="idPlanificacionEvaluacion") | |
58 | + * @ORM\OneToMany(targetEntity="PlanificacionSeccionEvaluacion", mappedBy="planificacionSeccionId", cascade={"all"}) | |
59 | 59 | */ |
60 | 60 | private $evaluacion; |
61 | 61 | |
... | ... | @@ -99,6 +99,11 @@ class PlanificacionSeccion |
99 | 99 | */ |
100 | 100 | private $seccion; |
101 | 101 | |
102 | + /** | |
103 | + * @ORM\OneToMany(targetEntity="AppBundle\Entity\PlanificacionCalificacion", mappedBy="idPlanificacionSeccion", cascade={"all"}) | |
104 | + * */ | |
105 | + protected $hasCalificacion; | |
106 | + | |
102 | 107 | |
103 | 108 | |
104 | 109 | /** |
... | ... | @@ -110,6 +115,7 @@ class PlanificacionSeccion |
110 | 115 | $this->contenido = new \Doctrine\Common\Collections\ArrayCollection(); |
111 | 116 | $this->estrategia = new \Doctrine\Common\Collections\ArrayCollection(); |
112 | 117 | $this->evaluacion = new \Doctrine\Common\Collections\ArrayCollection(); |
118 | + $this->hasCalificacion = new \Doctrine\Common\Collections\ArrayCollection(); | |
113 | 119 | } |
114 | 120 | |
115 | 121 | |
... | ... | @@ -360,4 +366,41 @@ class PlanificacionSeccion |
360 | 366 | { |
361 | 367 | return $this->fechaUltimaActualizacion; |
362 | 368 | } |
369 | + | |
370 | + /** | |
371 | + * Add objetivoEspecifico | |
372 | + * | |
373 | + * @param \AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico | |
374 | + * @return PlanificacionSeccion | |
375 | + */ | |
376 | + public function addObjetivoEspecifico(\AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico) | |
377 | + { | |
378 | + $this->objetivoEspecifico[] = $objetivoEspecifico; | |
379 | + | |
380 | + return $this; | |
381 | + } | |
382 | + | |
383 | + /** | |
384 | + * Remove objetivoEspecifico | |
385 | + * | |
386 | + * @param \AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico | |
387 | + */ | |
388 | + public function removeObjetivoEspecifico(\AppBundle\Entity\PlanificacionSeccionEspecifico $objetivoEspecifico) | |
389 | + { | |
390 | + $this->objetivoEspecifico->removeElement($objetivoEspecifico); | |
391 | + } | |
392 | + | |
393 | + /** | |
394 | + * Get objetivoEspecifico | |
395 | + * | |
396 | + * @return \Doctrine\Common\Collections\Collection | |
397 | + */ | |
398 | + public function getObjetivoEspecifico() | |
399 | + { | |
400 | + return $this->objetivoEspecifico; | |
401 | + } | |
402 | + | |
403 | + public function __toString() { | |
404 | + return $this->getSeccion()->getNombre(); | |
405 | + } | |
363 | 406 | } | ... | ... |