src/Aviatur/SearchBundle/Controller/ExperienceController.php line 25

Open in your IDE?
  1. <?php
  2. /*
  3.  * To change this license header, choose License Headers in Project Properties.
  4.  * To change this template file, choose Tools | Templates
  5.  * and open the template in the editor.
  6.  */
  7. namespace Aviatur\SearchBundle\Controller;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Doctrine\Persistence\ManagerRegistry;
  10. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  11. use Aviatur\TwigBundle\Services\TwigFolder;
  12. use Aviatur\GeneralBundle\Services\AviaturChangeCoin;
  13. use Aviatur\ExperienceBundle\Services\SearchExperienceCookie;
  14. /**
  15.  * Description of ExperienceController
  16.  *
  17.  * @author sergio.amaya
  18.  */
  19. class ExperienceController extends AbstractController {
  20.     public function indexAction(TwigFolder $twigFolderManagerRegistry $registrySessionInterface $sessionSearchExperienceCookie $searchExperienceCookieAviaturChangeCoin $aviaturChangeCoinService) {
  21.         $agencyFolder $twigFolder->twigFlux();
  22.         $em $registry->getManager();
  23.         $cookieLastSearch $searchExperienceCookie->searchExperienceCookie();
  24.         $agencyId $session->get('agencyId');
  25.         $agency $em->getRepository(\Aviatur\AgencyBundle\Entity\Agency::class)->find($agencyId);
  26.         $validateChange $aviaturChangeCoinService->validateChangeCoin('mpt');
  27.         $promoType '';
  28.         $promoTypeImg '-img';
  29.         $promoTypeMain '-main';
  30.         $promoTypeRecommendations '-recommendations';
  31.         if($session->has('whitemark') === true){
  32.             $promoType '_' $session->get('whitemark');
  33.         }
  34.         $agenciesExcluded = ['Aviatur S.A.S.''Aviatur S.A.S. Metasearch''Aval''Aviacaribbean''Aviatur - WorldPay''Aviatur Carnaval BAQ MB''Aviatur Colombia''Aviatur Colombia EN''Aviatur Colombia ES''Aviatur Ecoturismo''Aviatur Kioskos''Aviatur Metasearch Mexico''Aviatur Mexico''Aviatur Mexico QA''Aviatur Mobile''Aviatur PinBus''Aviatur - Pruebas''BabyMarket''Buceo Colombia''Cielos Abiertos''Corona Aviatur''Directo a la Playa''Experiencias Jet-Set''Great Vibes''Landing visa''Lufthansa City Center''Megatours''Octopus Agents''Octopus Marcas Blancas''Octopus Travel QA''Panturismo Marcas Blancas''Parque Tayrona''Representaciones Pasabordo WM''Rokatur Marcas Blancas''RollingTrips''Star World''Swissandina''Takentours''TerraNet Marcas Blancas''Turiscol Ltda.''Aviatur S.A.''Union de Representaciones''Union de Representaciones - Whitemark''Virtuoso''Claro''WeCare''Octopus Travel Ltda.''Aviatur Site''Aviatur S.A.S. - BBVA''Aviatur Welcome Beds'];
  35.         $agencyPromoId 172;
  36.         $validationAgencyFolder false;
  37.         foreach ($agenciesExcluded as $agencyExcluded) {
  38.             if ($agencyExcluded === $agency->getName()) {
  39.                 $agencyPromoId $session->get('agencyId');
  40.                 $validationAgencyFolder true;
  41.             }
  42.         }
  43.         $homePromoList $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(['type' => '__experience'.$promoType'agency' => $agencyPromoId]);
  44.         if ($homePromoList != null) {
  45.             $homePromoTitle $homePromoList->getTitle();
  46.             $homePromoSubtitle $homePromoList->getSubtitle();
  47.             $homePromos $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoList, ['date' => 'DESC']);
  48.         } else {
  49.             $homePromoTitle null;
  50.             $homePromoSubtitle null;
  51.             $homePromos = [];
  52.         }
  53.         $homePromoListImg $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__experience'.$promoTypeImg"agency" => $agencyPromoId]);
  54.         if ($homePromoListImg != null) {
  55.             $homePromoImgTitle $homePromoListImg->getTitle();
  56.             $homePromoImgSubtitle $homePromoListImg->getSubtitle();
  57.             $homePromosImg $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListImg, ['date' => 'DESC']);
  58.         } else {
  59.             $homePromoImgTitle null;
  60.             $homePromoImgSubtitle null;
  61.             $homePromosImg = [];
  62.         }
  63.         $homePromoListMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__experience'.$promoTypeMain"agency" => $agencyPromoId]);
  64.         if ($homePromoListMain != null) {
  65.             $homePromoMainTitle $homePromoListMain->getTitle();
  66.             $homePromoMainSubtitle $homePromoListMain->getSubtitle();
  67.             $homePromosMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMain, ['date' => 'DESC']);
  68.         } else {
  69.             $homePromoMainTitle null;
  70.             $homePromoMainSubtitle null;
  71.             $homePromosMain = [];
  72.         }
  73.         $homePromoListRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__experience'.$promoTypeRecommendations"agency" => $agencyPromoId]);
  74.         if ($homePromoListRecommendations != null) {
  75.             $homePromoRecommendationsTitle $homePromoListRecommendations->getTitle();
  76.             $homePromoRecommendationsSubtitle $homePromoListRecommendations->getSubtitle();
  77.             $homePromosRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListRecommendations, ['date' => 'DESC']);
  78.         } else {
  79.             $homePromoRecommendationsTitle null;
  80.             $homePromoRecommendationsSubtitle null;
  81.             $homePromosRecommendations = [];
  82.         }
  83.         return $this->render($twigFolder->twigExists('@AviaturTwig/' $agencyFolder .'/Search/Experience/experiencesSearch_index.html.twig'), ['cookieLastSearch' => $cookieLastSearch'homePromos' => $homePromos'titlePromo' => $homePromoTitle'subtitlePromo' => $homePromoSubtitle'promoType' => '__experience''homePromosImg' => $homePromosImg'titlePromoImg' => $homePromoImgTitle'subtitlePromoImg' => $homePromoImgSubtitle'promoTypeImg' => '__experience'.$promoTypeImg'homePromosMain' => $homePromosMain'titlePromoMain' => $homePromoMainTitle'subtitlePromoMain' => $homePromoMainSubtitle'promoTypeMain' => '__experience'.$promoTypeMain'homePromosRecommendations' => $homePromosRecommendations'titlePromoRecommendations' => $homePromoRecommendationsTitle'subtitlePromoRecommendations' => $homePromoRecommendationsSubtitle'promoTypeRecommendations' => '__experience'.$promoTypeRecommendations'validationAgencyFolder' => $validationAgencyFolder]);
  84.     }
  85. }