public function registerAction()
 {
     $form = $this->container->get('fos_user.registration.form');
     $formHandler = $this->container->get('fos_user.registration.form.handler');
     $confirmationEnabled = $this->container->getParameter('fos_user.registration.confirmation.enabled');
     $process = $formHandler->process($confirmationEnabled);
     if ($process) {
         $user = $form->getData();
         $authUser = false;
         if ($confirmationEnabled) {
             $this->container->get('session')->set('fos_user_send_confirmation_email/email', $user->getEmail());
             $route = 'fos_user_registration_check_email';
         } else {
             $authUser = true;
             $user->setEnabled(false);
             $this->container->get('fos_user.user_manager')->updateUser($user);
             $notification = new Notification();
             $notification->setAction('Nouvel utilisateur')->setDescriptif('Un nouvel utilisateur s\'est inscrit');
             $this->getDoctrine()->getManager()->persist($notification);
             $this->getDoctrine()->getManager()->flush();
             $route = 'fos_user_registration_confirmed';
             // envoi d'un mail
             /*	$message = \Swift_Message::newInstance();
             			$message->setSubject("Bienvenue");
             			$message->setFrom('*****@*****.**');
             			$message->setTo('*****@*****.**');
             			$message->setBody('corps du message');
             			
             			$this->container->get('mailer')->send($message); */
         }
         $url = $this->container->get('router')->generate($route);
         $response = new RedirectResponse($url);
         return $response;
     }
     return $this->container->get('templating')->renderResponse('AMiEUserBundle:Registration:register.html.twig', array('form' => $form->createView()));
 }
Beispiel #2
0
 public function modifierAction(Actualite $actualite)
 {
     $em = $this->getDoctrine()->getManager();
     $user = $this->get('security.context')->getToken()->getUser();
     $update = self::insertOrUpdate($em, $user, $actualite->getId());
     if ($update['Valide']) {
         $actualite = $update['actualite'];
         $notification = new Notification();
         $notification->setAction('Modification d\'une actualité')->setDescriptif('L\'utilisateur ' . $user->getUsername() . ' a modifié l\'actualité : ' . $actualite->getTitre())->setIdUser($user->getId());
         $em->persist($notification);
         $em->flush();
         return $this->redirect($this->generateUrl('amie_actualites_actualite', array('id' => $actualite->getId(), 'slug' => $this->get('slugify')->slugify($actualite->getTitre()))));
     }
     $layout = $this->getLayout($em);
     return $this->render('AMiEActualitesBundle:News:modifier.html.twig', array('layout' => $layout, 'formActu' => $update['formActu'], 'formImage' => $update['formImage'], 'actualite' => $actualite));
 }
Beispiel #3
0
 public function modifierembaucheAction(Formulaire $f)
 {
     $em = $this->getDoctrine()->getManager();
     $layout = $this->getLayout($em);
     $user = $this->get('security.context')->getToken()->getUser();
     $requete = $this->get('request');
     if ($requete->isMethod('POST')) {
         if (!empty($_POST['secteur'])) {
             $f->setSecteur($_POST['secteur']);
         }
         if (!empty($_POST['sectAutre'])) {
             $f->setSectAutre($_POST['sectAutre']);
         }
         if (!empty($_POST['metier'])) {
             $f->setMetier($_POST['metier']);
         }
         if (!empty($_POST['metAutre'])) {
             $f->setMetAutre($_POST['metAutre']);
         }
         $em->persist($f);
         $em->flush();
         $notification = new Notification();
         $notification->setAction('Modification d\'un formulaire Miagiste')->setDescriptif('L\'utilisateur ' . $user->getUsername() . ' a modifié le formulaire de : ' . $f->getPrenom() . $f->getNom())->setIdUser($user->getId())->setIdOffre($f->getId());
         $em->persist($notification);
         $em->flush();
     }
     return $this->render('AMiEMiagistesBundle:Miagistes:fiche.html.twig', array('layout' => $layout, 'formulaire' => $f));
 }
Beispiel #4
0
 public function modifiertypeAction(OffreEmploi $offre)
 {
     $em = $this->getDoctrine()->getManager();
     $user = $this->get('security.context')->getToken()->getUser();
     $requete = $this->get('request');
     if ($requete->isMethod('POST')) {
         if (!empty($_POST['lieu'])) {
             $offre->setLieuTravail(trim(htmlspecialchars($_POST['lieu'])));
         }
         if (!empty($_POST['typeposte'])) {
             $offre->setTypePoste(trim(htmlspecialchars($_POST['typeposte'])));
         }
         if (!empty($_POST['typecontrat'])) {
             $offre->setTypeContrat(trim(htmlspecialchars($_POST['typecontrat'])));
         }
         if (!empty($_POST['xpexigee'])) {
             $offre->setXpExigee(trim(htmlspecialchars($_POST['xpexigee'])));
         }
         if (!empty($_POST['dureevalidite'])) {
             $offre->setDureeValidite(trim(htmlspecialchars($_POST['dureevalidite'])));
         }
         if (!empty($_POST['urgence'])) {
             $offre->setUrgence(trim(htmlspecialchars($_POST['urgence'])));
         }
         if (!empty($_POST['salaire'])) {
             $offre->setSalaire(trim(htmlspecialchars($_POST['salaire'])));
         }
         $em->persist($offre);
         $em->flush();
         $notification = new Notification();
         $notification->setAction('Modification d\'une offre')->setDescriptif('L\'utilisateur ' . $user->getUsername() . ' a modifié l\'offre : ' . $offre->getTitre())->setIdUser($user->getId())->setIdOffre($offre->getId());
         $em->persist($notification);
         $em->flush();
     }
     return $this->redirect($this->generateUrl('amie_offresemplois_offre', array('id' => $offre->getId(), 'slug' => $this->get('slugify')->slugify($offre->getTitre()))));
 }