Commit 0505ef2c6b0f054e8426c7f8e06de2f177eb8734

Authored by Wilmer
1 parent 05194af2ee
Exists in master

gran cambio en la entidad de jurados para el ascenso debido a la necesidad de es…

…tatus y tipo de jurado que no lo contemplaba
app/Resources/views/cea/acta_defensa_mostar.html.twig
... ... @@ -163,7 +163,7 @@
163 163 {% set cantidadJurado = 6 %}
164 164 <div id="seccion_jurados" class="well">
165 165 <ul>
166   - {% for tutor in ascenso.tutoresAscenso %}
  166 + {% for tutor in ascenso.tutores %}
167 167 {% if loop.length == 6 %}
168 168 {% set anadirJurado = false %}
169 169 {% else %}
... ... @@ -172,8 +172,8 @@
172 172  
173 173 <li id="well_{{tutor.id}}">
174 174  
175   - <strong>{{ tutor.nombres }} {{ tutor.apellidos }}:</strong>
176   - {{ tutor.institucion }} -> {{ tutor.idEscala.nombre }}
  175 + <strong>{{ tutor.idTutor.nombres }} {{ tutor.idTutor.apellidos }}:</strong>
  176 + {{ tutor.idTutor.institucion }} -> {{ tutor.idTutor.idEscala.nombre }}
177 177 <input type="button" class="btn btn-warning btn-xs" value="act" id="actualizar_tutor">
178 178 <input type="button" class="btn btn-danger btn-xs eliminar_jurado" value="X" id="{{ tutor.id }}">
179 179 </li>
... ...
app/Resources/views/cea/ascenso_mostar.html.twig
... ... @@ -163,7 +163,7 @@
163 163 {% set cantidadJurado = 6 %}
164 164 <div id="seccion_jurados" class="well">
165 165 <ul>
166   - {% for tutor in ascenso.tutoresAscenso %}
  166 + {% for tutor in ascenso.tutores %}
167 167 {% if loop.length == 6 %}
168 168 {% set anadirJurado = false %}
169 169 {% else %}
... ... @@ -172,8 +172,8 @@
172 172  
173 173 <li id="well_{{tutor.id}}">
174 174  
175   - <strong>{{ tutor.nombres }} {{ tutor.apellidos }}:</strong>
176   - {{ tutor.institucion }} -> {{ tutor.idEscala.nombre }}
  175 + <strong>{{ tutor.idTutor.nombres }} {{ tutor.idTutor.apellidos }}:</strong>
  176 + {{ tutor.idTutor.institucion }} -> {{ tutor.idTutor.idEscala.nombre }}
