Esempio n. 1
0
 public function executeConnexion(sfWebRequest $request)
 {
     $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
     $this->formIdentification = new $class();
     if ($request->ismethod('post')) {
         $this->formIdentification->bind($request->getParameter('signin'));
         if ($this->formIdentification->isValid()) {
             $values = $this->formIdentification->getValues();
             $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
             $paypal = new PayPal();
             $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
             //print_r($ret);
         }
     }
 }
Esempio n. 2
0
 public function executeAmende(sfWebRequest $request)
 {
     $this->formContravention = new ContrevenantForm();
     if ($request->ismethod('post')) {
         $this->formContravention->bind($request->getParameter('contrevenant'));
         if ($this->formContravention->isValid()) {
             $param = $request->getParameter('contrevenant');
             $numImmatriculation = $param['num_immatriculation'];
             $dateContravention = $param['date_contravention']['year'] . '-' . $param['date_contravention']['month'] . '-' . $param['date_contravention']['day'];
             $heureContravention = $param['heure_contravention']['hour'] . ':' . $param['heure_contravention']['minute'];
             $listContrevenant = $this->getLocation($numImmatriculation, $dateContravention, $heureContravention);
             //print_r($listContrevenant);
             if (count($listContrevenant) == 0) {
                 $this->listContrevenant = null;
             } else {
                 $this->listContrevenant = $listContrevenant;
             }
         } else {
             $this->listContrevenant = null;
         }
     }
 }
Esempio n. 3
0
 public function executeIdentification(sfWebRequest $request)
 {
     if (!$this->getUser()->isAuthenticated()) {
         $this->formInscription = new InscriptionForm();
         $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
         $this->form = new $class();
         if ($request->ismethod('post')) {
             if ($request->getParameter('send') == "signin") {
                 $this->form->bind($request->getParameter('signin'));
                 if ($this->form->isValid()) {
                     $values = $this->form->getValues();
                     $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
                     if ($this->getUser()->getAttribute('montantLocation')) {
                         $paypal = new PayPal();
                         $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
                         print_r($ret);
                     } else {
                         $this->redirect('espace_membre_profil');
                     }
                 }
             } else {
                 if ($request->getParameter('send') == "signup") {
                     $this->formInscription->bind($request->getParameter('signup'));
                     if ($this->formInscription->isValid()) {
                         $values = $this->formInscription->getValues();
                         //print_r($values);
                         //exit;
                         $user = new sfGuardUser();
                         $user->setEmailAddress($values['email_address']);
                         $user->setUsername($values['email_address']);
                         $user->setLastName($values['nom']);
                         $user->setFirstName($values['prenom']);
                         $user->setPassword($values['password1']);
                         $user->setIsActive(1);
                         $user->getProfile()->setAdresse($values['adresse']);
                         $user->getProfile()->setCodepostal($values['codepostal']);
                         $user->getProfile()->setVille($values['ville']);
                         $user->getProfile()->setFixe($values['fixe']);
                         $user->getProfile()->setMobile($values['mobile']);
                         $user->getProfile()->setDateNaissance($values['date_naissance']);
                         $user->getProfile()->setNumeroPermis($values['numero_permis']);
                         $user->getProfile()->setVilleDelivrance($values['ville_permis']);
                         $user->getProfile()->setPaysDelivrance($values['pays_permis']);
                         $user->getProfile()->setDateDelivrance($values['date_delivrance_permis']);
                         $user->getProfile()->setIsActivated(1);
                         $user->addGroupByName("client");
                         $user->save();
                         $this->getUser()->setAttribute('email_address', $values['email_address']);
                         $message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $values['email_address'], '[Mobilyrent] - Inscription Mobilyrent location de voiture', '[Mobilyrent] - Inscription Mobilyrent location de voiture');
                         $this->getMailer()->send($message);
                         //echo $this->getUser()->getAttribute('montantLocation');exit;
                         if ($this->getUser()->getAttribute('montantLocation')) {
                             $paypal = new PayPal();
                             $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
                             print_r($ret);
                         }
                         //$this->getUser()->setFlash('notice', sprintf('Inscription terminée.<br/>Un email vous a été envoyé. Connectez vous et continuer votre reservation.'));
                     }
                 }
             }
         }
     } else {
         $paypal = new PayPal();
         $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
         print_r($ret);
     }
 }
Esempio n. 4
0
 public function executeIdentification(sfWebRequest $request)
 {
     //Si non authentifie
     if (!$this->getUser()->isAuthenticated()) {
         $this->formInscription = new InscriptionForm();
         $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
         $this->form = new $class();
         if ($request->ismethod('post')) {
             if ($request->getParameter('send') == "signin") {
                 $this->form->bind($request->getParameter('signin'));
                 if ($this->form->isValid()) {
                     $values = $this->form->getValues();
                     $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
                     if ($this->getUser()->getAttribute('montantLocation')) {
                         $contratMobilyrent = $this->ajouterContrat();
                         $this->ajouterLocation($contratMobilyrent);
                         $this->setPlanning();
                         $this->envoyerEmail();
                         $this->redirect('espace_membre_profil');
                     } else {
                         $this->redirect('espace_membre_profil');
                     }
                 }
             } else {
                 if ($request->getParameter('send') == "signup") {
                     $this->formInscription->bind($request->getParameter('signup'));
                     if ($this->formInscription->isValid()) {
                         $values = $this->formInscription->getValues();
                         $sfGuarduser = $this->ajouterUtilisateur($values);
                         $this->getUser()->signin($sfGuarduser, false, null);
                         if ($this->getUser()->getAttribute('montantLocation')) {
                             $contratMobilyrent = $this->ajouterContrat();
                             $this->ajouterLocation($contratMobilyrent);
                             $this->setPlanning();
                             $this->envoyerEmailInscription($values);
                             $this->envoyerEmail();
                             $this->redirect('espace_membre_profil');
                         } else {
                             //                        $message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'),
                             //                        $values['email_address'],
                             //                        '[Mobilyrent] - Inscription Mobilyrent location de voiture',
                             //                        '<p style="font-size:14px">Bonjour,<br/>
                             //                            Votre inscription Mobilyrent a bien été prise en compte.<br/>
                             //                            Vous pouvez dorénavant vous connecter.<br/><br/>Cordialement<br/>Mobilyrent<br/>Place des fetes<br/>75019 Paris<br/></p>'
                             //                        );
                             //                        $message->setContentType('text/html');
                             //                        $this->getMailer()->send($message);
                             $this->envoyerEmailInscription($values);
                         }
                         $this->redirect('espace_membre_profil');
                     }
                 }
             }
         }
     } else {
         $contratMobilyrent = $this->ajouterContrat();
         $this->ajouterLocation($contratMobilyrent);
         $this->setPlanning();
         $this->envoyerEmail();
         $this->getUser()->setFlash('notice', 'Un email vous a été envoyé');
         $this->redirect('espace_membre_profil');
     }
 }