src/Controller/FrontController.php line 2185

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