177 177 <input type="button" class="btn btn-warning btn-xs" value="act" id="actualizar_tutor">
178 178 <input type="button" class="btn btn-danger btn-xs eliminar_jurado" value="X" id="{{ tutor.id }}">
179 179 </li>
... ... @@ -380,7 +380,7 @@
380 380 cache: false,
381 381 data: ({ eliminar: eliminado, ascensoId: {{ ascenso.id }} }),
382 382 success: function (data) {
383   - alert(cantidad);
  383 + alert(cantidad);
384 384 console.log("esto es id: " + eliminado);
385 385 $("#well_" + eliminado).remove();
386 386 cantidad = cantidad + 1;
... ...
src/AppBundle/Controller/AjaxController.php
... ... @@ -7,6 +7,7 @@
7 7 */
8 8  
9 9 namespace AppBundle\Controller;
  10 +use AppBundle\Entity\AscensoTutores;
10 11 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
11 12 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
12 13 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
... ... @@ -202,19 +203,25 @@ class AjaxController extends Controller {
202 203 $ascensoId = filter_input(INPUT_POST, 'ascensoId', FILTER_SANITIZE_SPECIAL_CHARS);
203 204  
204 205  
205   - $ascenso = $this->getDoctrine()->getRepository("AppBundle:Ascenso")->findOneById($ascensoId);
206   -
  206 + $ascenso = $this->getDoctrine()->getRepository("AppBundle:Ascenso")->findOneById($ascensoId);
  207 + $em = $this->getDoctrine()->getManager();
207 208 foreach ($jurados as $jurado){
208 209 $adicionar = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($jurado);
209   - $ascenso->addTutoresAscenso($adicionar);
210   - $nuevos_nombres[] = $adicionar->getNombres() . " " . $adicionar->getApellidos();
211   - $nuevos_institucion[] = $adicionar->getInstitucion() . " -> " . $adicionar->getIdEscala()->getNombre();
212   - $nuevos_id[] = $adicionar->getId();
  210 + $ascensoTutor = new AscensoTutores();
  211 + $ascensoTutor->setIdAscenso($ascenso);
  212 + $ascensoTutor->setIdTutor($adicionar);
  213 + $ascensoTutor->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById(2));
  214 + $em->persist($ascensoTutor);
  215 + $em->flush();
  216 +
  217 + $nuevos_nombres[] = $ascensoTutor->getIdTutor()->getNombres() . " " . $ascensoTutor->getIdTutor()->getApellidos();
  218 + $nuevos_institucion[] = $ascensoTutor->getIdTutor()->getInstitucion() . " -> " . $ascensoTutor->getIdTutor()->getIdEscala()->getNombre();
  219 + $nuevos_id[] = $ascensoTutor->getIdTutor()->getId();
213 220 }
214 221  
215 222  
216 223  
217   - $em = $this->getDoctrine()->getManager();
  224 +
218 225 $em->persist($ascenso);
219 226 $em->flush();
220 227  
... ... @@ -370,19 +377,20 @@ class AjaxController extends Controller {
370 377 $eliminar = filter_input(INPUT_POST, 'eliminar', FILTER_SANITIZE_SPECIAL_CHARS);
371 378 $ascensoId = filter_input(INPUT_POST, 'ascensoId', FILTER_SANITIZE_SPECIAL_CHARS);
372 379  
373   -
374   - $ascenso = $this->getDoctrine()->getRepository("AppBundle:Ascenso")->findOneById($ascensoId);
375   -
376   -
377   - $quitarJurado = $this->getDoctrine()->getRepository("AppBundle:TutoresAscenso")->findOneById($eliminar);
378   - $ascenso->removeTutoresAscenso($quitarJurado);
  380 +
  381 +
  382 + $quitarJurado = $this->getDoctrine()->getRepository("AppBundle:AscensoTutores")->findOneById($eliminar);
  383 +
  384 + if (!$quitarJurado) {
  385 + throw $this->createNotFoundException('no se encontrรณ el jurado solicitado');
  386 + }
379 387  
380 388  
381 389  
382 390  
383 391 $em = $this->getDoctrine()->getManager();
384   - $em->persist($ascenso);
385   - $em->flush();
  392 + $em->remove($quitarJurado);
  393 + $em->flush();
386 394  
387 395 $response = new JsonResponse();
388 396 $response->setStatusCode(200);
... ...
src/AppBundle/Controller/AscensoController.php
... ... @@ -9,6 +9,7 @@
9 9 namespace AppBundle\Controller;
10 10  
11 11  
  12 +use AppBundle\Entity\AscensoTutores;
12 13 use AppBundle\Entity\DocumentosVerificados;
13 14 use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
14 15 use Symfony\Component\Form\Extension\Core\Type\DateType;
... ... @@ -262,7 +263,12 @@ class AscensoController extends Controller
262 263  
263 264 $tutores = $form->get('tutores_ascenso')->getData();
264 265 foreach ($tutores as $tutor){
265   - $ascenso->addTutoresAscenso($tutor);
  266 + $ascensoTutor = new AscensoTutores();
  267 + $ascensoTutor->setIdAscenso($ascenso);
  268 + $ascensoTutor->setIdTutor($tutor);
  269 + $ascensoTutor->setIdEstatus($em->getRepository("AppBundle:Estatus")->findOneById(2));
  270 + $em->persist($ascensoTutor);
  271 + $em->flush();
266 272 }
267 273  
268 274  
... ...
src/AppBundle/Entity/Ascenso.php
... ... @@ -48,6 +48,11 @@ class Ascenso
48 48 * })
49 49 */
50 50 protected $idEscalafones;
  51 +
  52 + /**
  53 + * @ORM\OneToMany(targetEntity="AppBundle\Entity\AscensoTutores", mappedBy="idAscenso")
  54 + */
  55 + private $tutores;
