Commit 86ad52b0796a7372b014c883b6ffc0ea7595acf9

Authored by Wilmer
1 parent c8399c4cc1
Exists in master

gran cambio en donde se amplia el uso del Pida a través de una collección de formularios

app/Resources/views/planificacionseccion/new.html.twig
... ... @@ -9,19 +9,19 @@
9 9 {{ form_row(form.idtemaUc) }}
10 10  
11 11 <ul class="contenido" data-prototype="{{ form_widget(form.contenido.vars.prototype)|e('html_attr') }}">
12   -
  12 +
13 13 </ul>
14   -
  14 +
15 15 <ul class="objetivoEspecifico" data-prototype="{{ form_widget(form.objetivoEspecifico.vars.prototype)|e('html_attr') }}">
16   -
  16 +
17 17 </ul>
18   -
  18 +
19 19 <ul class="estrategia" data-prototype="{{ form_widget(form.estrategia.vars.prototype)|e('html_attr') }}">
20   -
  20 +
21 21 </ul>
22   -
  22 +
23 23 <ul class="evaluacion" data-prototype="{{ form_widget(form.evaluacion.vars.prototype)|e('html_attr') }}">
24   -
  24 +
25 25 </ul>
26 26  
27 27 <input type="submit" value="Create" />
... ... @@ -46,7 +46,7 @@
46 46 var $addEstrategiaLink = $('<a href="#" class="add_estrategia_link">Añadir estrategias</a>');
47 47 var $addEvaluacionLink = $('<a href="#" class="add_evaluacion_link">Añadir Evaluaciones</a>');
48 48 var $RemoveContenidoLink = $('<a href="#" class="remove_contenido_link">Quitar Conceptos</a>');
49   -
  49 +
50 50 var $newLinkLiContenido = $('<li></li>').append($addContenidoLink);
51 51 var $newLinkLiEspecifico = $('<li></li>').append($addEspecificoLink);
52 52 var $newLinkLiEstrategia = $('<li></li>').append($addEstrategiaLink);
... ...
app/Resources/views/solicitudes/pida.html.twig
... ... @@ -13,6 +13,12 @@
13 13 .container{
14 14 margin-bottom: 0;
15 15 }
  16 +
  17 + .account-container{
  18 + width:100%;
  19 + margin-left: 50px;
  20 + }
  21 +
16 22 </style>
17 23 {% endblock %}
18 24  
... ... @@ -29,23 +35,60 @@
29 35  
30 36 </h4>
31 37 </div>
32   - <div class="account-container register">
33   - <div class="content clearfix">
34   - <h1>PIDA</h1>
35   - {% form_theme form 'bootstrap_3_layout.html.twig' %}
36   - {{ form_start(form) }}
37   - {{ form_widget(form) }}
  38 + <div class="row">
  39 + <div class="col-md-5">
  40 +
38 41  
39   - <ul class="actividad" data-prototype="{{ form_widget(form.contenido.vars.prototype)|e('html_attr') }}">
  42 + <div class="account-container register">
  43 + <div class="content clearfix">
  44 + <h1>PIDA</h1>
  45 + {% form_theme form 'bootstrap_3_layout.html.twig' %}
  46 + {{ form_start(form) }}
  47 + {{ form_row(form.id_plan_historico_nacional_estrategico) }}
  48 + {{ form_row(form.id_actividad_docente) }}
  49 + <ul class="actividad" data-prototype="{{ form_widget(form.pidaTareaEspecifico.vars.prototype)|e('html_attr') }}">
40 50  
41   - </ul>
  51 + </ul>
42 52  
  53 + <button type="submit" class="btn btn-success">Añadir</button>
  54 + <button type="submit" class="btn btn-primary">Añadir y Finalizar</button>
  55 + {{ form_end(form) }}
  56 + </div>
43 57  
44   - {{ form_end(form) }}
  58 + </div>
