src/Controller/IndexController.php line 726

Open in your IDE?
  1. <?php
  2. // src/Controller/LuckyController.php
  3. namespace App\Controller;
  4. use App\Services\MetaTag;
  5. use App\Controller\EntityUsingController;
  6. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  7. use App\Services\Buzz\BuzzIndexPageProvider;
  8. use App\Services\ManagerEntity\{
  9.     ActualitesManagers,
  10.     AnnuairesManagers,
  11.     AnnoncesManagers,
  12.     DocumentationManagers,
  13.     FormationsManager,
  14.     QuestionsSemaineManagers,
  15.     WebinarManager,
  16.     BusinessAngelManagers
  17. };
  18.  
  19. use Symfony\Component\Form\Extension\Core\Type\ButtonType;
  20. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  21. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  22. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  23. use Symfony\Component\Form\Extension\Core\Type\TextType;
  24. use Symfony\Component\Form\Forms;
  25. use Symfony\Component\HttpFoundation\Request;
  26. use Symfony\Component\HttpFoundation\Response;
  27. use App\Services\LangCodePaysHandler;
  28. use App\Helper\Utils;
  29. use App\Twig\TranslationExtension;
  30. use App\Repository\AnnoncesPubliquesRepository;
  31. use App\Entity\{
  32.     AnnoncesVendeur,Localisations,
  33.     AnnoncesAcheteur,
  34.     Societes,
  35.     AnnuaireRepreneurs,
  36.     InvestisseursPrives,
  37.     BuzzActualites,
  38.     UtilisateursInteractions,
  39.     SuiviUtilisateur
  40. };
  41. use App\Form\Models\ContactPubFusacqExpert;
  42. use App\Services\ContactPubFusacqExpert as ContactPubFusacqExpertService;
  43. use App\Form\Type\ContactPubFusacqExpertType;
  44. use App\Services\CacheHandler;
  45. use Symfony\Component\Serializer\Serializer;
  46. use Symfony\Component\Serializer\SerializerInterface;
  47. use App\Services\RedisCacheDB;
  48. use App\Services\Encryptage\AesEncrytageStrategy;
  49. use Doctrine\ORM\EntityManagerInterface;
  50.  
  51. use App\Services\LogUtilisateurs\LogUtilisateursHandler;
  52. class IndexController extends EntityUsingController {
  53.     /**
  54.      * @var Serializer
  55.      */
  56.     private $serializer;
  57.     /**
  58.      * @var RedisCacheDB
  59.      */
  60.     private $redisCacheDB;
  61.     /**
  62.      * @var CacheHandler
  63.      */
  64.     private $cacheHandler;
  65.     public const CACHE_TTL 259200// 72heures 3 jours
  66.     public const MAX_AGE 43200// 12heures
  67.     /**
  68.      * @var \App\Controller\WebinarManager
  69.      */
  70.     private $wm;
  71.     /**
  72.      * @var \App\Controller\FormationsManager
  73.      */
  74.     private $fm;
  75.     /**
  76.      * @var \App\Controller\ActualitesManagers
  77.      */
  78.     private $actm;
  79.     /**
  80.      * @var QuestionsSemaineManagers
  81.      */
  82.     private $qsm;
  83.     /**
  84.      * @var AnnuairesManagers
  85.      */
  86.     private $am;
  87.     /**
  88.      * @var TranslationExtension
  89.      */
  90.     private $translationExtension;
  91.     private $documentationManagers;
  92.     /**
  93.      * @var LangCodePaysHandler
  94.      */
  95.     private $codePaysHandler;
  96.     /**
  97.      * @var BusinessAngelManagers
  98.      */
  99.     private $bam;
  100.     /**
  101.      * @var MetaTag
  102.      */
  103.     private $metaTag;
  104.     /**
  105.      * @var string
  106.      */
  107.     private $lang;
  108.     /**
  109.      * @var EntityManagerInterface
  110.      */
  111.     protected $em;
  112.     /**
  113.      * @var AesEncrytageStrategy
  114.      */
  115.     private $encrypt;
  116.     
  117.     protected $logUtilisateursHandler;
  118.     /**
  119.      * @var BuzzIndexPageProvider
  120.      */
  121.     private $buzzIndexPageProvider;
  122.     /**
  123.      * @param \App\Services\ManagerEntity\WebinarManager $wm
  124.      */
  125.     public function __construct(
  126.             WebinarManager $wm,
  127.             FormationsManager $fm,
  128.             AnnuairesManagers $am,
  129.             ActualitesManagers $actm,
  130.             DocumentationManagers $documentationManagers,
  131.             QuestionsSemaineManagers $qsm,
  132.             LangCodePaysHandler $codePaysHandler,
  133.             ParameterBagInterface $params,
  134.             AnnoncesPubliquesRepository $apr,
  135.             AnnoncesManagers $anm,
  136.             TranslationExtension $translationExtension,
  137.             BusinessAngelManagers $bam,
  138.             MetaTag $metaTag,
  139.             LogUtilisateursHandler $logUtilisateursHandler,
  140.             BuzzIndexPageProvider $buzzIndexPageProvider,
  141.             SerializerInterface $serializerRedisCacheDB $redisCacheDBCacheHandler $cacheHandlerAesEncrytageStrategy $aesEncrytageStrategyEntityManagerInterface $em
  142.     ) {
  143.         $this->wm $wm;
  144.         $this->fm $fm;
  145.         $this->am $am;
  146.         $this->actm $actm;
  147.         $this->qsm $qsm;
  148.         $this->documentationManagers $documentationManagers;
  149.         $this->codePaysHandler $codePaysHandler;
  150.         $this->params $params;
  151.         $this->apr $apr;
  152.         $this->anm $anm;
  153.         $this->translationExtension $translationExtension;
  154.         $this->bam $bam;
  155.         $this->metaTag $metaTag;
  156.         $this->buzzIndexPageProvider $buzzIndexPageProvider;
  157.         $this->lang $codePaysHandler->getLang();
  158.         $this->cacheHandler $cacheHandler;
  159.         $this->redisCacheDB $redisCacheDB;
  160.         $this->serializer $serializer;
  161.         $this->encrypt $aesEncrytageStrategy;
  162.         $this->em $em;
  163.         $this->logUtilisateursHandler $logUtilisateursHandler;
  164.     }
  165.     public function index(Request $request$codePays ): Response {
  166.         $response $this->render("index/index_" $this->getVersionByCodePays($codePays) . ".html.twig", []);
  167.         $response->setPublic();
  168.         $response->setMaxAge(self::MAX_AGE); // 12heures
  169.         $response->headers->addCacheControlDirective('must-revalidate'true);
  170.         return $response;
  171.     }
  172. // https://www.fusacq.com/symf_fr_
  173. // http://symfony.fusacq.com/symf_fr_
  174. //
  175.     public function test(): Response {
  176.         return $this->render('index/test.html.twig', []);
  177.     }
  178.     public function cookie(): Response {
  179.         return $this->render('index/cookie.html.twig', []);
  180.     }
  181.     public function reactiveCompteRgpd($id$codePays): Response {
  182.         $idUtilisateur $this->encrypt->decryptage($id);
  183.         if (!is_numeric($idUtilisateur)) {
  184.             return $this->redirect('/');
  185.         }
  186.         $interactionUtilisateur $this->em->getRepository(UtilisateursInteractions::class)->findOneBy(array(
  187.             'id_utilisateur' => $idUtilisateur
  188.         ));
  189.         if (empty($interactionUtilisateur)) {
  190.             return $this->redirect('/');
  191.         }
  192.         $plateform_interaction $interactionUtilisateur->_get("plateform_interaction");
  193.         if ($plateform_interaction == "RETIF" || $plateform_interaction == "retif") {
  194.             $motSujet "RETIF / Place des Commerces";
  195.             $lienLogo "https://www.placedescommerces.com/images/logo_PDC.png";
  196.             $lienSite "https://www.placedescommerces.com";
  197.         } elseif ($plateform_interaction == "uimm" || $plateform_interaction == "UIMM") {
  198.             $motSujet "UIMM / FUSACQ";
  199.             $lienLogo "https://content.fusacq.com/static/help-fusacq/fr/css/images/logo_fusacq2.gif";
  200.             $lienSite "https://opportunites-industrielles.uimm.fr/";
  201.         } elseif ($plateform_interaction == "transmibat" || $plateform_interaction == "TRANSMIBAT") {
  202.             $motSujet "TRANSMIBAT / FUSACQ";
  203.             $lienLogo "https://content.fusacq.com/static/help-fusacq/fr/css/images/logo_fusacq2.gif";
  204.             $lienSite "https://www.transmibat.fr/";
  205.         } elseif ($plateform_interaction == "PDC") {
  206.             $motSujet "Place des Commerces";
  207.             $lienLogo "https://www.placedescommerces.com/images/logo_PDC.png";
  208.             $lienSite "https://www.placedescommerces.com";
  209.         } elseif ($plateform_interaction == "PDF") {
  210.             $motSujet "Place des Franchises";
  211.             $lienLogo 'https://static.placedesfranchises.com/img/logo_mail.jpg';
  212.             $lienSite "https://www.placedesfranchises.com";
  213.         } else {
  214.             $motSujet "FUSACQ";
  215.             $lienLogo "https://content.fusacq.com/static/help-fusacq/fr/css/images/logo_fusacq2.gif";
  216.             $lienSite "https://www.fusacq.com";
  217.         }
  218.         $interactionUtilisateur->_set("date_time_interaction"date("YmdHis"));
  219.         $interactionUtilisateur->_set("date_action_anonymisation_totale"null);
  220.         $interactionUtilisateur->_set("date_action_anonymisation"null);
  221.         $interactionUtilisateur->_set("anonymisation_rgpd"null);
  222.         $interactionUtilisateur->_set("type_interaction""reactive");
  223.         //$interactionUtilisateur->_set("plateform_interaction", "FUSACQ");
  224.         try {
  225.             $this->em->persist($interactionUtilisateur);
  226.             $this->em->flush($interactionUtilisateur);
  227.         } catch (\Exception $e) {
  228.             
  229.         }
  230.         $suiviUtilisateur = new SuiviUtilisateur();
  231.         $suiviUtilisateur->_set("id_utilisateur"$idUtilisateur);
  232.         $suiviUtilisateur->_set("date_suivi"date("Ymd"));
  233.         $suiviUtilisateur->_set("nom_administrateur""admin");
  234.         $suiviUtilisateur->_set("detail_action""RGPD : L'utilisateur ne souhaite pas que son compte soit désactivé");
  235.         try {
  236.             $this->em->persist($suiviUtilisateur);
  237.             $this->em->flush($suiviUtilisateur);
  238.         } catch (\Exception $e) {
  239.             
  240.         }
  241.         return $this->render('index/reactive_compte_rgpd.html.twig', [
  242.                     'codePays' => $codePays,
  243.                     'lienSite' => $lienSite,
  244.                     'lienLogo' => $lienLogo,
  245.                     'motSujet' => $motSujet
  246.         ]);
  247.     }
  248.     public function first(string $word): Response {
  249.         return new Response(
  250.                 '<html><body> ' $word '</body></html>'
  251.         );
  252.     }
  253.     public function redirectionLienMail(Request $request$codePays): Response {
  254.         /*
  255.          *  case "annonces_acquisition_public":$page_de_redirection = "/espace_reprise";
  256.           break;
  257.           case "annuaire_repreneurs_public":$page_de_redirection = "/annuaire-repreneurs";
  258.           break;
  259.           case "demande_de_pret_financement":$page_de_redirection = "/pret-reprise-entreprise";
  260.           break;
  261.           case "annuaire_des_participations_des_fonds":$page_de_redirection = "/participations/liste_participations.php?id_page=1&tri=invest_down";
  262.           break;
  263.           case "annuaire_des_fonds_d_investissement":$page_de_redirection = "/annuaire-fonds-investissement";
  264.           break;
  265.           case "simulateur_reprise_entreprise":$page_de_redirection = "/simulateur-reprise-entreprise#refSollicitation";
  266.           break;
  267.           case "abonnement_tarif":$page_de_redirection = "/tarifs/tarifs.php";
  268.           break;
  269.           case "annonce_cession":$page_de_redirection = "/espace_cession";
  270.           break;
  271.           case "financement_detail":$page_de_redirection = "/financement-detail";
  272.           break;
  273.           case "annuaire_experts": $page_de_redirection = "/annuaire_experts";
  274.           break;
  275.           case "annuaire_repreneur": $page_de_redirection = "/annuaire-repreneurs"; // "/annuaire_repreneurs_recherche/liste.php";
  276.           break;
  277.           case "formation_croissance_externe": $page_de_redirection = "/formation-croissance-externe";
  278.           break;
  279.           case "formation_reprise": $page_de_redirection = "/formation-reprise-entreprise";
  280.           break;
  281.           case "base_valorisation": $page_de_redirection = "/evaluation-d-entreprise";
  282.           break;
  283.           case "buzz": $page_de_redirection = "/buzz";
  284.           break;
  285.           case "espace_cession": $page_de_redirection = "/espace_cession";
  286.           break;
  287.           case "offre_fusacq_expert": $page_de_redirection = "/offre-fusacq-expert";
  288.           break;
  289.          * */
  290.         $parametres $request->query->all();
  291.         $lien "/compte";
  292.         if (!empty($parametres["type_redirection"])) {
  293.             $lien $parametres["type_redirection"];
  294.         }
  295.         return $this->redirect($lien);
  296.     }
  297.     public function authredirect(Request $request): Response {
  298.         $codePays $request->getSession()->get('codePays');
  299.         return $this->redirectToRoute('index', ['codePays' => $codePays]);
  300.     }
  301.     public function deconnexion(Request $request): Response {
  302.         return $this->redirectToRoute('app_logout');
  303.     }
  304.     public function prochainWebinar($lang$codePays): Response {
  305.         $prochainWebinar $this->wm->getProchainWebinar();
  306.         $response $this->render(
  307.                 "index/fragments/prochain_webinar_" strtolower($this->getVersionByCodePays($codePays)) . ".html.twig",
  308.                 [
  309.                     'lang' => $lang,
  310.                     'prochainWebinar' => $prochainWebinar,
  311.                     'codePays' => $codePays,
  312.                 ]
  313.         );
  314.         $response->setPublic();
  315.         $response->setMaxAge(self::MAX_AGE); // 12heures
  316.         return $response;
  317.     }
  318.     public function dernieresFormations($lang$codePays): Response {
  319.         $formations $this->fm->getDernieresFormations(5);
  320.         // on complete la liste par des à venir pour afficher 5 exactement
  321.         $formations[] = [
  322.             "date_formation" => "",
  323.             "type_lieu_session" => "",
  324.             "id_date_formation" => "",
  325.             "id_formation" => "7",
  326.             "reference" => "JR1",
  327.             "dates" => "A venir",
  328.             "titre" => "Formation à la reprise d'entreprise"
  329.         ];
  330.         $formations[] = [
  331.             "date_formation" => "",
  332.             "type_lieu_session" => "",
  333.             "id_date_formation" => "",
  334.             "id_formation" => "24",
  335.             "reference" => "CE1",
  336.             "dates" => "A venir",
  337.             "titre" => "Formation à la croissance externe"
  338.         ];
  339.         $formations[] = [
  340.             "date_formation" => "",
  341.             "type_lieu_session" => "",
  342.             "id_date_formation" => "",
  343.             "id_formation" => "43",
  344.             "reference" => "CE1",
  345.             "dates" => "A venir",
  346.             "titre" => "Formation à la reprise de commerce"
  347.         ];
  348.         $formations[] = [
  349.             "date_formation" => "",
  350.             "type_lieu_session" => "",
  351.             "id_date_formation" => "",
  352.             "id_formation" => "61",
  353.             "reference" => "MOD34",
  354.             "dates" => "A venir",
  355.             "titre" => "Savoir lire et analyser un Bilan et un Compte de résultat, sur 2 jours"
  356.         ];
  357.         $formations array_slice($formations05);        // on complete la liste par des à venir pour afficher 5 exactement
  358.         $response $this->render(
  359.                 'index/fragments/dernieres_formations.html.twig',
  360.                 [
  361.                     'lang' => $lang,
  362.                     'formations' => $formations,
  363.                     'codePays' => $codePays,
  364.                 ]
  365.         );
  366.         $response->setPublic();
  367.         $response->setMaxAge(self::MAX_AGE); // 12heures
  368.         return $response;
  369.     }
  370.     /**
  371.      * @param $lang
  372.      * @param $codePays
  373.      * @return \Symfony\Component\HttpFoundation\Response
  374.      * @throws \Exception
  375.      */
  376.     public function derniersExperts($lang$codePays) {
  377.         $experts $this->am->getDerniersExperts($this->getIdPaysByCodePays($codePays));
  378.         $formFactory Forms::createFormFactoryBuilder()->getFormFactory();
  379.         $form $formFactory->createBuilder()
  380.                 ->add('searchWord'TextType::class)
  381.                 ->setAction($this->generateUrl('annuaires_experts_recherche', ['codePays' => $codePays]))
  382.                 ->setMethod('GET')
  383.                 ->getForm();
  384.         return $this->render(
  385.                         'index/fragments/derniers_experts.html.twig',
  386.                         [
  387.                             'lang' => $lang,
  388.                             'experts' => $experts,
  389.                             'codePays' => $codePays'form' => $form->createView(),
  390.                         ]
  391.                 );
  392.     }
  393.     /**
  394.      *
  395.      * @param type $lang
  396.      * @param type $codePays
  397.      * @return type
  398.      */
  399.     public function dernieresAnnoncesPDC($lang$codePays) {
  400.         $annonces $this->apr->getDernieresAnnoncesPDC($this->getIdPaysByCodePays($codePays));
  401.         $response $this->render(
  402.                 "index/fragments/dernieres_annonces_pdc.html.twig",
  403.                 [
  404.                     'lang' => $lang,
  405.                     'annonces' => $annonces,
  406.                     'codePays' => $codePays,
  407.                 ]
  408.         );
  409.         $response->setPublic();
  410.         $response->setMaxAge(self::MAX_AGE); // 12heures
  411.         return $response;
  412.     }
  413.     /**
  414.      * @param type $lang
  415.      * @param type $codePays
  416.      * @return type
  417.      */
  418.     public function dernieresAnnoncesFusacqAlaUne($lang$codePays) {
  419.         $annonces $this->anm->getAnnoncesAlaUnePageAccueil($this->getIdPaysByCodePays($codePays));
  420.         $response $this->render(
  421.                 "index/fragments/dernieres_annonces_fusacq_alaune.html.twig",
  422.                 [
  423.                     'lang' => $lang,
  424.                     'annonces' => $annonces,
  425.                     'codePays' => $codePays,
  426.                 ]
  427.         );
  428.         $response->setPublic();
  429.         $response->setMaxAge(self::MAX_AGE); // 12heures
  430.         return $response;
  431.     }
  432.     /**
  433.      * @param $lang
  434.      * @param $codePays
  435.      * @return \Symfony\Component\HttpFoundation\Response
  436.      */
  437.     public function derniersCVRepreneurs($lang$codePays) {
  438.         $CVs $this->am->getDerniersCVRepreneurs($this->getIdPaysByCodePays($codePays));
  439.         $formFactory Forms::createFormFactoryBuilder()->getFormFactory();
  440.         $form $formFactory->createBuilder()
  441.                 ->add('mots_cle_recherche'TextType::class)
  442.                 ->setAction($this->generateUrl('annuaires_repreneurs_recherche', ['codePays' => $codePays]))
  443.                 ->setMethod('GET')
  444.                 ->getForm();
  445.         return $this->render(
  446.                         'index/fragments/derniers_cv_repreneurs.html.twig',
  447.                         [
  448.                             'lang' => $lang,
  449.                             'CVs' => $CVs,
  450.                             'codePays' => $codePays'form' => $form->createView(),
  451.                         ]
  452.                 );
  453.     }
  454.     /**
  455.      *
  456.      * @param type $lang
  457.      * @param type $codePays
  458.      * @return type
  459.      */
  460.     public function derniersActualiteExperts($lang$codePays) {
  461.         $actualites $this->actm->getDerniersActualitesExperts($limit 5$this->getIdPaysByCodePays($codePays));
  462.         $response $this->render(
  463.                 'index/fragments/derniers_actualite_experts.html.twig',
  464.                 [
  465.                     'lang' => $lang,
  466.                     'actualites' => $actualites,
  467.                     'codePays' => $codePays,
  468.                 ]
  469.         );
  470.         $response->setPublic();
  471.         $response->setMaxAge(self::MAX_AGE); // 12heures
  472.         return $response;
  473.     }
  474.     /**
  475.      * @param $lang
  476.      * @param $codePays
  477.      * @return mixed
  478.      */
  479.     public function avisExpert($lang$codePays) {
  480.         $avis $this->documentationManagers->randomAvis(); // random avis
  481.         $response $this->render(
  482.                 'index/fragments/avis_expert.html.twig',
  483.                 [
  484.                     'lang' => $lang"avis" => $avis,
  485.                     'codePays' => $codePays,
  486.                 ]
  487.         );
  488.         $response->setPublic();
  489.         $response->setMaxAge(self::MAX_AGE); // 12heures
  490.         return $response;
  491.     }
  492.     /**
  493.      *
  494.      * @param type $lang
  495.      * @param type $codePays
  496.      * @return type
  497.      */
  498.     public function evenements($lang$codePays) {
  499.         $event $this->getDoctrine()->getRepository(BuzzActualites::class)->getDernierEvennement();
  500.         if (!$event) {
  501.             $actu $this->getDoctrine()->getRepository(BuzzActualites::class)->getDerniereActu($this->getIdPaysByCodePays($codePays));
  502.         }
  503.         $response $this->render(
  504.                 'index/fragments/evenements.html.twig',
  505.                 [
  506.                     'lang' => $lang,
  507.                     "event" => $event,
  508.                     "actu" => $actu ?? NULL,
  509.                     'codePays' => $codePays,
  510.                 ]
  511.         );
  512.         $response->setPublic();
  513.         $response->setMaxAge(self::MAX_AGE); // 12heures
  514.         return $response;
  515.     }
  516.     /**
  517.      * Récupère et affiche les dernières actualités Fusacq Buzz 
  518.      *
  519.      * @param string $lang 
  520.      * @param string $codePays 
  521.      * @return Response
  522.      */
  523.     public function toutesActuFusacqBuzz($lang$codePays): Response
  524.     {
  525.         $idPays $this->getIdPaysByCodePays($codePays);
  526.         $actualitesRaw $this->getDoctrine()
  527.             ->getRepository(BuzzActualites::class)
  528.             ->getDernieresActuFusionsAcquisitions($idPays);
  529.         $actualites array_map([$this->buzzIndexPageProvider'formatArticle'], $actualitesRaw);
  530.         $response $this->render(
  531.             'index/fragments/toutes_actu_fusacq_buzz.html.twig',
  532.             [
  533.                 'lang' => $lang,
  534.                 'actualites' => $actualites,
  535.                 'codePays' => $codePays,
  536.             ]
  537.         );
  538.         $response->setPublic();
  539.         $response->setMaxAge(self::MAX_AGE);
  540.         return $response;
  541.     }
  542.     /**
  543.      * @param $lang
  544.      * @param $codePays
  545.      * @return mixed
  546.      * @throws \Exception
  547.      */
  548.     public function laQuestionDeLaSemaine($lang$codePays) {
  549.         $question $this->qsm->derniereQuestion();
  550.         $response $this->render(
  551.                 'index/fragments/la_question_de_la_semaine.html.twig',
  552.                 [
  553.                     'lang' => $lang,
  554.                     'question' => $question,
  555.                     'codePays' => $codePays,
  556.                 ]
  557.         );
  558.         $response->setPublic();
  559.         $response->setMaxAge(self::MAX_AGE); // 12heures
  560.         return $response;
  561.     }
  562.     /**
  563.      * @param $codePays
  564.      * @return mixed
  565.      */
  566.     public function offreFusacqExpert(Request $requestContactPubFusacqExpertService $contactPubFusacqExpert$codePays) {
  567.         $model = new ContactPubFusacqExpert();
  568.         $form_contact $this->createForm(ContactPubFusacqExpertType::class, $model, [
  569.             'action' => $this->generateUrl(
  570.                     'offreFusacqExpert',
  571.                     [
  572.                         'codePays' => $codePays,
  573.                     ]
  574.             ),
  575.             'method' => 'POST',
  576.         ]);
  577.         $form_contact->handleRequest($request);
  578.         if ($form_contact->isSubmitted()) {
  579.             if ($form_contact->isValid()) {
  580.                 $data $form_contact->getData();
  581.                 $response $contactPubFusacqExpert->sendMail($data);
  582.                 if ($response) {
  583.                     $this->addFlash('success'"votre message est bien envoye");
  584.                 } else {
  585.                     $this->addFlash('error'"l'envoi de votre message a echoue");
  586.                 }
  587.             } else {
  588.                 $this->addFlash('error'"l'envoi de votre message a echoue");
  589.             }
  590.         }
  591.         $response $this->render(
  592.                 'index/offre_fusacq_expert.html.twig',
  593.                 [
  594.                     'codePays' => $codePays,
  595.                     'form_contact' => $form_contact->createView()
  596.                 ]
  597.         );
  598.         $response->setPublic();
  599.         $response->setMaxAge(self::MAX_AGE); // 12heures
  600.         return $response;
  601.     }
  602.     /**
  603.      * @param $lang
  604.      * @param $codePays
  605.      * @return \Symfony\Component\HttpFoundation\Response
  606.      */
  607.     public function ongletReprendreUneEntreprise($lang$codePays) {
  608.         $id_pays $this->getIdPaysByCodePays($codePays);
  609.         $nb_actifs NULL;
  610.         $nb_entreprises NULL;
  611.         $nb_cibles_potentielles NULL;
  612.         $nb_recherches_partenariat NULL;
  613.         $nb_annonces_reprendre_entreprise NULL;
  614.         $pays_cession $this->anm->donne_option_select_pays_annonce_vente($id_pays);
  615.         $txt_region $this->translationExtension->translate('toutes les regions'$lang"""M""");
  616.         $regions = [$txt_region => 0];
  617.         $formFactory Forms::createFormFactoryBuilder()->getFormFactory();
  618.         $form_reprendre_entreprise $formFactory->createNamedBuilder('')
  619.                 ->add('id_pays'ChoiceType::class, [
  620.                     'choices' => $pays_cession
  621.                 ])
  622.                 ->add('id_region'ChoiceType::class, [
  623.                     'choices' => $regions
  624.                 ])
  625.                 ->add('reference_mots_cles'TextType::class, [
  626.                     'required' => false,
  627.                     'attr' => array(
  628.                         'placeholder' => $this->translationExtension->translate("ex. transport, métalurgie, V35455, ..."$lang'''M''')
  629.                     )
  630.                 ])
  631.                 ->add('type_recherche'HiddenType::class, [
  632.                     'data' => 5,
  633.                 ])
  634.                 ->add('rechercher'SubmitType::class)
  635.                 ->setAction($this->generateUrl('reprendre_entreprise_resultats_annonces_cession_entreprise', ['codePays' => "_" $codePays "_"]))
  636.                 ->setMethod('GET')
  637.                 ->getForm();
  638.         return $this->render(
  639.                         'index/fragments/onglet_reprendre_une_entreprise.html.twig',
  640.                         [
  641.                             'nb_annonces_reprendre_entreprise' => $nb_annonces_reprendre_entreprise,
  642.                             'nb_entreprises' => $nb_entreprises,
  643.                             'nb_actifs' => $nb_actifs,
  644.                             'nb_cibles_potentielles' => $nb_cibles_potentielles,
  645.                             'nb_recherches_partenariat' => $nb_recherches_partenariat,
  646.                             'lang' => $lang,
  647.                             'form_reprendre_entreprise' => $form_reprendre_entreprise->createView(),
  648.                             'codePaysWithUnderScore' => '_' $codePays '_'
  649.                         ]
  650.                 );
  651.     }
  652.     /**
  653.      * @param $lang
  654.      * @param $codePays
  655.      * @return \Symfony\Component\HttpFoundation\Response
  656.      */
  657.     public function ongletVendreUneEntreprise($lang$codePays) {
  658.         $id_pays $this->getIdPaysByCodePays($codePays);
  659.         $nb_annonces_acheteur NULL;
  660.         $nb_recherches_partenariats NULL;
  661.         $nb_acquisitions NULL;
  662.         $nb_cv NULL;
  663.         $nb_acquereurs_historiques NULL;
  664.         $nb_participations_fonds NULL;
  665.         $nb_acheteurs_potentiels NULL;
  666.         $nb_investisseurs_acquereurs NULL;
  667.         $nb_annonces_vendre_entreprise NULL;
  668.         $pays_acquisition $this->anm->donne_option_select_pays_annonces_acheteur("entreprise"$id_pays);
  669.         $txt_region $this->translationExtension->translate('toutes les regions'$lang"""M""");
  670.         $regions = [$txt_region => 0];
  671.         $formFactory Forms::createFormFactoryBuilder()->getFormFactory();
  672.         $form_vendre_entreprise $formFactory->createNamedBuilder('')
  673.                 ->add('id_pays'ChoiceType::class, [
  674.                     'choices' => $pays_acquisition
  675.                 ])
  676.                 ->add('id_region'ChoiceType::class, [
  677.                     'choices' => $regions
  678.                 ])
  679.                 ->add('reference_mots_cles'TextType::class, [
  680.                     'required' => false,
  681.                     'attr' => array(
  682.                         'placeholder' => $this->translationExtension->translate("ex. transport, metallurgie, hotellerie, ..."$lang'''M''')
  683.                     )
  684.                 ])
  685.                 ->add('type_recherche'HiddenType::class, [
  686.                     'data' => 5,
  687.                 ])
  688.                 ->add('rechercher'SubmitType::class)
  689.                 ->setAction($this->generateUrl('vendre_entreprise_resultats_annonces_acquisition', ['codePays' => "_" $codePays "_"]))
  690.                 ->setMethod('GET')
  691.                 ->getForm();
  692.         return $this->render(
  693.                         'index/fragments/onglet_vendre_une_entreprise.html.twig',
  694.                         [
  695.                             'nb_annonces_vendre_entreprise' => $nb_annonces_vendre_entreprise,
  696.                             'nb_acquisitions' => $nb_acquisitions,
  697.                             'nb_cv' => $nb_cv,
  698.                             'nb_acheteurs_potentiels' => $nb_acheteurs_potentiels,
  699.                             'nb_investisseurs_acquereurs' => $nb_investisseurs_acquereurs,
  700.                             'lang' => $lang,
  701.                             'form_vendre_entreprise' => $form_vendre_entreprise->createView(),
  702.                             'codePaysWithUnderScore' => '_' $codePays '_'
  703.                         ]
  704.                 );
  705.     }
  706.     /**
  707.      * @param $lang
  708.      * @param $codePays
  709.      * @return \Symfony\Component\HttpFoundation\Response
  710.      */
  711.     public function ongletOuvrirMonCapital($lang$codePays) {
  712.         $id_pays $this->getIdPaysByCodePays($codePays);
  713.         $nb_business_angel NULL;
  714.         $nb_cv_repreneurs_investisseurs NULL;
  715.         $nb_acquereurs_investisseurs NULL;
  716.         $nb_fonds_investissement NULL;
  717.         $nb_annonces_ouvrir_capital NULL;
  718.         $pays_business_angel $this->bam->donne_option_select_pays_business_angel($id_pays);
  719.         $txt_region $this->translationExtension->translate('toutes les regions'$lang"""M""");
  720.         $regions = [$txt_region => 0];
  721.         $formFactory Forms::createFormFactoryBuilder()->getFormFactory();
  722.         $form_ouvrir_capital $formFactory->createNamedBuilder('')
  723.                 ->add('id_pays'ChoiceType::class, [
  724.                     'choices' => $pays_business_angel
  725.                 ])
  726.                 ->add('id_region'ChoiceType::class, [
  727.                     'choices' => $regions
  728.                 ])
  729.                 ->add('reference_mots_cles'TextType::class, [
  730.                     'required' => false,
  731.                     'attr' => array(
  732.                         'placeholder' => $this->translationExtension->translate("ex. transport, metallurgie, hotellerie, ..."$lang'''M''')
  733.                     )
  734.                 ])
  735.                 ->add('type_recherche'HiddenType::class, [
  736.                     'data' => 5,
  737.                 ])
  738.                 ->add('rechercher'SubmitType::class)
  739.                 ->setAction($this->generateUrl('ouvrir_capital_resultats_business_angel', ['codePays' => "_" $codePays "_"]))
  740.                 ->setMethod('GET')
  741.                 ->getForm();
  742.         return $this->render(
  743.                         'index/fragments/onglet_ouvrir_mon_capital.html.twig',
  744.                         [
  745.                             'nb_annonces_ouvrir_capital' => $nb_annonces_ouvrir_capital,
  746.                             'nb_business_angel' => $nb_business_angel,
  747.                             'nb_cv_repreneurs_investisseurs' => $nb_cv_repreneurs_investisseurs,
  748.                             'nb_acquereurs_investisseurs' => $nb_acquereurs_investisseurs,
  749.                             'nb_fonds_investissement' => $nb_fonds_investissement,
  750.                             'lang' => $lang,
  751.                             'form_ouvrir_capital' => $form_ouvrir_capital->createView(),
  752.                             'codePaysWithUnderScore' => '_' $codePays '_'
  753.                         ]
  754.                 );
  755.     }
  756.     /**
  757.      *
  758.      * @param type $codePays
  759.      * @return type
  760.      */
  761.     private function getVersionByCodePays($codePays) {
  762.         return Utils::codePaysWithoutDash($codePays);
  763.     }
  764.     /**
  765.      * @param type $codePays
  766.      * @return type
  767.      */
  768.     private function getIdPaysByCodePays($codePays) {
  769.         return $this->container->get("id_pays_by_code_pays")->getIdPaysByCodePays($codePays);
  770.     }
  771.     public function logUtilisateursHandler() { // Service pour logger utilisateur avec service = 68
  772.         $response = new Response(''Response::HTTP_NOT_FOUND);
  773.         $response->setPublic();
  774.         $response->setMaxAge(self::MAX_AGE); // 12heures
  775.         return $this->logUtilisateursHandler->main($response);
  776.     }
  777. }