src/Controller/DefaultController.php line 486

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use App\Repository\PagesRepository;
  7. use App\Repository\FormationsRepository;
  8. use App\Repository\VersionsFormationsRepository;
  9. use App\Repository\TypesFormationsRepository;
  10. use App\Repository\TemoignagesRepository;
  11. use App\Repository\LieuFormationsRepository;
  12. use App\Repository\TeamsRepository;
  13. use App\Repository\ContenusRepository;
  14. use App\Repository\SujetsFormationsRepository;
  15. use App\Repository\LogicielsFormationsRepository;
  16. use App\Repository\JobsRepository;
  17. use App\Repository\BusinessUnitRepository;
  18. use App\Repository\AdressesRepository;
  19. use App\Repository\LieuxJobsRepository;
  20. use App\Repository\ActualitesRepository;
  21. use App\Repository\SessionsFormationsRepository;
  22. use App\Repository\DocumentsRepository;
  23. use App\Repository\CategoriesActualitesRepository;
  24. use App\Repository\SectionsRepository;
  25. use App\Repository\CarouselsRepository;
  26. use App\Repository\DictionnaireRepository;
  27. use App\Repository\CertificatsFormationsRepository;
  28. use App\Repository\CriteresFormationsRepository;
  29. use App\Repository\CatalogueRepository;
  30. use App\Repository\CategoriesFormationsRepository;
  31. use Mailjet\Api\Client;
  32. use Mailjet\Resources;
  33. use Symfony\Component\HttpFoundation\RedirectResponse;
  34. use Doctrine\ORM\EntityManagerInterface;
  35. use ReCaptcha\ReCaptcha;
  36. use Symfony\Component\HttpFoundation\Request;
  37. use Spipu\Html2Pdf\Html2Pdf;
  38. class DefaultController extends AbstractController
  39. {
  40.     /**
  41.         * @Route("/", name="app_home")
  42.     */
  43.     public function indexActualitesRepository $actualitesRepository,SessionsFormationsRepository $sessionsFormationsRepositoryFormationsRepository $formationsRepositoryCarouselsRepository $carouRepoDictionnaireRepository $dicoRepo,SectionsRepository $sectionsRepositoryPagesRepository $pagesRepository): Response
  44.     {
  45.         $page $pagesRepository->findOneById(13);
  46.         $nb count($page->getSections()) +1;
  47.         $sections $sectionsRepository->findBy(array('Pages'=>13),array('Ordre'=>'asc'));
  48.         $formations $formationsRepository->findAll();
  49.         $sessions $sessionsFormationsRepository->findAll();
  50.         $dates = [];
  51.         foreach ($sessions as $session) {
  52.             $dates[] = $session->getDate(); // Supposons que "getDate()" soit la méthode pour récupérer la date.
  53.         }
  54.         $actus $actualitesRepository->findBy(['Afficher'=>1],['Date'=>'desc'],2);
  55.         $lastActus $actualitesRepository->findBy(['Afficher'=>1],['Date'=>'desc'],10);
  56.         $lastFormations $formationsRepository->findBy(['Afficher'=>1], ['Date' => 'desc'], 10);
  57.         return $this->render('default/index.html.twig', [
  58.             'actus' => $actus,
  59.             'lastActus'=>$lastActus,
  60.             'formations' => $formations,
  61.             'sessions' => $sessions,
  62.             'lastFormations' => $lastFormations,
  63.             'sections' => $sections,
  64.             'page'=> $page,
  65.             'ordreMax' =>$nb,
  66.             'carousels' => $carouRepo->findBy(['Contenus'=>367],['Ordre'=>'asc']),
  67.             'dico' => $dicoRepo->findAll(),
  68.             'dates' => $dates
  69.         ]);
  70.     }
  71.     /**
  72.     * @Route("/{locale}/industrialisation", name="app_industrialisation")
  73.     */
  74.     public function industrialisation($localeRequest $request,SectionsRepository $sectionsRepositoryPagesRepository $pagesRepository,TemoignagesRepository $temoignagesRepository): Response
  75.     {
  76.         
  77.         $page $pagesRepository->findOneById(1);
  78.         $nb count($page->getSections()) +1;
  79.         
  80.         $sections $sectionsRepository->findBy(array('Pages'=>1),array('Ordre'=>'asc'));
  81.         return $this->render('default/industrialisation.html.twig', [
  82.             'sections' => $sections,
  83.             'page'=> $page,
  84.             'ordreMax' =>$nb,
  85.             'ip' => '90.63.222.84',
  86.             'temoignages'=>$temoignagesRepository->findAll()
  87.         ]);
  88.     }
  89.    
  90.     /**
  91.         * @Route("{locale}/demo", name="demo")
  92.     */
  93.     public function demo(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  94.     {
  95.         $page $pagesRepository->findOneById(11);
  96.         $nb count($page->getSections()) +1;
  97.         
  98.         $sections $sectionsRepository->findBy(array('Pages'=>11),array('Ordre'=>'asc'));
  99.         return $this->render('default/demo.html.twig', [
  100.             'sections' => $sections,
  101.             'page'=> $page,
  102.             'ordreMax' =>$nb,
  103.             'ip' => '90.63.222.84',
  104.             'temoignages'=>$temoignagesRepository->findAll()
  105.         ]);
  106.     }
  107.     /**
  108.         * @Route("/{locale}/formation", name="app_formation")
  109.     */
  110.     public function formation($locale): Response
  111.     {
  112.         return $this->render('default/formation.html.twig', [
  113.             'controller_name' => 'DefaultController',
  114.         ]);
  115.     }
  116.      /**
  117.     * @Route("/cms/digital-manufacturing-services", name="app_digitalManufacturingServicesCms")
  118.     */
  119.     public function app_digitalManufacturingServicesCms(): Response
  120.     {
  121.         return $this->render('default/digitalManufacturingServicesbackup.html.twig', [
  122.             'controller_name' => 'DefaultController',
  123.         ]);
  124.     }
  125.     /**
  126.     * @Route("/{locale}/digital-manufacturing-services", name="app_digitalManufacturingServices")
  127.     */
  128.    
  129.     public function app_digitalManufacturingServices(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  130.     {
  131.         $page $pagesRepository->findOneById(3);
  132.         $nb count($page->getSections()) +1;
  133.         
  134.         $sections $sectionsRepository->findBy(array('Pages'=>3),array('Ordre'=>'asc'));
  135.         return $this->render('default/digitalManufacturingServices.html.twig', [
  136.             'sections' => $sections,
  137.             'page'=> $page,
  138.             'ordreMax' =>$nb,
  139.             'ip' => '90.63.222.84',
  140.             'temoignages'=>$temoignagesRepository->findAll()
  141.         ]);
  142.        
  143.     }
  144.     /**
  145.     * @Route("/cms/presentation-erp", name="app_manufacturingERPCms")
  146.     */
  147.     public function app_manufacturingERP(DocumentsRepository $documentRepository): Response
  148.     {
  149.         $pdfs $documentRepository->findAll();
  150.         
  151.         return $this->render('default/ERPBackup.html.twig', [
  152.             'pdfs' => $pdfs,
  153.         ]);
  154.     }
  155.     /**
  156.     * @Route("admin/{locale}/presentation-erp", name="app_manufacturingERP")
  157.     */
  158.     
  159.     public function app_manufacturingERPCmsDocumentsRepository $documentRepositorySectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  160.     {
  161.         $page $pagesRepository->findOneById(4);
  162.         $nb count($page->getSections()) +1;
  163.         $pdfs $documentRepository->findAll();
  164.         $sections $sectionsRepository->findBy(array('Pages'=>4),array('Ordre'=>'asc'));
  165.         return $this->render('default/manufacturingERP.html.twig', [
  166.             'sections' => $sections,
  167.             'page'=> $page,
  168.             'ordreMax' =>$nb,
  169.             'ip' => '90.63.222.84'  ,
  170.             'pdfs' => $pdfs,
  171.             'temoignages'=>$temoignagesRepository->findAll()
  172.         ]);
  173.     }
  174.     
  175.    /**
  176.         * @Route("admin/{locale}/fonctionnalites-delmiaworks", name="presentationERP")
  177.     */
  178.     public function app_presentationERP(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  179.     {
  180.         $page $pagesRepository->findOneById(12);
  181.         $nb count($page->getSections()) +1;
  182.         
  183.         $sections $sectionsRepository->findBy(array('Pages'=>12),array('Ordre'=>'asc'));
  184.         return $this->render('default/presentationERP.html.twig', [
  185.             'sections' => $sections,
  186.             'page'=> $page,
  187.             'ordreMax' =>$nb,
  188.             'ip' => '90.63.222.84',
  189.             'temoignages'=>$temoignagesRepository->findAll()
  190.         ]);
  191.     }
  192.       /**
  193.         * @Route("/{locale}/base-outils", name="app_baseOutils")
  194.     */
  195.     public function app_baseOutilsCms(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  196.     {
  197.         $page $pagesRepository->findOneById(5);
  198.         $nb count($page->getSections()) +1;
  199.         
  200.         $sections $sectionsRepository->findBy(array('Pages'=>5),array('Ordre'=>'asc'));
  201.         return $this->render('default/baseOutils.html.twig', [
  202.             'sections' => $sections,
  203.             'page'=> $page,
  204.             'ordreMax' =>$nb,
  205.             'ip' => '90.63.222.84'  ,
  206.             'temoignages'=>$temoignagesRepository->findAll(),
  207.             
  208.         ]);
  209.     }
  210.      /**
  211.         * @Route("/cms/base-outils", name="app_baseOutilsCms")
  212.     */
  213.     
  214.     public function app_baseOutils(): Response
  215.     {
  216.         return $this->render('default/base-outil-backup.html.twig', [
  217.             'controller_name' => 'DefaultController',
  218.         ]);
  219.     }
  220.      /**
  221.         * @Route("/{locale}/societe", name="app_societe")
  222.     */
  223.     public function app_societeCms(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  224.     {
  225.         $page $pagesRepository->findOneById(6);
  226.         $nb count($page->getSections()) +1;
  227.         $sections $sectionsRepository->findBy(array('Pages'=>6),array('Ordre'=>'asc'));
  228.         return $this->render('default/societe.html.twig', [
  229.             'sections' => $sections,
  230.             'page'=> $page,
  231.             'ordreMax' =>$nb,
  232.             'ip' => '90.63.222.84'  ,
  233.             'temoignages'=>$temoignagesRepository->findAll()
  234.         ]);
  235.     }
  236.  
  237.      /**
  238.     * @Route("/cms/societe", name="app_societeCms")
  239.     */
  240.    
  241.     public function app_societe(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  242.     {
  243.         $page $pagesRepository->findOneById(6);
  244.         $nb count($page->getSections()) +1;
  245.         $sections $sectionsRepository->findBy(array('Pages'=>6),array('Ordre'=>'asc'));
  246.         return $this->render('default/societeBackup.html.twig', [
  247.             'sections' => $sections,
  248.             'page'=> $page,
  249.             'ordreMax' =>$nb,
  250.             'ip' => '90.63.222.84'  ,
  251.             'temoignages'=>$temoignagesRepository->findAll()
  252.         ]);
  253.     }
  254.      /**
  255.  * @Route("/{locale}/formations", name="formations")
  256.  */
  257. public function formations($localeCatalogueRepository $catalogueRepositorySessionsFormationsRepository $sessionsFormationsRepositoryFormationsRepository $formationsRepository,CertificatsFormationsRepository $certificatsFormationsCriteresFormationsRepository $criteresFormations,VersionsFormationsRepository $versionsFormationsRepositoryTypesFormationsRepository $typesFormationsRepositorySujetsFormationsRepository $sujetsFormationsRepositoryLogicielsFormationsRepository $logicielsFormationsRepositoryRequest $requestSectionsRepository $sectionsRepositoryPagesRepository $pagesRepository): Response
  258. {
  259.     $page $pagesRepository->findOneById(14);
  260.     $nb count($page->getSections()) + 1;
  261.     $sections $sectionsRepository->findBy(array('Pages' => 14), array('Ordre' => 'asc'));
  262.     $typeTitre $typesFormationsRepository->findBy(['TitreFr' => 'ASC']);
  263.     // Initialisation du tableau de critères
  264.     $critereFiltre = ['Afficher' => 1];
  265.     // Ajout des critères de filtrage
  266.     if ($request->query->get('version')) {
  267.         $critereFiltre['VersionsFormations'] = $request->query->get('version');
  268.     }
  269.     $typesFormations $typesFormationsRepository->findAll();
  270.     // Ajoutez le filtre pour le type s'il est spécifié dans la requête
  271.    
  272.     
  273.     if ($request->query->get('sujet')) {
  274.         $critereFiltre['SujetsFormations'] = $request->query->get('sujet');
  275.     }
  276.     if ($request->query->get('logiciel')) {
  277.         $critereFiltre['LogicielsFormations'] = $request->query->get('logiciel');
  278.     }
  279.     if ($request->query->get('formation')) {
  280.         $critereFiltre['TitreFr'] = $request->query->get('formation');
  281.     }
  282.     $sessions $sessionsFormationsRepository->findAll();
  283.     $dates = [];
  284.     foreach ($sessions as $session) {
  285.         $dates[] = $session->getDate(); // Supposons que "getDate()" soit la méthode pour récupérer la date.
  286.     }
  287.     
  288.     // Requête avec tous les critères
  289.     $formations $formationsRepository->findBy($critereFiltre, ['Ordre' => 'ASC']);
  290.     $sessionsFormations $sessionsFormationsRepository->findAll();
  291.     $certificats $certificatsFormations->findAll();
  292.     $criteres $criteresFormations->findAll();
  293.     $cataloguesFormations $catalogueRepository->findAll();
  294.     if ($request->query->has('type')) {
  295.         $selectedTypeId $request->query->get('type');
  296.     
  297.         // Vérifiez si l'option "Tous les Types" est sélectionnée
  298.         if ($selectedTypeId !== 'all') {
  299.             $formations $this->filterFormationsByType($formations, (int)$selectedTypeId);
  300.         }
  301.         // Si "Tous les Types" est sélectionné, n'appliquez pas de filtre par type
  302.     }
  303.     
  304.     return $this->render('default/formations.html.twig', [
  305.         'formations' => $formations,
  306.         'cataloguesFormations' => $cataloguesFormations,
  307.         'sessionsFormations' => $sessionsFormations,
  308.         'certificats' => $certificats,
  309.         'criteres' => $criteres,
  310.         'versions' => $versionsFormationsRepository->findBy([], ['TitreFr' => 'ASC']),
  311.         'types' => $typesFormationsRepository->findBy([], ['TitreFr' => 'ASC']),
  312.         'sujets' => $sujetsFormationsRepository->findBy([], ['TitreFr' => 'ASC']),
  313.         'logiciels' => $logicielsFormationsRepository->findBy([], ['TitreFr' => 'ASC']),
  314.         'formation' => $formationsRepository->findBy([], ['TitreFr' => 'ASC']),
  315.         'sections' => $sections,
  316.         'page' => $page,
  317.         'ordreMax' => $nb,
  318.         'formationSelected' => $request->query->get('formation'),
  319.         'ip' => '90.63.222.84',
  320.         'dates' => $dates
  321.     ]);
  322. }
  323. /**
  324.  * Filtre les formations par le type spécifié.
  325.  */
  326. private function filterFormationsByType(array $formationsint $typeId): array
  327. {
  328.     return array_filter($formations, function ($formation) use ($typeId) {
  329.         foreach ($formation->getSessionsFormations() as $session) {
  330.             if ($session->getTypesFormations()->getId() === $typeId) {
  331.                 return true;
  332.             }
  333.         }
  334.         return false;
  335.     });
  336. }
  337.      /**
  338.         * @Route("/{locale}/formations/{ref}", name="detailsFormation")
  339.     */
  340.     public function detailsFormation($locale,FormationsRepository $formationsRepository,SessionsFormationsRepository $sessionsFormationsRepository,  $ref): Response
  341.     {
  342.         $sessions $sessionsFormationsRepository->findAll();
  343.         
  344.         $dates = [];
  345.         foreach ($sessions as $session) {
  346.             $dates[] = $session->getDate(); // Supposons que "getDate()" soit la méthode pour récupérer la date.
  347.         }
  348.         
  349.         return $this->render('default/detailsFormation.html.twig', [
  350.             'formation' => $formationsRepository->findOneBy(['Reference'=>$ref]),
  351.             'formationsall' => $formationsRepository->findAll(),
  352.             '$dates' => $dates,
  353.            
  354.         ]);
  355.     }
  356.     /**
  357.         * @Route("/{locale}/actualites", name="app_actualites")
  358.     */
  359.     public function actualites(ActualitesRepository $actualitesRepositoryCategoriesActualitesRepository $categoriesActualites): Response
  360.     {
  361.         if(isset($_GET['date']))
  362.         {
  363.             if($_GET['date'] == 'mois')
  364.             {
  365.                 $debut date('Y-m-d',strtotime('- 30 day'));
  366.       
  367.                 $fin date('Y-m-d');
  368.             }
  369.             if($_GET['date'] == 'annee')
  370.             {
  371.                 $debut date('Y-m-d',strtotime('- 365 day'));
  372.       
  373.                 $fin date('Y-m-d');
  374.             }
  375.         }
  376.     
  377.         $last $actualitesRepository->findBy([],['Date'=>'desc'],1);
  378.         $two $actualitesRepository->findBy([],['Date'=>'desc'],2,1);
  379.         $all $actualitesRepository->findBy([],['Date'=>'desc'],10,3);
  380.         if(isset($_GET['categorie']))
  381.         {
  382.             $last $actualitesRepository->findBy(['CategoriesActualites'=>$_GET['categorie']],['Date'=>'desc'],1);
  383.             $two $actualitesRepository->findBy(['CategoriesActualites'=>$_GET['categorie']],['Date'=>'desc'],2,1);
  384.             $all $actualitesRepository->findBy(['CategoriesActualites'=>$_GET['categorie']],['Date'=>'desc'],10,3);
  385.         }
  386.         if(isset($_GET['date']))
  387.         {
  388.             /*$last = $actualitesRepository->findOneBy(['CategoriesActualites'=>$_GET['categorie']],['Date'=>'desc']);
  389.             $two = $actualitesRepository->findBy(['CategoriesActualites'=>$_GET['categorie']],['Date'=>'desc'],2,1);*/
  390.             $last $actualitesRepository->findDate1($debut,$fin);
  391.             $two $actualitesRepository->findDate2($debut,$fin);
  392.             $all $actualitesRepository->findDate($debut,$fin);
  393.         }
  394.         
  395.         
  396.         return $this->render('default/actualites.html.twig', [
  397.             'lasts' => $last,
  398.             'two'=>$two,
  399.             'all'=>$all,
  400.             'cat'=>$categoriesActualites->findBy([], ['TitreFr' => 'ASC'])
  401.         ]);
  402.     }
  403.     /**
  404.      * @Route("/{locale}/actualites/{titre}/{id}", name="actualitesD")
  405.      */
  406.     public function actualitesD(ActualitesRepository $actualitesRepository$idSectionsRepository $sectionsRepository): Response
  407.     {
  408.         $actu $actualitesRepository->findOneBy(['id' => $id]);
  409.         if (!$actu) {
  410.             throw $this->createNotFoundException('Article non trouvé');
  411.         }
  412.         $nb $actu->getNbVues() + 1;
  413.         $actu->setNbVues($nb);
  414.         $actualitesRepository->add($actutrue);
  415.         $previousActu $actualitesRepository->findOneBy(['id' => $id 1]);
  416.         $nextActu $actualitesRepository->findOneBy(['id' => $id 1]);
  417.         $vues $actualitesRepository->findBy([], ['NbVues' => 'desc'], 5);
  418.         
  419.        
  420.         
  421.         $sections $sectionsRepository->findBy(array('Actualites'=>$actu),array('Ordre'=>'asc'));
  422.         return $this->render('default/detailsActualites.html.twig', [
  423.             'actu' => $actu,
  424.             'previousActu' => $previousActu,
  425.             'nextActu' => $nextActu,
  426.             'vues' => $vues,
  427.             'sections' => $sections,
  428.             'ordreMax' =>$nb
  429.         ]);
  430.     }
  431.     /**
  432.         * @Route("/{locale}/contact", name="app_contact")
  433.     */
  434.     public function contact(AdressesRepository $adressesRepositoryTeamsRepository $teams): Response
  435.     {
  436.         return $this->render('default/contact.html.twig', [
  437.             'adresses' => $adressesRepository->findAll(),
  438.             'teams'=>$teams->findBy([],['Ordre'=>'asc'])
  439.         ]);
  440.     }
  441.   /**
  442.  * @Route("/{locale}/join-us", name="app_joinus")
  443.  */
  444. public function joinUs(Request $request$localeJobsRepository $JobsRepositoryBusinessUnitRepository $businessUnitRepositoryLieuxJobsRepository $lieuxJobsRepository): Response
  445. {
  446.     
  447.     $jobsCriteria=[];
  448.     $businessUnits $businessUnitRepository->findAll();
  449.     $lieux $lieuxJobsRepository->findAll();
  450.     $jobsListe $JobsRepository->findAll();
  451.     
  452.     if ($request->query->get('businessUnit')) {
  453.         $jobsCriteria['BusinessUnit'] = $request->query->get('businessUnit');
  454.     }
  455.     if ($request->query->get('lieu')) {
  456.         $jobsCriteria['LieuxJobs'] = $request->query->get('lieu');
  457.     }
  458.     if ($request->query->get('job')) {
  459.         $jobsCriteria['TitreFr'] = $request->query->get('job');
  460.     }
  461.     $jobs $JobsRepository->findByCriteria($jobsCriteria);
  462.     return $this->render('default/joinUs.html.twig', [
  463.         'jobs' => $jobs,
  464.         'businessUnit' => $businessUnits,
  465.         'lieux' => $lieux,
  466.         'locale' => $locale,
  467.         'jobsL' => $jobsListe
  468.         
  469.     ]);
  470. }
  471.     /**
  472.         * @Route("/{locale}/join-us/{ref}", name="app_joinusD")
  473.     */
  474.     public function app_joinusD(JobsRepository $JobsRepositoryBusinessUnitRepository $businessUnitRepositoryLieuxJobsRepository $lieuxJobsRepository$ref): Response
  475.     {
  476.         $jobs=$JobsRepository->findOneBy(['Reference'=>$ref]);
  477.         return $this->render('default/joinUsDetails.html.twig', [
  478.             'jobs' => $jobs,
  479.            
  480.         ]);
  481.     }
  482.     /**
  483.      * @Route("/sendFormJoin", name="sendFormJoin")
  484.      */
  485.     public function sendJoinUs(JobsRepository $JobsRepository,Request $request): Response
  486.     {
  487.         $jobs $JobsRepository->findOneBy(['id'=>$_POST['job']]);
  488.         $nom $_POST['nom'];
  489.        $prenom $_POST['prenom'];
  490.         $email $_POST['email'];
  491.         $telephone $_POST['telephone'];
  492.          $motivation $_POST['motivation'];
  493.          $total_count count($_FILES['cv']['name']);
  494.          // Loop through every file
  495.          for( $i=$i $total_count $i++ ) {
  496.         
  497.             $extension pathinfo($_FILES['cv']['name'][$i], PATHINFO_EXTENSION);
  498.             //The temp file path is obtained
  499.             $tmpFilePath $_FILES['cv']['tmp_name'][$i];
  500.             //A file path needs to be present
  501.             if ($tmpFilePath != ""){
  502.                //Setup our new file path
  503.                $newFilePath "./uploadFiles/" $_FILES['cv']['name'][$i];
  504.                //File is uploaded to temp dir
  505.                $nb =  rand();
  506.                $newfilename time().$nb.'.'.$extension;
  507.               move_uploaded_file($_FILES['cv']['tmp_name'][$i], '/var/www/vhosts/deamonerp.fr/httpdocs/cpi2/public/uploads/cv/'.$newfilename);
  508.               $lien $newfilename
  509.               $content fread(fopen('uploads/cv/'.$lien"r"), filesize('uploads/cv/'.$lien));
  510.               $doc['ContentType'] = "text/plain";
  511.               $doc['Filename'] = $lien;
  512.               $doc['Base64Content'] = base64_encode($content);
  513.               $docs[$i] = $doc;
  514.              
  515.             }
  516.          }
  517.        
  518.         
  519.         if(isset($_POST['confidentialite']))
  520.         {
  521.         $confidentialite 'on';
  522.         }
  523.         else
  524.         {
  525.            $confidentialite 'off';
  526.         }
  527.           // Verify reCAPTCHA
  528.           $recaptchaResponse $request->request->get('g-recaptcha-response');
  529.           $recaptcha = new \ReCaptcha\ReCaptcha('6Lf0RGEnAAAAANFz2iFW62hx189DTGl08c3fYnw4');
  530.               $recaptchaResult $recaptcha->verify($recaptchaResponse);
  531.   
  532.               if (!$recaptchaResult->isSuccess()) {
  533.                   // La vérification reCAPTCHA a échoué. Redirigez vers le formulaire avec un message d'erreur.
  534.                   return $this->redirectToRoute('app_joinusD', ['ref' => $jobs->getReference(), 'recaptcha_error' => 'true']);
  535.               }
  536.         $subject "CPI - Candidature";
  537.         $message $this->renderView(
  538.            'emails/joinus.html.twig',
  539.            [
  540.                'nom' => strtoupper($nom), 
  541.                'prenom' => strtoupper($prenom), 
  542.                'email'=>$email
  543.                'telephone'=>$telephone
  544.                'motivation'=>$motivation
  545.                'flexCheckDefault'=>$confidentialite
  546.                'titre'=>$jobs->getTitreFr(),
  547.                'reference'=>$jobs->getReference()        
  548.                ]
  549.        );
  550.        
  551.        $userEmail $_POST['email'];
  552.         $mj = new \Mailjet\Client('61722507da55a4f5570d0ad1a5b1435e''01d31913ab5c0fd4586d08d17d114b8c',true,['version' => 'v3.1']); 
  553.         $body = [
  554.             'Messages' => [
  555.                 [
  556.                     'From' => [
  557.                         'Email' => "recrutement@cpi.lu",
  558.                         'Name' => "CPI"
  559.                     ],
  560.                     'To' => [
  561.                         [
  562.                             'Email' => 'recrutement@cpi.lu',
  563.                         ]
  564.                         
  565.                     ],
  566.                     'Bcc' => [  
  567.                         [
  568.                             'Email' => 'damien@piranha.lu',
  569.                         ],
  570.                         [
  571.                             'Email' => 'thomasbregler@protonmail.com',
  572.                         ],
  573.                         [
  574.                             'Email' => $userEmail,
  575.                         ],
  576.                     ],
  577.                     'Attachments' => $docs,
  578.                     'Subject' => $subject,
  579.                     'HTMLPart' => $message,
  580.                 ]
  581.             ]
  582.         ];
  583.         
  584.         $response $mj->post(Resources::$Email, ['body' => $body]);
  585.         $response->success();
  586.     
  587.         return $this->redirectToRoute('app_joinusD', ['ref'=>$jobs->getReference(),'send'=>'success'], Response::HTTP_SEE_OTHER);
  588.      }
  589.     /**
  590.      * @Route("/sendFormContact", name="sendFormContact")
  591.      */
  592.       public function sendFormContact(Request $request,$locale): Response
  593.    {
  594.         
  595.          $nom $_POST['nom'];
  596.          $prenom $_POST['prenom'];
  597.          $societe $_POST['societe'];
  598.         
  599.          $bp $_POST['bp'];
  600.          $batiment $_POST['batiment'];
  601.          $cp $_POST['cp'];
  602.          $ville $_POST['ville'];
  603.          $pays $_POST['pays'];
  604.          $email $_POST['email'];
  605.          $telephone $_POST['telephone'];
  606.          $message $_POST['message'];
  607.          if(isset($_POST['flexCheckDefault']))
  608.          {
  609.          $flexCheckDefault 'on';
  610.          }
  611.          else
  612.          {
  613.             $flexCheckDefault 'off';
  614.          }
  615.        // Verify reCAPTCHA
  616.        $recaptchaResponse $request->request->get('g-recaptcha-response');
  617.        $recaptcha = new \ReCaptcha\ReCaptcha('6Lf0RGEnAAAAANFz2iFW62hx189DTGl08c3fYnw4');
  618.         $recaptchaResult $recaptcha->verify($recaptchaResponse);
  619.         if (!$recaptchaResult->isSuccess()) {
  620.             // La vérification reCAPTCHA a échoué. Redirigez vers le formulaire avec un message d'erreur.
  621.             return $this->redirectToRoute('app_contact', ['recaptcha_error' => 'true']);
  622.         }
  623.       
  624.         
  625.          
  626.          $subject "CPI - Demande de contact / Contact request";
  627.          $message $this->renderView(
  628.             'emails/contact.html.twig',
  629.             [
  630.                 'nom' => strtoupper($nom), 
  631.                 'prenom' => strtoupper($prenom), 
  632.                 'societe'=>$societe,  
  633.                 'bp'=>$bp
  634.                 'cp'=>$cp
  635.                 'ville'=>$ville
  636.                 'pays'=>$pays
  637.                 'email'=>$email
  638.                 'telephone'=>$telephone
  639.                 'message'=>$message
  640.                 'batiment'=>$batiment
  641.                 'flexCheckDefault'=>$flexCheckDefault
  642.                
  643.                 ]
  644.         );
  645.       
  646.         $userEmail $_POST['email'];
  647.          $mj = new \Mailjet\Client('61722507da55a4f5570d0ad1a5b1435e''01d31913ab5c0fd4586d08d17d114b8c',true,['version' => 'v3.1']);
  648.          $body = [
  649.             'Messages' => [
  650.                 [
  651.                     'From' => [
  652.                         'Email' => "info@cpi.lu",
  653.                         'Name' => "CPI"
  654.                     ],
  655.                     'To' => [
  656.                         [
  657.                             'Email' => 'info@cpi.lu'
  658.                             
  659.                         ]
  660.                        
  661.                      
  662.                     ],
  663.                     'Bcc' => [  
  664.                         [
  665.                             'Email' => 'damien@piranha.lu',
  666.                         ],
  667.                         [
  668.                             'Email' => 'thomasbregler@protonmail.com',
  669.                         ],
  670.                         [
  671.                             'Email' => $userEmail,
  672.                         ],
  673.                     ],
  674.            
  675.                     'Subject' => $subject,
  676.                     'HTMLPart' => $message,
  677.                 ]
  678.             ]
  679.         ];
  680.          $response $mj->post(Resources::$Email, ['body' => $body]);
  681.          $response->success();
  682.          return $this->redirectToRoute('app_contact', ['locale' => $locale'send' => 'success'], Response::HTTP_SEE_OTHER);
  683.         }
  684.     /**
  685.      * @Route("/sendFormDetailsFormation", name="sendFormDetailsFormation")
  686.      */
  687.     public function sendFormDetailsFormation(SessionsFormationsRepository $sessionsFormationsRepository,Request $request) : Response
  688.     {
  689.          $session $_POST['session'];
  690.         $nom $_POST['nom'];
  691.          $prenom $_POST['prenom'];
  692.          $societe $_POST['societe'];
  693.          $email $_POST['email'];
  694.          $telephone $_POST['telephone'];
  695.          $remarque $_POST['remarque'];
  696.          if(isset($_POST['confidentialite']))
  697.          {
  698.          $confidentialite 'on';
  699.          }
  700.          else
  701.          {
  702.             $confidentialite 'off';
  703.          }
  704.          $sess $sessionsFormationsRepository->findOneById($session);
  705.          $subject "CPI - Demande de formation / Training application";
  706.          $message $this->renderView(
  707.             'emails/formation.html.twig',
  708.             [
  709.                 'nom' => strtoupper($nom), 
  710.                 'prenom' => strtoupper($prenom), 
  711.                 'societe'=>$societe
  712.                 'email'=>$email
  713.                 'telephone'=>$telephone
  714.                 'remarque'=>$remarque
  715.                 'flexCheckDefault'=>$confidentialite
  716.                 'titre'=>$sess->getFormations()->getTitreFr(),
  717.                 'reference'=>$sess->getFormations()->getReference(),
  718.                 'session'=>$sess->getDate()        
  719.                 ]
  720.         );
  721.  
  722.          // Verify reCAPTCHA
  723.         $recaptchaResponse $request->request->get('g-recaptcha-response');
  724.         $recaptcha = new \ReCaptcha\ReCaptcha('6Lf0RGEnAAAAANFz2iFW62hx189DTGl08c3fYnw4');
  725.             $recaptchaResult $recaptcha->verify($recaptchaResponse);
  726.             if (!$recaptchaResult->isSuccess()) {
  727.                 // La vérification reCAPTCHA a échoué. Redirigez vers le formulaire avec un message d'erreur.
  728.                 return $this->redirectToRoute('detailsFormation', ['ref' => $sess->getFormations()->getReference(), 'recaptcha_error' => 'true']);
  729.             }
  730.       
  731.          $userEmail $_POST['email'];
  732.          $mj = new \Mailjet\Client('61722507da55a4f5570d0ad1a5b1435e''01d31913ab5c0fd4586d08d17d114b8c',true,['version' => 'v3.1']);
  733.          $body = [
  734.             'Messages' => [
  735.                 [
  736.                     'From' => [
  737.                         'Email' => "formations@cpi.lu",
  738.                         'Name' => "CPI"
  739.                     ],
  740.                     'To' => [
  741.                         [
  742.                             'Email' => 'formations@cpi.lu',
  743.                             
  744.                         ]
  745.                        
  746.                      
  747.                     ], 
  748.                     'Bcc' => [  
  749.                         [
  750.                             'Email' => 'damien@piranha.lu',
  751.                         ],
  752.                         [
  753.                             'Email' => 'thomasbregler@protonmail.com',
  754.                         ],
  755.                         [
  756.                             'Email' => $userEmail,
  757.                         ],
  758.                     ],
  759.                    
  760.                     'Subject' => $subject,
  761.                     'HTMLPart' => $message,
  762.                 ]
  763.             ]
  764.         ];
  765.          $response $mj->post(Resources::$Email, ['body' => $body]);
  766.          $response->success();
  767.          
  768.          return $this->redirectToRoute('detailsFormation', ['ref'=>$sess->getFormations()->getReference(),'send'=>'success'], Response::HTTP_SEE_OTHER);
  769.      }
  770.  /**
  771.      * @Route("/sendDocument", name="sendDocument")
  772.      */
  773.     public function sendDocument(Request $requestContenusRepository $contenusRepository): Response
  774.     {
  775.         
  776.             $id $_POST['document'];
  777.             $doc $contenusRepository->findOneBy(['id' => $id]);
  778.             $docName $doc->getDocument();
  779.             $fileUrl '../uploads/contenus/'.$docName;
  780.            
  781.             
  782.            
  783.         
  784.             
  785.           $nom $_POST['nom'];
  786.           $prenom $_POST['prenom'];
  787.           $societe $_POST['societe'];
  788.           $email $_POST['mail'];
  789.          
  790.           if(isset($_POST['flexCheckDefault']))
  791.           {
  792.           $flexCheckDefault 'on';
  793.           }
  794.           else
  795.           {
  796.              $flexCheckDefault 'off';
  797.           }
  798.  
  799.  
  800.           $subject "CPI - Demande de Documentation / documentation request";
  801.           $message $this->renderView(
  802.              'emails/document.html.twig',
  803.              [
  804.                  'nom' => strtoupper($nom), 
  805.                  'prenom' => strtoupper($prenom), 
  806.                  'societe'=>$societe
  807.                  'email'=>$email
  808.                  'flexCheckDefault'=>$flexCheckDefault
  809.                 
  810.                  ]
  811.          );
  812.  
  813.        
  814.         $userEmail $_POST['mail'];
  815.           $mj = new \Mailjet\Client('61722507da55a4f5570d0ad1a5b1435e''01d31913ab5c0fd4586d08d17d114b8c',true,['version' => 'v3.1']);
  816.           $body = [
  817.             'Messages' => [
  818.                 [
  819.                     'From' => [
  820.                         'Email' => "info@cpi.lu",
  821.                         'Name' => "CPI"
  822.                     ],
  823.                     'To' => [
  824.                         [
  825.                             'Email' => 'info@cpi.lu',
  826.                             
  827.                         ]
  828.                         
  829.                         ],
  830.                         'Bcc' => [  
  831.                             [
  832.                                 'Email' => 'damien@piranha.lu',
  833.                             ],
  834.                             [
  835.                                 'Email' => 'thomasbregler@protonmail.com',
  836.                             ],
  837.                             [
  838.                                 'Email' => $userEmail,
  839.                             ],
  840.                      
  841.                     ],
  842.                     'Subject' => $subject,
  843.                     'HTMLPart' => $message,
  844.                 ]
  845.             ]
  846.         ];
  847.           $response $mj->post(Resources::$Email, ['body' => $body]);
  848.           $response->success();
  849.           
  850.        
  851.           return new RedirectResponse($fileUrl);
  852.           //return $this->redirectToRoute('app_contact', ['send'=>'success'], Response::HTTP_SEE_OTHER);
  853.      }
  854.      
  855.  /**
  856.      * @Route("/sendConsultationERP", name="sendConsultationERP")
  857.      */
  858.     public function sendConsultationERP(DocumentsRepository $documentsRepository): Response
  859.     {
  860.        
  861.           $nom $_POST['nom'];
  862.           $prenom $_POST['prenom'];
  863.           $societe $_POST['societe'];
  864.           $email $_POST['mail'];
  865.          
  866.           if(isset($_POST['flexCheckDefault']))
  867.           {
  868.           $flexCheckDefault 'on';
  869.           }
  870.           else
  871.           {
  872.              $flexCheckDefault 'off';
  873.           }
  874.  
  875.  
  876.           $subject "CPI - Demande de consultation ERP-MES / ERP-MES consultation request";
  877.           $message $this->renderView(
  878.              'emails/consultationERP.html.twig',
  879.              [
  880.                  'nom' => strtoupper($nom), 
  881.                  'prenom' => strtoupper($prenom), 
  882.                  'societe'=>$societe
  883.                  'email'=>$email
  884.                  'flexCheckDefault'=>$flexCheckDefault
  885.                 
  886.                  ]
  887.          );
  888.  
  889.        
  890.          $userEmail $_POST['mail'];
  891.           $mj = new \Mailjet\Client('61722507da55a4f5570d0ad1a5b1435e''01d31913ab5c0fd4586d08d17d114b8c',true,['version' => 'v3.1']);
  892.           $body = [
  893.             'Messages' => [
  894.                 [
  895.                     'From' => [
  896.                         'Email' => "info@cpi.lu",
  897.                         'Name' => "CPI"
  898.                     ],
  899.                     'To' => [
  900.                         [
  901.                             'Email' => 'info@cpi.lu',
  902.                             
  903.                         ]
  904.                        
  905.                      
  906.                     ],
  907.                     'Bcc' => [  
  908.                         [
  909.                             'Email' => 'damien@piranha.lu',
  910.                         ],
  911.                         [
  912.                             'Email' => 'thomasbregler@protonmail.com',
  913.                         ],
  914.                     
  915.                         [
  916.                             'Email' => $userEmail,
  917.                         ],
  918.                     ],
  919.                    
  920.                     'Subject' => $subject,
  921.                     'HTMLPart' => $message,
  922.                 ]
  923.             ]
  924.         ];
  925.           $response $mj->post(Resources::$Email, ['body' => $body]);
  926.           $response->success();
  927.           
  928.     
  929.           return $this->redirectToRoute('app_manufacturingERP');
  930.      }
  931.       /**
  932.      * @Route("/sendConsultationBaseOutils", name="sendConsultationBaseOutils")
  933.      */
  934.     public function sendConsultationBaseOutils(DocumentsRepository $documentsRepository): Response
  935.     {
  936.        
  937.           $nom $_POST['nom'];
  938.           $prenom $_POST['prenom'];
  939.           $societe $_POST['societe'];
  940.           $email $_POST['mail'];
  941.          
  942.           if(isset($_POST['flexCheckDefault']))
  943.           {
  944.           $flexCheckDefault 'on';
  945.           }
  946.           else
  947.           {
  948.              $flexCheckDefault 'off';
  949.           }
  950.  
  951.  
  952.           $subject "CPI - Demande de consultation BASE OUTILS COUPANTS / CUTTING TOOLS BASE consultation request : WINTOOL";
  953.           $message $this->renderView(
  954.              'emails/consultationBaseOutils.html.twig',
  955.              [
  956.                  'nom' => strtoupper($nom), 
  957.                  'prenom' => strtoupper($prenom), 
  958.                  'societe'=>$societe
  959.                  'email'=>$email
  960.                  'flexCheckDefault'=>$flexCheckDefault
  961.                 
  962.                  ]
  963.          );
  964.  
  965.        
  966.          $userEmail $_POST['mail'];
  967.           $mj = new \Mailjet\Client('61722507da55a4f5570d0ad1a5b1435e''01d31913ab5c0fd4586d08d17d114b8c',true,['version' => 'v3.1']);
  968.           $body = [
  969.             'Messages' => [
  970.                 [
  971.                     'From' => [
  972.                         'Email' => "info@cpi.lu",
  973.                         'Name' => "CPI"
  974.                     ],
  975.                     'To' => [
  976.                         [
  977.                             'Email' => 'info@cpi.lu',
  978.                             
  979.                         ]
  980.                        
  981.                      
  982.                     ],
  983.                     'Bcc' => [  
  984.                         [
  985.                             'Email' => 'damien@piranha.lu',
  986.                         ],
  987.                         [
  988.                             'Email' => 'thomasbregler@protonmail.com',
  989.                         ],
  990.                         [
  991.                             'Email' => $userEmail,
  992.                         ],
  993.                     ],
  994.                    
  995.                     'Subject' => $subject,
  996.                     'HTMLPart' => $message,
  997.                 ]
  998.             ]
  999.         ];
  1000.           $response $mj->post(Resources::$Email, ['body' => $body]);
  1001.           $response->success();
  1002.           
  1003.     
  1004.           return $this->redirectToRoute('app_baseOutils');
  1005.      }
  1006.      
  1007.      
  1008.     /**
  1009.         * @Route("/{locale}/cookies", name="cookies")
  1010.     */
  1011.     public function cookies(): Response
  1012.     {
  1013.         return $this->render('default/cookie.html.twig', [
  1014.             
  1015.            
  1016.         ]);
  1017.     }
  1018.     /**
  1019.         * @Route("/{locale}/politique-de-confidentialite", name="politique")
  1020.     */
  1021.     public function politique(SectionsRepository $sectionsRepositoryPagesRepository $pagesRepositoryTemoignagesRepository $temoignagesRepository): Response
  1022.     {
  1023.         $page $pagesRepository->findOneById(15);
  1024.         $nb count($page->getSections()) +1;
  1025.         
  1026.         $sections $sectionsRepository->findBy(array('Pages'=>15),array('Ordre'=>'asc'));
  1027.         return $this->render('default/politique.html.twig', [
  1028.             'sections' => $sections,
  1029.             'page'=> $page,
  1030.             'ordreMax' =>$nb,
  1031.             'ip' => '90.63.222.84',
  1032.             'temoignages'=>$temoignagesRepository->findAll()
  1033.             
  1034.            
  1035.         ]);
  1036.     }
  1037.     public function findSearch($sujet$type$lieu$ref) {
  1038.         $query $this->createQueryBuilder('s'); // s représente votre entité de session
  1039.     
  1040.         if ($sujet) {
  1041.             $query->andWhere('s.sujetFormation = :sujet')
  1042.                   ->setParameter('sujet'$sujet);
  1043.         }
  1044.     
  1045.         if ($type) {
  1046.             $query->andWhere('s.typeFormation = :type')
  1047.                   ->setParameter('type'$type);
  1048.         }
  1049.     
  1050.         if ($lieu) {
  1051.             $query->andWhere('s.lieu = :lieu')
  1052.                   ->setParameter('lieu'$lieu);
  1053.         }
  1054.     
  1055.         if ($ref) {
  1056.             $query->andWhere('s.ref = :ref')
  1057.                   ->setParameter('ref'$ref);
  1058.         }
  1059.     
  1060.         // Continuez pour les autres critères de filtrage
  1061.     
  1062.         return $query->getQuery()->getResult();
  1063.     }
  1064.      /**
  1065.      * @Route("/{locale}/planning-formation", name="app_planningFormation")
  1066.      */
  1067.     public function planningFormation($locale,FormationsRepository $formationsRepositoryVersionsFormationsRepository $versionsFormationsRepositoryTypesFormationsRepository $typesFormationsRepository,
  1068.     SujetsFormationsRepository $sujetsFormationsRepository,LogicielsFormationsRepository $logicielsFormationsRepositorySessionsFormationsRepository $sessionsFormationsRepositoryRequest $request): Response
  1069.     {
  1070.     
  1071.             $formations $formationsRepository->findBy([], ['Date' => 'ASC']);
  1072.             $sessionsformations $sessionsFormationsRepository->findBy([], ['Date' => 'ASC']);
  1073.             $sessionsformationsAll $sessionsFormationsRepository->findAll();
  1074.             $formationsSearch $formationsRepository->findBy([], ['TitreFr' => 'ASC']);
  1075.             $typeFormation $typesFormationsRepository->findAll();
  1076.             $sujetFormation $sujetsFormationsRepository->findAll();
  1077.             $date $sessionsFormationsRepository->findBy([],['Date'=>'asc']);
  1078.             $tarifs $sessionsFormationsRepository->findBy([],['Tarifs'=>'asc']);
  1079.             
  1080.             $langues $sessionsFormationsRepository->findBy([],['LanguesFr'=>'asc']);
  1081.             $sessionsCriteria=[];
  1082.             $sujetFormation $sujetsFormationsRepository->findAll();
  1083.             $typeFormation $typesFormationsRepository->findAll();
  1084.             if ($request->query->get('sujet')) {
  1085.                 $sessionsCriteria['SujetsFormations'] = $request->query->get('sujet');
  1086.             }
  1087.             if ($request->query->get('type')) {
  1088.                 $sessionsCriteria['TypesFormations'] = $request->query->get('type');
  1089.             }
  1090.             if ($request->query->get('lieu')) {
  1091.                 $sessionsCriteria['Lieu'] = $request->query->get('lieu');
  1092.             }
  1093.             if ($request->query->get('ref')) {
  1094.                 $sessionsCriteria['TitreFr'] = $request->query->get('ref');
  1095.             }
  1096.             $sessionsformations $sessionsFormationsRepository->findByCriteria($sessionsCriteria);
  1097.             
  1098.         
  1099.     
  1100.             return $this->render('default/planningFormation.html.twig', [
  1101.                 'formations' => $formations,
  1102.                 'sessionsformationsAll' => $sessionsformationsAll,
  1103.                 'sessionsformations' => $sessionsformations,
  1104.                 'formationsSearch'=>$formationsSearch,
  1105.                 'typeFormation'=>$typeFormation,
  1106.                 'sujetFormation'=>$sujetFormation,
  1107.             
  1108.                 'sujets' => $sujetsFormationsRepository->findBy([], ['TitreFr' => 'ASC']),
  1109.                 'date' => $date,
  1110.                 'tarifs' => $tarifs,
  1111.                 'langues' => $langues,
  1112.                
  1113.                
  1114.              
  1115.             ]);
  1116.         }
  1117.         
  1118. /**
  1119.         * @Route("/genererpdf/{id}", name="genererpdf")
  1120.     */
  1121.     public function genererpdf(FormationsRepository $formationsRepository,CategoriesFormationsRepository $categoriesFormationsRep,$id): Response
  1122.     {
  1123.         $categoriesFormations $categoriesFormationsRep->findAll();
  1124.         $forma $formationsRepository->findOneById($id);
  1125.         $template $this->renderView('formationPdf.html.twig', [
  1126.             'formations' => $formationsRepository->findOneById($id),
  1127.             'categoriesFormations' => $categoriesFormations
  1128.             
  1129.        ]);
  1130.        $html2pdf = new Html2Pdf();
  1131.        $html2pdf->setDefaultFont('dejavusans'); // Définit 'dejavusans' comme police par défaut
  1132.        $html2pdf->writeHTML($template);
  1133.        $html2pdf->output('formation_cpi_'.$forma->getReference().'.pdf');
  1134.     }
  1135.     /**
  1136.         * @Route("/genererpdfjobs/{id}", name="genererpdfjob")
  1137.     */
  1138.     public function genererpdfjobs(JobsRepository $jobsRepository,$id): Response
  1139.     {
  1140.         $template $this->renderView('jobsPdf.html.twig', [
  1141.             'jobs' => $jobsRepository->findOneById($id)
  1142.        ]);
  1143.        $html2pdf = new Html2Pdf();
  1144.         $html2pdf->writeHTML($template);
  1145.         $html2pdf->output();
  1146.         
  1147.     }
  1148.       /**
  1149.         * @Route("/resultat-recherche", name="resultatRecherche")
  1150.     */
  1151.     public function resultatRecherche(ContenusRepository $ContenusRepositoryFormationsRepository $FormationsRepositoryActualitesRepository $ActualitesRepositoryJobsRepository $JobsRepository): Response
  1152.     {
  1153.         $keyword $_POST['search'];
  1154.         $contenus $ContenusRepository->findSearch($keyword);
  1155.         $formations $FormationsRepository->findSearch($keyword);
  1156.         $actualites $ActualitesRepository->findSearch($keyword);
  1157.         $jobs $JobsRepository->findSearch($keyword);
  1158.     
  1159.         return $this->render('default/resultatRecherche.html.twig', [
  1160.             'contenus'=>$contenus,
  1161.             'formations'=>$formations,
  1162.             'actualites'=>$actualites,
  1163.             'jobs'=>$jobs
  1164.            
  1165.         ]);
  1166.     }
  1167.     /**
  1168.         * @Route("/search", name="search")
  1169.     */
  1170.     public function search(ContenusRepository $ContenusRepositoryFormationsRepository $FormationsRepositoryActualitesRepository $ActualitesRepositoryJobsRepository $JobsRepository): Response
  1171.     {
  1172.         $keyword 'Manufacturing';
  1173.         $contenus $ContenusRepository->findSearch($keyword);
  1174.         $formations $FormationsRepository->findSearch($keyword);
  1175.         $actualites $ActualitesRepository->findSearch($keyword);
  1176.         $jobs $JobsRepository->findSearch($keyword);
  1177.         dd($formations);
  1178.        
  1179.         return new response('ok');
  1180.     }
  1181.     }
  1182.     
  1183.     
  1184. // $formations = $formationsRepository->findBy([], ['TitreFr' => 'ASC']);
  1185. // $formationsSearch = $formationsRepository->findBy([], ['TitreFr' => 'ASC']);
  1186. // $date = $sessionsFormationsRepository->findBy([],['Date'=>'asc']);
  1187. // if(isset($_GET['sujet']))
  1188. // {
  1189. //     $formations = $formationsRepository->findBy(['SujetsFormations'=>$_GET['sujet']]);
  1190. // }
  1191. // $selectedSujet = $request->query->get('sujet');
  1192. // if ($selectedSujet !== null) {
  1193. //     // Filter the sessions by the selected sujet
  1194. //     $formations = $formationsRepository->findBy(['SujetsFormations' => $selectedSujet]);
  1195. // }
  1196. // $reference = $formationsRepository->findBy([],['Reference'=>'asc']);
  1197. // $lieu = $sessionsFormationsRepository->findBy([],['Lieu'=>'desc']);
  1198. // $type = $sessionsFormationsRepository->findBy([], ['Type' => 'desc']);
  1199. // $tarifs = $sessionsFormationsRepository->findBy([], ['Tarifs' => 'desc']);
  1200. // return $this->render('default/planningFormation.html.twig', [
  1201. //     'formations' => $formations,
  1202. //     'date' => $date,
  1203. //     'sujets' =>$sujetsFormationsRepository->findBy([], ['TitreFr' => 'ASC']),
  1204. //     'reference' => $reference,
  1205. //     'lieu'=>$lieu,
  1206. //     'tarifs' => $tarifs,
  1207. //     'type' => $type,
  1208. //     'catLieu'=>$sessionsFormationsRepository->findBy([], ['Lieu' => 'ASC']),
  1209. //     'selectedSujet' => $selectedSujet,
  1210. // ]);