51 56  
52 57  
53 58  
... ... @@ -113,21 +118,6 @@ class Ascenso
113 118 protected $idEstatus;
114 119  
115 120  
116   - /**
117   - * @var \Doctrine\Common\Collections\Collection
118   - *
119   - * @ORM\ManyToMany(targetEntity="AppBundle\Entity\TutoresAscenso", inversedBy="ascenso")
120   - * @ORM\JoinTable(name="ascenso_tutor",
121   - * joinColumns={
122   - * @ORM\JoinColumn(name="ascenso_id", referencedColumnName="id", nullable=false)
123   - * },
124   - * inverseJoinColumns={
125   - * @ORM\JoinColumn(name="tutor_id", referencedColumnName="id", nullable=false)
126   - * }
127   - * )
128   - */
129   - protected $tutoresAscenso;
130   -
131 121  
132 122 /**
133 123 * @ORM\PrePersist
... ... @@ -299,47 +289,6 @@ class Ascenso
299 289  
300 290  
301 291 /**
302   - * Constructor
303   - */
304   - public function __construct()
305   - {
306   - $this->tutoresAscenso = new \Doctrine\Common\Collections\ArrayCollection();
307   - }
308   -
309   - /**
310   - * Add tutoresAscenso
311   - *
312   - * @param \AppBundle\Entity\TutoresAscenso $tutoresAscenso
313   - * @return Ascenso
314   - */
315   - public function addTutoresAscenso(\AppBundle\Entity\TutoresAscenso $tutoresAscenso)
316   - {
317   - $this->tutoresAscenso[] = $tutoresAscenso;
318   -
319   - return $this;
320   - }
321   -
322   - /**
323   - * Remove tutoresAscenso
324   - *
325   - * @param \AppBundle\Entity\TutoresAscenso $tutoresAscenso
326   - */
327   - public function removeTutoresAscenso(\AppBundle\Entity\TutoresAscenso $tutoresAscenso)
328   - {
329   - $this->tutoresAscenso->removeElement($tutoresAscenso);
330   - }
331   -
332   - /**
333   - * Get tutoresAscenso
334   - *
335   - * @return \Doctrine\Common\Collections\Collection
336   - */
337   - public function getTutoresAscenso()
338   - {
339   - return $this->tutoresAscenso;
340   - }
341   -
342   - /**
343 292 *
344 293 * @return string
345 294 */
... ... @@ -442,4 +391,44 @@ class Ascenso
442 391 {
443 392 return $this->tesisUbv;
444 393 }
  394 + /**
  395 + * Constructor
  396 + */
  397 + public function __construct()
  398 + {
  399 + $this->tutores = new \Doctrine\Common\Collections\ArrayCollection();
  400 + }
  401 +
  402 + /**
  403 + * Add tutores
  404 + *
  405 + * @param \AppBundle\Entity\AscensoTutores $tutores
  406 + * @return Ascenso
  407 + */
  408 + public function addTutore(\AppBundle\Entity\AscensoTutores $tutores)
  409 + {
  410 + $this->tutores[] = $tutores;
  411 +
  412 + return $this;
  413 + }
  414 +
  415 + /**
  416 + * Remove tutores
  417 + *
  418 + * @param \AppBundle\Entity\AscensoTutores $tutores
  419 + */
  420 + public function removeTutore(\AppBundle\Entity\AscensoTutores $tutores)
  421 + {
  422 + $this->tutores->removeElement($tutores);
  423 + }
  424 +
  425 + /**
  426 + * Get tutores
  427 + *
  428 + * @return \Doctrine\Common\Collections\Collection
  429 + */
  430 + public function getTutores()
  431 + {
  432 + return $this->tutores;
  433 + }
