Esempio n. 1
0
 /**
  * Displays a form to edit an existing Application entity.
  *
  * @Route("/{id}/edit", name="application_edit")
  * @Method({"GET", "POST"})
  */
 public function editAction(Request $request, Application $application)
 {
     $deleteForm = $this->createDeleteForm($application);
     $editForm = $this->createForm('BackendBundle\\Form\\ApplicationType', $application, array('stateArray' => array_flip($application->getStateArray())));
     $editForm->handleRequest($request);
     if ($editForm->isSubmitted() && $editForm->isValid()) {
         /********** ESTO ES TEMPORAL HASTA QUE SIDING PROVEA RECURSOS 746E ***************/
         if ($application->getState() == 10) {
             //notificacion de systema a mentor
             $notification1 = new Notification();
             $mentor = $application->getOportunityResearch()->getMainMentor();
             $reciever = $mentor->getUser();
             $message = "Un nuevo alumno ha postulado a su oportunidad de investigación: " . $application->getOportunityResearch()->getName() . " porfavor pongase en contacto con el para coordinar su reunión." . '@<' . $currentUser->getId() . '>@';
             $notification1->sendSystemMessage($reciever, $message);
             //notificacion de systema a estudiante
             $notification2 = new Notification();
             $reciever = $application->getStudent()->getUser();
             $message = "Felicitaciones, su postulación a la oportunidad de investigación: " . $application->getOportunityResearch()->getName() . " ha sido ingresada y notifiacada al mentor, este se pondrá en contacto con usted para coordinar su reunión";
             $notification2->sendSystemMessage($reciever, $message);
         }
         /********** ESTO ES TEMPORAL HASTA QUE SIDING PROVEA RECURSOS ***************/
         $em = $this->getDoctrine()->getManager();
         $em->persist($application);
         /********** ESTO ES TEMPORAL HASTA QUE SIDING PROVEA RECURSOS 746E ***************/
         if ($application->getState() == 10) {
             $em->persist($notification1);
             $em->persist($notification2);
         }
         /********** ESTO ES TEMPORAL HASTA QUE SIDING PROVEA RECURSOS ***************/
         $em->flush();
         return $this->redirectToRoute('application_edit', array('id' => $application->getId()));
     }
     return $this->render('application/edit.html.twig', array('application' => $application, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView()));
 }
Esempio n. 2
0
 /**
  * Creates a form to delete a Notification entity.
  *
  * @param Notification $notification The Notification entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Notification $notification)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('notification_delete', array('id' => $notification->getId())))->setMethod('DELETE')->getForm();
 }