src/Controller/Backend/CongresController.php line 549

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Backend;
  3. use App\Entity\Congres;
  4. use App\Entity\Participation;
  5. use App\Form\Congres\ajoutCongresType;
  6. use App\Form\Congres\modifCongresType;
  7. use App\Repository\CongresRepository;
  8. use App\Repository\EventRepository;
  9. use App\Repository\InscriptionRepository;
  10. use App\Repository\AbstractInscriptionRepository;
  11. use App\Repository\MemberComiteCategorieRepository;
  12. use App\Repository\ParticipationRepository;
  13. use App\Repository\UserRepository;
  14. use App\Repository\AuteurAbstractRepository;
  15. use App\Repository\AbstracttRepository;
  16. use Doctrine\ORM\EntityManagerInterface;
  17. use Dompdf\Dompdf;
  18. use Dompdf\Options;
  19. use Knp\Component\Pager\PaginatorInterface;
  20. use phpDocumentor\Reflection\Types\Null_;
  21. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  22. use Symfony\Component\HttpFoundation\Request;
  23. use Symfony\Component\HttpFoundation\Response;
  24. use Symfony\Component\Routing\Annotation\Route;
  25. use Symfony\Component\HttpFoundation\File\Exception\FileException;
  26. use Symfony\Component\HttpFoundation\File\File;
  27. use Symfony\Component\HttpFoundation\JsonResponse;
  28. use App\Entity\PresenceCongres;
  29. use Symfony\Component\Security\Core\Security;
  30. class CongresController extends AbstractController
  31. {
  32.     /**
  33.      * @var CongresRepository
  34.      */
  35.     private $repository;
  36.     public function __construct(CongresRepository $repository)
  37.     {
  38.         $this->repository = $repository;
  39.     }
  40.     /**
  41.      * @Route("/admin/particpantParCongreIndex/{congres}", name="participant_par_congres_index")
  42.      */
  43.     public function participantParCongresIndex(Request $request, ParticipationRepository $participationRepository, $congres)
  44.     {
  45.         $participations = $participationRepository->findBy(['congres' => $congres]);
  46.         return $this->render('backend/congres/participantParCongres.html.twig', array('participations' => $participations, 'congres' => $congres));
  47.     }
  48.     /**
  49.      * @Route("/admin/particpantIndex", name="participant_index")
  50.      */
  51.     public function participantIndex(Request $request, ParticipationRepository $participationRepository)
  52.     {
  53.         $participations = $participationRepository->findAll();
  54.         return $this->render('backend/congres/participation.html.twig', array('participations' => $participations));
  55.     }
  56.     /**
  57.      * @Route("/admin/listecongres", name="tous_congres")
  58.      */
  59.     public function findAll(Request $request, ParticipationRepository $participationRepository)
  60.     {
  61.         $participations = $participationRepository->findByParticipationGroupeBy();
  62.         $touscongres = $this->repository->findAll();
  63.         return $this->render('backend/congres/congres.html.twig', array('touscongres' => $touscongres, 'participations' => $participations));
  64.     }
  65.     /**
  66.      * @Route("/admin/ParticipantAccepterDelegue", name="accepter_Delegue")
  67.      */
  68.     public function ParticipantAccepterDelegue(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em)
  69.     {
  70.         $participation = $participationRepository->findOneBy(['id' => $request->request->get('id')]);
  71.         if ($request->isMethod('post')) {
  72.             $participation->setTitre('participant');
  73.             $participation->setStatut('accepter');
  74.             $em->flush();
  75.             return new JsonResponse('participantAcceperDelegue');
  76.         }
  77.         return $this->render('backend/congres/participantParCongres.html.twig', array('congres' => $participation->getCongres()->getId()));
  78.     }
  79.     /**
  80.      * @Route("/admin/ParticipantAccepterParticipant", name="accepter_Modérateur")
  81.      */
  82.     public function ParticipantAccepterParticipant(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em)
  83.     {
  84.         $participation = $participationRepository->findOneBy(['id' => $request->request->get('id')]);
  85.         if ($request->isMethod('post')) {
  86.             $participation->setTitre('chair');
  87.             $participation->setStatut('accepter');
  88.             $em->flush();
  89.             return new JsonResponse('participantAcceperModérateur');
  90.         }
  91.         return $this->render('backend/congres/participantParCongres.html.twig', array('congres' => $participation->getCongres()->getId()));
  92.     }
  93.     /**
  94.      * @Route("/admin/ParticipantAccepterSpeaker", name="accepter_Speaker")
  95.      */
  96.     public function ParticipantAccepterSpeaker(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em)
  97.     {
  98.         $participation = $participationRepository->findOneBy(['id' => $request->request->get('id')]);
  99.         if ($request->isMethod('post')) {
  100.             $participation->setTitre('speaker');
  101.             $participation->setStatut('accepter');
  102.             $em->flush();
  103.             return new JsonResponse('participantAcceperSpeaker');
  104.         }
  105.         return $this->render('backend/congres/participantParCongres.html.twig', array('congres' => $participation->getCongres()->getId()));
  106.     }
  107.     /**
  108.      * @Route("/admin/ParticipantAccepterExposant", name="accepter_Exposant")
  109.      */
  110.     public function ParticipantAccepterExposant(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em)
  111.     {
  112.         $participation = $participationRepository->findOneBy(['id' => $request->request->get('id')]);
  113.         if ($request->isMethod('post')) {
  114.             $participation->setTitre('exhibitor');
  115.             $participation->setStatut('accepter');
  116.             $em->flush();
  117.             return new JsonResponse('participantAcceperExposant');
  118.         }
  119.         return $this->render('backend/congres/participantParCongres.html.twig', array('congres' => $participation->getCongres()->getId()));
  120.     }
  121.     /**
  122.      * @Route("/admin/ParticipantAccepterOrganizer", name="accepter_Organizer")
  123.      */
  124.     public function ParticipantAccepterOrganizer(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em)
  125.     {
  126.         $participation = $participationRepository->findOneBy(['id' => $request->request->get('id')]);
  127.         if ($request->isMethod('post')) {
  128.             $participation->setTitre('organisator');
  129.             $participation->setStatut('accepter');
  130.             $em->flush();
  131.             return new JsonResponse('participantAcceperOrganizer');
  132.         }
  133.         return $this->render('backend/congres/participantParCongres.html.twig', array('congres' => $participation->getCongres()->getId()));
  134.     }
  135.     /**
  136.      * @Route("/admin/ParticipantRefuser", name="refuser_Participant")
  137.      */
  138.     public function ParticipantRefuser(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em)
  139.     {
  140.         $participation = $participationRepository->findOneBy(['id' => $request->request->get('id')]);
  141.         if ($request->isMethod('post')) {
  142.             $participation->setTitre('refuser');
  143.             $participation->setStatut('refuser');
  144.             $em->flush();
  145.             return new JsonResponse('participantRefuser');
  146.         }
  147.         return $this->render('backend/congres/participantParCongres.html.twig', array('congres' => $participation->getCongres()->getId()));
  148.     }
  149.     /**
  150.      * @Route("/user/badgeIndex", name="badge_index")
  151.      */
  152.     public function BadgeIndex(Request $request, ParticipationRepository $participationRepository, EntityManagerInterface $em, CongresRepository $congresRepository)
  153.     {
  154.         $participants = $participationRepository->findAll();
  155.         $congres = $congresRepository->findBy(['type_congres' => 'national']);
  156.         return $this->render('backend/badge/badgeIndex.html.twig', array('congres' => $congres, 'participants' => $participants));
  157.     }
  158.     /**
  159.      * @Route("/event/badge/{id}", name="badge")
  160.      */
  161.     public function Badge(Request $request, InscriptionRepository $inscriptionRepository, EntityManagerInterface $em, $id)
  162.     {
  163.         $inscription = $inscriptionRepository->findOneBy(['id' => $id]);
  164.         $nom = $inscription->getNom();
  165.         $role = $inscription->getRole();
  166.         $prenom = $inscription->getPrenom();
  167.         $messageOld = 'Bienvenu(e) ' . $nom . ' ' . $prenom . ' parmi notre association tunisienne d\'urologie';
  168.         $message = 'http://urotunisia.com/presenceCongres/' . $inscription->getId();
  169.         $event = Null;
  170.         $congre = Null;
  171.         if (!empty($inscription->getCongres())) {
  172.             $congre = $inscription->getCongres();
  173.         } elseif (!empty($inscription->getEvent())) {
  174.             $event = $inscription->getEvent();
  175.         }
  176.         $pdfOptions = new Options();
  177.         $pdfOptions->set('defaultFont', 'Arial');
  178.         $pdfOptions->set('isRemoteEnabled', true); // temp folder with write permission
  179.         $pdfOptions->setIsRemoteEnabled(true);
  180.         // Instantiate Dompdf with our options
  181.         $dompdf = new Dompdf($pdfOptions);
  182.         // Retrieve the HTML generated in our twig file
  183.         $html = $this->renderView('backend/badge/badge.html.twig', ['nom' => $nom, 'prenom' => $prenom, 'event' => $event, 'congres' => $congre, 'message' => $message, 'role' => $role, 'id' => $inscription->getId()]);
  184.         // Load HTML to Dompdf
  185.         $dompdf->loadHtml($html);
  186.         // $paper_size = array(0,0,360,360);
  187.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  188.         $dompdf->setPaper('A4', 'portrait');
  189.         // Render the HTML as PDF
  190.         $dompdf->render();
  191.         // Output the generated PDF to Browser (force download)
  192.         $dompdf->stream("Badge-" . $nom . "-" . $prenom . ".pdf", [
  193.             "Attachment" => false
  194.         ]);
  195.         return $this->redirectToRoute('congres_nationaux');
  196.     }
  197.     /**
  198.      * @Route("/congresNationaux", name="congres_nationaux")
  199.      */
  200.     public function CongresNat(Request $request, PaginatorInterface $paginator, MemberComiteCategorieRepository $memberComiteCategorieRepository, EventRepository $eventRepository)
  201.     {
  202.         $dateNow = new \DateTime('now');
  203.         $touscongres = $this->repository->findBy([], ['id' => 'DESC']);
  204.         $events = $eventRepository->findBy(['categorie' => 'national'], ['startDate' => 'ASC']);
  205.         $memberComiteCategorie = $memberComiteCategorieRepository->findAll();
  206.         $touscongres = $paginator->paginate(
  207.             // Doctrine Query, not results
  208.             $touscongres,
  209.             // Define the page parameter
  210.             $request->query->getInt('page', 1),
  211.             // Items per page
  212.             6
  213.         );
  214.         $congressByYear = $this->repository->findCongresByYear();
  215.         return $this->render('frontend/frontindex/congresNationaux.html.twig', array('touscongres' => $touscongres, 'memberComiteCategories' => $memberComiteCategorie, 'congressByYear' => $congressByYear, 'dateNow' => $dateNow, 'eventsATU' => $events));
  216.     }
  217.     /**
  218.      * @Route("/presenceCongres/{inscription}", name="presenceCongres")
  219.      */
  220.     public function presenceCongres($inscription, EntityManagerInterface $em, InscriptionRepository $inscriptionRepository, Security $security): Response
  221.     {
  222.         $inscriptions = $inscriptionRepository->findOneBy(['id' => $inscription]);
  223.         // if ($security->isGranted('IS_AUTHENTICATED_FULLY')) {
  224.         //     // Vérifier si l'utilisateur a le rôle d'administrateur
  225.         //     if ($security->isGranted('ROLE_ADMIN_EVENTS')) {
  226.         $date = new \DateTime('now');
  227.         $dateFormatted = $date->format('Y-m-d');
  228.         $titreEvent = Null;
  229.         $dateFin = Null;
  230.         $dateDeb = Null;
  231.         if (!empty($inscriptions->getCongres())) {
  232.             $titreEvent = $inscriptions->getCongres()->getLabel();
  233.             $dateFin = $inscriptions->getCongres()->getDateFin()->format('Y-m-d');
  234.             $dateDeb = $inscriptions->getCongres()->getDateDebut()->format('Y-m-d');
  235.         } elseif (!empty($inscriptions->getEvent())) {
  236.             $titreEvent = $inscriptions->getEvent()->getTitre();
  237.             $dateFin = $inscriptions->getEvent()->getEndDate()->format('Y-m-d');
  238.             $dateDeb = $inscriptions->getEvent()->getStartDate()->format('Y-m-d');
  239.         }
  240.         if (($dateFin < $dateFormatted)) {
  241.             $this->addFlash('danger', 'Le congrès ' . $titreEvent . ' est déja passé');
  242.         } elseif (($dateDeb > $dateFormatted)) {
  243.             $this->addFlash('danger', 'Le congrès ' . $titreEvent . ' est Ã  venir');
  244.         } elseif (($dateFormatted >= $dateDeb) && ($dateFormatted <= $dateFin)) {
  245.             $presenceCongres = new PresenceCongres();
  246.             $presenceCongres->setInscription($inscriptions);
  247.             $presenceCongres->setDate(new \DateTime('now'));
  248.             $em->persist($presenceCongres);
  249.             $em->flush();
  250.             $this->addFlash('success', 'Bienvenu(e) ' . $inscriptions->getNom() . ' ' . $inscriptions->getPrenom() . ' dans le : ' . $titreEvent . ', votre présence est enregistrée avec succès');
  251.         }
  252.         return $this->redirectToRoute('congres_nationaux', []);
  253.         //     }
  254.         //     else
  255.         //     {
  256.         //         $this->addFlash('success', 'Bonjour, le QR code doit Ãªtre scanné par une des hôtesses Ã  l\'accueil du congrès. ');
  257.         //         return $this->redirectToRoute('congres_nationaux',[]);
  258.         //     }
  259.         // }
  260.         // else{
  261.         //     $this->addFlash('danger', 'Bonjour, merci de se connecter en tant qu\'admin et ensuite scanner le QR code. ');
  262.         //     return $this->redirectToRoute('app_login',[]);
  263.         // }
  264.     }
  265.     /**
  266.      * @Route("/BeParticipant/{user}/{congre}", name="BeParticipant")
  267.      */
  268.     public function BeParticipant(Request $request, $user, $congre, CongresRepository $congresRepository, UserRepository $userRepository, EntityManagerInterface $em, ParticipationRepository $participationRepository)
  269.     {
  270.         $congres = $congresRepository->findOneBy(array('id' => $congre));
  271.         $userr = $userRepository->findOneBy(['id' => $user]);
  272.         $partexist = $participationRepository->findBy(['user' => $user, 'congres' => $congre]);
  273.         $participation = new Participation();
  274.         if ($request->isMethod('post')) {
  275.             if (empty($partexist)) {
  276.                 $participation->setCongres($congres);
  277.                 $participation->setUser($userr);
  278.                 $participation->setStatut('en_attente');
  279.                 $participation->setTitre($request->request->get('statuts'));
  280.                 $em->persist($participation);
  281.                 $em->flush();
  282.                 if ($request->getLocale() == 'fr') {
  283.                     $this->addFlash('success', 'Félicitations! nous vous avons confirmé votre participation au congrès');
  284.                 } elseif ($request->getLocale() == 'en') {
  285.                     $this->addFlash('success', 'Congratulation! we have confirmed your participation in the congress');
  286.                 }
  287.             } elseif (!empty($partexist)) {
  288.                 if ($request->getLocale() == 'fr') {
  289.                     $this->addFlash('danger', 'Vous avez deja participé dans ce congrès');
  290.                 } elseif ($request->getLocale() == 'en') {
  291.                     $this->addFlash('danger', 'You have already participated in this congress');
  292.                 }
  293.             }
  294.         }
  295.         return $this->redirectToRoute('congres_nationaux');
  296.     }
  297.     /**
  298.      * @Route("/congres-details/{id}", name="details_congres")
  299.      * @param Congres $congres
  300.      * @param Request $request
  301.      * @return \Symfony\Component\HttpFoundation\Response
  302.      */
  303.     public function detailsCongres(Congres $congres, Request $request, $id, EntityManagerInterface $em, CongresRepository $repository, AbstractInscriptionRepository $abstractInscriptionRepository)
  304.     {
  305.         $congres = $repository->find($id);
  306.         $abstractsInscriptions = $abstractInscriptionRepository->findAll();
  307.         return $this->render('frontend/frontindex/detailsCongres.html.twig', array('congres' => $congres, 'abstractInscriptions' => $abstractsInscriptions));
  308.     }
  309.     /**
  310.      * @Route("/admin/modifierCongres/{id}", name="modifier_congres")
  311.      * @param Congres $congres
  312.      * @param Request $request
  313.      * @return \Symfony\Component\HttpFoundation\Response
  314.      */
  315.     public function editer(Congres $congres, Request $request, $id, EntityManagerInterface $em, CongresRepository $repository)
  316.     {
  317.         $congres = $repository->find($id);
  318.         $oldImage = $congres->getImage();
  319.         $oldPdf = $congres->getLienPdf();
  320.         if ($congres->getImage() != null) {
  321.             $congres->setImage(
  322.                 new File($this->getParameter('imagesCongres_directory') . '/' . $congres->getImage())
  323.             );
  324.         }
  325.         if ($congres->getLienPdf() != null) {
  326.             $congres->setLienPdf(
  327.                 new File($this->getParameter('uploadCongres_directory') . '/' . $congres->getLienPdf())
  328.             );
  329.         }
  330.         $form = $this->createForm(modifCongresType::class, $congres);
  331.         $form->handleRequest($request);
  332.         $touscongres = $this->repository->findAll();
  333.         if ($form->isSubmitted() && $form->isValid()) {
  334.             $brochureFile = $form->get('image')->getData();
  335.             $brochureFilePdf = $form->get('lien_pdf')->getData();
  336.             if ($brochureFile) {
  337.                 $fileNameimage = md5(uniqid()) . '.' . $brochureFile->guessExtension();
  338.                 $congres->setImage($fileNameimage);
  339.                 $brochureFile->move(
  340.                     $this->getParameter('imagesCongres_directory'),
  341.                     $fileNameimage
  342.                 );
  343.             } else {
  344.                 $congres->setImage($oldImage);
  345.             }
  346.             if ($brochureFilePdf) {
  347.                 $fileNamePdf = md5(uniqid()) . '.' . $brochureFilePdf->guessExtension();
  348.                 $congres->setLienPdf($fileNamePdf);
  349.                 $brochureFilePdf->move(
  350.                     $this->getParameter('uploadCongres_directory'),
  351.                     $fileNamePdf
  352.                 );
  353.             } else {
  354.                 $congres->setLienPdf($oldPdf);
  355.             }
  356.             foreach ($congres->getPackCongre() as $pack) {
  357.                 $pack->setCongres($congres);
  358.             }
  359.             // var_dump($congres->getPackCongre());
  360.             // die();
  361.             $em->flush();
  362.             return $this->redirectToRoute('tous_congres');
  363.         }
  364.         return $this->render('backend/congres/edit.html.twig', array('form' => $form->createView(), 'touscongres' => $touscongres, 'congres' => $congres));
  365.     }
  366.     /**
  367.      * @Route("/admin/ajoutCongres", name="ajouter_congres")
  368.      */
  369.     public function ajoutCongres(Request $request, EntityManagerInterface $em)
  370.     {
  371.         $congres = new Congres();
  372.         $form = $this->createForm(ajoutCongresType::class, $congres);
  373.         $form->handleRequest($request);
  374.         if ($form->isSubmitted() && $form->isValid()) {
  375.             $brochureFile = $form->get('image')->getData();
  376.             $brochureFilePdf = $form->get('lien_pdf')->getData();
  377.             if ($congres->getImage() != null) {
  378.                 $fileNameimage = md5(uniqid()) . '.' . $brochureFile->guessExtension();
  379.                 $congres->setImage($fileNameimage);
  380.                 try {
  381.                     $brochureFile->move(
  382.                         $this->getParameter('imagesCongres_directory'),
  383.                         $fileNameimage
  384.                     );
  385.                 } catch (FileException $e) {
  386.                     // ... handle exception if something happens during file upload
  387.                 }
  388.             }
  389.             if ($congres->getLienPdf() != null) {
  390.                 $fileNamepdf = md5(uniqid()) . '.' . $brochureFilePdf->guessExtension();
  391.                 $congres->setLienPdf($fileNamepdf);
  392.                 try {
  393.                     $brochureFilePdf->move(
  394.                         $this->getParameter('uploadCongres_directory'),
  395.                         $fileNamepdf
  396.                     );
  397.                 } catch (FileException $e) {
  398.                     // ... handle exception if something happens during file upload
  399.                 }
  400.             }
  401.             foreach ($congres->getPackCongre() as $pack) {
  402.                 $pack->setCongres($congres);
  403.             }
  404.             // var_dump($congres->getPackCongre());
  405.             // die();
  406.             $em->persist($congres);
  407.             $em->flush();
  408.             return $this->redirectToRoute('tous_congres');
  409.         }
  410.         return $this->render('backend/congres/add.html.twig', array('form' => $form->createView()));
  411.     }
  412.     /**
  413.      * @Route("/admin/supprimerCongres/{id}", name="supprimer_congres")
  414.      */
  415.     public function supprimer($id, CongresRepository $repository, EntityManagerInterface $em)
  416.     {
  417.         $congres = $repository->find($id);
  418.         $em->remove($congres);
  419.         $em->flush();
  420.         return $this->redirectToRoute('tous_congres');
  421.     }
  422.     /**
  423.      * @Route("/admin/searchcongres/", name="congres_search")
  424.      */
  425.     public function searchCongres(CongresRepository $repository, Request $request, PaginatorInterface $paginator)
  426.     {
  427.         $congres = $repository->findByNamePopular(
  428.             $request->query->get('query')
  429.         );
  430.         $congres = $paginator->paginate(
  431.             // Doctrine Query, not results
  432.             $congres,
  433.             // Define the page parameter
  434.             $request->query->getInt('page', 1),
  435.             // Items per page
  436.             2
  437.         );
  438.         $entityManager = $this->getDoctrine()->getManager();
  439.         $categoryRepository = $entityManager->getRepository(Congres::class);
  440.         return $this->render('backend/congres/congres.html.twig', [
  441.             'touscongres' => $congres
  442.         ]);
  443.     }
  444.     /**
  445.      * @Route("/certificat", name="obtenir_certificat")
  446.      */
  447.     public function certificat(CongresRepository $repository, EntityManagerInterface $em)
  448.     {
  449.         return $this->render('frontend/frontindex/certificat.html.twig');
  450.     }
  451.     /**
  452.      * @Route("/pdf", name="pdf_certificat")
  453.      */
  454.     public function pdf(CongresRepository $repository, EntityManagerInterface $em)
  455.     {
  456.         // Configure Dompdf according to your needs
  457.         $pdfOptions = new Options();
  458.         $pdfOptions->set('defaultFont', 'Arial');
  459.         $pdfOptions->set('isRemoteEnabled', true); // temp folder with write permission
  460.         $pdfOptions->setIsRemoteEnabled(true);
  461.         // Instantiate Dompdf with our options
  462.         $dompdf = new Dompdf($pdfOptions);
  463.         // Retrieve the HTML generated in our twig file
  464.         $html = $this->renderView('frontend/frontindex/pdf.html.twig');
  465.         // Load HTML to Dompdf
  466.         $dompdf->loadHtml($html);
  467.         // $paper_size = array(0,0,360,360);
  468.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  469.         $dompdf->setPaper('A4', 'portrait');
  470.         // Render the HTML as PDF
  471.         $dompdf->render();
  472.         // Output the generated PDF to Browser (force download)
  473.         $dompdf->stream("certificat.pdf", [
  474.             "Attachment" => true
  475.         ]);
  476.         return $this->render('frontend/frontindex/certificat.html.twig');
  477.     }
  478.     /**
  479.      * @Route("/abstract-book/{id}", name="abstract-book")
  480.      */
  481.     public function abstractBook(AbstracttRepository $abstracttRepository, $id, CongresRepository $congresRepository, AuteurAbstractRepository $auteurAbstractRepository)
  482.     {
  483.         $congres = $congresRepository->findOneBy(['id' => $id]);
  484.         $abstracts = $abstracttRepository->findBy(['congres' => $congres->getId(), 'statut' => 'accepter'], ['typeFinal' => 'ASC']);
  485.         $auteurs = $auteurAbstractRepository->findAll([]);
  486.         $pdfOptions = new Options();
  487.         $pdfOptions->set('defaultFont', 'Arial');
  488.         $pdfOptions->set('isRemoteEnabled', true); // temp folder with write permission
  489.         $pdfOptions->setIsRemoteEnabled(true);
  490.         // Instantiate Dompdf with our options
  491.         $dompdf = new Dompdf($pdfOptions);
  492.         // Retrieve the HTML generated in our twig file
  493.         $html = $this->renderView('backend/congres/abstractBook.html.twig', ['abstracts' => $abstracts, 'auteurs' => $auteurs]);
  494.         // Load HTML to Dompdf
  495.         $dompdf->loadHtml($html);
  496.         // $paper_size = array(0,0,360,360);
  497.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  498.         $dompdf->setPaper('A4', 'portrait');
  499.         // Render the HTML as PDF
  500.         $dompdf->render();
  501.         // Output the generated PDF to Browser (force download)
  502.         $dompdf->stream("Abstarct-book-" . $congres->getId() . ".pdf", [
  503.             "Attachment" => false
  504.         ]);
  505.         return $this->render('frontend/frontindex/detailsCongres.html.twig', array('congres' => $congres));
  506.     }
  507. }