45 59 </div>
46   -
47   - </div>
  60 + {% if pida %}
  61 + <div class="col-md-6">
  62 + <div class="account-container register">
  63 + <div class="content clearfix">
  64 + <h2>Mi pida <span class="small" style="float: right;"> Estatus: {{ servicio.idEstatus }}</span></h2>
  65 + <table class="table table-bordered">
  66 + <th>Objetivo Histórico</th>
  67 + <th>Actividad Docente</th>
  68 + <th>Tarea Específica</th>
  69 + <th>Plazo</th>
  70 + <th>Estatus</th>
  71 + {% for pid in pida %}
  72 + <tr>
  73 + <td rowspan="{{ pid.pidaTareaEspecifico | length }}">{{ pid.idPlanHistoricoNacionalEstrategico.nombre }}</td>
  74 + <td rowspan="{{ pid.pidaTareaEspecifico | length }}">{{ pid.idActividadDocente.nombre }}</td>
  75 +
  76 + {% for tarea in pid.pidaTareaEspecifico %}
  77 + <td>{{ tarea.pidaTareaEspecifico }}</td>
  78 + <td>{{ tarea.idPidaPlazo }}</td>
  79 + <td>{{ tarea.idPidaEstatus }}</td>
  80 + </tr>
  81 + {% endfor %}
48 82  
  83 + </tr>
  84 + {% endfor %}
  85 + </table>
  86 + </div>
  87 + </div>
  88 + </div>
  89 + {% endif %}
  90 +
  91 + </div>
49 92  
50 93 {% endblock %}
51 94  
... ... @@ -58,5 +101,57 @@
58 101 <script type="text/javascript">
59 102  
60 103 $('select').select2();
  104 + var $addActividadLink = $('<a href="#" class="add_actividad_link">Añadir Tarea Específica</a>');
  105 + var $newLinkLiActividad = $('<li></li>').append($addActividadLink);
  106 + jQuery(document).ready(function() {
  107 + $ActividadHolder = $('ul.actividad');
  108 + $ActividadHolder.append($newLinkLiActividad);
  109 + $ActividadHolder.data('index', $ActividadHolder.find(':input').length);
  110 + console.log($ActividadHolder);
  111 + $addActividadLink.on('click', function(e) {
  112 + // prevent the link from creating a "#" on the URL
  113 + e.preventDefault();
  114 +
  115 + // add a new tag form (see next code block)
  116 + addActividadForm($ActividadHolder, $newLinkLiActividad);
  117 + });
  118 +
  119 + });
  120 +
  121 + function addActividadForm($contenidoHolder, $newLinkLiContenido) {
  122 + // Get the data-prototype explained earlier
  123 + var prototype = $contenidoHolder.data('prototype');
  124 + console.log(prototype);
  125 +
  126 + // get the new index
  127 + var index = $contenidoHolder.data('index');
  128 +
  129 + // Replace '$$name$$' in the prototype's HTML to
  130 + // instead be a number based on how many items we have
  131 + var newFormContenido = prototype.replace(/__name__/g, index);
  132 +
  133 + // increase the index with one for the next item
  134 + $contenidoHolder.data('index', index + 1);
  135 +
  136 + // Display the form in the page in an li, before the "Add a tag" link li
  137 + var $newFormLiContenido = $('<li></li>').append(newFormContenido);
  138 +
  139 + // also add a remove button, just for this example
  140 + $newFormLiContenido.append('<a href="#" class="remove-tag">x</a>');
  141 +
  142 + $newLinkLiContenido.before($newFormLiContenido);
  143 +
  144 + // handle the removal, just for this example
  145 + $('.remove-tag').click(function(e) {
  146 + e.preventDefault();
  147 +
  148 + $(this).parent().remove();
  149 +
  150 + return false;
  151 + });
  152 +
  153 +
  154 + }
  155 +
61 156 </script>
62 157 {% endblock %}
... ...
src/AppBundle/Controller/AdscripcionController.php
... ... @@ -9,6 +9,7 @@
9 9 namespace AppBundle\Controller;
10 10  
11 11 use AppBundle\Entity\DocumentosVerificados;
  12 +use AppBundle\Entity\PidaTareaEspecifico;
