use Rapsys\AirBundle\Entity\Session;
use Rapsys\AirBundle\Entity\Slot;
use Rapsys\AirBundle\Entity\User;
+use Rapsys\AirBundle\Pdf\DisputePdf;
+use Rapsys\UserBundle\Utils\Slugger;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
-use Rapsys\UserBundle\Utils\Slugger;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
//Create the form according to the FormType created previously.
//And give the proper parameters
- $form = $this->createForm('Rapsys\AirBundle\Form\DisputeType', null, [
+ $form = $this->createForm('Rapsys\AirBundle\Form\DisputeType', ['court' => 'Paris', 'abstract' => 'Pour constater cette prétendue infraction, les agents verbalisateurs ont pénétré dans un jardin privatif, sans visibilité depuis la voie publique, situé derrière un batiment privé, pour ce faire ils ont franchi au moins un grillage de chantier ou des potteaux métalliques séparant le terrain privé de la voie publique de l\'autre côté du batiment.'], [
'action' => $this->generateUrl('rapsys_air_dispute'),
'method' => 'POST'
]);
//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']);
+ //Gathering offense
+ if (!empty($data['offense']) && $data['offense'] == 'gathering') {
+ //Add gathering
+ $output = DisputePdf::genGathering($data['court'], $data['notice'], $data['agent'], $data['service'], $data['abstract'], $this->translator->trans($this->getUser()->getCivility()->getTitle()), $this->getUser()->getForename(), $this->getUser()->getSurname());
+ //Traffic offense
+ } elseif (!empty($data['offense'] && $data['offense'] == 'traffic')) {
+ //Add traffic
+ $output = DisputePdf::genTraffic($data['court'], $data['notice'], $data['agent'], $data['service'], $data['abstract'], $this->translator->trans($this->getUser()->getCivility()->getTitle()), $this->getUser()->getForename(), $this->getUser()->getSurname());
+ //Unsupported offense
+ } else {
+ header('Content-Type: text/plain');
+ die('TODO');
+ exit;
+ }
- //Civilité
- var_dump($this->translator->trans($this->getUser()->getCivility()->getTitle()));
+ //Send common headers
+ header('Content-Type: application/pdf');
- //Prénom
- var_dump($this->getUser()->getForename());
+ //Send remaining headers
+ header('Cache-Control: private, max-age=0, must-revalidate');
+ header('Pragma: public');
- //Nom
- var_dump($this->getUser()->getSurname());
+ //Send content-length
+ header('Content-Length: '.strlen($output));
- //Mail
- var_dump($this->getUser()->getMail());
+ //Display the pdf
+ echo $output;
+ //Die for now
exit;
# //Create message