445 434 }
... ...
src/AppBundle/Entity/AscensoTutores.php
... ... @@ -0,0 +1,185 @@
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: Wilmer Ramones
  5 + * Date: 29/06/16
  6 + * Time: 07:52 AM
  7 + */
  8 +
  9 +namespace AppBundle\Entity;
  10 +
  11 +use Doctrine\ORM\Mapping as ORM;
  12 +use Symfony\Component\Validator\Constraints as Assert;
  13 +use Doctrine\Common\Collections\ArrayCollection;
  14 +
  15 +/**
  16 + * AscensoTutores
  17 + *
  18 + * @ORM\Table(name="ascenso_tutores", uniqueConstraints={@ORM\UniqueConstraint(name="ascenso_id_tutor_id", columns={"id_ascenso", "id_tutor"})})
  19 + * @ORM\Entity
  20 + * @ORM\HasLifecycleCallbacks()
  21 + */
  22 +class AscensoTutores
  23 +{
  24 +
  25 + /**
  26 + * @var integer
  27 + *
  28 + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador de la Tabla"})
  29 + * @ORM\Id
  30 + * @ORM\GeneratedValue(strategy="IDENTITY")
  31 + * @ORM\SequenceGenerator(sequenceName="adscripcion_id_seq", allocationSize=1, initialValue=1)
  32 + */
  33 + private $id;
  34 +
  35 +
  36 + /**
  37 + * @var \AppBundle\Entity\Ascenso
  38 + *
  39 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Ascenso", inversedBy="tutores")
  40 + * @ORM\JoinColumns({
  41 + * @ORM\JoinColumn(name="id_ascenso", referencedColumnName="id", nullable=false)
  42 + * })
  43 + */
  44 + protected $idAscenso;
  45 +
  46 +
  47 + /**
  48 + * @var \AppBundle\Entity\TutoresAscenso
  49 + *
  50 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\TutoresAscenso")
  51 + * @ORM\JoinColumns({
  52 + * @ORM\JoinColumn(name="id_tutor", referencedColumnName="id", nullable=false)
  53 + * })
  54 + */
  55 + protected $idTutor;
  56 +
  57 +
  58 +
  59 + /**
  60 + * @var \AppBundle\Entity\EstatusTutor
  61 + *
  62 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\EstatusTutor")
  63 + * @ORM\JoinColumns({
  64 + * @ORM\JoinColumn(name="id_estatus_tutor", referencedColumnName="id", nullable=true)
  65 + * })
  66 + */
  67 + protected $idEstatusTutor;
  68 +
  69 +
  70 + /**
  71 + * @var \AppBundle\Entity\Estatus
  72 + *
  73 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Estatus")
  74 + * @ORM\JoinColumns({
  75 + * @ORM\JoinColumn(name="id_estatus", referencedColumnName="id", nullable=false)
  76 + * })
  77 + */
  78 + protected $idEstatus;
  79 +
  80 +
  81 +
  82 +
  83 +
  84 + /**
  85 + * Get id
  86 + *
  87 + * @return integer
  88 + */
  89 + public function getId()
  90 + {
  91 + return $this->id;
  92 + }
  93 +
  94 + /**
  95 + * Set idAscenso
  96 + *
  97 + * @param \AppBundle\Entity\Ascenso $idAscenso
  98 + * @return AscensoTutores
  99 + */
  100 + public function setIdAscenso(\AppBundle\Entity\Ascenso $idAscenso)
  101 + {
  102 + $this->idAscenso = $idAscenso;
  103 +
  104 + return $this;
  105 + }
  106 +
  107 + /**
  108 + * Get idAscenso
  109 + *
  110 + * @return \AppBundle\Entity\Ascenso
  111 + */
  112 + public function getIdAscenso()
  113 + {
  114 + return $this->idAscenso;
  115 + }
  116 +
  117 + /**
  118 + * Set idTutor
  119 + *
  120 + * @param \AppBundle\Entity\TutoresAscenso $idTutor
  121 + * @return AscensoTutores
  122 + */
  123 + public function setIdTutor(\AppBundle\Entity\TutoresAscenso $idTutor)
  124 + {
  125 + $this->idTutor = $idTutor;
  126 +
  127 + return $this;
  128 + }
  129 +
  130 + /**
  131 + * Get idTutor
  132 + *
  133 + * @return \AppBundle\Entity\TutoresAscenso
  134 + */
  135 + public function getIdTutor()
  136 + {
  137 + return $this->idTutor;
  138 + }
  139 +
  140 + /**
  141 + * Set idEstatusTutor
  142 + *
  143 + * @param \AppBundle\Entity\EstatusTutor $idEstatusTutor
  144 + * @return AscensoTutores
  145 + */
  146 + public function setIdEstatusTutor(\AppBundle\Entity\EstatusTutor $idEstatusTutor)
  147 + {
  148 + $this->idEstatusTutor = $idEstatusTutor;
  149 +
  150 + return $this;
  151 + }
  152 +
  153 + /**
  154 + * Get idEstatusTutor
  155 + *
  156 + * @return \AppBundle\Entity\EstatusTutor
  157 + */
  158 + public function getIdEstatusTutor()
  159 + {
  160 + return $this->idEstatusTutor;
  161 + }
  162 +
  163 + /**
  164 + * Set idEstatus
  165 + *
  166 + * @param \AppBundle\Entity\Estatus $idEstatus
  167 + * @return AscensoTutores
  168 + */
  169 + public function setIdEstatus(\AppBundle\Entity\Estatus $idEstatus)
  170 + {
  171 + $this->idEstatus = $idEstatus;
  172 +
  173 + return $this;
  174 + }
  175 +
  176 + /**
  177 + * Get idEstatus
  178 + *
  179 + * @return \AppBundle\Entity\Estatus
  180 + */
  181 + public function getIdEstatus()
  182 + {
  183 + return $this->idEstatus;
  184 + }
  185 +}