12 13 use Symfony\Component\Form\FormError;
13 14 use Symfony\Component\HttpFoundation\File\UploadedFile;
14 15 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
... ... @@ -448,9 +449,19 @@ class AdscripcionController extends Controller
448 449 if(!$adscripcion) return $this->redirect($this->generateUrl('solicitud_adscripcion'));
449 450  
450 451 //si ya se tiene PIDA
451   - if($this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')->findOneByIdRolInstitucion($this->getUser()->getIdRolInstitucion()->getId())){
452   - return $this->redirect($this->generateUrl('cea_index'));
453   - }
  452 + $pid = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')->findByIdRolInstitucion(array(
  453 + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId()
  454 + ));
  455 +
  456 + $serv = "";
  457 +
  458 + if($pid){
  459 + $serv = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->
  460 + findOneBy(array(
  461 + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId(),
  462 + 'idServicioCe' => 4
  463 + ));
  464 + }
454 465  
455 466 $pida = new AdscripcionPida();
456 467 $form = $this->createForm('AppBundle\Form\PidaType', $pida);
... ... @@ -458,33 +469,42 @@ class AdscripcionController extends Controller
458 469  
459 470  
460 471 if ($form->isSubmitted() && $form->isValid()) {
461   -
  472 + $em = $this->getDoctrine()->getManager();
462 473 //Crear la solicitud de Servicio
463   - $servicios = new DocenteServicio();
  474 + if(!$pid) {
  475 + $servicios = new DocenteServicio();
464 476  
465   - $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion());
466   - $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4));
467   - $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2));
  477 + $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion());
  478 + $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4));
  479 + $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2));
  480 + $em->persist($servicios);
  481 + }
468 482  
469 483  
470 484  
471 485 $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion());
472 486 $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2));
  487 + foreach($pida->getPidaTareaEspecifico() as $especifico){
  488 + //var_dump($especifico); exit;
  489 + $especifico->setAdscripcionPidaId($pida);
  490 + }
  491 +
473 492  
474   - $em = $this->getDoctrine()->getManager();
  493 +
475 494 $em->persist($pida);
476   - $em->persist($servicios);
  495 +
477 496 $em->flush();
478   -
479   - return $this->redirectToRoute('cea_index');
  497 +
  498 + return $this->redirectToRoute('solicitud_pida');
480 499  
481 500 }
482   -
483   -
484   - return $this->render(
485   - 'solicitudes/pida.html.twig',
486   - array('form' => $form->createView())
487   - );
  501 +
  502 +
  503 + return $this->render('solicitudes/pida.html.twig', array(
  504 + 'form' => $form->createView(),
  505 + 'pida' => $pid,
  506 + 'servicio' => $serv
  507 + ));
488 508  
489 509  
490 510 }
... ...
src/AppBundle/Entity/AdscripcionPida.php
... ... @@ -3,13 +3,14 @@
3 3  
4 4 namespace AppBundle\Entity;
5 5  
  6 +use Doctrine\Common\Collections\ArrayCollection;
6 7 use Doctrine\ORM\Mapping as ORM;
7 8  
8 9  
9 10 /**
10 11 * AdscripcionPida
11 12 *
12   - * @ORM\Table(name="solicitud_pida", uniqueConstraints={@ORM\UniqueConstraint(name="pida_id_rol_institucion_key", columns={"id_rol_institucion"})})
  13 + * @ORM\Table(name="solicitud_pida", uniqueConstraints={@ORM\UniqueConstraint(name="pida_id_rol_institucion_key", columns={"id_rol_institucion", "id_plan_historico_nacional_estrategico", "id_actividad_docente"})})
13 14 * @ORM\Entity
14 15 * @ORM\HasLifecycleCallbacks()
15 16 */
... ... @@ -25,14 +26,13 @@ class AdscripcionPida
25 26 * @ORM\SequenceGenerator(sequenceName="adscripcion_id_seq", allocationSize=1, initialValue=1)
26 27 */
27 28 private $id;
28   -
29   -
  29 +
  30 +
