Ejemplo n.º 1
0
 public function sendEmailRefus(Dossier $dossier)
 {
     $etudiant = $dossier->getEtudiant();
     $subject = "Refus de candidature";
     $to = $etudiant->getEmail();
     $template = 'AppBundle:Emails:reponseFinaleRefuser.html.twig';
     $body = $this->templating->render($template, array('etudiant' => $etudiant, 'dossier' => $dossier, 'annee' => '2016/2017'));
     $this->sendMessage($to, $subject, $body);
 }
Ejemplo n.º 2
0
 public function NewAction(Request $request)
 {
     $dossier = new Dossier();
     $etudiant = new Etudiant();
     $form = $this->createForm(new EtudiantType(), $etudiant);
     if ($form->handleRequest($request)->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($etudiant);
         $em->flush();
         $dossier->setIdDossier($this->createIdDossier());
         $dossier->setEtat($form->get('etat')->getData());
         $dossier->setEtudiant($etudiant);
         $em->persist($dossier);
         $em->flush();
         return $this->redirect($this->generateUrl('index_frontend'));
     }
     return $this->render('AppBundle:Dossier:newDossier.html.twig', array('form' => $form->createView()));
 }
Ejemplo n.º 3
0
 /**
  * @Security("has_role('ROLE_USER')")
  *
  */
 public function NewAction(Request $request)
 {
     $dossier = new Dossier();
     $etudiant = new Etudiant();
     $form = $this->createForm(new EtudiantType(), $etudiant);
     if ($form->handleRequest($request)->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $email = $form->get('email')->getData();
         $result = $em->getRepository("AppBundle:Etudiant")->findBy(array('email' => $email));
         if ($result != null) {
             $etud = $em->getRepository("AppBundle:Etudiant")->find($result[0]->getId());
             $dossier->setEtudiant($etud);
         } else {
             $em->persist($etudiant);
             $em->flush();
             $dossier->setEtudiant($etudiant);
         }
         //Ajout des attributs dans le dossier
         $dossier->setIdDossier($this->createIdDossier());
         $dossier->setEtat($form->get('etat')->getData());
         $dossier->setFormation($form->get('Formations')->getData());
         /* $formation = $em->getRepository("AppBundle:Etudiant")->find($result[0]->getDossier());
            if($form->get('Formations')->getID() != $formation->getId()){*/
         $em->persist($dossier);
         $em->flush();
         //Ajout dans l'historique
         $action = 'Nouveau Dossier';
         $nom = $etudiant->getNom();
         $prenom = $etudiant->getPrenom();
         $email = $etudiant->getEmail();
         $formationLibelle = $dossier->getFormation()->getLibelle();
         $formationNiveau = $dossier->getFormation()->getNiveau();
         $etat = $dossier->getEtat()->getLibelle();
         $comment = $nom . " " . $prenom . " " . $email . " " . $formationLibelle . " " . $formationNiveau . " " . $etat;
         $historique = $this->AjoutLigneHistorique(1, $dossier, $action, $comment);
         $em->persist($historique);
         $suivi = new Suivi();
         $suivi->setDossier($dossier);
         $em->persist($suivi);
         $em->flush();
         /*}*/
         $this->get('session')->getFlashBag()->add('info', "Le dossier a été ajouté avec succès.");
         return $this->redirect($this->generateUrl('get_dossier', ['id' => $dossier->getId()]));
     }
     return $this->render('AppBundle:Dossier:newDossier.html.twig', array('form' => $form->createView()));
 }
Ejemplo n.º 4
0
 /**
  * Creates a new dossier from the submitted data.
  *
  * @ApiDoc(
  *   resource = true,
  *   input = "AppBundle\Form\DossierType",
  *   statusCodes = {
  *     200 = "Returned when successful",
  *     400 = "Returned when the form has errors"
  *   }
  * )
  *
  * @Annotations\View(
  *   template = "AppBundle:Dossier:getDossier.html.twig",
  *   templateVar = "dossier",
  *   statusCode = Response::HTTP_BAD_REQUEST
  * )
  *
  * @param Request $request the request object
  *
  * @return FormTypeInterface[]|View
  */
 public function postDossiersAction(Request $request)
 {
     $dossier = new Dossier();
     $etudiant = new Etudiant();
     $form = $this->createForm(new EtudiantType(), $etudiant);
     if ($form->handleRequest($request)->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($etudiant);
         $em->flush();
         $dossier->setIdDossier($this->createIdDossier());
         $dossier->setEtat($form->get('etat')->getData());
         $dossier->setEtudiant($etudiant);
         $em->persist($dossier);
         $em->flush();
         return $this->routeRedirectView('api_1_get_dossier', ['id' => $dossier->getId()])->setData($dossier);
     }
     return array('form' => $form);
 }
Ejemplo n.º 5
0
 public function testGetIdDossierTest()
 {
     $dossier = new Dossier();
     $dossier->setIdDossier('coucou');
     $this->assertEquals('coucou', $dossier->getIdDossier());
 }