src/Controller/DefaultController.php line 38

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\BlogArticle;
  4. use App\Entity\Contract;
  5. use App\Entity\ContractComment;
  6. use App\Entity\ContractEstate;
  7. use App\Entity\ContractPicture;
  8. use App\Entity\ContractPromupInfo;
  9. use App\Entity\Notification;
  10. use App\Entity\Opinion;
  11. use App\Entity\RefTown;
  12. use App\Entity\Sponsorship;
  13. use App\Entity\User;
  14. use App\Service\AntiSpamService;
  15. use App\Service\EmailService;
  16. use App\Service\GeolocService;
  17. use App\Service\PdfService;
  18. use Sensio\Bundle\FrameworkExtraBundle\Configuration as FE;
  19. use Symfony\Component\HttpFoundation\Request;
  20. use Symfony\Component\HttpFoundation\RequestStack;
  21. use Symfony\Component\HttpFoundation\Response;
  22. use Symfony\Component\HttpFoundation\ResponseHeaderBag;
  23. use Symfony\Component\Routing\Annotation\Route;
  24. use App\Form\Type as FormType;
  25. class DefaultController extends AbstractBaseController
  26. {
  27. /**
  28. * @Route("/_navbar", name="navbar")
  29. * @FE\Template()
  30. *
  31. * @param RequestStack $oRequestStack
  32. *
  33. * @return array
  34. */
  35. public function _navbar(RequestStack $oRequestStack): array
  36. {
  37. return [
  38. 'request_attributes' => $oRequestStack->getMainRequest()->attributes,
  39. ];
  40. }
  41. /**
  42. * @Route("/", name="homepage")
  43. * @FE\Cache(public=true, smaxage=60)
  44. *
  45. * @return Response
  46. */
  47. public function homepage(): Response
  48. {
  49. return $this->cacheResponse($this->render('default/homepage.html.twig', [
  50. 'form_search' => null,
  51. 'form_contract' => $this->createForm(FormType\ContractEstateSearchType::class)->createView(),
  52. 'contracts' => $this->getDoctrineRepository(Contract::class)->findBy(['status' => Contract::STATUS_ACCEPTED, 'isDiffusion' => true], ['id' => 'DESC'], 8),
  53. 'opinions' => $this->getDoctrineRepository(Opinion::class)->findByCriterias(),
  54. ]));
  55. }
  56. /**
  57. * @Route("/agence", name="agency")
  58. * @FE\Cache(public=true, smaxage=600)
  59. *
  60. * @return Response|array
  61. */
  62. public function agency()
  63. {
  64. return $this->cacheResponse($this->render('default/agency.html.twig'));
  65. }
  66. /**
  67. * @Route("/pack-multi-diffusion", name="pack")
  68. * @FE\Cache(public=true, smaxage=600)
  69. *
  70. * @return Response|array
  71. */
  72. public function pack()
  73. {
  74. return $this->cacheResponse($this->render('default/pack.html.twig'));
  75. }
  76. /**
  77. * @Route("/nous-rejoindre", name="join_us")
  78. * @FE\Template()
  79. *
  80. * @param Request $oRequest
  81. * @param EmailService $oEmailSrv
  82. * @param AntiSpamService $oAntispamServ
  83. *
  84. * @return Response|array
  85. */
  86. public function joinUs(Request $oRequest, EmailService $oEmailSrv, AntiSpamService $oAntispamServ)
  87. {
  88. $oContract = null;
  89. $aFormData = [];
  90. $oForm = $this->createForm(FormType\JoinUsType::class, $aFormData);
  91. $oForm->handleRequest($oRequest);
  92. if ($oForm->isSubmitted() && $oForm->isValid()) {
  93. $bRecaptchaValid = $oAntispamServ->validate($oRequest->get('antispam_hash'), $oRequest->get('g-recaptcha-response'));
  94. if ($bRecaptchaValid) {
  95. $aFormData = $oForm->getData();
  96. $oEmailSrv->sendContactEmail($aFormData, $oContract);
  97. $this->addFlash('primary', 'Votre demande a bien été transmise. Vous serez recontacté dans les plus brefs délais.');
  98. return $this->redirectToRoute('join_us');
  99. }
  100. else {
  101. $this->addFlash('danger', 'La vérification Anti-Spam a échouée. Veuillez recommencer.');
  102. }
  103. }
  104. return [
  105. 'form' => $oForm->createView(),
  106. 'antispam_info' => $oAntispamServ->generateRecaptcha(),
  107. ];
  108. }
  109. /**
  110. * @Route("/blog", name="blog")
  111. * @FE\Cache(public=true, smaxage=600)
  112. *
  113. * @return Response
  114. */
  115. public function blog(): Response
  116. {
  117. return $this->redirectToRoute('homepage');
  118. $aCriterias = $this->isGranted('ROLE_ADMIN') ? [] : ['status' => BlogArticle::STATUS_PUBLISHED];
  119. return $this->cacheResponse($this->render('default/blog.html.twig',[
  120. 'articles' => $this->getDoctrineRepository(BlogArticle::class)->findBy($aCriterias, ['publishedAt' => 'DESC', 'id' => 'DESC'])
  121. ]));
  122. }
  123. /**
  124. * @Route("/blog/{iArticleId}", name="blog_show",
  125. * requirements={"iArticleId": "\d+"}
  126. * )
  127. * @FE\Cache(public=true, smaxage=600)
  128. *
  129. * @param int $iArticleId
  130. *
  131. * @return Response
  132. */
  133. public function blogArticle(int $iArticleId): Response
  134. {
  135. $oBlogArticle = $this->getDoctrineRepository(BlogArticle::class)->find($iArticleId);
  136. if (!$oBlogArticle instanceof BlogArticle
  137. || (!$this->isGranted('ROLE_ADMIN') && $oBlogArticle->getStatus() !== BlogArticle::STATUS_PUBLISHED)) {
  138. return $this->redirectToRoute('blog');
  139. }
  140. return $this->cacheResponse($this->render('default/blog_article.html.twig',[
  141. 'article' => $oBlogArticle,
  142. ]));
  143. }
  144. /**
  145. * @Route("/parrainage", name="sponsorship")
  146. * @FE\Template()
  147. *
  148. * @param Request $oRequest
  149. *
  150. * @return Response|array
  151. */
  152. public function sponsorship(Request $oRequest)
  153. {
  154. return $this->redirectToRoute('homepage');
  155. $oSponsorship = new Sponsorship();
  156. $oForm = $this->createForm(FormType\SponsorshipType::class, $oSponsorship);
  157. $oForm->handleRequest($oRequest);
  158. if ($oForm->isSubmitted() && $oForm->isValid()) {
  159. $this->persistAndFlush($oSponsorship);
  160. $this->addFlash('success', 'Votre demande a bien été prise en compte.');
  161. return $this->redirectToRoute('sponsorship');
  162. }
  163. return [
  164. 'form' => $oForm->createView(),
  165. ];
  166. }
  167. /**
  168. * @Route("/les-annonces", name="contracts")
  169. * @FE\Template()
  170. *
  171. * @param Request $oRequest
  172. *
  173. * @return array
  174. */
  175. public function contracts(Request $oRequest): array
  176. {
  177. $aParams = array_merge(
  178. $oRequest->request->get('contract_estate_search', []),
  179. $oRequest->request->get('contract_search', [])
  180. );
  181. if ($oRequest->query->has('last_search')) {
  182. $aParams = $oRequest->getSession()->get(self::SESS_KEY_SEARCH_PARAMS, []);
  183. }
  184. return [
  185. 'form' => $this->createForm(FormType\ContractEstateSearchType::class, $aParams)->createView(),
  186. ];
  187. }
  188. /**
  189. * @Route("/les-annonces/search", name="contracts_search")
  190. * @FE\Template()
  191. *
  192. * @param Request $oRequest
  193. * @param GeolocService $oGeolocServ
  194. *
  195. * @return Response|array
  196. */
  197. public function _search(Request $oRequest, GeolocService $oGeolocServ)
  198. {
  199. $iPage = $oRequest->request->get('page', 1);
  200. $aParams = $oRequest->request->all();
  201. $aParams['isFront'] = true;
  202. // Save query
  203. $oRequest->getSession()->set(self::SESS_KEY_SEARCH_PARAMS, $aParams);
  204. $oRefTown = null;
  205. if (!empty($aParams['location']) && !empty($aParams['distance'])) {
  206. $oRepoRT = $this->getDoctrineRepository(RefTown::class);
  207. $aParts = explode (' - ', $aParams['location']);
  208. if (count($aParts) == 2) {
  209. $oRefTown = $oRepoRT->findBestMatchByCriterias($aParts[0], $aParts[1]);
  210. }
  211. if (!$oRefTown instanceof RefTown) {
  212. $aRefTowns = $oRepoRT->findByCriterias(['magicSearch' => $aParams['location']]);
  213. if ($aRefTowns) {
  214. $oRefTown = $aRefTowns[0];
  215. }
  216. }
  217. if ($oRefTown instanceof RefTown) {
  218. $aSquareInfo = $oGeolocServ->getSquareLatLng($oRefTown->getLocLat(), $oRefTown->getLocLng(), preg_replace('/[a-z €²]*/', '', $aParams['distance']));
  219. $aParams['locLat'] = implode(GeolocService::SEPARATOR, [$aSquareInfo['min_lat'], $aSquareInfo['max_lat']]);
  220. $aParams['locLng'] = implode(GeolocService::SEPARATOR, [$aSquareInfo['min_lng'], $aSquareInfo['max_lng']]);
  221. }
  222. }
  223. $sSearchEntity = $aParams['class'] ?? ContractEstate::class;
  224. $oRepo = $this->getDoctrineRepository($sSearchEntity);
  225. $iNbResults = $oRepo->countByCriterias($aParams);
  226. $aResults = $oRepo->findByCriterias($aParams, self::NB_RESULTS_PER_PAGE, self::NB_RESULTS_PER_PAGE * ($iPage - 1));
  227. return [
  228. 'page' => $iPage,
  229. 'nb_results_per_page' => self::NB_RESULTS_PER_PAGE,
  230. 'nb_results' => $iNbResults,
  231. 'results' => $aResults,
  232. ];
  233. }
  234. /**
  235. * @Route("/annonce/{sRefNetty}", name="contract")
  236. * @FE\Template()
  237. *
  238. * @param Request $oRequest
  239. * @param GeolocService $oGeolocServ
  240. * @param string $sRefNetty
  241. *
  242. * @return Response|array
  243. */
  244. public function contract(Request $oRequest, GeolocService $oGeolocServ, string $sRefNetty)
  245. {
  246. $oContract = $this->getDoctrineRepository(Contract::class)->findOneBy(['refNetty' => $sRefNetty]);
  247. if (!$oContract instanceof Contract || !$oContract->getPromupInfo() || !$oContract->isAccessAllowed($oRequest->get('hash', ''))) {
  248. return $this->redirectToRoute('homepage');
  249. }
  250. $aRelContracts = [];
  251. if (!empty($oContract->getLocLat()) && !empty($oContract->getLocLng())) {
  252. $aSquareInfo = $oGeolocServ->getSquareLatLng($oContract->getLocLat(), $oContract->getLocLng(), 30);
  253. $aParams = [
  254. 'isFront' => true,
  255. 'getRelated' => $oContract,
  256. 'locLat' => implode(GeolocService::SEPARATOR, [$aSquareInfo['min_lat'], $aSquareInfo['max_lat']]),
  257. 'locLng' => implode(GeolocService::SEPARATOR, [$aSquareInfo['min_lng'], $aSquareInfo['max_lng']]),
  258. ];
  259. $aRelContracts = $this->getDoctrineRepository(get_class($oContract))->findByCriterias($aParams, 16);
  260. }
  261. $oRefTown = null;
  262. if ($oContract->getAddress() && $oContract->getAddress()->getPostalCode()) {
  263. $oRefTown = $this->getDoctrineRepository(RefTown::class)->findBestMatchByCriterias($oContract->getAddress()->getPostalCode(), $oContract->getAddress()->getCity());
  264. }
  265. $oContract->setNbViews($oContract->getNbViews() + 1);
  266. $this->persistAndFlush($oContract);
  267. return [
  268. 'contract' => $oContract,
  269. 'related_contracts' => $aRelContracts,
  270. 'ref_town' => $oRefTown,
  271. ];
  272. }
  273. /**
  274. * @Route("/annonce/{sRefNetty}/flyer-a4/{sOption}", name="contract_flyer_a4")
  275. * @FE\Template()
  276. *
  277. * @param Request $oRequest
  278. * @param PdfService $oPdfSrv
  279. * @param string $sRefNetty
  280. * @param string|null $sOption
  281. *
  282. * @return Response|array
  283. */
  284. public function contractFlyerA4(Request $oRequest, PdfService $oPdfSrv, string $sRefNetty, string $sOption = null)
  285. {
  286. return $this->contractFlyerA5($oRequest, $oPdfSrv, $sRefNetty, $sOption);
  287. /*$oContract = $this->getDoctrineRepository(Contract::class)->findOneBy(['refNetty' => $sRefNetty]);
  288. if (!$oContract instanceof Contract || !$oContract->isAccessAllowed($oRequest->get('hash', ''))) {
  289. return $this->json(['status' => 'NOK']);
  290. }
  291. $sFilename = $oPdfSrv->generateContractFlyerA4($oContract);
  292. if ($sOption === 'view') {
  293. return $this->render('partial/_viewer.html.twig', [
  294. 'path' => $sFilename,
  295. 'web_path' => $this->generateUrl('contract_flyer_a4', ['sRefNetty' => $sRefNetty]),
  296. ]);
  297. }
  298. return $this->file($sFilename);*/
  299. }
  300. /**
  301. * @Route("/annonce/{sRefNetty}/flyer-a5/{sOption}", name="contract_flyer_a5")
  302. * @FE\Cache(public=true, smaxage=600)
  303. *
  304. * @param Request $oRequest
  305. * @param PdfService $oPdfSrv
  306. * @param string $sRefNetty
  307. * @param string|null $sOption
  308. *
  309. * @return Response|array
  310. */
  311. public function contractFlyerA5(Request $oRequest, PdfService $oPdfSrv, string $sRefNetty, string $sOption = null)
  312. {
  313. $oContract = $this->getDoctrineRepository(Contract::class)->findOneBy(['refNetty' => $sRefNetty]);
  314. if (!$oContract instanceof Contract
  315. || (!$oContract->isAccessAllowed($oRequest->get('hash', '')) && $oContract->getCustomer() !== $this->getSfUser())) {
  316. return $this->json(['status' => 'NOK']);
  317. }
  318. $oSession = $oRequest->getSession();
  319. $sFilename = $oSession->get('contractFlyerA5_' . $sRefNetty);
  320. if (!$sFilename || !file_exists($sFilename) || $this->getSfUser()) {
  321. $sFilename = $oPdfSrv->generateContractFlyerA5($oContract);
  322. $oSession->set('contractFlyerA5_' . $sRefNetty, $sFilename);
  323. }
  324. if ($sOption === 'view') {
  325. return $this->cacheResponse($this->render('partial/_viewer.html.twig',[
  326. 'path' => $sFilename,
  327. 'web_path' => $this->generateUrl('contract_flyer_a5', ['sRefNetty' => $sRefNetty]),
  328. ]));
  329. }
  330. return $this->file($sFilename);
  331. }
  332. /**
  333. * @Route("/annonce/{sRefNetty}/dossier-vendeur/{sOption}", name="contract_bulk")
  334. * @FE\Cache(public=true, smaxage=600)
  335. *
  336. * @param Request $oRequest
  337. * @param PdfService $oPdfSrv
  338. * @param string $sRefNetty
  339. * @param string|null $sOption
  340. *
  341. * @return Response|array
  342. */
  343. public function contractBulk(Request $oRequest, PdfService $oPdfSrv, string $sRefNetty, string $sOption = null)
  344. {
  345. $oContract = $this->getDoctrineRepository(Contract::class)->findOneBy(['refNetty' => $sRefNetty]);
  346. if (!$oContract instanceof Contract
  347. || (!$oContract->isAccessAllowed($oRequest->get('hash', '')) && $oContract->getCustomer() !== $this->getSfUser())) {
  348. return $this->json(['status' => 'NOK']);
  349. }
  350. $oSession = $oRequest->getSession();
  351. $sFilename = $oSession->get('contractBulk_' . $sRefNetty);
  352. if (!$sFilename || !file_exists($sFilename)) {
  353. $sFilename = $oPdfSrv->generateContractBulk($oContract);
  354. $oSession->set('contractBulk_' . $sRefNetty, $sFilename);
  355. }
  356. if ($sOption === 'view') {
  357. return $this->cacheResponse($this->render('partial/_viewer.html.twig',[
  358. 'path' => $sFilename,
  359. 'web_path' => $this->generateUrl('contract_bulk', ['sRefNetty' => $sRefNetty]),
  360. ]));
  361. }
  362. return $this->file($sFilename);
  363. }
  364. /**
  365. * @Route("/annonce/{sRefNetty}/liens-de-diffusion", name="contract_links")
  366. * @FE\Cache(public=true, smaxage=600)
  367. * @FE\Security("is_granted('ROLE_CUSTOMER')")
  368. *
  369. * @param Request $oRequest
  370. * @param PdfService $oPdfSrv
  371. * @param string $sRefNetty
  372. * @param string|null $sOption
  373. *
  374. * @return Response|array
  375. */
  376. public function contractLinks(Request $oRequest, PdfService $oPdfSrv, string $sRefNetty, string $sOption = null)
  377. {
  378. $oContract = $this->getDoctrineRepository(Contract::class)->findOneBy(['refNetty' => $sRefNetty]);
  379. if (!$oContract instanceof Contract
  380. || (!$oContract->isAccessAllowed($oRequest->get('hash', '')) && $oContract->getCustomer() !== $this->getSfUser())) {
  381. return $this->json(['status' => 'NOK']);
  382. }
  383. $sFilename = $oPdfSrv->generateContractLinks($oContract);
  384. if ($sOption === 'view') {
  385. return $this->cacheResponse($this->render('partial/_viewer.html.twig',[
  386. 'path' => $sFilename,
  387. 'web_path' => $this->generateUrl('contract_links', ['sRefNetty' => $sRefNetty]),
  388. ]));
  389. }
  390. return $this->file($sFilename);
  391. }
  392. /**
  393. * @Route("/minisite/{sRefNetty}", name="contract_minisite")
  394. * @FE\Template()
  395. *
  396. * @param Request $oRequest
  397. * @param string $sRefNetty
  398. *
  399. * @return Response
  400. */
  401. public function minisite(Request $oRequest, string $sRefNetty): Response
  402. {
  403. $sHash = $oRequest->get('hash', '');
  404. return $this->redirect('https://www.avendre.site/annonce/'.$sRefNetty. ($sHash ? '?hash='. $sHash : ''));
  405. }
  406. /**
  407. * @Route("/annonce/{iContractId}/picture/{iPictureId}", name="contract_picture",
  408. * requirements={"iContractId": "\d+", "iPictureId": "\d+"}
  409. * )
  410. *
  411. * @param Request $oRequest
  412. * @param int $iContractId
  413. * @param int $iPictureId
  414. *
  415. * @return Response
  416. */
  417. public function contractPicture(Request $oRequest, int $iContractId, int $iPictureId): Response
  418. {
  419. $oPicture = $this->getDoctrineRepository(ContractPicture::class)->find($iPictureId);
  420. if (!$oPicture instanceof ContractPicture || ($oPicture->getContract()->getId() !== $iContractId)) {
  421. return $this->json(['status' => 'NOK']);
  422. }
  423. $sFilepath = $oPicture->getAbsolutePath(ContractPicture::CONF_TYPE[ContractPicture::PIC_TYPE_WPRO]);
  424. if ($oPicture->getContract()->getIsCompromise()) {
  425. $sFilepath = $oPicture->getAbsolutePath(ContractPicture::CONF_TYPE[ContractPicture::PIC_TYPE_WCOM]);
  426. }
  427. if (!file_exists($sFilepath)) {
  428. $sFilepath = $oPicture->getAbsolutePath(ContractPicture::CONF_TYPE[ContractPicture::PIC_TYPE_PLE]);
  429. }
  430. if (!file_exists($sFilepath)) {
  431. $sFilepath = realpath($this->getParameter('kernel.project_dir') . '/assets/images/fake_picture_1.jpg');
  432. }
  433. return $this->file($sFilepath, implode('_', [$oPicture->getContract()->getRefNetty(), $iPictureId]), ResponseHeaderBag::DISPOSITION_INLINE);
  434. }
  435. /**
  436. * @Route("/faire-gerer", name="how_to_manage")
  437. * @FE\Cache(public=true, smaxage=600)
  438. * @FE\Template()
  439. *
  440. * @return Response|array
  441. */
  442. public function howToManage()
  443. {
  444. return [];
  445. }
  446. /**
  447. * @Route("/contact/{iContractId}", name="contact", requirements={"iContractId": "\d+"})
  448. * @FE\Template()
  449. *
  450. * @param Request $oRequest
  451. * @param EmailService $oEmailSrv
  452. * @param AntiSpamService $oAntispamServ
  453. * @param int|null $iContractId
  454. *
  455. * @return Response|array
  456. */
  457. public function contact(Request $oRequest, EmailService $oEmailSrv, AntiSpamService $oAntispamServ, int $iContractId = null)
  458. {
  459. $oContract = null;
  460. $aFormData = [];
  461. if ($iContractId) {
  462. $oContract = $this->getDoctrineRepository(Contract::class)->find($iContractId);
  463. if ($oContract instanceof Contract) {
  464. $aFormData = [
  465. 'reference' => $oContract->getRefNetty(),
  466. 'content' => 'Bonjour,
  467. Nous souhaiterions plus d\'informations sur le bien '. $oContract->getRefNetty() .'.
  468. Cordialement,',
  469. ];
  470. }
  471. }
  472. $oForm = $this->createForm(FormType\ContactType::class, $aFormData);
  473. $oForm->handleRequest($oRequest);
  474. if ($oForm->isSubmitted() && $oForm->isValid()) {
  475. $bRecaptchaValid = $oAntispamServ->validate($oRequest->get('antispam_hash'), $oRequest->get('g-recaptcha-response'));
  476. if ($bRecaptchaValid) {
  477. $oRobotUser = $this->getDoctrineRepository(User::class)->find(-1);
  478. $aFormData = $oForm->getData();
  479. $aFormData['content'] = 'Référence : ' . (strtoupper($aFormData['reference']) ?: '/' ) . PHP_EOL . $aFormData['content'];
  480. if (!$oContract instanceof Contract) {
  481. $iNb = preg_match_all('/(V[ATEMIFPG][0-9]+)/', $aFormData['content'], $aMatches);
  482. if ($iNb === 1) {
  483. $oContract = $this->getDoctrineRepository(Contract::class)->findOneBy(['refNetty' => $aMatches[0][0]]);
  484. }
  485. else {
  486. $iNb = preg_match_all('/(P[0-9]{2}-[0-9]{4}-[0-9]+)/', $aFormData['content'], $aMatches);
  487. if ($iNb === 1) {
  488. $oContractPromupInfo = $this->getDoctrineRepository(ContractPromupInfo::class)->findOneBy(['reference' => $aMatches[0][0]]);
  489. if ($oContractPromupInfo instanceof ContractPromupInfo) {
  490. $oContract = $oContractPromupInfo->getContract();
  491. }
  492. }
  493. }
  494. }
  495. if ($oContract instanceof Contract) {
  496. $oCustomer = $oContract->getCustomer();
  497. if ($oCustomer && $oCustomer->getUserCustomerService()) {
  498. $oNotif = (new Notification())
  499. ->setGeneratedBy($oRobotUser)
  500. ->setGeneratedFor($oCustomer->getUserCustomerService())
  501. ->setSeverity(Notification::SEVERITY_IMPORTANT)
  502. ->setMessage(sprintf('Demande d\'information %s (%s)', $oContract->getRefNetty(), $aFormData['name']))
  503. ->setAction($this->generateUrl('bo_contract_overview', ['iContractId' => $oContract->getId()]))
  504. ;
  505. $this->persistAndFlush($oNotif);
  506. }
  507. $sText = sprintf('%s (%s) %s', 'Demande d\'information', $aFormData['name'], PHP_EOL.$aFormData['content'].PHP_EOL.implode(' - ', [$aFormData['email'], $aFormData['phone']]));
  508. $oContract->addComment($oRobotUser, $sText, ContractComment::CATEGORY_INFO);
  509. $oContract->setNbDemands($oContract->getNbDemands() + 1);
  510. $this->persistAndFlush($oContract);
  511. } else {
  512. $oEmailSrv->sendContactEmail($aFormData, $oContract);
  513. }
  514. $this->addFlash('primary', 'Votre demande a bien été transmise. Vous serez recontacté dans les plus brefs délais.');
  515. return $this->redirectToRoute('contact');
  516. }
  517. else {
  518. $this->addFlash('danger', 'La vérification Anti-Spam a échouée. Veuillez recommencer.');
  519. }
  520. }
  521. return [
  522. 'form' => $oForm->createView(),
  523. 'antispam_info' => $oAntispamServ->generateRecaptcha(),
  524. ];
  525. }
  526. /**
  527. * @Route("/mentions-legales", name="legal")
  528. * @FE\Cache(public=true, smaxage=600)
  529. *
  530. * @return Response
  531. */
  532. public function legal()
  533. {
  534. return $this->cacheResponse($this->render('default/legal.html.twig'));
  535. }
  536. /**
  537. * @Route("/conditions-generales", name="cgu_cgv")
  538. * @FE\Cache(public=true, smaxage=600)
  539. *
  540. * @return Response
  541. */
  542. public function cgu_cgv()
  543. {
  544. return $this->cacheResponse($this->render('default/cgu_cgv.html.twig'));
  545. }
  546. }