30 31 /**
31   - * @var string
32   - *
33   - * @ORM\Column(name="objetivo_especifico", type="text", nullable=false, options={"comment" = "objetivo especifico a desarrollar dentro enmarcado en el plan patria"})
  32 + * @ORM\OneToMany(targetEntity="AppBundle\Entity\PidaTareaEspecifico", mappedBy="adscripcionPidaId",cascade={"all"})
  33 + * @var \Doctrine\Common\Collections\ArrayCollection
34 34 */
35   - private $objetivoEspecifico;
  35 + private $pidaTareaEspecifico;
36 36  
37 37  
38 38  
... ... @@ -70,15 +70,7 @@ class AdscripcionPida
70 70 protected $idActividadDocente;
71 71  
72 72  
73   - /**
74   - * @var \AppBundle\Entity\PidaPlazo
75   - *
76   - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PidaPlazo")
77   - * @ORM\JoinColumns({
78   - * @ORM\JoinColumn(name="id_pida_plazo", referencedColumnName="id", nullable=true)
79   - * })
80   - */
81   - protected $idPidaPlazo;
  73 +
82 74  
83 75  
84 76  
... ... @@ -98,15 +90,6 @@ class AdscripcionPida
98 90 private $fecha_ultima_actualizacion;
99 91  
100 92  
101   - /**
102   - * @var \AppBundle\Entity\PidaEstatus
103   - *
104   - * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PidaEstatus")
105   - * @ORM\JoinColumns({
106   - * @ORM\JoinColumn(name="id_pida_estatus", referencedColumnName="id", nullable=true)
107   - * })
108   - */
109   - protected $idPidaEstatus;
110 93  
111 94  
112 95  
... ... @@ -267,72 +250,50 @@ class AdscripcionPida
267 250  
268 251  
269 252  
270   - /**
271   - * Set objetivoEspecifico
272   - *
273   - * @param string $objetivoEspecifico
274   - * @return AdscripcionPida
275   - */
276   - public function setObjetivoEspecifico($objetivoEspecifico)
277   - {
278   - $this->objetivoEspecifico = $objetivoEspecifico;
279 253  
280   - return $this;
281   - }
282 254  
283 255 /**
284   - * Get objetivoEspecifico
285   - *
286   - * @return string
  256 + * Constructor
287 257 */
288   - public function getObjetivoEspecifico()
  258 + public function __construct()
289 259 {
290   - return $this->objetivoEspecifico;
  260 + $this->pidaTareaEspecifico = new ArrayCollection();
291 261 }
292 262  
293 263 /**
294   - * Set idPidaPlazo
  264 + * Add pidaTareaEspecifico
295 265 *
296   - * @param \AppBundle\Entity\PidaPlazo $idPidaPlazo
  266 + * @param \AppBundle\Entity\PidaTareaEspecifico $pidaTareaEspecifico
297 267 * @return AdscripcionPida
298 268 */
299   - public function setIdPidaPlazo(\AppBundle\Entity\PidaPlazo $idPidaPlazo = null)
  269 + public function addPidaTareaEspecifico(\AppBundle\Entity\PidaTareaEspecifico $pidaTareaEspecifico)
300 270 {
301   - $this->idPidaPlazo = $idPidaPlazo;
  271 + $this->pidaTareaEspecifico[] = $pidaTareaEspecifico;
302 272  
303 273 return $this;
304 274 }
305 275  
306 276 /**
307   - * Get idPidaPlazo
  277 + * Remove pidaTareaEspecifico
308 278 *
309   - * @return \AppBundle\Entity\PidaPlazo
  279 + * @param \AppBundle\Entity\PidaTareaEspecifico $pidaTareaEspecifico
310 280 */
311   - public function getIdPidaPlazo()
  281 + public function removePidaTareaEspecifico(\AppBundle\Entity\PidaTareaEspecifico $pidaTareaEspecifico)