... ...
src/AppBundle/Entity/EstatusTutor.php
... ... @@ -0,0 +1,107 @@
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: ubv-cipee
  5 + * Date: 29/06/16
  6 + * Time: 08:12 AM
  7 + */
  8 +
  9 +
  10 +namespace AppBundle\Entity;
  11 +
  12 +use Doctrine\ORM\Mapping as ORM;
  13 +
  14 +/**
  15 + * EstatusTutor
  16 + *
  17 + * @ORM\Table(name="estatus_tutor", uniqueConstraints={@ORM\UniqueConstraint(name="uq_estatus_tutor", columns={"nombre"})})
  18 + * @ORM\Entity
  19 + */
  20 +class EstatusTutor
  21 +{
  22 + /**
  23 + * @var string
  24 + *
  25 + * @ORM\Column(name="nombre", type="string", length=20, nullable=false, options={"comment" = "Nombre del estatus"})
  26 + */
  27 + private $nombre;
  28 +
  29 + /**
  30 + * @var string
  31 + *
  32 + * @ORM\Column(name="descripcion", type="string", length=50, nullable=false, options={"comment" = "Descripcion o significado del estatus"})
  33 + */
  34 + private $descripcion;
  35 +
  36 + /**
  37 + * @var integer
  38 + *
  39 + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del estatus"})
  40 + * @ORM\Id
  41 + * @ORM\GeneratedValue(strategy="IDENTITY")
  42 + * @ORM\SequenceGenerator(sequenceName="estatus_id_seq", allocationSize=1, initialValue=1)
  43 + */
  44 + private $id;
  45 +
  46 +
  47 +
  48 + /**
  49 + * Set nombre
  50 + *
  51 + * @param string $nombre
  52 + * @return Estatus
  53 + */
  54 + public function setNombre($nombre)
  55 + {
  56 + $this->nombre = $nombre;
  57 +
  58 + return $this;
  59 + }
  60 +
  61 + /**
  62 + * Get nombre
  63 + *
  64 + * @return string
  65 + */
  66 + public function getNombre()
  67 + {
  68 + return $this->nombre;
  69 + }
  70 +
  71 + /**
  72 + * Set descripcion
  73 + *
  74 + * @param string $descripcion
  75 + * @return Estatus
  76 + */
  77 + public function setDescripcion($descripcion)
  78 + {
  79 + $this->descripcion = $descripcion;
  80 +
  81 + return $this;
  82 + }
  83 +
  84 + /**
  85 + * Get descripcion
  86 + *
  87 + * @return string
  88 + */
  89 + public function getDescripcion()
  90 + {
  91 + return $this->descripcion;
  92 + }
  93 +
  94 + /**
  95 + * Get id
  96 + *
  97 + * @return integer
  98 + */
  99 + public function getId()
  100 + {
  101 + return $this->id;
  102 + }
  103 +
  104 + public function __toString() {
  105 + return $this->getNombre();
  106 + }
  107 +}
0 108 \ No newline at end of file
... ...
src/AppBundle/Entity/TutoresAscenso.php
... ... @@ -100,13 +100,7 @@ class TutoresAscenso
100 100 protected $idEscala;
101 101  
102 102  
103   - /**
104   - * @var \Doctrine\Common\Collections\Collection
105   - *
106   - * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Ascenso", mappedBy="tutoresAscenso")
107   - */
108   - protected $ascenso;
109   -
  103 +
110 104  
111 105  
112 106  
... ... @@ -317,44 +311,5 @@ class TutoresAscenso
317 311 return $this->idEstado;
318 312 }
319 313  
320   - /**
321   - * Constructor
322   - */
323   - public function __construct()
324   - {
325   - $this->ascenso = new \Doctrine\Common\Collections\ArrayCollection();
326   - }
327   -
328   - /**
329   - * Add ascenso
330   - *
331   - * @param \AppBundle\Entity\Ascenso $ascenso
332   - * @return TutoresAscenso
333   - */
334   - public function addAscenso(\AppBundle\Entity\Ascenso $ascenso)
335   - {
336   - $this->ascenso[] = $ascenso;
337 314  
338   - return $this;
339   - }
340   -
341   - /**
342   - * Remove ascenso
343   - *
344   - * @param \AppBundle\Entity\Ascenso $ascenso
345   - */
346   - public function removeAscenso(\AppBundle\Entity\Ascenso $ascenso)
347   - {
348   - $this->ascenso->removeElement($ascenso);
349   - }
350   -
351   - /**
352   - * Get ascenso
353   - *
354   - * @return \Doctrine\Common\Collections\Collection
355   - */
356   - public function getAscenso()
357   - {
358   - return $this->ascenso;
359   - }
360 315 }
... ...