src/Controller/FrontController.php line 235

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Faqs;
  4. use App\Entity\Blogs;
  5. use App\Entity\Avis;
  6. use App\Entity\Themes;
  7. use App\Entity\Galeries;
  8. use App\Entity\Villes;
  9. use App\Entity\Thematiques;
  10. use App\Entity\Actualites;
  11. use App\Entity\Formations;
  12. use App\Entity\References;
  13. use App\Entity\Mentions;
  14. use App\Entity\Managements;
  15. use App\Entity\Bannieres;
  16. use App\Entity\Inscriptions;
  17. use App\Entity\Demandeformations;
  18. use App\Entity\Expertises;
  19. use App\Entity\Themeshanghai;
  20. use App\Entity\Videos;
  21. use App\Entity\Albums;
  22. use App\Form\RechercheFormType;
  23. use App\Form\RechercheNatFormType;
  24. use Doctrine\ORM\EntityManager;
  25. use App\Form\BlogFormType;
  26. use App\Form\ProduitFormType;
  27. use App\Form\InscriptionFormType;
  28. use App\Form\NewInscriptionFormType;
  29. use App\Service\GeoIpService;
  30. use App\Repository\BlogsRepository;
  31. use App\Repository\DemandeformationsRepository;
  32. use App\Repository\InscriptionsRepository;
  33. use App\Repository\AvisRepository;
  34. use App\Repository\ManagementsRepository;
  35. use App\Repository\MentionsRepository;
  36. use App\Repository\VillesRepository;
  37. use App\Repository\GaleriesRepository;
  38. use App\Repository\ThemesRepository;
  39. use App\Repository\FormationsRepository;
  40. use App\Repository\AboutsRepository;
  41. use App\Repository\ThematiquesRepository;
  42. use App\Repository\ValeursRepository;
  43. use App\Repository\BannieresRepository;
  44. use App\Repository\ActualitesRepository;
  45. use App\Repository\PartenairesRepository;
  46. use App\Repository\ReferenceclientsRepository;
  47. use App\Repository\InformationsRepository;
  48. use App\Repository\AlbumsRepository;
  49. use App\Repository\VideosRepository;
  50. use App\Repository\ExpertisesRepository;
  51. use App\Repository\ThemeshanghaiRepository;
  52. use App\Entity\Certificats;
  53. use App\Form\CertificatFormType;
  54. use App\Form\EditCertificatFormType;
  55. use App\Repository\CertificatsRepository;
  56. //use Symfony\Component\Mime\Email;
  57. use Symfony\Component\HttpFoundation\Request;
  58. use Symfony\Component\HttpFoundation\Response;
  59. use Symfony\Component\Routing\Annotation\Route;
  60. use Symfony\Component\String\Slugger\SluggerInterface;
  61. use App\Form\ContactFormType;
  62. use App\Form\DevisFormType;
  63. use App\Form\CombinedFormType;
  64. use App\Form\DemandeformationFormType;
  65. use Symfony\Bridge\Twig\Mime\TemplatedEmail;
  66. use Symfony\Component\Mime\Email;
  67. use Symfony\Component\Mailer\MailerInterface;
  68. use Symfony\Component\HttpFoundation\JsonResponse;
  69. use Knp\Component\Pager\PaginatorInterface;
  70. use Doctrine\ORM\EntityManagerInterface;
  71. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  72. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  73. use App\Entity\Certyous;
  74. use App\Form\CertyouFormType;
  75. use App\Entity\Inscriptionpersos;
  76. use App\Form\EditCertyouFormType;
  77. use App\Repository\CertyousRepository;
  78. use App\Form\InscriptionCertyouFormType;
  79. use App\Repository\InscriptionpersosRepository;
  80. use App\Entity\Sessions;
  81. use App\Form\SessionFormType;
  82. use App\Form\EditSessionFormType;
  83. use App\Repository\SessionsRepository;
  84. use Symfony\Contracts\HttpClient\HttpClientInterface;
  85. class FrontController extends AbstractController
  86. {
  87.     private HttpClientInterface $client;
  88.     public function __construct(HttpClientInterface $client)
  89.     {
  90.         $this->client $client;
  91.     }
  92.    
  93.     #[Route('/'name'front.inter.index'methods:['GET'])]
  94.     public function index(
  95.         Request $request
  96.         MentionsRepository $mentionRepository,
  97.         ThematiquesRepository $thematiqueRepository
  98.         BannieresRepository $banniereRepository,
  99.         ReferenceclientsRepository $referenceRepository
  100.         EntityManagerInterface $entityManager
  101.     ): Response
  102.     {
  103.         $thematiqueLimit $thematiqueRepository->findBy([], ['id' => 'DESC'], 20 );
  104.         //dd($thematiqueLimit);
  105.         $annee date('Y');
  106.        // 1️⃣ Requête Doctrine (sans tri sur dates_session)
  107.         $queryBuilder $entityManager->createQueryBuilder();
  108.         $queryBuilder
  109.             ->select(
  110.                 'for.id','for.image','for.dates_session','for.prix','for.devise','th.nom',
  111.                 'th.slug','thm.nom AS thmnom','vil.nom AS vilnom','vil.pays'
  112.             )
  113.             ->from(Formations::class, 'for')
  114.             ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  115.             ->innerJoin(Villes::class, 'vil''WITH''for.ville = vil.id')
  116.             ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id');
  117.         $formations $queryBuilder->getQuery()->getResult();
  118.         
  119.         // 2️⃣ Fonction : extraction DATE DE DÉBUT
  120.         $extractDateDebut = function (?string $datesSession): ?\DateTime {
  121.             if (!$datesSession) {
  122.                 return null;
  123.             }
  124.             $moisFr = [
  125.                 'janv'=>1,'janvier'=>1,
  126.                 'févr'=>2,'fevr'=>2,'février'=>2,
  127.                 'mars'=>3,
  128.                 'avr'=>4,'avril'=>4,
  129.                 'mai'=>5,
  130.                 'juin'=>6,
  131.                 'juil'=>7,'juillet'=>7,
  132.                 'août'=>8,'aout'=>8,
  133.                 'sept'=>9,'septembre'=>9,
  134.                 'oct'=>10,'octobre'=>10,
  135.                 'nov'=>11,'novembre'=>11,
  136.                 'déc'=>12,'dec'=>12,'décembre'=>12
  137.             ];
  138.             // Nettoyage
  139.             $text strtolower(trim($datesSession));
  140.             $text str_replace(['.'','], ''$text);
  141.             /**
  142.              * Exemples acceptés :
  143.              * 23 nov au 04 dec
  144.              * 29 juin au 10 juil
  145.              * 07 au 18 sept
  146.              */
  147.             if (preg_match('/(\d{1,2})\s*(janv|févr|fevr|mars|avr|mai|juin|juil|août|aout|sept|oct|nov|déc)?\s*au\s*\d{1,2}\s*(janv|févr|fevr|mars|avr|mai|juin|juil|août|aout|sept|oct|nov|déc)/i'$text$m)) {
  148.                 $jourDebut = (int) $m[1];
  149.                 $moisDebutTxt $m[2] ?: $m[3]; // parfois avant, parfois après "au"
  150.                 $moisDebut $moisFr[$moisDebutTxt] ?? null;
  151.                 if (!$moisDebut) {
  152.                     return null;
  153.                 }
  154.                 $today = new \DateTime('today');
  155.                 $year = (int) $today->format('Y');
  156.                 $date = new \DateTime(sprintf('%04d-%02d-%02d'$year$moisDebut$jourDebut));
  157.                 // Si la date est déjà passée → année suivante
  158.                 if ($date $today) {
  159.                     $date->modify('+1 year');
  160.                 }
  161.                 return $date;
  162.             }
  163.             return null;
  164.         };
  165.         $today = new \DateTime('today');
  166.         // 3️⃣ Filtrer UNIQUEMENT les formations à venir
  167.         $formations array_filter($formations, function ($f) use ($extractDateDebut) {
  168.             return $extractDateDebut($f['dates_session']) !== null;
  169.         });
  170.         // 4️⃣ Trier : plus proche → plus éloignée
  171.         usort($formations, function ($a$b) use ($extractDateDebut) {
  172.             return $extractDateDebut($a['dates_session'])
  173.                 <=> $extractDateDebut($b['dates_session']);
  174.         });  
  175.         // 5️⃣ Limiter à 3 formations (optionnel)
  176.         $formations array_slice($formations03);
  177.         //dd($formations);
  178.         
  179.         
  180.         
  181.         $queryBuilder $entityManager->createQueryBuilder();
  182.         $queryBuilder
  183.         ->select('actu')
  184.         ->from(Actualites::class, 'actu')
  185.         ->orderBy('actu.createdat''DESC')
  186.         ->setMaxResults(2);
  187.         $actualite $queryBuilder->getQuery()->getResult();
  188.         $reference $referenceRepository->findAll();
  189.         $mentions $mentionRepository->findAll();
  190.         
  191.         $bannieres $banniereRepository->findAll();
  192.         // dd($mentions);
  193.         
  194.         return $this->render('front/index.html.twig',[
  195.             'annee' => $annee,
  196.             'banniere' => $bannieres,
  197.             'mentions' => $mentions,
  198.             'reference' => $reference,
  199.             'formations' => $formations,
  200.             'thematiqueLimit' => $thematiqueLimit,
  201.             'actualite' => $actualite
  202.         ]);
  203.     }
  204.     
  205.     #[Route('/mediatheque/albums'name'front.inter.album'methods:['GET'])]
  206.     public function album(
  207.         Request $request
  208.         PaginatorInterface $paginator,
  209.         AlbumsRepository $albumRepository,
  210.         VideosRepository $videoRepository,
  211.         MentionsRepository $mentionRepository,
  212.         EntityManagerInterface $entityManager
  213.     ): Response
  214.     {
  215.         $queryBuilder $entityManager->createQueryBuilder();
  216.         $queryBuilder
  217.             ->select('al, MIN(g.imgGal) AS image')
  218.             ->from(Albums::class, 'al')
  219.             ->innerJoin(Galeries::class, 'g''WITH''al.slug = g.nom')
  220.             ->where('al.statut = :statut')
  221.             ->setParameter('statut''Publié')
  222.             ->groupBy('al.id')
  223.             ->orderBy('al.createdat''DESC');
  224.         $albums $queryBuilder->getQuery()->getResult();
  225.         //dd($albums);
  226.         $pagination $paginator->paginate(
  227.             $queryBuilder,
  228.             $request->query->getInt('page'1),
  229.             12
  230.         );  
  231.         /*$albums = $albumRepository->findAll();
  232.         $videos = $videoRepository->findAll();*/
  233.         $mentions $mentionRepository->findAll();
  234.         return $this->render('front/multimedia/album.html.twig',[
  235.             'pagination' => $pagination,
  236.             'mentions' => $mentions
  237.         ]);
  238.     }
  239.     
  240.     #[Route('/notre-expertise'name'front.inter.expertise'methods:['GET'])]
  241.     public function expertise(
  242.         Request $request
  243.         ReferenceclientsRepository $referenceRepository,
  244.         ExpertisesRepository $expertiseRepository,
  245.         MentionsRepository $mentionRepository,
  246.         EntityManagerInterface $entityManager
  247.     ): Response
  248.     {
  249.         $expertise $expertiseRepository->findBy(['statut' => 'Publié']);
  250.         //dd($expertise);
  251.         $mentions $mentionRepository->findAll();
  252.         $reference $referenceRepository->findAll();
  253.         //dd($reference);
  254.         return $this->render('front/expertise.html.twig',[
  255.             'reference' => $reference,
  256.             'expertise' => $expertise,
  257.             'mentions' => $mentions
  258.         ]);
  259.     }
  260.     
  261.     #[Route('/mediatheque/album/{slug}'name'front.inter.image'methods:['GET'])]
  262.     public function galerie(
  263.         $slug,
  264.         Request $request
  265.         AlbumsRepository $albumRepository,
  266.         GaleriesRepository $galerieRepository,
  267.         MentionsRepository $mentionRepository,
  268.         EntityManagerInterface $entityManager
  269.     ): Response
  270.     {
  271.         //$galerie = $galerieRepository->findBy(['nom' => $slug]);
  272.         $queryBuilder $entityManager->createQueryBuilder()
  273.             ->select('gal.nom, gal.imgGal AS image')
  274.             ->from(Galeries::class, 'gal')
  275.             ->where('gal.nom = :slug')
  276.             ->setParameter('slug'$slug);
  277.         $galerie $queryBuilder->getQuery()->getArrayResult(); // retourne un tableau
  278.         $mentions $mentionRepository->findAll();
  279.         return $this->render('front/multimedia/galerie.html.twig',[
  280.             'slug' => $slug,
  281.             'galeries' => $galerie,
  282.             'mentions' => $mentions
  283.         ]);
  284.     }
  285.     #[Route('/mediatheque/video'name'front.inter.video'methods:['GET'])]
  286.     public function video(
  287.         Request $request
  288.         VideosRepository $videoRepository,
  289.         MentionsRepository $mentionRepository,
  290.         EntityManagerInterface $entityManager
  291.     ): Response
  292.     {
  293.         $videos $videoRepository->findBy(
  294.             ['statut' => 'Publié'],
  295.             ['createdat' => 'DESC']
  296.         );
  297.         //dd($videos);
  298.         $mentions $mentionRepository->findAll();
  299.         return $this->render('front/multimedia/video.html.twig',[
  300.             'videos' => $videos,
  301.             'mentions' => $mentions
  302.         ]);
  303.     }
  304.     
  305.     //-----------------------------------------------------------------------------------------------------
  306.     
  307.     #[Route('/formations/certificats/certificats-internationaux-II'name'front.inter.certificat.certyou'methods:['GET'])]
  308.     public function certificat_certyou(
  309.         Request $request
  310.         PaginatorInterface $paginator,
  311.         CertyousRepository $certyouRepository,
  312.         ManagementsRepository $managementRepository,
  313.         MentionsRepository $mentionRepository,
  314.         EntityManagerInterface $entityManager
  315.     ): Response
  316.     {
  317.         $certyou $certyouRepository->findAll();
  318.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  319.         
  320.         $queryBuilder $entityManager->createQueryBuilder();
  321.         $queryBuilder
  322.         ->select(
  323.             'cert.id','cert.prixpresentiel','cert.prixvirtuelle',
  324.             'cert.devise','cert.theme','cert.duree','cert.slug',
  325.             'cert.type','cert.createdat'
  326.         )
  327.         ->from(Certyous::class, 'cert');
  328.         $certyous $queryBuilder->getQuery()->getResult();
  329.         
  330.         $pagination $paginator->paginate(
  331.             $queryBuilder,
  332.             $request->query->getInt('page'1),
  333.             12
  334.         );  
  335.         
  336.         $mentions $mentionRepository->findAll();
  337.         return $this->render('front/certyou.html.twig',[
  338.             'manageLimit' => $manageLimit,
  339.             'pagination' => $certyous,
  340.             'mentions' => $mentions,
  341.         ]);
  342.     }
  343.     
  344.     ///---------------------------------------------------------------------------------------------------
  345.     
  346.     #[Route('/formations/certificats/certificats-internationaux-II/{slug}/code{id}'name'front.inter.certificat.certyou.inscription'methods:['GET','POST'])]
  347.     public function certificat_certyou_inscription(
  348.         $id,
  349.         $slug,
  350.         Request $request
  351.         MailerInterface $mailer,
  352.         PaginatorInterface $paginator,
  353.         CertyousRepository $certyouRepository,
  354.         SessionsRepository $sessionRepository,
  355.         ManagementsRepository $managementRepository,
  356.         MentionsRepository $mentionRepository,
  357.         EntityManagerInterface $entityManager
  358.     ): Response
  359.     {
  360.         //$certyou = $certyouRepository->findAll();
  361.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  362.         
  363.         $queryBuilder $entityManager->createQueryBuilder();
  364.         $queryBuilder
  365.             ->select('cert')
  366.             ->from(Certyous::class, 'cert')
  367.             ->where('cert.slug = :slug')
  368.             ->setParameter('slug'$slug);
  369.         $certyou $queryBuilder->getQuery()->getOneOrNullResult();
  370.         if (!$certyou) {
  371.             $this->addFlash('danger','Certificat introuvable');
  372.         }
  373.         $nomTheme $certyou?->getTheme();
  374.         $Inscriptionpersos = new Inscriptionpersos();
  375.         $InscriptionCertyouForm $this->createForm(InscriptionCertyouFormType::class,null, [
  376.             'certyou' => $certyou
  377.         ]);
  378.         $InscriptionCertyouForm->handleRequest($request);
  379.         
  380.         if($InscriptionCertyouForm->isSubmitted()){
  381.             $theme str_replace('-'' '$slug);
  382.             $choix htmlspecialchars($InscriptionCertyouForm->get('choix')->getData());
  383.             $type htmlspecialchars($InscriptionCertyouForm->get('type')->getData());
  384.             $lieux htmlspecialchars($InscriptionCertyouForm->get('lieu')->getData());
  385.             $sessionEntity $InscriptionCertyouForm->get('session')->getData();
  386.             $session $sessionEntity $sessionEntity->getSession() : '';
  387.             //$choix = $certyou->getType();
  388.             $duree $certyou->getDuree();
  389.             $devise $certyou->getDevise();
  390.             
  391.             //$duree = htmlspecialchars($InscriptionCertyouForm->get('duree')->getData());
  392.             //$prixvirtuelle = htmlspecialchars($InscriptionCertyouForm->get('prixvirtuelle')->getData());
  393.             //$prixpresentiel = htmlspecialchars($InscriptionCertyouForm->get('prixpresentiel')->getData());
  394.             //$prixVirtuelle   = $certificat->getPrixvirtuelle();
  395.             //$prixPresentiel  = $certificat->getPrixpresentiel();
  396.             $civilite $InscriptionCertyouForm->get('civilite')->getData();
  397.             $nom $InscriptionCertyouForm->get('nom')->getData();
  398.             $prenoms $InscriptionCertyouForm->get('prenoms')->getData();
  399.             $fonction $InscriptionCertyouForm->get('fonction')->getData();
  400.             $adresse $InscriptionCertyouForm->get('adresse')->getData();
  401.             $mail $InscriptionCertyouForm->get('mail')->getData();
  402.             $entreprise $InscriptionCertyouForm->get('entreprise')->getData();
  403.             
  404.             $siteweb $InscriptionCertyouForm->get('siteweb')->getData();
  405.             $nbparticipant $InscriptionCertyouForm->get('nbparticipant')->getData();
  406.             $pays $InscriptionCertyouForm->get('pays')->getData();
  407.             $ville $InscriptionCertyouForm->get('ville')->getData();
  408.             $boitepostale $InscriptionCertyouForm->get('boitepostale')->getData();
  409.             $whatsapp $InscriptionCertyouForm->get('whatsapp')->getData();            
  410.             
  411.             $telephone $InscriptionCertyouForm->get('telephone')->getData();
  412.             $commentaire $InscriptionCertyouForm->get('commentaire')->getData(); 
  413.             
  414.             $token $InscriptionCertyouForm->get('recaptchaToken')->getData();
  415.             
  416.             if ($type === 'presentiel') {
  417.                 //$prix = 'presentiel ' . $InscriptionCertyouForm->get('prixpresentiel')->getData();
  418.                 $prix $certyou->getPrixpresentiel();
  419.             } else {
  420.                 //$prix = 'virtuelle ' . $InscriptionCertyouForm->get('prixvirtuelle')->getData();
  421.                 $prix $certyou->getPrixvirtuelle();
  422.             }
  423.             
  424.             if ($lieux === '') {
  425.                 $lieu 'classe uniquement virtuelle';
  426.             } else {
  427.                 $lieu $lieux;
  428.             }
  429.             
  430.             if(!$commentaire){
  431.                 $commentaire " ";
  432.             }else{
  433.                 $commentaire $InscriptionCertyouForm->get('commentaire')->getData();
  434.             }
  435.             
  436.             /*dd($nom ,$prenoms ,$fonction ,$adresse ,$mail ,$entreprise ,$siteweb ,$nbparticipant ,$pays ,$ville ,$boitepostale ,
  437.             $whatsapp, $telephone, $theme, $type, $duree, $lieu, $prix, $session, $commentaire);*/
  438.             
  439.             $destinataire 'inscriptions@cimef-international.org';
  440.             $expediteur   $mail;
  441.             $reponse      $expediteur;
  442.             $suj "INSCRIPTION FORMATION 2026";
  443.             
  444.             $codehtml '<html><body>'.
  445.             '<table width="100%" cellpadding="0" cellspacing="0" style="background-color:#f4f6f8; padding:20px;">
  446.             <tr>
  447.             <td align="center">
  448.             <table width="600" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,0.08);">
  449.             <tr>
  450.             <td style="background-color:#051a53; padding:20px; color:#ffffff; text-align:center;">
  451.             <h2 style="margin:0;">Confirmation d\'inscription</h2>
  452.             </td>
  453.             </tr>
  454.             <tr>
  455.             <td style="padding:25px; color:#333333; font-size:14px; line-height:1.6;">
  456.             <p>Inscription de '.$civilite.' '.$prenoms.' '.$nom.' à la formation <strong>'.$theme.'</strong> organisée par <strong>CIMEF International</strong>.</p>
  457.             <p>Veuillez trouver ci-dessous le récapitulatif :</p>
  458.             <hr style="border:none; border-top:1px solid #e0e0e0; margin:20px 0;">
  459.             <h4 style="margin-bottom:8px; color:#0d6efd;">Informations personnelles</h4>
  460.             <p>
  461.             <strong>Nom & Prénoms :</strong> '.$prenoms.' '.$nom.'<br>
  462.             <strong>Fonction :</strong> '.$fonction.'<br>
  463.             <strong>Entreprise :</strong> '.$entreprise.'<br>
  464.             <strong>Adresse :</strong> '.$adresse.'<br>
  465.             <strong>Pays / Ville :</strong> '.$pays.' / '.$ville.'<br>
  466.             <strong>Boîte postale :</strong> '.$boitepostale.'
  467.             </p>
  468.             <h4 style="margin-bottom:8px; color:#0d6efd;">Coordonnées</h4>
  469.             <p>
  470.             <strong>Email :</strong> '.$mail.'<br>
  471.             <strong>Téléphone :</strong> '.$telephone.'<br>
  472.             <strong>WhatsApp :</strong> '.$whatsapp.'<br>
  473.             <strong>Site web :</strong> '.$siteweb.'
  474.             </p>
  475.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détails de participation</h4>
  476.             <p>
  477.             <strong>Nombre de participants :</strong> '.$nbparticipant.'<br>
  478.             <strong>Commentaire :</strong> '.$commentaire.'
  479.             </p>
  480.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détail de la formation</h4>
  481.             <p>
  482.             <strong>Thème :</strong> '.$theme.'<br>
  483.             <strong>Type :</strong> '.$type.'<br>
  484.             <strong>Durée :</strong> '.$duree.'<br>
  485.             <strong>Lieu :</strong> '.$lieu.'<br>
  486.             <strong>Prix :</strong> '.$prix.' '.$devise.'<br>
  487.             <strong>Session :</strong> '.$session.'
  488.             </p>
  489.             </td>
  490.             </tr>
  491.             <tr>
  492.             <td style="background-color:#f1f1f1; padding:15px; text-align:center; font-size:12px; color:#777777;">
  493.             © '.date("Y").' CIMEF International — Tous droits réservés
  494.             </td>
  495.             </tr>
  496.             </table>
  497.             </td>
  498.             </tr>
  499.             </table>
  500.             </body></html>';
  501.             
  502.             $response $this->client->request(
  503.                 'POST',
  504.                 'https://www.google.com/recaptcha/api/siteverify',
  505.                 [
  506.                     'body' => [
  507.                         'secret' => $_ENV['RECAPTCHA_SECRET_KEY'],
  508.                         'response' => $token,
  509.                     ]
  510.                 ]
  511.             );
  512.             $result $response->toArray();
  513.             if (!$result['success'] || !isset($result['score']) || $result['score'] < 0.5) {
  514.                 return $this->addFlash('warning','Vérification reCAPTCHA échouée.');
  515.             }   
  516.             
  517.             /*
  518.             $secretKey = '6LfPYkosAAAAAJQFLCC-9U5bF6KdFTPrgmbxg5Ux';
  519.             $value = $request->get('g-recaptcha-response');
  520.             if (!$value) { 
  521.                 $this->addFlash('warning', 'Veuillez cocher le reCAPTCHA'); 
  522.                 return $this->redirectToRoute('front.seminaire.nationaux',['seminaires' => $seminaires,'slug' => $slug]);
  523.             }
  524.             $userIP = $_SERVER['REMOTE_ADDR'];
  525.             $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$value&remoteip=$userIP";
  526.             $response = \file_get_contents($url);
  527.             $response = json_decode((string)$response);
  528.             //dd($response);
  529.             if(!$response->success){
  530.                 $this->addFlash('warning','Cocher le champs recaptcha svp!');
  531.                 return $this->redirectToRoute('front.seminaire.nationaux',['seminaires' => $seminaires,'slug' => $slug]);
  532.             }
  533.             */
  534.            
  535.             $email = (new Email())
  536.             ->from('CIMEF International <inscriptions@cimef-international.org>')
  537.             ->to($destinataire)                 // destinataire principal
  538.             ->cc('medias@cimef-international.com'// COPIE
  539.             ->replyTo($expediteur)              // Reply-To:
  540.             ->subject($suj)     
  541.             ->text(strip_tags($codehtml))
  542.             ->html($codehtml);// Subject:
  543.             //->html($codehtml, 'text/html');   // Content-Type + charset utf-8
  544.             $mailer->send($email);
  545.             
  546.             
  547.             $Inscriptionpersos->setNom($nom);
  548.             $Inscriptionpersos->setPrenoms($prenoms);
  549.             $Inscriptionpersos->setFonction($fonction);
  550.             $Inscriptionpersos->setAdresse($adresse);
  551.             $Inscriptionpersos->setMail($mail);
  552.             $Inscriptionpersos->setEntreprise($entreprise);
  553.             $Inscriptionpersos->setSiteweb($siteweb);
  554.             $Inscriptionpersos->setNbparticipant($nbparticipant);
  555.             $Inscriptionpersos->setPays($pays);
  556.             $Inscriptionpersos->setVille($ville);
  557.             $Inscriptionpersos->setBoitepostale($boitepostale);
  558.             $Inscriptionpersos->setWhatsapp($whatsapp);
  559.             $Inscriptionpersos->setTelephone($telephone);
  560.             $Inscriptionpersos->setCommentaire($commentaire);
  561.             $Inscriptionpersos->setTheme($theme);
  562.             $Inscriptionpersos->setType($type);
  563.             $Inscriptionpersos->setDuree($duree);
  564.             $Inscriptionpersos->setLieu($lieu);
  565.             $Inscriptionpersos->setPrix($prix);
  566.             $Inscriptionpersos->setSession($session);
  567.             
  568.             $entityManager->persist($Inscriptionpersos);
  569.             $entityManager->flush();
  570.             $this->addFlash(
  571.             'success',
  572.             'Votre inscription à été bien enregistrée');
  573.             return $this->redirectToRoute('front.inter.certificat.certyou',['slug' => $slug,'id' => $id]);
  574.         }
  575.         
  576.         //dd($nomTheme);
  577.    
  578.         $mentions $mentionRepository->findAll();
  579.         return $this->render('front/inscriptions/inscription-certyou.html.twig',[
  580.             'id' => $id,
  581.             'slug' => $slug,
  582.             'theme' => $nomTheme,
  583.             'certyou' => $certyou,
  584.             'mentions' => $mentions,
  585.             'manageLimit' => $manageLimit,
  586.             'inscriptionCertyouForm' => $InscriptionCertyouForm->createView(),
  587.         ]);
  588.     }
  589.     //-----------------------------------------------------------------------------------------------------
  590.     
  591.     #[Route('/formations/certificats/certificats-internationaux-I'name'front.inter.certificat.inter'methods:['GET'])]
  592.     public function certificat(
  593.         Request $request
  594.         PaginatorInterface $paginator,
  595.         CertificatsRepository $certificatRepository,
  596.         ManagementsRepository $managementRepository,
  597.         MentionsRepository $mentionRepository,
  598.         EntityManagerInterface $entityManager
  599.     ): Response
  600.     {
  601.         $certificat $certificatRepository->findAll();
  602.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  603.         
  604.         $queryBuilder $entityManager->createQueryBuilder();
  605.         $sub $entityManager->createQueryBuilder()
  606.             ->select('MAX(c2.createdat)')
  607.             ->from(Certificats::class, 'c2')
  608.             ->where('c2.theme = cert.theme');
  609.         $queryBuilder
  610.             ->select('cert.id','cert.session','cert.prix','cert.slug','cert.devise',
  611.                 'vil.nom AS vilnom','vil.pays','cert.createdat','cert.type','cert.theme')
  612.             ->from(Certificats::class, 'cert')
  613.             ->innerJoin(Villes::class, 'vil''WITH''cert.ville = vil.id')
  614.             ->where($queryBuilder->expr()->eq('cert.createdat''(' $sub->getDQL() . ')'))
  615.             ->orderBy('cert.createdat''DESC');
  616.         $certificat $queryBuilder->getQuery()->getResult();
  617.         $pagination $paginator->paginate(
  618.             $queryBuilder,
  619.             $request->query->getInt('page'1),
  620.             12
  621.         );  
  622.             
  623.         $mentions $mentionRepository->findAll();
  624.         return $this->render('front/certificat.html.twig',[
  625.             'manageLimit' => $manageLimit,
  626.             'pagination' => $certificat,
  627.             'mentions' => $mentions,
  628.         ]);
  629.     }
  630.     #[Route('/formtaions/certificats/certificats-internationaux-I/{slug}'name'front.inter.detail.certificat'methods:['GET'])]
  631.     public function detail_certificat(
  632.         $slug,
  633.         Request $request
  634.         PaginatorInterface $paginator,
  635.         CertificatsRepository $certificatRepository,
  636.         ManagementsRepository $managementRepository,
  637.         MentionsRepository $mentionRepository,
  638.         EntityManagerInterface $entityManager
  639.     ): Response
  640.     {
  641.         $certificat $certificatRepository->findAll();
  642.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  643.         
  644.         $queryBuilder $entityManager->createQueryBuilder();
  645.         $queryBuilder
  646.             ->select(
  647.                 'cert.id','cert.session','cert.prix','cert.slug',
  648.                 'cert.devise','cert.theme','vil.nom AS vilnom',
  649.                 'vil.pays','cert.createdat','cert.type'
  650.             )
  651.             ->from(Certificats::class, 'cert')
  652.             ->innerJoin(Villes::class, 'vil''WITH''cert.ville = vil.id')
  653.             ->where('cert.slug = :slug')
  654.             ->setParameter('slug'$slug);
  655.         $certificat $queryBuilder->getQuery()->getResult();
  656.         $pagination $paginator->paginate(
  657.             $queryBuilder,
  658.             $request->query->getInt('page'1),
  659.             12
  660.         ); 
  661.             
  662.         $mentions $mentionRepository->findAll();
  663.         return $this->render('front/liste-certificat.html.twig',[
  664.             'manageLimit' => $manageLimit,
  665.             'pagination' => $pagination,
  666.             'mentions' => $mentions,
  667.             'slug' => $slug
  668.         ]);
  669.     }
  670.     
  671.     #[Route('/presentation'name'front.inter.presentation'methods:['GET'])]
  672.     public function presentation(
  673.         Request $request
  674.         PartenairesRepository $partenaireRepository,
  675.         FormationsRepository $formationRepository,
  676.         AboutsRepository $aboutRepository
  677.         ValeursRepository $valeurRepository,
  678.         AvisRepository $avisRepository,
  679.         MentionsRepository $mentionRepository,
  680.         EntityManagerInterface $entityManager
  681.     ): Response
  682.     {
  683.         $avis $avisRepository->findAll();
  684.         $All_partenaire $partenaireRepository->findAll();
  685.         $All_about $aboutRepository->findAll();
  686.         $All_valeur $valeurRepository->findAll();
  687.         $mentions $mentionRepository->findAll();
  688.         return $this->render('front/qui-sommes-nous.html.twig',[
  689.             'partenaires' => $All_partenaire,
  690.             'valeur' => $All_valeur,
  691.             'mentions' => $mentions,
  692.             'about' => $All_about,
  693.             'avis' => $avis,
  694.         ]);
  695.     }
  696.     #[Route('/formations/rencontre-top-management'name'front.top.management'methods:['GET'])]
  697.     public function management(
  698.         Request $request
  699.         PaginatorInterface $paginator,
  700.         MentionsRepository $mentionRepository,
  701.         ManagementsRepository $managementRepository,
  702.         EntityManagerInterface $entityManager
  703.     ): Response
  704.     {
  705.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  706.         // dd($manageLimit);
  707.         $queryBuilder $entityManager->createQueryBuilder();
  708.         $queryBuilder
  709.         ->select('man')
  710.         ->from(Managements::class, 'man')
  711.         ->orderBy('man.createdat''DESC');
  712.         $listmanagement $queryBuilder->getQuery()->getResult();
  713.         
  714.         $pagination $paginator->paginate(
  715.             $queryBuilder,
  716.             $request->query->getInt('page'1),
  717.             10
  718.         );  
  719.         $mentions $mentionRepository->findAll();
  720.         return $this->render('front/rencontre-management.html.twig',[
  721.             'mentions' => $mentions,
  722.             'pagination' => $listmanagement,
  723.             'manageLimit' => $manageLimit
  724.         ]);
  725.     }
  726.     
  727.     #[Route('/formations/rencontre-top-management/{slug}'name'front.seminaire.management.detail'methods:['GET'])]
  728.     public function detail_management(
  729.         $slug,
  730.         Request $request
  731.         ManagementsRepository $managementRepository,
  732.         MentionsRepository $mentionRepository,
  733.         EntityManagerInterface $entityManager
  734.     ): Response
  735.     {
  736.         $query $managementRepository->findOneBy(array('slug' => $slug));
  737.         $mentions $mentionRepository->findAll();
  738.         // dd($query);
  739.         return $this->render('front/detail/detail-rencontre.html.twig',[
  740.             'mentions' => $mentions,
  741.             'query' => $query,
  742.             'slug' => $slug
  743.         ]);
  744.     }
  745.     
  746.     #[Route('/formations/seminaires/internationaux'name'front.seminaire.internationaux'methods:['GET'])]
  747.     public function sem_inter(
  748.         Request $request,
  749.         PaginatorInterface $paginator,
  750.         MentionsRepository $mentionRepository,
  751.         EntityManagerInterface $entityManager
  752.     ): Response
  753.     {
  754.         $recherche $this->createForm(RechercheFormType::class);
  755.         $recherche->handleRequest($request);
  756.     
  757.         $annee = (int) date('Y');
  758.         $today = new \DateTime('today');
  759.         $mentions $mentionRepository->findAll();
  760.     
  761.         $qb $entityManager->createQueryBuilder();
  762.         $qb ->select('for','th','thm','vil')
  763.             ->from(Formations::class, 'for')
  764.             ->innerJoin('for.theme''th')
  765.             ->innerJoin('th.thematique''thm')
  766.             ->innerJoin('for.ville''vil')
  767.             ->Where('vil != :ville')
  768.             ->setParameter('ville''SHANGHAI');
  769.     
  770.         if ($recherche->isSubmitted() && $recherche->isValid()) {
  771.             $mot $recherche->get('mot')->getData();
  772.             if(empty($mot)){
  773.                 // Aucun thème sélectionné
  774.                 $this->addFlash('warning''Veuillez sélectionner un thème pour la recherche.');
  775.                 return $this->redirectToRoute('front.seminaire.internationaux'); // ou autre redirection
  776.             }
  777.             $ville $recherche->get('ville')->getData();
  778.             if ($ville && strtoupper($ville->getNom()) === 'SHANGHAI') {
  779.                 // On ignore silencieusement
  780.                 $ville null;
  781.             }
  782.             $nom $mot->getNom();
  783.             
  784.             if ($mot) {
  785.                 $qb ->andWhere($qb->expr()->orX('th.nom LIKE :mot','thm.nom LIKE :mot'))
  786.                     ->setParameter('mot''%' $nom '%');
  787.             }
  788.             if ($ville) {
  789.                 $qb ->andWhere('vil = :ville')
  790.                     ->setParameter('ville'$ville);
  791.             }
  792.         }
  793.     
  794.         $formations $qb->getQuery()->getResult();
  795.     
  796.         $extractDateDebut = function (?string $datesSession): ?\DateTime {
  797.     
  798.             if (!$datesSession) return null;
  799.             $mois = [
  800.                 'janv'=>1,'janvier'=>1,
  801.                 'févr'=>2,'fevr'=>2,'février'=>2,
  802.                 'mars'=>3,
  803.                 'avr'=>4,'avril'=>4,
  804.                 'mai'=>5,
  805.                 'juin'=>6,
  806.                 'juil'=>7,'juillet'=>7,
  807.                 'août'=>8,'aout'=>8,
  808.                 'sept'=>9,'septembre'=>9,
  809.                 'oct'=>10,'octobre'=>10,
  810.                 'nov'=>11,'novembre'=>11,
  811.                 'déc'=>12,'dec'=>12,'décembre'=>12
  812.             ];
  813.             $text strtolower(str_replace(['.'','], ''trim($datesSession)));
  814.             if (!preg_match(
  815.                 '/(\d{1,2})\s*(janv|févr|fevr|mars|avr|mai|juin|juil|août|aout|sept|oct|nov|déc)?\s*au\s*\d{1,2}\s*(janv|févr|fevr|mars|avr|mai|juin|juil|août|aout|sept|oct|nov|déc)/i',
  816.                 $text,
  817.                 $m
  818.             )) {
  819.                 return null;
  820.             }
  821.             $jour = (int) $m[1];
  822.             $moisTxt $m[2] ?: $m[3];
  823.             $moisNum $mois[$moisTxt] ?? null;
  824.             if (!$moisNum) return null;
  825.     
  826.             $date = new \DateTime(sprintf('%d-%02d-%02d'date('Y'), $moisNum$jour));
  827.     
  828.             if ($date < new \DateTime('today')) {
  829.                 $date->modify('+1 year');
  830.             }
  831.             return $date;
  832.         };
  833.     
  834.         $formationsParTheme = [];
  835.         foreach ($formations as $formation) {
  836.     
  837.             $dateDebut $extractDateDebut($formation->getDatesSession());
  838.             if (!$dateDebut || $dateDebut $today || (int)$dateDebut->format('Y') !== $annee) {
  839.                 continue;
  840.             }
  841.             $themeId $formation->getTheme()->getId();
  842.             if (
  843.                 !isset($formationsParTheme[$themeId]) ||
  844.                 $dateDebut $formationsParTheme[$themeId]['date']
  845.             ) {
  846.                 $formationsParTheme[$themeId] = [
  847.                     'formation' => $formation,
  848.                     'date'      => $dateDebut
  849.                 ];
  850.             }
  851.         }
  852.     
  853.         $formationsFinales array_map(fn($f) => $f['formation'], $formationsParTheme);
  854.         usort($formationsFinales, function ($a$b) use ($extractDateDebut) {
  855.             return $extractDateDebut($a->getDatesSession())
  856.                 <=> $extractDateDebut($b->getDatesSession());
  857.         });
  858.     
  859.         $pagination $paginator->paginate(
  860.             $formationsFinales,
  861.             $request->query->getInt('page'1),
  862.             12
  863.         );
  864.     
  865.         return $this->render('front/seminaire_inter.html.twig', [
  866.             'annee'      => $annee,
  867.             'mentions'   => $mentions,
  868.             'pagination' => $pagination,
  869.             'recherche'  => $recherche->createView(),
  870.         ]);
  871.     }
  872.     
  873.     #[Route('/formations/seminaires/nationaux'name'front.seminaire.nationaux'methods:['GET'])]
  874.     public function semNat(
  875.         Request $request,
  876.         GeoIpService $geo,
  877.         PaginatorInterface $paginator,
  878.         MentionsRepository $mentionRepository,
  879.         EntityManagerInterface $entityManager
  880.     ): Response
  881.     {
  882.         $annee date('Y');
  883.         $today = new \DateTime();
  884.     
  885.         // 🌍 Géo IP
  886.         $geoData $geo->getGeoData($request->getClientIp());
  887.         $pays $geoData['country'] ?? '';
  888.         $ville $geoData['city'] ?? '';
  889.     
  890.     
  891.         // Correction du nom du pays
  892.         if ($pays === 'Local' || $pays === 'Ivory Coast') {
  893.             $getpays "Côte d'ivoire";
  894.         } else {
  895.             $getpays $pays;
  896.         }
  897.     
  898.         // 🔍 Formulaire de recherche
  899.         $rechercheNat $this->createForm(RechercheNatFormType::class);
  900.         $rechercheNat->handleRequest($request);
  901.     
  902.         // 🔹 Requête pour récupérer les formations nationales
  903.         $qb $entityManager->createQueryBuilder()
  904.             ->select('f''th''thm''vil')
  905.             ->from(Formations::class, 'f')
  906.             ->innerJoin('f.theme''th')
  907.             ->innerJoin('th.thematique''thm')
  908.             ->innerJoin('f.ville''vil')
  909.             ->where('vil.pays = :pays')
  910.             ->setParameter('pays'$getpays);
  911.     
  912.         // 🔍 Filtrer par recherche si soumise
  913.         if ($rechercheNat->isSubmitted() && $rechercheNat->isValid()) {
  914.             $mot $rechercheNat->get('mot')->getData() ?? '';
  915.             if(empty($mot)){
  916.                 // Aucun thème sélectionné
  917.                 $this->addFlash('warning''Veuillez sélectionner un thème pour la recherche.');
  918.                 return $this->redirectToRoute('front.seminaire.nationaux'); // ou autre redirection
  919.             }
  920.             $nom $mot->getNom();
  921.             if ($mot) {
  922.                 $qb->andWhere(
  923.                     $qb->expr()->orX(
  924.                         'th.nom LIKE :mot',
  925.                         'thm.nom LIKE :mot'
  926.                     )
  927.                 )->setParameter('mot''%' $nom '%');
  928.             }
  929.         }
  930.     
  931.         // 📄 Récupération des formations
  932.         $formations $qb->getQuery()->getResult();
  933.     
  934.         $extractDates = function(?string $datesSession): ?array {
  935.         if (!$datesSession) return null;
  936.     
  937.             $moisFr = [
  938.                 'janv'=>1,'janvier'=>1,'févr'=>2,'fevr'=>2,'février'=>2,
  939.                 'mars'=>3,'avr'=>4,'avril'=>4,'mai'=>5,'juin'=>6,
  940.                 'juil'=>7,'juillet'=>7,'août'=>8,'aout'=>8,
  941.                 'sept'=>9,'septembre'=>9,'oct'=>10,'octobre'=>10,
  942.                 'nov'=>11,'novembre'=>11,'déc'=>12,'dec'=>12,'décembre'=>12
  943.             ];
  944.         
  945.             $text strtolower(trim($datesSession));
  946.             $text str_replace(['.'','], ''$text);
  947.         
  948.             if (preg_match('/(\d{1,2})\s*(\w+)?\s*au\s*(\d{1,2})\s*(\w+)?/i'$text$m)) {
  949.                 $jourDebut = (int)$m[1];
  950.                 $moisDebut $moisFr[$m[2] ?? ''] ?? null;
  951.                 $jourFin = (int)$m[3];
  952.                 $moisFin $moisFr[$m[4] ?? ''] ?? $moisDebut;
  953.         
  954.                 if (!$moisDebut || !$moisFin) return null;
  955.         
  956.                 $annee = (int)date('Y');
  957.                 $dateDebut = new \DateTime(sprintf('%04d-%02d-%02d'$annee$moisDebut$jourDebut));
  958.                 $dateFin = new \DateTime(sprintf('%04d-%02d-%02d'$annee$moisFin$jourFin));
  959.         
  960.                 if ($dateFin $dateDebut$dateFin->modify('+1 year');
  961.         
  962.                 return ['debut' => $dateDebut'fin' => $dateFin];
  963.             }
  964.         
  965.             return null;
  966.         };
  967.         // 🔹 Filtrer uniquement les formations à venir
  968.         $today = new \DateTime('today');
  969.         
  970.         $formations array_filter($formations, function($f) use ($extractDates$today) {
  971.             $dates $extractDates($f->getDatesSession());
  972.             if (!$dates) return false;
  973.         
  974.             // garder uniquement les formations dont la date de début est après aujourd'hui
  975.             return $dates['debut'] > $today;
  976.         });
  977.         // 🔹 Trier par date la plus proche
  978.         usort($formations, function($a$b) use ($extractDates) {
  979.             return $extractDates($a->getDatesSession())['debut'] <=> $extractDates($b->getDatesSession())['debut'];
  980.         });
  981.         // 📄 Pagination
  982.         $pagination $paginator->paginate(
  983.             $formations,
  984.             $request->query->getInt('page'1),
  985.             12
  986.         );
  987.     
  988.         $mentions $mentionRepository->findAll();
  989.     
  990.         // 🔹 Rendu Twig
  991.         return $this->render('front/seminaire_nat.html.twig', [
  992.             'annee' => $annee,
  993.             'mentions' => $mentions,
  994.             'recherche' => $rechercheNat->createView(),
  995.             'pagination' => $pagination,
  996.             'ville' => $ville,
  997.             'pays' => $getpays,
  998.         ]);
  999.     }
  1000.     
  1001.     #[Route('/formations/{seminaires}/{slug}/{id}code/inscription'name'front.inscription'methods:['GET','POST'])]
  1002.     public function inscription_sem(
  1003.         $slug,
  1004.         $seminaires,
  1005.         $id,
  1006.         Request $request,
  1007.         MailerInterface $mailer,
  1008.         InscriptionsRepository $inscriptionRepository,
  1009.         ThemeshanghaiRepository $themeshanghaiRepository,
  1010.         VillesRepository $villeRepository,
  1011.         ThemesRepository $themeRepository,
  1012.         FormationsRepository $formationRepository,
  1013.         MentionsRepository $mentionRepository,
  1014.         EntityManagerInterface $entityManager
  1015.     ): Response
  1016.     {
  1017.         $annee date('Y');
  1018.         $queryBuilder $entityManager->createQueryBuilder();
  1019.         $queryBuilder
  1020.         ->select('for.id''for.dates_session''for.prix''for.devise''th.nom'
  1021.             'thm.nom AS thmnom','vil.nom AS vilnom','vil.pays','for.created_at',
  1022.             'th.slug','th.description','for.devise','vil.longitude','vil.latitude'
  1023.         )
  1024.         ->from(Formations::class, 'for')
  1025.         ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  1026.         ->innerJoin(Villes::class,  'vil''WITH''for.ville = vil.id')
  1027.         ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique= thm.id')
  1028.         ->where('th.slug = :theme')
  1029.         ->andwhere('for.id = :forid')
  1030.         ->setParameter('theme'$slug)
  1031.         ->setParameter('forid'$id);
  1032.         $query $queryBuilder->getQuery()->getResult();
  1033.         $mentions $mentionRepository->findAll();
  1034.         
  1035.         $queryBuilder1 $entityManager->createQueryBuilder();
  1036.         $queryBuilder1
  1037.             ->select(
  1038.                 'cert.id','cert.session','cert.prix','cert.slug',
  1039.                 'cert.devise','cert.theme','vil.nom AS vilnom',
  1040.                 'vil.pays','cert.createdat','cert.type'
  1041.             )
  1042.             ->from(Certificats::class, 'cert')
  1043.             ->innerJoin(Villes::class, 'vil''WITH''cert.ville = vil.id')
  1044.             ->where('cert.slug = :slug')
  1045.             ->andwhere('cert.id = :id')
  1046.             ->setParameter('slug'$slug)
  1047.             ->setParameter('id'$id);
  1048.         $certificat $queryBuilder1->getQuery()->getOneOrNullResult();
  1049.         
  1050.         $queryBuilder2 $entityManager->createQueryBuilder();
  1051.         $queryBuilder2
  1052.             ->select(
  1053.                 'shan.id','shan.session','shan.prix','shan.slug',
  1054.                 'shan.devise','shan.theme','shan.ville','shan.createdat','shan.updatedat'
  1055.             )
  1056.             ->from(Themeshanghai::class, 'shan')
  1057.             ->where('shan.slug = :slug')
  1058.             ->andwhere('shan.id = :id')
  1059.             ->setParameter('slug'$slug)
  1060.             ->setParameter('id'$id);
  1061.         $shanghai $queryBuilder2->getQuery()->getOneOrNullResult();
  1062.         
  1063.         $inscription = new Inscriptions();
  1064.         $inscriptionForm $this->createForm(InscriptionFormType::class, $inscription);
  1065.         $inscriptionForm->handleRequest($request);
  1066.         if ($inscriptionForm->isSubmitted()) {
  1067.             $civilite $inscriptionForm->get('civilite')->getData();
  1068.             $nom $inscriptionForm->get('nom')->getData();
  1069.             $prenoms $inscriptionForm->get('prenoms')->getData();
  1070.             $fonction $inscriptionForm->get('fonction')->getData();
  1071.             $adresse $inscriptionForm->get('adresse')->getData();
  1072.             $mail $inscriptionForm->get('mail')->getData();
  1073.             $entreprise $inscriptionForm->get('entreprise')->getData();
  1074.             
  1075.             $site $inscriptionForm->get('siteweb')->getData();
  1076.             $nbparticipant $inscriptionForm->get('nbparticipant')->getData();
  1077.             $pays $inscriptionForm->get('pays')->getData();
  1078.             $ville $inscriptionForm->get('ville')->getData();
  1079.             $boitepostale $inscriptionForm->get('boitepostale')->getData();
  1080.             $whatsapp $inscriptionForm->get('whatsapp')->getData();            
  1081.             
  1082.             $telephone $inscriptionForm->get('telephone')->getData();
  1083.             $commentaire $inscriptionForm->get('commentaire')->getData(); 
  1084.             $formation $formationRepository->find($id);
  1085.             $formationShanghai $themeshanghaiRepository->find($id);
  1086.             
  1087.             $token $inscriptionForm->get('recaptchaToken')->getData();
  1088.  
  1089.             if($query){
  1090.                 $theme $formation->getTheme();
  1091.                 $idville $formation->getVille();
  1092.                 $session $formation->getDatesSession();
  1093.                 $prix $formation->getPrix();
  1094.                 $devise $formation->getDevise();
  1095.                 
  1096.                 $villes $villeRepository->find($idville);
  1097.                 $nomtheme $theme->getNom();
  1098.                 $nomville $villes->getNom();
  1099.             }
  1100.             
  1101.             if(!$site){
  1102.                 $siteweb 'Pas renseigné';
  1103.             }else{
  1104.                 $siteweb $inscriptionForm->get('siteweb')->getData();
  1105.             }
  1106.             
  1107.             if($certificat){
  1108.                 $nomtheme $certificat['theme'];
  1109.                 $nomville $certificat['vilnom'];
  1110.                 $nompays $certificat['pays'];
  1111.                 $session $certificat['session'];
  1112.                 $prix $certificat['prix'];
  1113.                 $devise $certificat['devise'];
  1114.             }
  1115.             if($shanghai){
  1116.                 $nomtheme $shanghai['theme'];
  1117.                 $nomville $shanghai['ville'];
  1118.                 $nompays '';
  1119.                 $session $shanghai['session'];
  1120.                 $prix $shanghai['prix'];
  1121.                 $devise $shanghai['devise'];
  1122.             }
  1123.             
  1124.             //dd($certificat);
  1125.             if(!$commentaire){
  1126.                 $commentaire " ";
  1127.             }else{
  1128.                 $commentaire $inscriptionForm->get('commentaire')->getData();
  1129.             }
  1130.             $response $this->client->request(
  1131.                 'POST',
  1132.                 'https://www.google.com/recaptcha/api/siteverify',
  1133.                 [
  1134.                     'body' => [
  1135.                         'secret' => $_ENV['RECAPTCHA_SECRET_KEY'],
  1136.                         'response' => $token,
  1137.                     ]
  1138.                 ]
  1139.             );
  1140.             $result $response->toArray();
  1141.             if (!$result['success'] || !isset($result['score']) || $result['score'] < 0.5) {
  1142.                 return $this->addFlash('warning','Vérification reCAPTCHA échouée.');
  1143.             }            
  1144.             
  1145.             /*
  1146.             $inscription->setNom($nom);
  1147.             $inscription->setPrenoms($prenoms);
  1148.             $inscription->setFonction($fonction);
  1149.             $inscription->setAdresse($adresse);
  1150.             $inscription->setMail($mail);
  1151.             $inscription->setEntreprise($entreprise);
  1152.             $inscription->setSiteweb($siteweb);
  1153.             $inscription->setNbparticipant($nbparticipant);
  1154.             $inscription->setPays($pays);
  1155.             $inscription->setVille( $ville);
  1156.             $inscription->setBoitepostale($boitepostale);
  1157.             $inscription->setWhatsapp($whatsapp);
  1158.             $inscription->setTelephone($telephone);
  1159.             $inscription->setCommentaire($commentaire);
  1160.             $inscription->setFormation($formation);
  1161.             $entityManager->persist($inscription);
  1162.             $entityManager->flush();
  1163.             */
  1164.             
  1165.             $destinataire 'inscriptions@cimef-international.org';
  1166.             $expediteur   $mail;
  1167.             $reponse      $expediteur;
  1168.             $suj "INSCRIPTION FORMATION 2026";
  1169.             
  1170.             $codehtml '<html><body>'.
  1171.             '<table width="100%" cellpadding="0" cellspacing="0" style="background-color:#f4f6f8; padding:20px;">
  1172.             <tr>
  1173.             <td align="center">
  1174.             <table width="600" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,0.08);">
  1175.             <tr>
  1176.             <td style="background-color:#051a53; padding:20px; color:#ffffff; text-align:center;">
  1177.             <h2 style="margin:0;">Confirmation d\'inscription</h2>
  1178.             </td>
  1179.             </tr>
  1180.             <tr>
  1181.             <td style="padding:25px; color:#333333; font-size:14px; line-height:1.6;">
  1182.             <p>Inscription de '.$civilite.' '.$prenoms.' '.$nom.' à la formation <strong>'.$nomtheme.'</strong> organisée par <strong>CIMEF International</strong>.</p>
  1183.             <p>Veuillez trouver ci-dessous le récapitulatif :</p>
  1184.             <hr style="border:none; border-top:1px solid #e0e0e0; margin:20px 0;">
  1185.             <h4 style="margin-bottom:8px; color:#0d6efd;">Informations personnelles</h4>
  1186.             <p>
  1187.             <strong>Nom & Prénoms :</strong> '.$prenoms.' '.$nom.'<br>
  1188.             <strong>Fonction :</strong> '.$fonction.'<br>
  1189.             <strong>Entreprise :</strong> '.$entreprise.'<br>
  1190.             <strong>Adresse :</strong> '.$adresse.'<br>
  1191.             <strong>Pays / Ville :</strong> '.$pays.' / '.$ville.'<br>
  1192.             <strong>Boîte postale :</strong> '.$boitepostale.'
  1193.             </p>
  1194.             <h4 style="margin-bottom:8px; color:#0d6efd;">Coordonnées</h4>
  1195.             <p>
  1196.             <strong>Email :</strong> '.$mail.'<br>
  1197.             <strong>Téléphone :</strong> '.$telephone.'<br>
  1198.             <strong>WhatsApp :</strong> '.$whatsapp.'<br>
  1199.             <strong>Site web :</strong> '.$siteweb.'
  1200.             </p>
  1201.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détails de participation</h4>
  1202.             <p>
  1203.             <strong>Nombre de participants :</strong> '.$nbparticipant.'<br>
  1204.             <strong>Commentaire :</strong> '.$commentaire.'
  1205.             </p>
  1206.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détail de la formation</h4>
  1207.             <p>
  1208.             <strong>Thème :</strong> '.$nomtheme.'<br>
  1209.             <strong>Ville :</strong> '.$nomville.'<br>
  1210.             <strong>Prix :</strong> '.$prix.''.$devise.'<br>
  1211.             <strong>Session :</strong> '.$session.'
  1212.             </p>
  1213.             </td>
  1214.             </tr>
  1215.             <tr>
  1216.             <td style="background-color:#f1f1f1; padding:15px; text-align:center; font-size:12px; color:#777777;">
  1217.             © '.date("Y").' CIMEF International — Tous droits réservés
  1218.             </td>
  1219.             </tr>
  1220.             </table>
  1221.             </td>
  1222.             </tr>
  1223.             </table>
  1224.             </body></html>';
  1225.             
  1226.             /*
  1227.             $secretKey = '6LfPYkosAAAAAJQFLCC-9U5bF6KdFTPrgmbxg5Ux';
  1228.             $value = $request->get('g-recaptcha-response');
  1229.             if (!$value) { 
  1230.                 $this->addFlash('warning', 'Veuillez cocher le reCAPTCHA'); 
  1231.                 return $this->redirectToRoute('front.seminaire.nationaux',['seminaires' => $seminaires,'slug' => $slug]);
  1232.             }
  1233.             $userIP = $_SERVER['REMOTE_ADDR'];
  1234.             $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$value&remoteip=$userIP";
  1235.             $response = \file_get_contents($url);
  1236.             $response = json_decode((string)$response);
  1237.             if(!$response->success){
  1238.                 $this->addFlash('warning','Cocher le champs recaptcha svp!');
  1239.                 return $this->redirectToRoute('front.seminaire.nationaux',['seminaires' => $seminaires,'slug' => $slug]);
  1240.             }
  1241.             */
  1242.  
  1243.             $email = (new Email())
  1244.             ->from('CIMEF International <inscriptions@cimef-international.org>')
  1245.             ->to($destinataire)                 // destinataire principal
  1246.             ->cc('medias@cimef-international.com'// COPIE
  1247.             ->replyTo($expediteur)              // Reply-To:
  1248.             ->subject($suj)     
  1249.             ->text(strip_tags($codehtml))
  1250.             ->html($codehtml);// Subject:
  1251.             //->html($codehtml, 'text/html');   // Content-Type + charset utf-8
  1252.             $mailer->send($email);
  1253.             $this->addFlash(
  1254.             'success',
  1255.             'Votre inscription à été bien enregistrée');
  1256.             return $this->redirectToRoute('front.seminaire.nationaux',['seminaires' => $seminaires,'slug' => $slug]);
  1257.         }
  1258.         //dd($seminaires);
  1259.         if($query){
  1260.             return $this->render('front/inscriptions/inscription-seminaire.html.twig',[
  1261.                 'slug' => $slug,
  1262.                 'query' => $query,
  1263.                 'annee' => $annee,
  1264.                 'type' => $seminaires,
  1265.                 'mentions' => $mentions,
  1266.                 'inscriptionForm' => $inscriptionForm->createView(),
  1267.             ]);
  1268.         }elseif($shanghai){
  1269.                 $nomtheme $shanghai['theme'];
  1270.                 $nomville $shanghai['ville'];
  1271.                 $nompays '';
  1272.                 $session $shanghai['session'];
  1273.                 $prix $shanghai['prix'];
  1274.                 $devise $shanghai['devise'];
  1275.             
  1276.             return $this->render('front/inscriptions/inscription-certificat.html.twig',[
  1277.                 'slug' => $slug,
  1278.                 'prix' => $prix,
  1279.                 'annee' => $annee,
  1280.                 'pays' => $nompays,
  1281.                 'devise' => $devise,
  1282.                 'ville' => $nomville,
  1283.                 'theme' => $nomtheme,
  1284.                 'type' => $seminaires,
  1285.                 'session' => $session,
  1286.                 'mentions' => $mentions,
  1287.                 'certificat' => $shanghai,
  1288.                 'inscriptionForm' => $inscriptionForm->createView(),
  1289.             ]);
  1290.     
  1291.         }else{
  1292.             $nomtheme $certificat['theme'];
  1293.             $nomville $certificat['vilnom'];
  1294.             $nompays $certificat['pays'];
  1295.             $session $certificat['session'];
  1296.             $prix $certificat['prix'];
  1297.             $devise $certificat['devise'];
  1298.             
  1299.             return $this->render('front/inscriptions/inscription-certificat.html.twig',[
  1300.                 'slug' => $slug,
  1301.                 'prix' => $prix,
  1302.                 'annee' => $annee,
  1303.                 'pays' => $nompays,
  1304.                 'devise' => $devise,
  1305.                 'ville' => $nomville,
  1306.                 'theme' => $nomtheme,
  1307.                 'type' => $seminaires,
  1308.                 'session' => $session,
  1309.                 'mentions' => $mentions,
  1310.                 'certificat' => $certificat,
  1311.                 'inscriptionForm' => $inscriptionForm->createView(),
  1312.             ]);
  1313.         }
  1314.     }
  1315.         
  1316.     #[Route('/formations/rencontre-des-top-management/{slug}/{id}code/inscription-manager'name'front.inscription.management'methods:['GET','POST'])]
  1317.     public function inscription_man(
  1318.         $slug,
  1319.         $id,
  1320.         Request $request,
  1321.         MailerInterface $mailer,
  1322.         InscriptionsRepository $inscriptionRepository,
  1323.         ManagementsRepository $managementRepository,
  1324.         MentionsRepository $mentionRepository,
  1325.         EntityManagerInterface $entityManager
  1326.     ): Response
  1327.     {
  1328.         $annee date('Y');
  1329.         $queryBuilder_1 $entityManager->createQueryBuilder();
  1330.         $queryBuilder_1
  1331.         ->select('man')
  1332.         ->from(Managements::class, 'man')
  1333.         ->where('man.slug = :theme')
  1334.         ->andwhere('man.id = :forid')
  1335.         ->setParameter('theme'$slug)
  1336.         ->setParameter('forid'$id);
  1337.         $query_1 $queryBuilder_1->getQuery()->getResult();
  1338.         $mentions $mentionRepository->findAll();
  1339.         $inscription = new Inscriptions();
  1340.         $inscriptionForm $this->createForm(InscriptionFormType::class, $inscription);
  1341.         $inscriptionForm->handleRequest($request);
  1342.         
  1343.         if ($inscriptionForm->isSubmitted()) {
  1344.             $nom $inscriptionForm->get('nom')->getData();
  1345.             $prenoms $inscriptionForm->get('prenoms')->getData();
  1346.             $fonction $inscriptionForm->get('fonction')->getData();
  1347.             $adresse $inscriptionForm->get('adresse')->getData();
  1348.             $mail $inscriptionForm->get('mail')->getData();
  1349.             $entreprise $inscriptionForm->get('entreprise')->getData();
  1350.             
  1351.             $siteweb $inscriptionForm->get('siteweb')->getData();
  1352.             $nbparticipant $inscriptionForm->get('nbparticipant')->getData();
  1353.             $pays $inscriptionForm->get('pays')->getData();
  1354.             $ville $inscriptionForm->get('ville')->getData();
  1355.             $boitepostale $inscriptionForm->get('boitepostale')->getData();
  1356.             $whatsapp $inscriptionForm->get('whatsapp')->getData();            
  1357.             
  1358.             $telephone $inscriptionForm->get('telephone')->getData();
  1359.             $commentaire $inscriptionForm->get('commentaire')->getData(); 
  1360.             $management $managementRepository->find($id);
  1361.             //dd($formation->getId());
  1362.             $token $inscriptionForm->get('recaptchaToken')->getData();
  1363.             
  1364.             $theme $management->getTheme();
  1365.             $ville $management->getVille();
  1366.             $datedebut $management->getDateDebut();
  1367.             $datefin $management->getDateFin();
  1368.             $prix $management->getPrix();
  1369.             $devise $management->getDevise();
  1370.             
  1371.             if(!$commentaire){
  1372.                 $commentaire "...";
  1373.             }else{
  1374.                 $commentaire $inscriptionForm->get('commentaire')->getData();
  1375.             }
  1376.             
  1377.             //$codehtml = "test";
  1378.             
  1379.             $codehtml '<html><body>'.
  1380.             '<table width="100%" cellpadding="0" cellspacing="0" style="background-color:#f4f6f8; padding:20px;">
  1381.             <tr>
  1382.             <td align="center">
  1383.             <table width="600" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,0.08);">
  1384.             <tr>
  1385.             <td style="background-color:#051a53; padding:20px; color:#ffffff; text-align:center;">
  1386.             <h2 style="margin:0;">Confirmation d\'inscription</h2>
  1387.             </td>
  1388.             </tr>
  1389.             <tr>
  1390.             <td style="padding:25px; color:#333333; font-size:14px; line-height:1.6;">
  1391.             <p>Inscription de M/Mme <strong>'.$prenoms.' '.$nom.'</strong> à la formation <strong>'.$nomtheme.'</strong> organisée par <strong>CIMEF International</strong>.</p>
  1392.             <p>Veuillez trouver ci-dessous le récapitulatif :</p>
  1393.             <hr style="border:none; border-top:1px solid #e0e0e0; margin:20px 0;">
  1394.             <h4 style="margin-bottom:8px; color:#0d6efd;">Informations personnelles</h4>
  1395.             <p>
  1396.             <strong>Nom & Prénoms :</strong> '.$prenoms.' '.$nom.'<br>
  1397.             <strong>Fonction :</strong> '.$fonction.'<br>
  1398.             <strong>Entreprise :</strong> '.$entreprise.'<br>
  1399.             <strong>Adresse :</strong> '.$adresse.'<br>
  1400.             <strong>Pays / Ville :</strong> '.$pays.' / '.$ville.'<br>
  1401.             <strong>Boîte postale :</strong> '.$boitepostale.'
  1402.             </p>
  1403.             <h4 style="margin-bottom:8px; color:#0d6efd;">Coordonnées</h4>
  1404.             <p>
  1405.             <strong>Email :</strong> '.$mail.'<br>
  1406.             <strong>Téléphone :</strong> '.$telephone.'<br>
  1407.             <strong>WhatsApp :</strong> '.$whatsapp.'<br>
  1408.             <strong>Site web :</strong> '.$siteweb.'
  1409.             </p>
  1410.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détails de participation</h4>
  1411.             <p>
  1412.             <strong>Nombre de participants :</strong> '.$nbparticipant.'<br>
  1413.             <strong>Commentaire :</strong> '.$commentaire.'
  1414.             </p>
  1415.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détail de la formation</h4>
  1416.             <p>
  1417.             <strong>Thème :</strong> '.$theme.'<br>
  1418.             <strong>Ville :</strong> '.$ville.'<br>
  1419.             <strong>Prix :</strong> '.$prix.''.$devise.'<br>
  1420.             <strong>Date de la rencontre :</strong> Du'.$datedebut.' au '.$datefin.'<br>
  1421.             </p>
  1422.             </td>
  1423.             </tr>
  1424.             <tr>
  1425.             <td style="background-color:#f1f1f1; padding:15px; text-align:center; font-size:12px; color:#777777;">
  1426.             © '.date("Y").' CIMEF International — Tous droits réservés
  1427.             </td>
  1428.             </tr>
  1429.             </table>
  1430.             </td>
  1431.             </tr>
  1432.             </table>
  1433.             </body></html>';
  1434.             /*
  1435.             $secretKey = '6LfPYkosAAAAAJQFLCC-9U5bF6KdFTPrgmbxg5Ux';
  1436.             $value = $request->get('g-recaptcha-response');
  1437.             if (!$value) { 
  1438.                 return $this->addFlash('warning', 'Veuillez cocher le reCAPTCHA'); 
  1439.             }
  1440.             $userIP = $_SERVER['REMOTE_ADDR'];
  1441.             $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$value&remoteip=$userIP";
  1442.             $response = \file_get_contents($url);
  1443.             $response = json_decode((string)$response);
  1444.             //dd($response);
  1445.             if(!$response->success){
  1446.                 return $this->addFlash('warning','Cocher le champs recaptcha svp!');
  1447.             }
  1448.             */
  1449.             $response $this->client->request(
  1450.                 'POST',
  1451.                 'https://www.google.com/recaptcha/api/siteverify',
  1452.                 [
  1453.                     'body' => [
  1454.                         'secret' => $_ENV['RECAPTCHA_SECRET_KEY'],
  1455.                         'response' => $token,
  1456.                     ]
  1457.                 ]
  1458.             );
  1459.             $result $response->toArray();
  1460.             if (!$result['success'] || !isset($result['score']) || $result['score'] < 0.5) {
  1461.                 return $this->addFlash('warning','Vérification reCAPTCHA échouée.');
  1462.             } 
  1463.             $destinataire 'inscriptions@cimef-international.org';
  1464.             $expediteur   $mail;
  1465.             $reponse      $expediteur;
  1466.             $suj "INSCRIPTION FORMATION 2026";
  1467.         
  1468.             $email = (new Email())
  1469.             ->from('CIMEF International <inscriptions@cimef-international.org>')
  1470.             ->to($destinataire)                 // destinataire principal
  1471.             ->cc('medias@cimef-international.com'// COPIE
  1472.             ->replyTo($expediteur)              // Reply-To:
  1473.             ->subject($suj)     
  1474.             ->text(strip_tags($codehtml))
  1475.             ->html($codehtml);// Subject:
  1476.             //->html($codehtml, 'text/html');   // Content-Type + charset utf-8
  1477.             $mailer->send($email);
  1478.             $inscription->setNom($nom);
  1479.             $inscription->setPrenoms($prenoms);
  1480.             $inscription->setFonction($fonction);
  1481.             $inscription->setAdresse($adresse);
  1482.             $inscription->setMail($mail);
  1483.             $inscription->setEntreprise($entreprise);
  1484.             $inscription->setSiteweb($siteweb);
  1485.             $inscription->setNbparticipant($nbparticipant);
  1486.             $inscription->setPays($pays);
  1487.             $inscription->setVille$ville);
  1488.             $inscription->setBoitepostale($boitepostale);
  1489.             $inscription->setWhatsapp($whatsapp);
  1490.             $inscription->setTelephone($telephone);
  1491.             $inscription->setCommentaire($commentaire);
  1492.             $inscription->setFormation($management);
  1493.             $entityManager->persist($inscription);
  1494.             $entityManager->flush();
  1495.         
  1496.             $this->addFlash(
  1497.             'success',
  1498.             'Votre inscription à été bien enregistrée');
  1499.             return $this->redirectToRoute('front.top.management');
  1500.         }
  1501.           
  1502.         return $this->render('front/inscriptions/inscription-top-management.html.twig',[
  1503.             'query_1' => $query_1,
  1504.             'annee' => $annee,
  1505.             'mentions' => $mentions,
  1506.             'inscriptionForm' => $inscriptionForm->createView(),
  1507.         ]);    
  1508.     }
  1509.  
  1510.     #[Route('/formations/seminaire-a-la-carte'name'front.seminaire-a-la-carte'methods:['GET','POST'])]
  1511.     public function inscription_seminaire_sur_mesure(
  1512.         Request $request,
  1513.         MailerInterface $mailer,
  1514.         InscriptionsRepository $inscriptionRepository,
  1515.         MentionsRepository $mentionRepository,
  1516.         EntityManagerInterface $entityManager
  1517.     ): Response
  1518.     {
  1519.         //dd($seminaires);
  1520.         $annee date('Y');
  1521.         $mentions $mentionRepository->findAll();
  1522.         $demandeformation = new Demandeformations();
  1523.         $demandeformationsForm $this->createForm(DemandeformationFormType::class, $demandeformation);
  1524.         $demandeformationsForm->handleRequest($request);
  1525.         if ($demandeformationsForm->isSubmitted()) {
  1526.             $civilite $demandeformationsForm->get('civilite')->getData();
  1527.             $nom $demandeformationsForm->get('nom')->getData();
  1528.             $prenoms $demandeformationsForm->get('prenoms')->getData();
  1529.             $fonction $demandeformationsForm->get('fonction')->getData();
  1530.             $adresse $demandeformationsForm->get('adresse')->getData();
  1531.             $mail $demandeformationsForm->get('mail')->getData();
  1532.             $entreprise $demandeformationsForm->get('entreprise')->getData();
  1533.             
  1534.             $siteweb $demandeformationsForm->get('siteweb')->getData();
  1535.             $nombrepart $demandeformationsForm->get('nombrepart')->getData();
  1536.             $lieu $demandeformationsForm->get('lieu')->getData();
  1537.             $theme $demandeformationsForm->get('theme')->getData();
  1538.             $duree $demandeformationsForm->get('duree')->getData();
  1539.             
  1540.             $telephone $demandeformationsForm->get('telephone')->getData();
  1541.             $commentaire $demandeformationsForm->get('commentaire')->getData(); 
  1542.             //dd($formation->getId());
  1543.             $token $demandeformationsForm->get('recaptchaToken')->getData();
  1544.             
  1545.             if(!$commentaire){
  1546.                 $commentaire "...";
  1547.             }else{
  1548.                 $commentaire $demandeformationsForm->get('commentaire')->getData();
  1549.             }
  1550.             $demandeformation->setNom($nom);
  1551.             $demandeformation->setPrenoms($prenoms);
  1552.             $demandeformation->setFonction($fonction);
  1553.             $demandeformation->setAdresse($adresse);
  1554.             $demandeformation->setMail($mail);
  1555.             $demandeformation->setEntreprise($entreprise);
  1556.             $demandeformation->setSiteweb($siteweb);
  1557.             $demandeformation->setNombrepart($nombrepart);
  1558.             $demandeformation->setLieu($lieu);
  1559.             $demandeformation->setTheme($theme);
  1560.             $demandeformation->setDuree($duree);
  1561.             $demandeformation->setTelephone($telephone);
  1562.             $demandeformation->setCommentaire($commentaire);
  1563.             $entityManager->persist($demandeformation);
  1564.             $entityManager->flush();
  1565.             $destinataire 'inscriptions@cimef-international.org';
  1566.             $expediteur   $mail;
  1567.             $reponse      $expediteur;
  1568.             $suj "INSCRIPTION FORMATION 2026";
  1569.             //$codehtml = "test";
  1570.             
  1571.             $codehtml '<html><body>'.
  1572.             '<table width="100%" cellpadding="0" cellspacing="0" style="background-color:#f4f6f8; padding:20px;">
  1573.             <tr>
  1574.             <td align="center">
  1575.             <table width="600" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,0.08);">
  1576.             <tr>
  1577.             <td style="background-color:#051a53; padding:20px; color:#ffffff; text-align:center;">
  1578.             <h2 style="margin:0;">Demande de dévis</h2>
  1579.             </td>
  1580.             </tr>
  1581.             <tr>
  1582.             <td style="padding:25px; color:#333333; font-size:14px; line-height:1.6;">
  1583.             <p>Demande de dévis de '.$civilite.' <strong>'.$prenoms.' '.$nom.'</strong> pour une formation avec pour thème :<strong>'.$theme.'</strong>.</p>
  1584.             <p>Veuillez trouver ci-dessous le récapitulatif :</p>
  1585.             <hr style="border:none; border-top:1px solid #e0e0e0; margin:20px 0;">
  1586.             <h4 style="margin-bottom:8px; color:#0d6efd;">Informations personnelles</h4>
  1587.             <p>
  1588.             <strong>Nom & Prénoms :</strong> '.$prenoms.' '.$nom.'<br>
  1589.             <strong>Fonction :</strong> '.$fonction.'<br>
  1590.             <strong>Entreprise :</strong> '.$entreprise.'<br>
  1591.             <strong>Adresse :</strong> '.$adresse.'<br>
  1592.             </p>
  1593.             <h4 style="margin-bottom:8px; color:#0d6efd;">Coordonnées</h4>
  1594.             <p>
  1595.             <strong>Email :</strong> '.$mail.'<br>
  1596.             <strong>Téléphone :</strong> '.$telephone.'<br>
  1597.             <strong>Site web :</strong> '.$siteweb.'
  1598.             </p>
  1599.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détails de participation</h4>
  1600.             <p>
  1601.             <strong>Nombre de participants :</strong> '.$nombrepart.'<br>
  1602.             <strong>Commentaire :</strong> '.$commentaire.'
  1603.             </p>
  1604.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détail de la formation</h4>
  1605.             <p>
  1606.             <strong>Thème :</strong> '.$theme.'<br>
  1607.             <strong>Lieu :</strong> '.$lieu.'<br>
  1608.             <strong>Date :</strong> '.$duree.'
  1609.             </p>
  1610.             </td>
  1611.             </tr>
  1612.             <tr>
  1613.             <td style="background-color:#f1f1f1; padding:15px; text-align:center; font-size:12px; color:#777777;">
  1614.             © '.date("Y").' CIMEF International — Tous droits réservés
  1615.             </td>
  1616.             </tr>
  1617.             </table>
  1618.             </td>
  1619.             </tr>
  1620.             </table>
  1621.             </body></html>';
  1622.             /*
  1623.             $secretKey = '6LfPYkosAAAAAJQFLCC-9U5bF6KdFTPrgmbxg5Ux';
  1624.             $value = $request->get('g-recaptcha-response');
  1625.             
  1626.             if (!$value) { $this->addFlash('warning', 'Veuillez cocher le reCAPTCHA'); 
  1627.                 $this->addFlash('warning','Cocher le champs recaptcha svp!');
  1628.                 return $this->render('front/inscriptions/formation-a-la-carte.html.twig',[
  1629.                     'annee' => $annee,
  1630.                     'mentions' => $mentions,
  1631.                     'demandeformationsForm' => $demandeformationsForm->createView(),
  1632.                 ]);
  1633.             }
  1634.             $userIP = $_SERVER['REMOTE_ADDR'];
  1635.             $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$value&remoteip=$userIP";
  1636.             $response = \file_get_contents($url);
  1637.             $response = json_decode((string)$response);
  1638.             //dd($response);
  1639.             if(!$response->success){
  1640.                 $this->addFlash('warning','Cocher le champs recaptcha svp!');
  1641.                 return $this->render('front/inscriptions/formation-a-la-carte.html.twig',[
  1642.                     'annee' => $annee,
  1643.                     'mentions' => $mentions,
  1644.                     'demandeformationsForm' => $demandeformationsForm->createView(),
  1645.                 ]);
  1646.             } 
  1647.             */
  1648.             $response $this->client->request(
  1649.                 'POST',
  1650.                 'https://www.google.com/recaptcha/api/siteverify',
  1651.                 [
  1652.                     'body' => [
  1653.                         'secret' => $_ENV['RECAPTCHA_SECRET_KEY'],
  1654.                         'response' => $token,
  1655.                     ]
  1656.                 ]
  1657.             );
  1658.             $result $response->toArray();
  1659.             if (!$result['success'] || !isset($result['score']) || $result['score'] < 0.5) {
  1660.                 $this->addFlash(
  1661.                     'warning',
  1662.                     'Vérification reCAPTCHA échouée.'
  1663.                 );
  1664.                 return $this->render('front/inscriptions/formation-a-la-carte.html.twig',[
  1665.                     'annee' => $annee,
  1666.                     'mentions' => $mentions,
  1667.                     'demandeformationsForm' => $demandeformationsForm->createView(),
  1668.                 ]);
  1669.             }  
  1670.             
  1671.             $email = (new Email())
  1672.             ->from('CIMEF International <inscriptions@cimef-international.org>')
  1673.             ->to($destinataire)                 // destinataire principal
  1674.             ->cc('medias@cimef-international.com'// COPIE
  1675.             ->replyTo($expediteur)              // Reply-To:
  1676.             ->subject($suj)     
  1677.             ->text(strip_tags($codehtml))
  1678.             ->html($codehtml);// Subject:
  1679.             //->html($codehtml, 'text/html');   // Content-Type + charset utf-8
  1680.             $mailer->send($email);
  1681.             $this->addFlash(
  1682.             'success',
  1683.             'Votre inscription à été bien enregistrée');
  1684.             return $this->redirectToRoute('front.inter.index');
  1685.         }
  1686.         
  1687.         return $this->render('front/inscriptions/formation-a-la-carte.html.twig',[
  1688.             'annee' => $annee,
  1689.             'mentions' => $mentions,
  1690.             'demandeformationsForm' => $demandeformationsForm->createView(),
  1691.         ]);
  1692.     }
  1693.     
  1694.     #[Route('/formations/seminaires-internationaux/{slug}/{id}code'name'front.seminaire.inter.detail'methods:['GET'])]
  1695.     public function detail_sem_int(
  1696.         $slug,
  1697.         $id,
  1698.         Request $request
  1699.         MentionsRepository $mentionRepository,
  1700.         EntityManagerInterface $entityManager
  1701.     ): Response
  1702.     {
  1703.         $type "Séminaires internationaux";
  1704.         $annee date('Y');
  1705.         $queryBuilder $entityManager->createQueryBuilder();
  1706.         $queryBuilder
  1707.         ->select('for.id''for.dates_session''for.prix''for.devise''th.nom'
  1708.             'thm.nom AS thmnom','vil.nom AS vilnom','vil.pays','for.created_at',
  1709.             'th.slug','th.description','for.devise','vil.longitude','vil.latitude'
  1710.         )
  1711.         ->from(Formations::class, 'for')
  1712.         ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  1713.         ->innerJoin(Villes::class,  'vil''WITH''for.ville = vil.id')
  1714.         ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id')
  1715.         ->where('th.slug = :theme')
  1716.         ->andwhere('for.id = :forid')
  1717.         ->setParameter('theme'$slug)
  1718.         ->setParameter('forid'$id);
  1719.         $query $queryBuilder->getQuery()->getResult();
  1720.         
  1721.         
  1722.         $queryBuilder $entityManager->createQueryBuilder();
  1723.         $queryBuilder
  1724.         ->select('for.id''for.dates_session''for.prix''for.devise''th.nom'
  1725.             'thm.nom AS thmnom','vil.nom AS vilnom','vil.pays','for.created_at',
  1726.             'th.slug','th.description','for.devise','vil.longitude','vil.latitude',
  1727.             'for.image'
  1728.         )
  1729.         ->from(Formations::class, 'for')
  1730.         ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  1731.         ->innerJoin(Villes::class,  'vil''WITH''for.ville = vil.id')
  1732.         ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id')
  1733.         ->where('th.slug = :theme')
  1734.         ->andwhere('for.id != :forid')
  1735.         ->setParameter('theme'$slug)
  1736.         ->setParameter('forid'$id);
  1737.         $formations $queryBuilder->getQuery()->getResult();
  1738.         $mentions $mentionRepository->findAll();
  1739.         
  1740.         $locations = [];
  1741.         foreach ($query as $row) {
  1742.             if (!empty($row['latitude']) && !empty($row['longitude'])) {
  1743.                 $locations[] = [
  1744.                     'lat'   => (float) $row['latitude'],
  1745.                     'lng'   => (float) $row['longitude'],
  1746.                     'ville' => strtoupper($row['vilnom']),
  1747.                     'pays'  => strtoupper($row['pays']),
  1748.                 ];
  1749.             }
  1750.         }
  1751.         return $this->render('front/detail/detail-seminaire-inter.html.twig',[
  1752.             'formations' => $formations,
  1753.             'locations' => $locations,
  1754.             'mentions' => $mentions,
  1755.             'annee' => $annee,
  1756.             'type' => $type,
  1757.             'query' => $query,
  1758.             'slug' => $slug
  1759.         ]);
  1760.     }
  1761.     
  1762.     #[Route('/formations/seminaires-nationaux/{slug}/{id}code'name'front.seminaire.nation.detail'methods:['GET'])]
  1763.     public function detail_sem_nat(
  1764.         $slug,
  1765.         $id,
  1766.         Request $request
  1767.         GeoIpService $geo,
  1768.         MentionsRepository $mentionRepository,
  1769.         EntityManagerInterface $entityManager
  1770.     ): Response
  1771.     {
  1772.         $type "Séminaires nationaux";
  1773.         $annee date('Y');
  1774.                 // 🌍 Géo IP
  1775.         $geoData $geo->getGeoData($request->getClientIp());
  1776.         $pays $geoData['country'] ?? '';
  1777.         $ville $geoData['city'] ?? '';
  1778.         
  1779.         // Correction du nom du pays
  1780.         if ($pays === 'Local' || $pays === 'Ivory Coast') {
  1781.             $getpays "Côte d'ivoire";
  1782.         } else {
  1783.             $getpays $pays;
  1784.         }
  1785.         //dd($getpays);
  1786.         $queryBuilder $entityManager->createQueryBuilder();
  1787.         $queryBuilder
  1788.         ->select('for.id''for.dates_session''for.prix''for.devise''th.nom'
  1789.             'thm.nom AS thmnom','vil.nom AS vilnom','vil.pays','for.created_at',
  1790.             'th.slug','th.description','for.devise','vil.longitude','vil.latitude'
  1791.         )
  1792.         ->from(Formations::class, 'for')
  1793.         ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  1794.         ->innerJoin(Villes::class,  'vil''WITH''for.ville = vil.id')
  1795.         ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id')
  1796.         ->where('th.slug = :theme')
  1797.         ->andwhere('for.id = :forid')
  1798.         ->setParameter('theme'$slug)
  1799.         ->setParameter('forid'$id);
  1800.         $query $queryBuilder->getQuery()->getResult();
  1801.         $mentions $mentionRepository->findAll();
  1802.         
  1803.         $locations = [];
  1804.         foreach ($query as $row) {
  1805.             if (!empty($row['latitude']) && !empty($row['longitude'])) {
  1806.                 $locations[] = [
  1807.                     'lat'   => (float) $row['latitude'],
  1808.                     'lng'   => (float) $row['longitude'],
  1809.                     'ville' => strtoupper($row['vilnom']),
  1810.                     'pays'  => strtoupper($row['pays']),
  1811.                 ];
  1812.             }
  1813.         }
  1814.         $today = new \DateTime('today');
  1815.     // Fonction pour extraire date de début et fin depuis dates_session
  1816.     $extractDates = function(?string $datesSession): ?array {
  1817.         if (!$datesSession) return null;
  1818.     $moisFr = [
  1819.         'janv'=>1,'janvier'=>1,'févr'=>2,'fevr'=>2,'février'=>2,
  1820.         'mars'=>3,'avr'=>4,'avril'=>4,'mai'=>5,'juin'=>6,
  1821.         'juil'=>7,'juillet'=>7,'août'=>8,'aout'=>8,
  1822.         'sept'=>9,'septembre'=>9,'oct'=>10,'octobre'=>10,
  1823.         'nov'=>11,'novembre'=>11,'déc'=>12,'dec'=>12,'décembre'=>12
  1824.     ];
  1825.     $text strtolower(trim($datesSession));
  1826.     $text str_replace(['.'','], ''$text);
  1827.     if (preg_match('/(\d{1,2})\s*(\w+)?\s*au\s*(\d{1,2})\s*(\w+)?/i'$text$m)) {
  1828.         $jourDebut = (int)$m[1];
  1829.         $moisDebut $moisFr[$m[2] ?? ''] ?? null;
  1830.         $jourFin = (int)$m[3];
  1831.         $moisFin $moisFr[$m[4] ?? ''] ?? $moisDebut;
  1832.             if (!$moisDebut || !$moisFin) return null;
  1833.     
  1834.             $annee = (int)date('Y');
  1835.             $dateDebut = new \DateTime(sprintf('%04d-%02d-%02d'$annee$moisDebut$jourDebut));
  1836.             $dateFin = new \DateTime(sprintf('%04d-%02d-%02d'$annee$moisFin$jourFin));
  1837.     
  1838.             if ($dateFin $dateDebut$dateFin->modify('+1 year');
  1839.     
  1840.             return ['debut' => $dateDebut'fin' => $dateFin];
  1841.         }
  1842.     
  1843.         return null;
  1844.     };
  1845.     
  1846.     // Requête Doctrine
  1847.     $queryBuilder $entityManager->createQueryBuilder();
  1848.     $queryBuilder
  1849.         ->select('for.id''for.dates_session''for.prix''for.devise''th.nom'
  1850.             'thm.nom AS thmnom','vil.nom AS vilnom','vil.pays','for.created_at',
  1851.             'th.slug','th.description','for.devise','vil.longitude','vil.latitude',
  1852.             'for.image'
  1853.         )
  1854.         ->from(Formations::class, 'for')
  1855.         ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  1856.         ->innerJoin(Villes::class,  'vil''WITH''for.ville = vil.id')
  1857.         ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id')
  1858.         ->where('th.slug = :theme')
  1859.         ->andWhere('for.id != :forid')
  1860.         ->andWhere('vil.pays = :pays')
  1861.         ->setParameter('theme'$slug)
  1862.         ->setParameter('forid'$id)
  1863.         ->setParameter('pays'$getpays);
  1864.     
  1865.     $results $queryBuilder->getQuery()->getResult();
  1866.     
  1867.     // Filtrer uniquement les formations à venir
  1868.     $formations array_filter($results, function($f) use ($extractDates$today) {
  1869.         $dates $extractDates($f['dates_session']);
  1870.         return $dates && $dates['debut'] > $today;
  1871.     });
  1872.     
  1873.     // Trier par date de début la plus proche
  1874.     usort($formations, function($a$b) use ($extractDates) {
  1875.         return $extractDates($a['dates_session'])['debut'] <=> $extractDates($b['dates_session'])['debut'];
  1876.     });
  1877.     
  1878.     // Maintenant $formationsAvenir contient uniquement les formations à venir
  1879.         return $this->render('front/detail/detail-seminaire-inter.html.twig',[
  1880.             'formations' => $formations,
  1881.             'locations' => $locations,
  1882.             'annee' => $annee,
  1883.             'type' => $type,
  1884.             'mentions' => $mentions,
  1885.             'query' => $query,
  1886.             'slug' => $slug
  1887.         ]);
  1888.     }
  1889.     
  1890.     #[Route('/blogs'name'front.blog'methods:['GET'])]
  1891.     public function blog(
  1892.         Request $request
  1893.         MentionsRepository $mentionRepository,
  1894.         ManagementsRepository $managementRepository,
  1895.         PaginatorInterface $paginator,
  1896.         BlogsRepository $blogRepository
  1897.         EntityManagerInterface $entityManager
  1898.         ): Response
  1899.     {
  1900.         $All_blog $blogRepository->findBy(['statut' => 'Publié'], ['createdat' => 'DESC']);
  1901.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  1902.         $queryBuilder $entityManager->createQueryBuilder();
  1903.         $queryBuilder
  1904.         ->select('blog')
  1905.         ->from(Blogs::class, 'blog')
  1906.         ->where('blog.statut = :statut')
  1907.         ->setParameter('statut''Publié')
  1908.         ->orderBy('blog.createdat''DESC');
  1909.         
  1910.         $pagination $paginator->paginate(
  1911.             $queryBuilder,
  1912.             $request->query->getInt('page'1),
  1913.             12
  1914.         ); 
  1915.         
  1916.         $last_blog $blogRepository->findBy(['statut' => 'Publié'], ['createdat' => 'DESC'],limit4);
  1917.         $mentions $mentionRepository->findAll();
  1918.         return $this->render('front/blog.html.twig',[
  1919.             'mentions' => $mentions,
  1920.             'last_blog' => $last_blog,
  1921.             'pagination' => $pagination,
  1922.             'manageLimit' => $manageLimit
  1923.         ]);
  1924.     }
  1925.     
  1926.     #[Route('/blog/{slug}'name'front.detail.blog'methods:['GET','POST'])]
  1927.     public function detailblog(
  1928.         $slug,
  1929.         Request $request
  1930.         BlogsRepository $blogRepository,
  1931.         MentionsRepository $mentionRepository,
  1932.         ManagementsRepository $managementRepository,
  1933.         EntityManagerInterface $entityManager
  1934.     ): Response
  1935.     {
  1936.         $Allblog $blogRepository->findAll();
  1937.         $detblog $blogRepository->findOneBy(array('slug' => $slug));
  1938.         $last_blog $blogRepository->findBy([], ['createdat' => 'ASC']);
  1939.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  1940.         $mentions $mentionRepository->findAll();
  1941.         return $this->render('front/detail/detail-blog.html.twig',[
  1942.             'detblog' => $detblog,
  1943.             'blog' => $Allblog,
  1944.             'mentions' => $mentions,
  1945.             'last_blog' => $last_blog,
  1946.             'manageLimit' => $manageLimit
  1947.         ]);
  1948.     }
  1949.     
  1950.     
  1951.     
  1952.     #[Route('/actualites'name'front.actualite'methods:['GET'])]
  1953.     public function actualite(
  1954.         Request $request
  1955.         MentionsRepository $mentionRepository,
  1956.         ManagementsRepository $managementRepository,
  1957.         PaginatorInterface $paginator,
  1958.         ActualitesRepository $actualiteRepository
  1959.         EntityManagerInterface $entityManager
  1960.         ): Response
  1961.     {
  1962.         $All_actu $actualiteRepository->findBy(['statut' => 'Publié'], ['createdat' => 'DESC']);
  1963.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  1964.         $queryBuilder $entityManager->createQueryBuilder();
  1965.         $queryBuilder
  1966.         ->select('actu')
  1967.         ->from(Actualites::class, 'actu')
  1968.         ->where('actu.statut = :statut')
  1969.         ->setParameter('statut''Publié')
  1970.         ->orderBy('actu.createdat''DESC');
  1971.         
  1972.         $pagination $paginator->paginate(
  1973.             $queryBuilder,
  1974.             $request->query->getInt('page'1),
  1975.             12
  1976.         ); 
  1977.         
  1978.         $last_actu $actualiteRepository->findBy(['statut' => 'Publié'], ['createdat' => 'DESC'],limit4);
  1979.         $mentions $mentionRepository->findAll();
  1980.         return $this->render('front/actualite.html.twig',[
  1981.             'mentions' => $mentions,
  1982.             'last_actu' => $last_actu,
  1983.             'pagination' => $pagination,
  1984.             'manageLimit' => $manageLimit
  1985.         ]);
  1986.     }
  1987.     
  1988.     #[Route('/actualite/{slug}'name'front.detail.actu'methods:['GET','POST'])]
  1989.     public function detailactu(
  1990.         $slug,
  1991.         Request $request
  1992.         ActualitesRepository $actuRepository,
  1993.         MentionsRepository $mentionRepository,
  1994.         ManagementsRepository $managementRepository,
  1995.         EntityManagerInterface $entityManager
  1996.     ): Response
  1997.     {
  1998.         $Allactu $actuRepository->findAll();
  1999.         $detactu $actuRepository->findOneBy(array('slug' => $slug));
  2000.         $last_actu $actuRepository->findBy([], ['createdat' => 'ASC']);
  2001.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  2002.         $mentions $mentionRepository->findAll();
  2003.         return $this->render('front/detail/detail-actualite.html.twig',[
  2004.             'detactu' => $detactu,
  2005.             'actualite' => $Allactu,
  2006.             'mentions' => $mentions,
  2007.             'last_actu' => $last_actu,
  2008.             'manageLimit' => $manageLimit
  2009.         ]);
  2010.     }
  2011.     
  2012.     #[Route('/mentions/{slug}'name'front.mention.detail'methods:['GET','POST'])]
  2013.     public function detailmention(
  2014.         $slug,
  2015.         Request $request
  2016.         MentionsRepository $mentionRepository,
  2017.         EntityManagerInterface $entityManager
  2018.     ): Response
  2019.     {
  2020.         $detmention $mentionRepository->findOneBy(array('slug' => $slug));
  2021.         $mentions $mentionRepository->findAll();
  2022.         return $this->render('front/detail/detail-mention.html.twig',[
  2023.             'detmention' => $detmention,
  2024.             'mentions' => $mentions,
  2025.         ]);
  2026.     }
  2027.     
  2028.     #[Route('/presentation/nos-centres'name'front.centres'methods:['GET'])]
  2029.     public function centres(
  2030.         Request $request
  2031.         VillesRepository $villeRepository,
  2032.         MentionsRepository $mentionRepository,
  2033.         EntityManagerInterface $entityManager
  2034.         ): Response
  2035.     {
  2036.         $Ville $villeRepository->findAll();
  2037.         $locations = [
  2038.             [
  2039.                 'lat' => 5.399573993486265
  2040.                 'lng' => -3.9608326481739446
  2041.                 'ville' => 'ABIDJAN',
  2042.                 'Pays' => 'CÔTE D\'IVOIRE',
  2043.             ],
  2044.             [
  2045.                 'lat' => 48.82503553852063
  2046.                 'lng' => 2.3943687952459913
  2047.                 'ville' => 'PARIS',
  2048.                 'pays' => 'FRANCE',
  2049.             ],
  2050.             [
  2051.                 'lat' => 33.61983014582587
  2052.                 'lng' => -7.591902517162099
  2053.                 'ville' => 'CASABLANCA',
  2054.                 'pays' => 'MAROC',
  2055.             ],
  2056.             [
  2057.                 'lat' => 14.671959307245515
  2058.                 'lng' => -17.428349942742518
  2059.                 'ville' => 'DAKAR',
  2060.                 'pays' => 'SENEGAL',
  2061.             ],
  2062.             [
  2063.                 'lat' => 25.222641788192867
  2064.                 'lng' =>  55.4419721341237
  2065.                 'ville' => 'DUBAI',
  2066.                 'pays' => 'EMIRATS ARABES UNIS',
  2067.             ],
  2068.             [
  2069.                 'lat' => 41.008441347309684
  2070.                 'lng' => 28.969801288596543
  2071.                 'ville' => 'ISTANBUL',
  2072.                 'pays' => 'TURQUIE',
  2073.             ],
  2074.             [
  2075.                 'lat' => 40.71278802621601
  2076.                 'lng' => -74.0050546180957
  2077.                 'ville' => 'NEW YORK',
  2078.                 'pays' => 'USA',
  2079.             ],
  2080.             [
  2081.                 'lat' => 45.50191624423104
  2082.                 'lng' => -73.57059318260778
  2083.                 'ville' => 'MONTREAL',
  2084.                 'pays' => 'CANADA',
  2085.             ],
  2086.             [
  2087.                 'lat' => 31.25354887891074
  2088.                 'lng' => 121.44798285112802
  2089.                 'ville' => 'SHANGHAI',
  2090.                 'pays' => 'CHNE',
  2091.             ],
  2092.         ];
  2093.         $mentions $mentionRepository->findAll();
  2094.         return $this->render('front/centres.html.twig',[
  2095.             'locations' => $locations,
  2096.             'mentions' => $mentions,
  2097.             'ville' => $Ville    
  2098.         ]);
  2099.     }
  2100.     
  2101.     #[Route('/presentation/nos-partenaires'name'front.nos-partenaires'methods:['GET'])]
  2102.     public function partenaires(
  2103.         Request $request
  2104.         PartenairesRepository $partenaireRepository,
  2105.         MentionsRepository $mentionRepository,
  2106.         EntityManagerInterface $entityManager
  2107.         ): Response
  2108.     {
  2109.         $partenaires $partenaireRepository->findAll();
  2110.         $groupes = [];
  2111.         foreach ($partenaires as $p) {
  2112.             $groupes[$p->getPaysPart()][] = $p;
  2113.         }
  2114.         $mentions $mentionRepository->findAll();
  2115.         return $this->render('front/partenaire.html.twig',[
  2116.             'mentions' => $mentions,
  2117.             'groupes' => $groupes   
  2118.         ]);
  2119.     }
  2120.     
  2121.     #[Route('/presentation/nos-centres/{slug}'name'front.detail.centre'methods:['GET'])]
  2122.     public function detail_centre(
  2123.         $slug,
  2124.         Request $request,
  2125.         GaleriesRepository $galRepository,
  2126.         VillesRepository $villeRepository,
  2127.         MentionsRepository $mentionRepository,
  2128.         EntityManagerInterface $entityManager
  2129.         ): Response
  2130.     {
  2131.         $queryBuilder $entityManager->createQueryBuilder();
  2132.         $queryBuilder
  2133.         ->select('gal.imgGal''gal.nom')
  2134.         ->from(Galeries::class, 'gal')
  2135.         ->where('gal.nom = :nom')
  2136.         ->setParameter('nom'$slug);
  2137.         $detgal $queryBuilder->getQuery()->getResult();
  2138.         
  2139.         //$detgal = $galRepository->findOneBy(array('nom' => $slug));
  2140.         //$detgal = $galRepository->findAll();
  2141.         $detcentres $villeRepository->findOneBy(array('slug' => $slug));
  2142.         $mentions $mentionRepository->findAll();
  2143.         return $this->render('front/detail/detail-centre.html.twig',[
  2144.             'slug' => $slug,
  2145.             'detcentre' => $detcentres,
  2146.             'mentions' => $mentions,
  2147.             'detgal' => $detgal
  2148.         ]);
  2149.     }
  2150.     
  2151.     #[Route('/financement-des-etudes'name'front.financement.etude'methods:['GET','POST'])]
  2152.     public function financement(): Response
  2153.     {
  2154.         return $this->render('front/admissions/financement.html.twig');
  2155.     }
  2156.     
  2157.     #[Route('/nos-thematiques'name'front.inter.thematique'methods:['GET','POST'])]
  2158.     public function thematiques(
  2159.         Request $request
  2160.         PaginatorInterface $paginator,
  2161.         ThematiquesRepository $thematiqueRepository,
  2162.         ManagementsRepository $managementRepository,
  2163.         MentionsRepository $mentionRepository,
  2164.         EntityManagerInterface $entityManager
  2165.     ): Response
  2166.     {
  2167.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  2168.         $queryBuilder $entityManager->createQueryBuilder();
  2169.         $queryBuilder
  2170.             ->select('thm.id, thm.nom, thm.slug, thm.description, COUNT(th.id) AS nbThemes')
  2171.             ->from(Thematiques::class, 'thm')
  2172.             ->innerJoin(Themes::class, 'th''WITH''thm.id = th.thematique')
  2173.             ->groupBy('thm.id, thm.nom, thm.slug, thm.description');
  2174.         $query $queryBuilder->getQuery()->getResult();
  2175.         $pagination $paginator->paginate(
  2176.             $queryBuilder,
  2177.             $request->query->getInt('page'1),
  2178.             12
  2179.         ); 
  2180.         //dd($query);
  2181.         $mentions $mentionRepository->findAll();
  2182.         return $this->render('front/thematique.html.twig',[
  2183.             'manageLimit' => $manageLimit,
  2184.             'pagination' => $query,
  2185.             'mentions' => $mentions
  2186.         ]);
  2187.     }
  2188.     
  2189.     #[Route('/nos-thematiques/{slug}/code{id}'name'front.thematique.detail'methods: ['GET'])]
  2190.     public function detail_thematique(
  2191.         $id,
  2192.         $slug,
  2193.         Request $request
  2194.         PaginatorInterface $paginator,
  2195.         ThemesRepository $themeRepository,
  2196.         ThematiquesRepository $thematiqueRepository,
  2197.         ManagementsRepository $managementRepository,
  2198.         MentionsRepository $mentionRepository,
  2199.         EntityManagerInterface $entityManager    
  2200.     ): Response
  2201.     {
  2202.         $slug strtolower(trim($slug));
  2203.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  2204.         $thematique $thematiqueRepository->findOneBy(['slug' => $slug]);
  2205.         // dd($slug);
  2206.         $nomThematique $thematique->getNom();
  2207.         
  2208.         if (!$thematique) {
  2209.             $this->addFlash('danger','Cette thématique est introuvable');
  2210.             return $this->redirectToRoute('front.inter.thematique');
  2211.         }
  2212.         
  2213.         $queryBuilder $entityManager->createQueryBuilder();
  2214.         $queryBuilder
  2215.             ->select('th.id''th.nom''th.slug' 'th.description')
  2216.             ->from(Themes::class, 'th')
  2217.             ->where('th.thematique = :id'
  2218.             ->setParameter('id'$id);
  2219.         $query $queryBuilder->getQuery()->getResult();
  2220.         $pagination $paginator->paginate(
  2221.             $queryBuilder,
  2222.             $request->query->getInt('page'1),
  2223.             12
  2224.         ); 
  2225.         //dd($slug);
  2226.         $mentions $mentionRepository->findAll();
  2227.         return $this->render('front/detail/detail-thematique.html.twig',[
  2228.             'nomThematique' => $nomThematique,
  2229.             'manageLimit' => $manageLimit,
  2230.             'thematique' => $thematique,
  2231.             'pagination' => $query,
  2232.             'mentions' => $mentions,
  2233.             'slug' => $slug
  2234.         ]);
  2235.     }
  2236.     
  2237.     #[Route('/nos-thematiques/{slugThematique}/{slug}'name'front.thematique.date.theme'methods: ['GET'])]
  2238.     public function detail_thematique_theme(
  2239.         $slug,
  2240.         $slugThematique,
  2241.         Request $request
  2242.         SluggerInterface $slugger
  2243.         PaginatorInterface $paginator,
  2244.         ThemesRepository $themeRepository,
  2245.         ThematiquesRepository $thematiqueRepository,
  2246.         FormationsRepository $formationRepository,
  2247.         ManagementsRepository $managementRepository,
  2248.         MentionsRepository $mentionRepository,
  2249.         EntityManagerInterface $entityManager    
  2250.     ): Response
  2251.     {
  2252.         $annee date('Y');
  2253.         
  2254.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  2255.         $thematique $thematiqueRepository->findOneBy(['slug' => $slugThematique]);
  2256.         $theme $themeRepository->findOneBy(['slug' => $slug]);
  2257.         if (!$theme) {
  2258.             $this->addFlash('danger','Cette thème est introuvable');
  2259.             return $this->redirectToRoute('front.inter.thematique');
  2260.         }
  2261.         $themeId $theme->getId();
  2262.         $thematiqueId $theme->getId();
  2263.         
  2264.         $thematique $thematiqueRepository->findOneBy(['slug' => $slugThematique]);
  2265.         
  2266.         $queryBuilder $entityManager->createQueryBuilder();
  2267.         $queryBuilder
  2268.             ->select('th.nom','th.slug','thm.slug AS thematiqueSlug',
  2269.                 'th.description','vil.longitude','vil.latitude'
  2270.             )
  2271.             ->from(Formations::class, 'for')
  2272.             ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  2273.             ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id')
  2274.             ->innerJoin(Villes::class, 'vil''WITH''for.ville = vil.id')
  2275.             ->where('th.slug = :themeSlug')
  2276.             ->andWhere('thm.slug = :thematiqueSlug')
  2277.             ->setParameter('themeSlug'$slug)
  2278.             ->setParameter('thematiqueSlug'$slugThematique)
  2279.             ->orderBy('for.created_at''DESC')
  2280.             ->setMaxResults(1);
  2281.         $query $queryBuilder->getQuery()->getResult();
  2282.         //dd($query);
  2283.         $queryBuilder $entityManager->createQueryBuilder();
  2284.         $queryBuilder
  2285.             ->select('for.id','vil.nom AS vilnom','vil.pays')
  2286.             ->from(Formations::class, 'for')
  2287.             ->innerJoin(Themes::class, 'th''WITH''for.theme = th.id')
  2288.             ->innerJoin(Villes::class,  'vil''WITH''for.ville = vil.id')
  2289.             ->innerJoin(Thematiques::class, 'thm''WITH''th.thematique = thm.id')
  2290.             ->where('for.theme = :id'
  2291.             ->setParameter('id'$themeId);
  2292.         $ville $queryBuilder->getQuery()->getResult();
  2293.         //dd($query);
  2294.         //dd($thematique);
  2295.         
  2296.         $mentions $mentionRepository->findAll();
  2297.         return $this->render('front/detail/detail-thematique-theme-date.html.twig',[
  2298.             'manageLimit' => $manageLimit,
  2299.             'thematique' => $thematique,
  2300.             'query' => $query,
  2301.             'ville' => $ville,
  2302.             'annee' => $annee,
  2303.             'mentions' => $mentions,
  2304.             'slug' => $slug,
  2305.             'slugThematique' => $slugThematique
  2306.         ]);
  2307.     }
  2308.     #[Route('/inscription-{annee}'name'front.inscriptions'methods: ['GET''POST'])]
  2309.     public function inscription(
  2310.         Request $request,
  2311.         MailerInterface $mailer,
  2312.         ThemesRepository $themesRepository,
  2313.         VillesRepository $villesRepository
  2314.         EntityManagerInterface $entityManager,
  2315.         MentionsRepository $mentionRepository,
  2316.         FormationsRepository $formationsRepository
  2317.     ): Response {
  2318.         
  2319.         $annee date('Y');
  2320.         /* =========================
  2321.            AJAX
  2322.         ========================= */
  2323.         if ($request->isXmlHttpRequest()) {
  2324.             /* THÉMATIQUE → THÈMES */
  2325.             if ($request->request->get('action') === 'themes') {
  2326.                 $thematiqueVal $request->request->get('thematiqueVal');
  2327.                 $themes $themesRepository->findBy(
  2328.                     ['thematique' => $thematiqueVal],
  2329.                     ['nom' => 'ASC']
  2330.                 );
  2331.                 $data = [];
  2332.                 foreach ($themes as $theme) {
  2333.                     $data[] = [
  2334.                         'id'  => $theme->getId(),
  2335.                         'nom' => $theme->getNom(),
  2336.                     ];
  2337.                 }
  2338.                 return new JsonResponse($data);
  2339.             }
  2340.             /* THÈME → LIEUX */
  2341.             if ($request->request->get('action') === 'lieux') {
  2342.                 $themeId $request->request->get('themeVal');
  2343.                 $queryBuilder $entityManager->createQueryBuilder();
  2344.                 $queryBuilder
  2345.                 ->select(
  2346.                     'for.id''for.dates_session AS session''for.prix''for.devise''th.nom'
  2347.                     'vil.nom AS vilnom','vil.pays','for.created_at','th.slug',
  2348.                     'th.description','for.devise'
  2349.                     )
  2350.                 ->from(Formations::class, 'for')
  2351.                 ->innerJoin(Themes::class,'th''WITH''for.theme = th.id')
  2352.                 ->innerJoin(Villes::class, 'vil''WITH''for.ville = vil.id')
  2353.                 ->where('th.id = :idtheme')
  2354.                 ->setParameter('idtheme'$themeId);
  2355.                 $formations $queryBuilder->getQuery()->getResult();
  2356.                 //dump($themeId,$formations);
  2357.                 $data = [];
  2358.                 foreach ($formations as $formation) {
  2359.                     $data[] = [
  2360.                         'id'   => $formation['id'],
  2361.                         'prix' => $formation['prix'],
  2362.                         'lieu' => $formation['vilnom'],
  2363.                         'devise' => $formation['devise'],
  2364.                         'session' => $formation['session'],
  2365.                     ];
  2366.                 }
  2367.                 return new JsonResponse($data);
  2368.             }
  2369.             /* LIEU → SESSION + PRIX */
  2370.             if ($request->request->get('action') === 'lieu_details') {
  2371.                 $formationId $request->request->get('formationId');
  2372.                 $queryBuilder $entityManager->createQueryBuilder();
  2373.                 $queryBuilder
  2374.                     ->select(
  2375.                         'for.dates_session AS session',
  2376.                         'for.prix',
  2377.                         'for.devise'
  2378.                     )
  2379.                     ->from(Formations::class, 'for')
  2380.                     ->where('for.id = :id')
  2381.                     ->setParameter('id'$formationId);
  2382.                 $formation $queryBuilder->getQuery()->getOneOrNullResult();
  2383.                 if (!$formation) {
  2384.                     return new JsonResponse(['error' => 'Formation introuvable'], 404);
  2385.                 }
  2386.                 return new JsonResponse([
  2387.                     'session' => $formation['session'],
  2388.                     'prix'    => $formation['prix'],
  2389.                     'devise'  => $formation['devise'],
  2390.                 ]);
  2391.             }
  2392.         }
  2393.         /* =========================
  2394.            AFFICHAGE NORMAL
  2395.         ========================= */
  2396.         $inscription = new Inscriptions();
  2397.  
  2398.         $form $this->createForm(NewInscriptionFormType::class);
  2399.         $form->handleRequest($request);
  2400.         if ($form->isSubmitted()) {
  2401.             
  2402.             $civilite $form->get('civilite')->getData();
  2403.             $nom $form->get('nom')->getData();
  2404.             $prenoms $form->get('prenoms')->getData();
  2405.             $fonction $form->get('fonction')->getData();
  2406.             $telephone $form->get('telephone')->getData();
  2407.             
  2408.             $adresse $form->get('adresse')->getData();
  2409.             $mail $form->get('mail')->getData();
  2410.             $entreprise $form->get('entreprise')->getData();
  2411.             
  2412.             $siteweb $form->get('siteweb')->getData();
  2413.             $nombrepart $form->get('nbparticipant')->getData();
  2414.             
  2415.             $pays $form->get('pays')->getData();
  2416.             $ville $form->get('ville')->getData();
  2417.             
  2418.             $boitepostale $form->get('boitepostale')->getData();
  2419.             $whatsapp $form->get('whatsapp')->getData();          
  2420.             
  2421.             $theme $form->get('theme')->getData();
  2422.             //$lieu = $form->get('lieu')->getData();
  2423.             $periode $form->get('periode')->getData();
  2424.             
  2425.             $telephone $form->get('telephone')->getData();
  2426.             $commentaire $form->get('commentaire')->getData(); 
  2427.            
  2428.             $token $form->get('recaptchaToken')->getData();
  2429.             
  2430.             if(!$commentaire){
  2431.                 $commentaire "pas renseigné";
  2432.             }else{
  2433.                 $commentaire $form->get('commentaire')->getData();
  2434.             }
  2435.             
  2436.             if(!$siteweb){
  2437.                 $siteweb "pas renseigné";
  2438.             }else{
  2439.                 $siteweb $form->get('siteweb')->getData();
  2440.             }
  2441.             
  2442.             if(!$adresse){
  2443.                 $adresse "pas renseigné";
  2444.             }else{
  2445.                 $adresse $form->get('adresse')->getData();
  2446.             }
  2447.             
  2448.             if(!$boitepostale){
  2449.                 $boitepostale "pas renseigné";
  2450.             }else{
  2451.                 $boitepostale $form->get('boitepostale')->getData();
  2452.             }
  2453.             
  2454.             $themeId $theme->getId();
  2455.             $nomtheme $theme->getNom();
  2456.             //dd($form);
  2457.             
  2458.             $Seminaires $formationsRepository->findOneBy(array('theme' => $themeId'dates_session' => $periode));
  2459.             /*$formationId = $formations->getId();*/
  2460.             
  2461.             $queryBuilder $entityManager->createQueryBuilder();
  2462.             $queryBuilder
  2463.             ->select(
  2464.                 'for.id''for.dates_session AS session''for.prix''for.devise''th.nom'
  2465.                 'vil.nom AS vilnom','vil.pays','for.created_at','th.slug''th.id AS themeId'
  2466.                 'th.description','for.devise'
  2467.                 )
  2468.             ->from(Formations::class, 'for')
  2469.             ->innerJoin(Themes::class,'th''WITH''for.theme = th.id')
  2470.             ->innerJoin(Villes::class, 'vil''WITH''for.ville = vil.id')
  2471.             ->where('th.id = :idtheme')
  2472.             ->andwhere('for.dates_session = :sessions')
  2473.             ->setParameter('idtheme'$themeId)
  2474.             ->setParameter('sessions'$periode);
  2475.             $formations $queryBuilder->getQuery()->getResult();
  2476.             $villeForm $formations[0]['vilnom'];
  2477.             $prixForm $formations[0]['prix'];
  2478.             $deviseForm $formations[0]['devise'];
  2479.             
  2480.             //dd($villeForm, $villeForm, $prixForm, $deviseForm);
  2481.             $destinataire 'inscriptions@cimef-international.org';
  2482.             $expediteur   $mail;
  2483.             $reponse      $expediteur;
  2484.             $suj "INSCRIPTION FORMATION 2026";
  2485.             
  2486.             $codehtml '<html><body>'.
  2487.             '<table width="100%" cellpadding="0" cellspacing="0" style="background-color:#f4f6f8; padding:20px;">
  2488.             <tr>
  2489.             <td align="center">
  2490.             <table width="600" cellpadding="0" cellspacing="0" style="background-color:#ffffff; border-radius:6px; overflow:hidden; box-shadow:0 2px 6px rgba(0,0,0,0.08);">
  2491.             <tr>
  2492.             <td style="background-color:#051a53; padding:20px; color:#ffffff; text-align:center;">
  2493.             <h2 style="margin:0;">Demande de dévis</h2>
  2494.             </td>
  2495.             </tr>
  2496.             <tr>
  2497.             <td style="padding:25px; color:#333333; font-size:14px; line-height:1.6;">
  2498.             <p>Demande de dévis de '.$civilite.' <strong>'.$prenoms.' '.$nom.'</strong> pour une formation avec pour thème :<strong>'.$nomtheme.'</strong>.</p>
  2499.             <p>Veuillez trouver ci-dessous le récapitulatif :</p>
  2500.             <hr style="border:none; border-top:1px solid #e0e0e0; margin:20px 0;">
  2501.             <h4 style="margin-bottom:8px; color:#0d6efd;">Informations personnelles</h4>
  2502.             <p>
  2503.             <strong>Nom & Prénoms :</strong> '.$prenoms.' '.$nom.'<br>
  2504.             <strong>Fonction :</strong> '.$fonction.'<br>
  2505.             <strong>Entreprise :</strong> '.$entreprise.'<br>
  2506.             <strong>Adresse :</strong> '.$adresse.'<br>
  2507.             <strong>Pays / Ville :</strong> '.$pays.' / '.$ville.'<br>
  2508.             </p>
  2509.             <h4 style="margin-bottom:8px; color:#0d6efd;">Coordonnées</h4>
  2510.             <p>
  2511.             <strong>Email :</strong> '.$mail.'<br>
  2512.             <strong>Téléphone :</strong> '.$telephone.'<br>
  2513.             <strong>Whatsapp :</strong> '.$whatsapp.'<br>
  2514.             <strong>Site web :</strong> '.$siteweb.'
  2515.             </p>
  2516.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détails de participation</h4>
  2517.             <p>
  2518.             <strong>Nombre de participants :</strong> '.$nombrepart.'<br>
  2519.             <strong>Commentaire :</strong> '.$commentaire.'
  2520.             </p>
  2521.             <h4 style="margin-bottom:8px; color:#0d6efd;">Détail de la formation</h4>
  2522.             <p>
  2523.             <strong>Thème :</strong> '.$nomtheme.'<br>
  2524.             <strong>Lieu :</strong> '.$villeForm.'<br>
  2525.             <strong>Période :</strong> '.$periode.'<br>
  2526.             <strong>Prix :</strong> '.$prixForm.' '.$deviseForm.'
  2527.             </p>
  2528.             </td>
  2529.             </tr>
  2530.             <tr>
  2531.             <td style="background-color:#f1f1f1; padding:15px; text-align:center; font-size:12px; color:#777777;">
  2532.             © '.date("Y").' CIMEF International — Tous droits réservés
  2533.             </td>
  2534.             </tr>
  2535.             </table>
  2536.             </td>
  2537.             </tr>
  2538.             </table>
  2539.             </body></html>';
  2540.             
  2541.             /*
  2542.             $secretKey = '6LfPYkosAAAAAJQFLCC-9U5bF6KdFTPrgmbxg5Ux';
  2543.             $value = $request->get('g-recaptcha-response');
  2544.             
  2545.             if (!$value) { $this->addFlash('warning', 'Veuillez cocher le reCAPTCHA'); 
  2546.                 $this->addFlash('warning','Cocher le champs recaptcha svp!');
  2547.                 return $this->render('front/inscriptions/inscription-index.html.twig', [
  2548.                     'annee' => date('Y'),
  2549.                     'mentions' => $mentions,
  2550.                     'demandeformationsForm' => $form->createView(),
  2551.                 ]);
  2552.             }
  2553.             $userIP = $_SERVER['REMOTE_ADDR'];
  2554.             $url = "https://www.google.com/recaptcha/api/siteverify?secret=$secretKey&response=$value&remoteip=$userIP";
  2555.             $response = \file_get_contents($url);
  2556.             $response = json_decode((string)$response);
  2557.             //dd($response);
  2558.             if(!$response->success){
  2559.                 $this->addFlash('warning','Cocher le champs recaptcha svp!');
  2560.                 return $this->render('front/inscriptions/inscription-index.html.twig', [
  2561.                     'annee' => date('Y'),
  2562.                     'mentions' => $mentions,
  2563.                     'demandeformationsForm' => $form->createView(),
  2564.                 ]);
  2565.             }
  2566.             */
  2567.             $response $this->client->request(
  2568.                 'POST',
  2569.                 'https://www.google.com/recaptcha/api/siteverify',
  2570.                 [
  2571.                     'body' => [
  2572.                         'secret' => $_ENV['RECAPTCHA_SECRET_KEY'],
  2573.                         'response' => $token,
  2574.                     ]
  2575.                 ]
  2576.             );
  2577.             $result $response->toArray();
  2578.             if (!$result['success'] || !isset($result['score']) || $result['score'] < 0.5) {
  2579.                 $this->addFlash(
  2580.                     'warning',
  2581.                     'Vérification reCAPTCHA échouée.'
  2582.                 );
  2583.                 $mentions $mentionRepository->findAll();
  2584.                 return $this->render('front/inscriptions/inscription-index.html.twig', [
  2585.                     'annee' => date('Y'),
  2586.                     'mentions' => $mentions,
  2587.                     'demandeformationsForm' => $form->createView(),
  2588.                 ]);
  2589.             }  
  2590.             
  2591.             
  2592.             $email = (new Email())
  2593.         ->from('CIMEF International <inscriptions@cimef-international.org>')
  2594.             ->to($destinataire)                 // destinataire principal
  2595.             ->cc('medias@cimef-international.com'// COPIE
  2596.             ->replyTo($expediteur)              // Reply-To:
  2597.             ->subject($suj)     
  2598.             ->text(strip_tags($codehtml))
  2599.             ->html($codehtml);// Subject:
  2600.             //->html($codehtml, 'text/html');   // Content-Type + charset utf-8
  2601.             $mailer->send($email);
  2602.             $inscription->setNom($nom);
  2603.             $inscription->setPrenoms($prenoms);
  2604.             $inscription->setFonction($fonction);
  2605.             $inscription->setAdresse($adresse);
  2606.             $inscription->setMail($mail);
  2607.             $inscription->setEntreprise($entreprise);
  2608.             $inscription->setSiteweb($siteweb);
  2609.             $inscription->setNbparticipant($nombrepart);
  2610.             $inscription->setPays($pays);
  2611.             $inscription->setVille$ville);
  2612.             $inscription->setBoitepostale($boitepostale);
  2613.             $inscription->setWhatsapp($whatsapp);
  2614.             $inscription->setTelephone($telephone);
  2615.             $inscription->setCommentaire($commentaire);
  2616.             $inscription->setFormation($Seminaires);
  2617.             $entityManager->persist($inscription);
  2618.             $entityManager->flush();
  2619.             $this->addFlash(
  2620.             'success',
  2621.             'Votre inscription à été bien enregistrée');
  2622.             return $this->redirectToRoute('front.inscriptions',['annee' => $annee]);
  2623.         }
  2624.     
  2625.         $mentions $mentionRepository->findAll();
  2626.         return $this->render('front/inscriptions/inscription-index.html.twig', [
  2627.             'annee' => date('Y'),
  2628.             'mentions' => $mentions,
  2629.             'demandeformationsForm' => $form->createView(),
  2630.         ]);
  2631.     }
  2632.     #[Route('/catalogue-CIMEF-INTERNATIONAL-2026'name'front.catalogue'methods:['GET'])]
  2633.     public function catalogue(
  2634.         Request $request
  2635.         ManagementsRepository $managementRepository,
  2636.         MentionsRepository $mentionRepository,
  2637.         EntityManagerInterface $entityManager
  2638.     ): Response
  2639.     {
  2640.         return $this->render('front/cato.html.twig',[
  2641.             'no_base_style' => true
  2642.         ]);
  2643.     }
  2644.     #[Route('/contact'name'front.contact'methods:['GET','POST'])]
  2645.     public function contact(
  2646.         Request $request,
  2647.         MailerInterface $mailer,
  2648.         MentionsRepository $mentionRepository,
  2649.         EntityManagerInterface $entityManager
  2650.     ): Response
  2651.     {
  2652.         $mentions $mentionRepository->findAll();
  2653.         $contactForm $this->createForm(ContactFormType::class);
  2654.         $contactForm->handleRequest($request);
  2655.         
  2656.         if($contactForm->isSubmitted()){
  2657.             $nom htmlspecialchars($contactForm->get('nom')->getData());
  2658.             $mail htmlspecialchars($contactForm->get('email')->getData());
  2659.             $sujet htmlspecialchars($contactForm->get('sujet')->getData());
  2660.             $contact htmlspecialchars($contactForm->get('contact')->getData());
  2661.             $message htmlspecialchars($contactForm->get('message')->getData());
  2662.             
  2663.             $token $contactForm->get('recaptchaToken')->getData();
  2664.             
  2665.             $besoinArray $contactForm->get('besoin')->getData();
  2666.             $besoin implode(', 'array_map('htmlspecialchars'$besoinArray));
  2667.             $response $this->client->request(
  2668.                 'POST',
  2669.                 'https://www.google.com/recaptcha/api/siteverify',
  2670.                 [
  2671.                     'body' => [
  2672.                         'secret' => $_ENV['RECAPTCHA_SECRET_KEY'],
  2673.                         'response' => $token,
  2674.                     ]
  2675.                 ]
  2676.             );
  2677.             $result $response->toArray();
  2678.             if (!$result['success'] || !isset($result['score']) || $result['score'] < 0.5) {
  2679.                 $this->addFlash(
  2680.                     'warning',
  2681.                     'Vérification reCAPTCHA échouée.'
  2682.                 );
  2683.                 return $this->render('front/contact.html.twig',[
  2684.                     'contactForm' => $contactForm->createView(),
  2685.                     'mentions' => $mentions
  2686.                 ]);
  2687.             }            
  2688.             
  2689.             $destinataire 'contact@cimef-international.org';
  2690.             $expediteur   $mail;
  2691.             $reponse      $expediteur;
  2692.             $suj $sujet;
  2693.             
  2694.             $codehtml '
  2695.             <!DOCTYPE html>
  2696.                 <html lang="fr">
  2697.                 <head>
  2698.                     <meta charset="UTF-8">
  2699.                     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  2700.                     <title>Nouveau message de contact</title>
  2701.                 </head>
  2702.                 <body style="margin: 0; padding: 20px; font-family: Arial, sans-serif; background-color: #f8f9fa;">
  2703.                     <table width="100%" cellpadding="0" cellspacing="0" style="max-width: 700px; margin: 0 auto; background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 12px rgba(5, 26, 83, 0.1);">
  2704.                         <!-- Header -->
  2705.                         <tr>
  2706.                             <td style="background: linear-gradient(135deg, #051a53 0%, #0a2a7a 100%); padding: 30px 30px 25px 30px; text-align: center; border-top: 4px solid #ff6600;">
  2707.                                 <table width="100%" cellpadding="0" cellspacing="0">
  2708.                                     <tr>
  2709.                                         <td style="color: white; font-size: 28px; font-weight: bold; padding-bottom: 10px;">
  2710.                                             CIMEF-INTERNATIONAL
  2711.                                         </td>
  2712.                                     </tr>
  2713.                                     <tr>
  2714.                                         <td style="color: white; font-size: 22px; font-weight: 600; padding-bottom: 8px;">
  2715.                                             Nouveau message de contact
  2716.                                         </td>
  2717.                                     </tr>
  2718.                                     <tr>
  2719.                                         <td style="color: rgba(255, 255, 255, 0.9); font-size: 16px;">
  2720.                                             Formulaire de contact • Site de CIMEF-INTERNATIONAL
  2721.                                         </td>
  2722.                                     </tr>
  2723.                                 </table>
  2724.                             </td>
  2725.                         </tr>
  2726.                         
  2727.                         <!-- Content -->
  2728.                         <tr>
  2729.                             <td style="padding: 30px;">
  2730.                                 <table width="100%" cellpadding="0" cellspacing="0">
  2731.                                     <tr>
  2732.                                         <td style="background-color: rgba(255, 102, 0, 0.1); color: #ff6600; padding: 10px 15px; border-radius: 20px; font-weight: bold; font-size: 14px; text-align: center; margin-bottom: 25px;">
  2733.                                             Nouveau message reçu
  2734.                                         </td>
  2735.                                     </tr>
  2736.                                     
  2737.                                     <tr>
  2738.                                         <td style="padding-bottom: 20px; color: #555; line-height: 1.6;">
  2739.                                             Bonjour,<br>
  2740.                                             Un visiteur a rempli le formulaire de contact de votre site de formation.
  2741.                                         </td>
  2742.                                     </tr>
  2743.                                     
  2744.                                     <!-- Informations -->
  2745.                                     <tr>
  2746.                                         <td>
  2747.                                             <table width="100%" cellpadding="0" cellspacing="0" style="margin-bottom: 25px;">
  2748.                                                 <tr>
  2749.                                                     <td width="50%" style="padding: 15px; background-color: #f8f9ff; border-left: 4px solid #051a53; border-radius: 5px;">
  2750.                                                         <div style="font-size: 12px; color: #6c757d; font-weight: bold; text-transform: uppercase; margin-bottom: 5px;">
  2751.                                                             Nom complet
  2752.                                                         </div>
  2753.                                                         <div style="font-size: 16px; color: #051a53; font-weight: bold;">
  2754.                                                             '.$nom.'
  2755.                                                         </div>
  2756.                                                     </td>
  2757.                                                     <td width="10"></td>
  2758.                                                     <td width="50%" style="padding: 15px; background-color: #f8f9ff; border-left: 4px solid #ff6600; border-radius: 5px;">
  2759.                                                         <div style="font-size: 12px; color: #6c757d; font-weight: bold; text-transform: uppercase; margin-bottom: 5px;">
  2760.                                                             Adresse email
  2761.                                                         </div>
  2762.                                                         <div style="font-size: 16px; color: #ff6600; font-weight: bold;">
  2763.                                                             <a href="mailto:'.$mail.'" style="color: #ff6600; text-decoration: none;">'.$mail.'</a>
  2764.                                                         </div>
  2765.                                                     </td>
  2766.                                                 </tr>
  2767.                                                 <tr height="15"></tr>
  2768.                                                 <tr>
  2769.                                                     <td width="50%" style="padding: 15px; background-color: #f8f9ff; border-left: 4px solid #051a53; border-radius: 5px;">
  2770.                                                         <div style="font-size: 12px; color: #6c757d; font-weight: bold; text-transform: uppercase; margin-bottom: 5px;">
  2771.                                                             Objet du message
  2772.                                                         </div>
  2773.                                                         <div style="font-size: 16px; color: #051a53; font-weight: bold;">
  2774.                                                             '.$sujet.'
  2775.                                                         </div>
  2776.                                                     </td>
  2777.                                                     <td width="10"></td>
  2778.                                                     <td width="50%" style="padding: 15px; background-color: #f8f9ff; border-left: 4px solid #ff6600; border-radius: 5px;">
  2779.                                                         <div style="font-size: 12px; color: #6c757d; font-weight: bold; text-transform: uppercase; margin-bottom: 5px;">
  2780.                                                             Date d\'envoi
  2781.                                                         </div>
  2782.                                                         <div style="font-size: 16px; color: #051a53; font-weight: bold;">
  2783.                                                             '.$contact.'
  2784.                                                         </div>
  2785.                                                     </td>
  2786.                                                 </tr>
  2787.                                                 <tr height="15"></tr>
  2788.                                                 <tr>
  2789.                                                     <td width="100%" style="padding: 15px; background-color: #f8f9ff; border-left: 4px solid #051a53; border-radius: 5px;">
  2790.                                                         <div style="font-size: 12px; color: #6c757d; font-weight: bold; text-transform: uppercase; margin-bottom: 5px;">
  2791.                                                             Type de besoin
  2792.                                                         </div>
  2793.                                                         <div style="font-size: 16px; color: #051a53; font-weight: bold;">
  2794.                                                             '.$besoin.'
  2795.                                                         </div>
  2796.                                                     </td>
  2797.                                                 </tr>
  2798.                                             </table>
  2799.                                         </td>
  2800.                                     </tr>
  2801.                                     
  2802.                                     <!-- Message -->
  2803.                                     <tr>
  2804.                                         <td>
  2805.                                             <div style="color: #051a53; font-size: 18px; font-weight: bold; padding-bottom: 10px; border-bottom: 2px solid rgba(255, 102, 0, 0.3); margin-bottom: 15px;">
  2806.                                                 Message
  2807.                                             </div>
  2808.                                             <div style="background-color: #f8f9ff; padding: 20px; border-radius: 8px; border: 1px solid rgba(5, 26, 83, 0.1); white-space: pre-wrap; line-height: 1.6;">
  2809.                                                 '.$message.'
  2810.                                             </div>
  2811.                                         </td>
  2812.                                     </tr>
  2813.                                     
  2814.                                     <!-- Info note -->
  2815.                                     <tr>
  2816.                                         <td style="padding-top: 30px;">
  2817.                                             <div style="background-color: rgba(5, 26, 83, 0.05); padding: 15px; border-radius: 8px; font-size: 14px; color: #555; line-height: 1.5;">
  2818.                                                 <strong style="color: #ff6600;">Information :</strong> Cet email a été envoyé automatiquement depuis le formulaire de contact de votre plateforme de formation.
  2819.                                             </div>
  2820.                                         </td>
  2821.                                     </tr>
  2822.                                 </table>
  2823.                             </td>
  2824.                         </tr>
  2825.                         
  2826.                         <!-- Footer -->
  2827.                         <tr>
  2828.                             <td style="background-color: #f8f9ff; padding: 25px 30px; text-align: center; border-top: 1px solid rgba(5, 26, 83, 0.1);">
  2829.                                 <div style="color: #051a53; font-size: 20px; font-weight: bold; margin-bottom: 10px;">
  2830.                                     CIMEF-INTERNATIONAL
  2831.                                 </div>
  2832.                                 <div style="color: #6c757d; font-size: 14px; line-height: 1.5; margin-bottom: 20px;">
  2833.                                     La formation précède la compétitivité
  2834.                                 </div>
  2835.                                 
  2836.                                 <div style="color: #6c757d; font-size: 12px; padding-top: 20px; border-top: 1px solid rgba(5, 26, 83, 0.1);">
  2837.                                     © 2026 CIMEF-INTERNATIONAL. Tous droits réservés.<br>
  2838.                                     Cet email a été généré automatiquement.
  2839.                                 </div>
  2840.                             </td>
  2841.                         </tr>
  2842.                     </table>
  2843.                 </body>
  2844.             </html>';
  2845.             $email = (new Email())
  2846.             ->from('CIMEF International <contact@cimef-international.org>')
  2847.             ->to($destinataire)                 // destinataire principal
  2848.             ->replyTo($expediteur
  2849.             ->subject($suj)
  2850.            ->text(strip_tags($codehtml))
  2851.             ->html($codehtml);
  2852.             /*->html('<html><body>'.
  2853.             '<p>Bonjour vous avez un nouveau message de M/Mme <b>'.$nom.' </b><br>'.
  2854.             ''.$message.'<br>'.
  2855.             'Vous pouvez mecm\'écrire à l\'adresse suivante <b>'.$mail.'<br>'.
  2856.             '</p>'.
  2857.             '</body></html>');*/
  2858.             $mailer->send($email);
  2859.     
  2860.             $this->addFlash'success','Votre message a été envoyé');
  2861.             return $this->redirectToRoute('front.contact');
  2862.         }
  2863.         return $this->render('front/contact.html.twig',[
  2864.             'contactForm' => $contactForm->createView(),
  2865.             'mentions' => $mentions
  2866.         ]);
  2867.     }
  2868.     
  2869.     #[Route('/formations/shanghai'name'front.inter.shanghai'methods:['GET'])]
  2870.     public function shanghai(
  2871.         Request $request,
  2872.         MentionsRepository $mentionRepository,
  2873.         ThemeshanghaiRepository $themeshanghaiRepository,
  2874.         ManagementsRepository $managementRepository,
  2875.         EntityManagerInterface $entityManager
  2876.     ): Response
  2877.     {
  2878.         $shanghai $themeshanghaiRepository->findAll();
  2879.         //dd($shanghai);
  2880.         $manageLimit $managementRepository->findBy([], ['id' => 'DESC'], 10 );
  2881.         
  2882.         $queryBuilder $entityManager->createQueryBuilder();
  2883.         $queryBuilder
  2884.         ->select('for','th','thm','vil')
  2885.             ->from(Formations::class, 'for')
  2886.             ->innerJoin('for.theme''th')
  2887.             ->innerJoin('th.thematique''thm')
  2888.             ->innerJoin('for.ville''vil')
  2889.             ->Where('vil = :ville')
  2890.             ->setParameter('ville''SHANGHAI');
  2891.         $formationShanghai $queryBuilder->getQuery()->getResult();
  2892.     
  2893.         $mentions $mentionRepository->findAll();
  2894.         return $this->render('front/shanghai.html.twig',[
  2895.             'pagination' => $shanghai,
  2896.             'manageLimit' => $manageLimit,
  2897.             'mentions' => $mentions,
  2898.         ]);
  2899.     }
  2900. }