312 282 {
313   - return $this->idPidaPlazo;
  283 + $this->pidaTareaEspecifico->removeElement($pidaTareaEspecifico);
314 284 }
315 285  
316 286 /**
317   - * Set idPidaEstatus
  287 + * Get pidaTareaEspecifico
318 288 *
319   - * @param \AppBundle\Entity\PidaEstatus $idPidaEstatus
320   - * @return AdscripcionPida
  289 + * @return \Doctrine\Common\Collections\Collection
321 290 */
322   - public function setIdPidaEstatus(\AppBundle\Entity\PidaEstatus $idPidaEstatus)
  291 + public function getPidaTareaEspecifico()
323 292 {
324   - $this->idPidaEstatus = $idPidaEstatus;
325   -
326   - return $this;
  293 + return $this->pidaTareaEspecifico;
327 294 }
328 295  
329   - /**
330   - * Get idPidaEstatus
331   - *
332   - * @return \AppBundle\Entity\PidaEstatus
333   - */
334   - public function getIdPidaEstatus()
335   - {
336   - return $this->idPidaEstatus;
  296 + public function __toString() {
  297 + return $this->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre();
337 298 }
338 299 }
... ...
src/AppBundle/Entity/AdscripcionPida.php~
... ... @@ -25,14 +25,13 @@ class AdscripcionPida
25 25 * @ORM\SequenceGenerator(sequenceName="adscripcion_id_seq", allocationSize=1, initialValue=1)
26 26 */
27 27 private $id;
28   -
29   -
  28 +
  29 +
30 30 /**
31   - * @var string
32   - *
33   - * @ORM\Column(name="objetivo_especifico", type="text", nullable=false, options={"comment" = "objetivo especifico a desarrollar dentro enmarcado en el plan patria"})
  31 + * @ORM\OneToMany(targetEntity="AppBundle\Entity\PidaTareaEspecifico", mappedBy="AdscripcionPidaId",cascade={"all"})
  32 + * @var \Doctrine\Common\Collections\ArrayCollection
34 33 */
35   - private $objetivoEspecifico;
  34 + private $pidaTareaEspecifico;
36 35  
37 36  
38 37  
... ... @@ -103,7 +102,7 @@ class AdscripcionPida
103 102 *
104 103 * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PidaEstatus")
105 104 * @ORM\JoinColumns({
106   - * @ORM\JoinColumn(name="id_pida_estatus", referencedColumnName="id", nullable=false)
  105 + * @ORM\JoinColumn(name="id_pida_estatus", referencedColumnName="id", nullable=true)
107 106 * })
108 107 */
109 108 protected $idPidaEstatus;
... ... @@ -267,49 +266,50 @@ class AdscripcionPida
267 266  
268 267  
269 268  
  269 +
270 270 /**
271   - * Set objetivoEspecifico
  271 + * Set idPidaPlazo
272 272 *
273   - * @param string $objetivoEspecifico
  273 + * @param \AppBundle\Entity\PidaPlazo $idPidaPlazo
274 274 * @return AdscripcionPida
275 275 */
276   - public function setObjetivoEspecifico($objetivoEspecifico)
  276 + public function setIdPidaPlazo(\AppBundle\Entity\PidaPlazo $idPidaPlazo = null)
277 277 {
278   - $this->objetivoEspecifico = $objetivoEspecifico;
  278 + $this->idPidaPlazo = $idPidaPlazo;
279 279  
280 280 return $this;
281 281 }
282 282  
283 283 /**
284   - * Get objetivoEspecifico
  284 + * Get idPidaPlazo
285 285 *
286   - * @return string
  286 + * @return \AppBundle\Entity\PidaPlazo
287 287 */
288   - public function getObjetivoEspecifico()
  288 + public function getIdPidaPlazo()
