return $this->render('@RapsysAir/form/contact.html.twig', ['title' => $title, 'section' => $section, 'form' => $form->createView(), 'sent' => $request->query->get('sent', 0)]+$this->context);
}
+
+ /**
+ * The dispute page
+ *
+ * @desc Generate a dispute document
+ *
+ * @param Request $request The request instance
+ * @param MailerInterface $mailer The mailer instance
+ *
+ * @return Response The rendered view or redirection
+ */
+ public function dispute(Request $request, MailerInterface $mailer): Response {
+ //Prevent non-guest to access here
+ $this->denyAccessUnlessGranted('ROLE_USER', null, $this->translator->trans('Unable to access this page without role %role%!', ['%role%' => $this->translator->trans('User')]));
+ //Set section
+ $section = $this->translator->trans('Dispute');
+
+ //Set description
+ $this->context['description'] = $this->translator->trans('Libre Air dispute');
+
+ //Set keywords
+ $this->context['keywords'] = [
+ $this->translator->trans('dispute'),
+ $this->translator->trans('Libre Air'),
+ $this->translator->trans('outdoor'),
+ $this->translator->trans('Argentine Tango'),
+ $this->translator->trans('calendar')
+ ];
+
+ //Set title
+ $title = $this->translator->trans($this->config['site']['title']).' - '.$section;
+
+ //Create the form according to the FormType created previously.
+ //And give the proper parameters
+ $form = $this->createForm('Rapsys\AirBundle\Form\DisputeType', null, [
+ 'action' => $this->generateUrl('rapsys_air_dispute'),
+ 'method' => 'POST'
+ ]);
+
+ if ($request->isMethod('POST')) {
+ // Refill the fields in case the form is not valid.
+ $form->handleRequest($request);
+
+ if ($form->isValid()) {
+ //Get data
+ $data = $form->getData();
+
+ header('Content-Type: text/plain');
+
+ //Infraction
+ var_dump($data['offense']);
+
+ //Numéro d'avis
+ var_dump($data['notice']);
+
+ //Numéro d'agent
+ var_dump($data['agent']);
+
+ //Code service
+ var_dump($data['service']);
+
+ //Masque porté
+ var_dump($data['mask']);
+
+ //Civilité
+ var_dump($this->translator->trans($this->getUser()->getCivility()->getTitle()));
+
+ //Prénom
+ var_dump($this->getUser()->getForename());
+
+ //Nom
+ var_dump($this->getUser()->getSurname());
+
+ //Mail
+ var_dump($this->getUser()->getMail());
+
+ exit;
+
+# //Create message
+# $message = (new TemplatedEmail())
+# //Set sender
+# ->from(new Address($data['mail'], $data['name']))
+# //Set recipient
+# //XXX: remove the debug set in vendor/symfony/mime/Address.php +46
+# ->to(new Address($this->config['contact']['mail'], $this->config['contact']['name']))
+# //Set subject
+# ->subject($data['subject'])
+#
+# //Set path to twig templates
+# ->htmlTemplate('@RapsysAir/mail/contact.html.twig')
+# ->textTemplate('@RapsysAir/mail/contact.text.twig')
+#
+# //Set context
+# ->context(
+# [
+# 'subject' => $data['subject'],
+# 'message' => strip_tags($data['message']),
+# ]+$this->context
+# );
+#
+# //Try sending message
+# //XXX: mail delivery may silently fail
+# try {
+# //Send message
+# $mailer->send($message);
+#
+# //Redirect on the same route with sent=1 to cleanup form
+# return $this->redirectToRoute($request->get('_route'), ['sent' => 1]+$request->get('_route_params'));
+# //Catch obvious transport exception
+# } catch(TransportExceptionInterface $e) {
+# if ($message = $e->getMessage()) {
+# //Add error message mail unreachable
+# $form->get('mail')->addError(new FormError($this->translator->trans('Unable to contact: %mail%: %message%', ['%mail%' => $this->config['contact']['mail'], '%message%' => $this->translator->trans($message)])));
+# } else {
+# //Add error message mail unreachable
+# $form->get('mail')->addError(new FormError($this->translator->trans('Unable to contact: %mail%', ['%mail%' => $this->config['contact']['mail']])));
+# }
+# }
+ }
+ }
+
+ //Render template
+ return $this->render('@RapsysAir/form/dispute.html.twig', ['title' => $title, 'section' => $section, 'form' => $form->createView(), 'sent' => $request->query->get('sent', 0)]+$this->context);
+ }
+
/**
* The index page
*
--- /dev/null
+<?php
+
+namespace Rapsys\AirBundle\Form;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
+use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
+use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Validator\Constraints\NotBlank;
+
+class DisputeType extends AbstractType {
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(FormBuilderInterface $builder, array $options) {
+ return $builder
+ //Select|enum
+ ->add('offense', ChoiceType::class, ['choices' => ['Forbidden gathering' => 'gathering', 'Traffic at prohibited time' => 'traffic'], 'attr' => ['placeholder' => 'Your offense'], 'constraints' => [new NotBlank(['message' => 'Please provide your offense'])]])
+ ->add('notice', TextType::class, ['label' => 'Notice number', 'attr' => ['placeholder' => 'Your notice number'], 'constraints' => [new NotBlank(['message' => 'Please provide your notice'])]])
+ ->add('agent', TextType::class, ['label' => 'Agent number', 'attr' => ['placeholder' => 'Your agent number'], 'constraints' => [new NotBlank(['message' => 'Please provide your agent'])]])
+ ->add('service', TextType::class, ['label' => 'Service code', 'attr' => ['placeholder' => 'Your service code'], 'constraints' => [new NotBlank(['message' => 'Please provide your service'])]])
+ ->add('mask', CheckboxType::class, ['label' => 'Mask worn', 'attr' => ['placeholder' => 'Your mask worn'], 'constraints' => [new NotBlank(['message' => 'Please provide your mask'])]])
+ ->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function configureOptions(OptionsResolver $resolver) {
+ $resolver->setDefaults(['error_bubbling' => true]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName() {
+ return 'dispute_form';
+ }
+}
controller: Rapsys\AirBundle\Controller\DefaultController::contact
methods: GET|POST
+rapsys_air_frequently_asked_questions:
+ path:
+ en: '/en/frequently-asked-questions'
+ fr: '/foire-aux-questions'
+ controller: Rapsys\AirBundle\Controller\DefaultController::frequentlyAskedQuestions
+ methods: GET
+
rapsys_air_organizer_regulation:
path:
en: '/en/organizer-regulation'
controller: Rapsys\AirBundle\Controller\DefaultController::termsOfService
methods: GET
-rapsys_air_frequently_asked_questions:
+rapsys_air_dispute:
path:
- en: '/en/frequently-asked-questions'
- fr: '/foire-aux-questions'
- controller: Rapsys\AirBundle\Controller\DefaultController::frequentlyAskedQuestions
- methods: GET
+ en: '/en/dispute'
+ fr: '/contestation'
+ controller: Rapsys\AirBundle\Controller\DefaultController::dispute
+ methods: GET|POST
rapsys_air_location:
path:
'Advanced tango music programming': 'Advanced tango music programming'
'After': 'After'
'Afternoon': 'Afternoon'
+'Agent number': 'Agent number'
'All rights reserved': 'All rights reserved'
'All slot canceled and account disabled for one month': 'All slot canceled and account disabled for one month'
'All slot canceled and account disabled for one week': 'All slot canceled and account disabled for one week'
'Dashboard': 'Dashboard'
'Date': 'Date'
'Description': 'Description'
+'dispute': 'dispute'
+'Dispute': 'Dispute'
'Docks': 'Docks'
'Donate': 'Donate'
'Donate to %pseudonym%': 'Donate to %pseudonym%'
'Evening': 'Evening'
'faq': 'faq'
'First time': 'First time'
+'Forbidden gathering': 'Forbidden gathering'
'Force cancel': 'Force cancel'
'Forename': 'Forename'
'French': 'French'
'Kicked out for music too strong': 'Kicked out for music too strong'
'Latitude': 'Latitude'
'Length': 'Length'
+'Libre Air dispute': 'Libre Air dispute'
'Libre Air frequently asked questions': 'Libre Air frequently asked questions'
'Libre Air is an initiative to have a powerful and shared calendar for outdoor Tango Argentin sessions.': 'Libre Air is an initiative to have a powerful and shared calendar for outdoor Tango Argentin sessions.'
'Libre Air': 'Libre Air'
'Managment': 'Managment'
'Managment veto possible': 'Managment veto possible'
'Maps': 'Maps'
+'Mask worn': 'Mask worn'
'Medium change': 'Medium change'
'Meeting': 'Meeting'
'Message': 'Message'
'No more battery': 'No more battery'
'None': 'None'
'Not Found': 'Not Found'
+'Notice number': 'Notice number'
+'Offense': 'Offense'
'Only danceable songs': 'Only danceable songs'
'On this page you will find the most recurring questions of Libre Air users.': 'On this page you will find the most recurring questions of Libre Air users.'
'organizer': 'organizer'
'Send a message to %pseudonym%': 'Send a message to %pseudonym%'
'Send': 'Send'
'Senior': 'Senior'
+'Service code': 'Service code'
'Session %id% by %pseudonym%': 'Session %id% by %pseudonym%'
'Session %id%': 'Session %id%'
'Session %id% updated': 'Session %id% updated'
'Tokyo': 'Tokyo'
'To recover your account you can follow this link: %recover_url%': 'To recover your account you can follow this link: %recover_url%'
'To recover your account you can follow this link:': 'To recover your account you can follow this link:'
+'Traffic at prohibited time': 'Traffic at prohibited time'
'Trocadero esplanade': 'Trocadero esplanade'
'Trocadero': 'Trocadero'
'Tuesday': 'Tuesday'
'Your account password has been changed, to recover your account you can follow this link: %recover_url%': 'Your account password has been changed, to recover your account you can follow this link: %recover_url%'
'Your account password has been changed, to recover your account you can follow this link:': 'Your account password has been changed, to recover your account you can follow this link:'
'Your address': 'Your address'
+'Your agent number': 'Your agent number'
'Your begin': 'Your begin'
'Your city': 'Your city'
'Your civility': 'Your civility'
'Your location': 'Your location'
'Your longitude': 'Your longitude'
'Your mail': 'Your mail address'
+'Your mask worn': 'Your mask worn'
'Your message has been sent': 'Your message has been sent'
'Your message': 'Your message'
'Your name': 'Your name'
+'Your notice number': 'Your notice number'
+'Your offense': 'Your offense'
'Your password confirmation': 'Your password confirmation'
'Your password is updated and an account recover message has been sent': 'Your password is updated and an account recover message has been sent'
'Your password': 'Your password'
'Your profile': 'Your profile'
'Your pseudonym': 'Your pseudonym'
'Your recover account message has been sent': 'Your recover account message has been sent'
+'Your service code': 'Your service code'
'Your short': 'Your short'
'Your slot': 'Your slot'
'Your surname': 'Your surname'
'Advanced tango music programming': 'Programmation musicale de tango avancée'
'After': 'After'
'Afternoon': 'Après-midi'
+'Agent number': 'Numéro d''agent'
'All rights reserved': 'Tous droits réservés'
'All slot canceled and account disabled for one month': 'Annulation de tous les créneaux et compte désactivé pour un mois'
'All slot canceled and account disabled for one week': 'Annulation de tous les créneaux et compte désactivé pour une semaine'
'Dashboard': 'Tableau de bord'
'Date': 'Date'
'Description': 'Description'
+'dispute': 'contestation'
+'Dispute': 'Contestation'
'Docks': 'Quais'
'Donate': 'Contribuer'
'Donate to %pseudonym%': 'Faire un don à %pseudonym%'
'Evening': 'Soirée'
'faq': 'faq'
'First time': 'Première fois'
+'Forbidden gathering': 'Rassemblement interdit'
'Force cancel': 'Annulation forcée'
'Forename': 'Prénom'
'French': 'Français'
'Latitude': 'Latitude'
'Length': 'Durée'
'Libre Air': 'Air Libre'
+'Libre Air dispute': 'Contestation Air Libre'
'Libre Air frequently asked questions': 'Foire aux questions d''Air Libre'
'Libre Air is an initiative to have a powerful and shared calendar for outdoor Tango Argentin sessions.': 'Air Libre est une initiative pour avoir un calendrier puissant et partagé pour les sessions de Tango Argentin en plein air.'
'Libre Air location list': 'Liste des emplacements d''Air Libre'
'Managment': 'Encadrement'
'Managment veto possible': 'Possibilité de véto encadrement'
'Maps': 'Cartes'
+'Mask worn': 'Masque porté'
'Medium change': 'Changement intermédiaire'
'Meeting': 'Réunion'
'Message': 'Message'
'No more battery': 'Plus de batterie'
'None': 'Aucun'
'Not Found': 'Pas Trouvé'
+'Notice number': 'Numéro d''avis'
+'Offense': 'Infraction'
'Only danceable songs': 'Musique dançable uniquement'
'On this page you will find the most recurring questions of Libre Air users.': 'Sur cette page, vous trouverez les questions les plus récurrentes des utilisateurs d''Air Libre.'
'organizer': 'organisateur'
'Send a message to %pseudonym%': 'Envoyer un message à %pseudonym%'
'Send': 'Envoyer'
'Senior': 'Senior'
+'Service code': 'Code service'
'Session %id% by %pseudonym%': 'Séance %id% par %pseudonym%'
'Session %id%': 'Séance %id%'
'Session %id% the %date% for %location% on the slot %slot% saved': 'Séance %id% Réservation le %date% pour %location% sur le créneau %slot% enregistrée'
'Tokyo': 'Tokyo'
'To recover your account you can follow this link:': 'Pour récupérer votre compte vous pouvez suivre ce lien :'
'To recover your account you can follow this link: %recover_url%': 'Pour récupérer votre compte vous pouvez suivre ce lien : %recover_url%'
+'Traffic at prohibited time': 'Circulation à une heure interdite'
'Trocadero esplanade': 'Esplanade du Trocadéro'
'Trocadero': 'Trocadéro'
'Tuesday': 'Mardi'
'Your account password has been changed, to recover your account you can follow this link: %recover_url%': 'Votre mot de passe a été changé, pour récupérer votre compte vous pouvez suivre ce lien : %recover_url%'
'Your account password has been changed, to recover your account you can follow this link:': 'Votre mot de passe a été changé, pour récupérer votre compte vous pouvez suivre ce lien :'
'Your address': 'Votre adresse'
+'Your agent number': 'Votre numéro d''agent'
'Your begin': 'Votre début'
'Your city': 'Votre ville'
'Your civility': 'Votre civilité'
'Your location': 'Votre emplacement'
'Your longitude': 'Votre longitude'
'Your mail': 'Votre courriel'
+'Your mask worn': 'Votre masque porté'
'Your message has been sent': 'Votre message a été envoyé'
'Your message': 'Votre message'
'Your name': 'Votre nom'
+'Your notice number': 'Votre numéro d''avis'
+'Your offense': 'Votre infraction'
'Your password confirmation': 'Votre confirmation de mot de passe'
'Your password is updated and an account recover message has been sent': 'Votre mot de passe est modifié et un message de récupération de compte a été envoyé'
'Your password': 'Votre mot de passe'
'Your profile': 'Votre profil'
'Your pseudonym': 'Votre pseudonyme'
'Your recover account message has been sent': 'Votre message de récupération de compte a été envoyé'
+'Your service code': 'Votre code service'
'Your short': 'Votre titre court'
'Your site': 'Votre site'
'Your slot': 'Your créneau'