289 289 {
290   - return $this->objetivoEspecifico;
  290 + return $this->idPidaPlazo;
291 291 }
292 292  
293 293 /**
294   - * Set idPidaPlazo
  294 + * Set idPidaEstatus
295 295 *
296   - * @param \AppBundle\Entity\PidaPlazo $idPidaPlazo
  296 + * @param \AppBundle\Entity\PidaEstatus $idPidaEstatus
297 297 * @return AdscripcionPida
298 298 */
299   - public function setIdPidaPlazo(\AppBundle\Entity\PidaPlazo $idPidaPlazo = null)
  299 + public function setIdPidaEstatus(\AppBundle\Entity\PidaEstatus $idPidaEstatus)
300 300 {
301   - $this->idPidaPlazo = $idPidaPlazo;
  301 + $this->idPidaEstatus = $idPidaEstatus;
302 302  
303 303 return $this;
304 304 }
305 305  
306 306 /**
307   - * Get idPidaPlazo
  307 + * Get idPidaEstatus
308 308 *
309   - * @return \AppBundle\Entity\PidaPlazo
  309 + * @return \AppBundle\Entity\PidaEstatus
310 310 */
311   - public function getIdPidaPlazo()
  311 + public function getIdPidaEstatus()
312 312 {
313   - return $this->idPidaPlazo;
  313 + return $this->idPidaEstatus;
314 314 }
315 315 }
... ...
src/AppBundle/Entity/PidaTareaEspecifico.php
... ... @@ -0,0 +1,171 @@
  1 +<?php
  2 +
  3 +namespace AppBundle\Entity;
  4 +
  5 +use Doctrine\ORM\Mapping as ORM;
  6 +
  7 +/**
  8 + * PidaTareaEspecifico
  9 + *
  10 + * @ORM\Table(name="pida_tarea_especifico")
  11 + * @ORM\Entity
  12 + */
  13 +class PidaTareaEspecifico
  14 +{
  15 + /**
  16 + * @var text
  17 + *
  18 + * @ORM\Column(name="pida_tarea_especifico", type="text", nullable=false, options={"comment" = "Tarea especifia ejecuta por el docenta bajo una labor y enmarcada en el plan de la patria"})
  19 + */
  20 + private $pidaTareaEspecifico;
  21 +
  22 +
  23 +
  24 + /**
  25 + * @var integer
  26 + *
  27 + * @ORM\Column(name="id", type="integer", nullable=false, options={"comment" = "Identificador del municipio"})
  28 + * @ORM\Id
  29 + * @ORM\GeneratedValue(strategy="IDENTITY")
  30 + * @ORM\SequenceGenerator(sequenceName="municipio_id_seq", allocationSize=1, initialValue=1)
  31 + */
  32 + private $id;
  33 +
  34 +
  35 +
  36 + /**
  37 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\AdscripcionPida", inversedBy="pidaTareaEspecifico")
  38 + * @ORM\JoinColumn(name="adscripcion_pida_id", referencedColumnName="id", nullable=FALSE)
  39 + */
  40 + private $adscripcionPidaId;
  41 +
  42 + /**
  43 + * @var \AppBundle\Entity\PidaPlazo
  44 + *
  45 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PidaPlazo")
  46 + * @ORM\JoinColumns({
  47 + * @ORM\JoinColumn(name="id_pida_plazo", referencedColumnName="id", nullable=true)
  48 + * })
  49 + */
  50 + protected $idPidaPlazo;
  51 +
  52 +
  53 + /**
  54 + * @var \AppBundle\Entity\PidaEstatus
  55 + *
  56 + * @ORM\ManyToOne(targetEntity="AppBundle\Entity\PidaEstatus")
  57 + * @ORM\JoinColumns({
  58 + * @ORM\JoinColumn(name="id_pida_estatus", referencedColumnName="id", nullable=true)
  59 + * })
  60 + */
  61 + protected $idPidaEstatus;
  62 +
  63 +
  64 +
  65 +
  66 + /**
  67 + * Get id
  68 + *
  69 + * @return integer
  70 + */
  71 + public function getId()
  72 + {
  73 + return $this->id;
  74 + }
  75 +
  76 + /**
  77 + * Set adscripcionPidaId
  78 + *
  79 + * @param \AppBundle\Entity\AdscripcionPida $adscripcionPidaId
  80 + * @return PidaTareaEspecifico
  81 + */
  82 + public function setAdscripcionPidaId(\AppBundle\Entity\AdscripcionPida $adscripcionPidaId)
  83 + {
  84 + $this->adscripcionPidaId = $adscripcionPidaId;
  85 +
  86 + return $this;
  87 + }
  88 +
  89 + /**
  90 + * Get adscripcionPidaId
  91 + *
  92 + * @return \AppBundle\Entity\AdscripcionPida
  93 + */
  94 + public function getAdscripcionPidaId()
  95 + {
  96 + return $this->adscripcionPidaId;
  97 + }
  98 +
  99 + /**
  100 + * Set pidaTareaEspecifico
  101 + *
  102 + * @param string $pidaTareaEspecifico
  103 + * @return PidaTareaEspecifico
  104 + */
  105 + public function setPidaTareaEspecifico($pidaTareaEspecifico)
  106 + {
  107 + $this->pidaTareaEspecifico = $pidaTareaEspecifico;
  108 +
  109 + return $this;
  110 + }
  111 +
  112 + /**
  113 + * Get pidaTareaEspecifico
  114 + *
  115 + * @return string
  116 + */
  117 + public function getPidaTareaEspecifico()
  118 + {
  119 + return $this->pidaTareaEspecifico;
  120 + }
  121 +
  122 + /**
  123 + * Set idPidaPlazo
  124 + *
  125 + * @param \AppBundle\Entity\PidaPlazo $idPidaPlazo
  126 + * @return PidaTareaEspecifico
  127 + */
  128 + public function setIdPidaPlazo(\AppBundle\Entity\PidaPlazo $idPidaPlazo = null)
  129 + {
  130 + $this->idPidaPlazo = $idPidaPlazo;
  131 +
  132 + return $this;
  133 + }
  134 +
  135 + /**
  136 + * Get idPidaPlazo
  137 + *
  138 + * @return \AppBundle\Entity\PidaPlazo
  139 + */
  140 + public function getIdPidaPlazo()
  141 + {
  142 + return $this->idPidaPlazo;
  143 + }
  144 +
  145 + /**
  146 + * Set idPidaEstatus
  147 + *
  148 + * @param \AppBundle\Entity\PidaEstatus $idPidaEstatus
  149 + * @return PidaTareaEspecifico
  150 + */
  151 + public function setIdPidaEstatus(\AppBundle\Entity\PidaEstatus $idPidaEstatus = null)
  152 + {
  153 + $this->idPidaEstatus = $idPidaEstatus;
  154 +
  155 + return $this;
  156 + }
  157 +
  158 + /**
  159 + * Get idPidaEstatus
  160 + *
  161 + * @return \AppBundle\Entity\PidaEstatus
  162 + */
  163 + public function getIdPidaEstatus()
  164 + {
  165 + return $this->idPidaEstatus;
  166 + }
  167 + public function __toString()
  168 + {
  169 + return $this->getPidaTareaEspecifico();
  170 + }
  171 +}
... ...
src/AppBundle/Form/PidaTareaEspecificoType.php
... ... @@ -0,0 +1,66 @@
  1 +<?php
  2 +
  3 +namespace AppBundle\Form;
  4 +
  5 +use Doctrine\ORM\EntityRepository;
  6 +use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  7 +use Symfony\Component\Form\AbstractType;
  8 +use Symfony\Component\Form\FormBuilderInterface;
  9 +use Symfony\Component\OptionsResolver\OptionsResolver;
  10 +
  11 +class PidaTareaEspecificoType extends AbstractType
  12 +{
  13 + /**
  14 + * @param FormBuilderInterface $builder
  15 + * @param array $options
  16 + */
  17 + public function buildForm(FormBuilderInterface $builder, array $options)
  18 + {
  19 + $builder
  20 + ->add('pidaTareaEspecifico', \Symfony\Component\Form\Extension\Core\Type\TextType::class, array(
  21 + 'label' => 'Tarea: '
  22 + ))
  23 + ->add('idPidaPlazo', EntityType::class, array(
  24 + 'class' => 'AppBundle:PidaPlazo',
  25 + 'label' => 'Plazo de la Tarea: ',
  26 + 'label_attr' => array('class' => 'radio-inline'),
  27 +
  28 +
  29 +
  30 + 'choice_label' => 'nombre',
  31 +
  32 + // used to render a select box, check boxes or radios
  33 + // 'multiple' => true,
  34 + 'expanded' => true,
  35 + ))
  36 +
  37 +
  38 + ->add('idPidaEstatus', EntityType::class, array(
  39 + 'class' => 'AppBundle:PidaEstatus',
  40 + 'label' => 'Estado Actual de la tarea:',
  41 + 'label_attr' => array('class' => 'radio-inline'),
  42 + 'query_builder' => function (EntityRepository $er) {
  43 + return $er->createQueryBuilder('u')
  44 + ->orderBy('u.id', 'ASC');
  45 + },
  46 +
  47 + // use the User.username property as the visible option string
  48 + 'choice_label' => 'nombre',
  49 +
  50 + // used to render a select box, check boxes or radios
  51 + // 'multiple' => true,
  52 + 'expanded' => true,
  53 + ))
  54 + ;
  55 + }
  56 +
  57 + /**
  58 + * @param OptionsResolver $resolver
  59 + */
  60 + public function configureOptions(OptionsResolver $resolver)
  61 + {
  62 + $resolver->setDefaults(array(
  63 + 'data_class' => 'AppBundle\Entity\PidaTareaEspecifico'
  64 + ));
  65 + }
  66 +}
... ...
src/AppBundle/Form/PidaType.php
... ... @@ -11,12 +11,12 @@ namespace AppBundle\Form;
11 11  
12 12 use Doctrine\ORM\EntityRepository;
13 13 use Symfony\Component\Form\AbstractType;
  14 +use Symfony\Component\Form\Extension\Core\Type\CollectionType;
14 15 use Symfony\Component\Form\FormBuilderInterface;
15 16 use Symfony\Component\OptionsResolver\OptionsResolver;
16 17  
17 18  
18 19 use Symfony\Bridge\Doctrine\Form\Type\EntityType;
19   -use Symfony\Component\Form\Extension\Core\Type\TextType;
20 20  
21 21 class PidaType extends AbstractType
22 22 {
... ... @@ -48,42 +48,14 @@ class PidaType extends AbstractType
48 48 'choice_label' => 'getNombre'
49 49  
50 50 ))
51   -
52   - ->add('objetivo_especifico', TextType::class, array(
53   - 'label' => 'Tarea'
54   - ))
55   -
56   - ->add('idPidaPlazo', EntityType::class, array(
57   - 'class' => 'AppBundle:PidaPlazo',
58   - 'label' => 'Plazos de la Actividad: ',
59   - 'label_attr' => array('class' => 'radio-inline'),
60   -
61   -
62 51  
63   - 'choice_label' => 'nombre',
64   -
65   - // used to render a select box, check boxes or radios
66   - // 'multiple' => true,
67   - 'expanded' => true,
  52 + ->add('pidaTareaEspecifico', CollectionType::class, array(
  53 + 'entry_type' => PidaTareaEspecificoType::class,
  54 + 'allow_add' => true,
  55 + 'label' => false
68 56 ))
  57 +
69 58  
70   -
71   - ->add('idPidaEstatus', EntityType::class, array(
72   - 'class' => 'AppBundle:PidaEstatus',
73   - 'label' => false,
74   - 'label_attr' => array('class' => 'radio-inline'),
75   - 'query_builder' => function (EntityRepository $er) {
76   - return $er->createQueryBuilder('u')
77   - ->orderBy('u.id', 'ASC');
78   - },
79   -
80   - // use the User.username property as the visible option string
81   - 'choice_label' => 'nombre',
82   -
83   - // used to render a select box, check boxes or radios
84   - // 'multiple' => true,
85   - 'expanded' => true,
86   - ))
87 59  
88 60  
89 61  
... ...