src/Aviatur/SearchBundle/Controller/CruiseController.php line 100

Open in your IDE?
  1. <?php
  2. namespace Aviatur\SearchBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Doctrine\Persistence\ManagerRegistry;
  5. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  6. use Aviatur\TwigBundle\Services\TwigFolder;
  7. use Aviatur\GeneralBundle\Services\AviaturChangeCoin;
  8. use Aviatur\PackageBundle\Services\SearchPackageCookie;
  9. use Aviatur\CruiserBundle\Services\SearchCruiseCookie;
  10. class CruiseController extends AbstractController {
  11.     public function indexActionBack(SessionInterface $sessionSearchPackageCookie $searchPackageCookieManagerRegistry $registryAviaturChangeCoin $aviaturChangeCoinTwigFolder $twigFolder) {
  12.       $cookieLastSearch $searchPackageCookie->searchPackageCookie();
  13.       $em $registry->getManager();
  14.       $agencyId $session->get('agencyId');
  15.       $validateChange $aviaturChangeCoin->validateChangeCoin('mpt');
  16.       $agency $em->getRepository(\Aviatur\AgencyBundle\Entity\Agency::class)->find($agencyId);
  17.       $promoType '';
  18.       $promoTypeMain '-main';
  19.       $promoTypeMes 'paquetes-mes';
  20.       $promoTypeRecommendations '-recommendations';
  21.       if($session->has('whitemark') === true){
  22.           $promoType '_' $session->get('whitemark');
  23.       }
  24.       $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'];
  25.         $agencyPromoId 172;
  26.         $validationAgencyFolder false;
  27.         foreach ($agenciesExcluded as $agencyExcluded) {
  28.             if ($agencyExcluded === $agency->getName()) {
  29.                 $agencyPromoId $session->get('agencyId');
  30.                 $validationAgencyFolder true;
  31.             }
  32.         }
  33.       $homePromoList $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(['type' => '__paquetes'.$promoType'agency' => $agencyPromoId]);
  34.       if ($homePromoList != null) {
  35.           $homePromoTitle $homePromoList->getTitle();
  36.           $homePromoSubtitle $homePromoList->getSubtitle();
  37.           $homePromos $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoList, ['date' => 'DESC']);
  38.       } else {
  39.           $homePromoTitle null;
  40.           $homePromoSubtitle null;
  41.           $homePromos = [];
  42.       }
  43.       $homePromoListMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__paquetes'.$promoTypeMain"agency" => $agencyPromoId]);
  44.       if ($homePromoListMain != null) {
  45.           $homePromoTitleMain $homePromoListMain->getTitle();
  46.           $homePromoSubtitleMain $homePromoListMain->getSubtitle();
  47.           $homePromosMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMain, ['date' => 'DESC']);
  48.       }else {
  49.           $homePromoTitleMain null;
  50.           $homePromoSubtitleMain null;
  51.           $homePromosMain = [];
  52.       }
  53.       $homePromoListMes $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => $promoTypeMes"agency" => $agencyPromoId]);
  54.       if ($homePromoListMes != null) {
  55.           $homePromoTitleMes $homePromoListMes->getTitle();
  56.           $homePromoSubtitleMes $homePromoListMes->getSubtitle();
  57.           $homePromosMes $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMes, ['date' => 'DESC']);
  58.       }else {
  59.           $homePromoTitleMes null;
  60.           $homePromoSubtitleMes null;
  61.           $homePromosMes = [];
  62.       }
  63.       $homePromoListRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__paquetes'.$promoTypeRecommendations"agency" => $agencyPromoId]);
  64.       if ($homePromoListRecommendations != null) {
  65.           $homePromoRecommendationsTitle $homePromoListRecommendations->getTitle();
  66.           $homePromoRecommendationsSubtitle $homePromoListRecommendations->getSubtitle();
  67.           $homePromosRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListRecommendations, ['date' => 'DESC']);
  68.       } else {
  69.           $homePromoRecommendationsTitle null;
  70.           $homePromoRecommendationsSubtitle null;
  71.           $homePromosRecommendations = [];
  72.       }
  73.       $agencyFolder $twigFolder->twigFlux();
  74.       return $this->render($twigFolder->twigExists('@AviaturTwig/'$agencyFolder .'/Search/Package/cruiseTempSearch_index.html.twig'), ['cookieLastSearch' => $cookieLastSearch'homePromos' => $homePromos'titlePromo' => $homePromoTitle'subtitlePromo' => $homePromoSubtitle'promoType' => '__paquetes''homePromosMain' => $homePromosMain'titlePromoMain' => $homePromoTitleMain'subtitlePromoMain' => $homePromoSubtitleMain'promoTypeMain'=>'__paquetes'.$promoTypeMain'homePromosMes' => $homePromosMes'titlePromoMes' => $homePromoTitleMes'subtitlePromoMes' => $homePromoSubtitleMes'promoTypeMes'=>$promoTypeMes'homePromosRecommendations' => $homePromosRecommendations'titlePromoRecommendations' => $homePromoRecommendationsTitle'subtitlePromoRecommendations' => $homePromoRecommendationsSubtitle'promoTypeRecommendations' => '__paquetes'.$promoTypeRecommendations'agency_name' => $agency->getDomain(), 'validationAgencyFolder' => $validationAgencyFolder]);
  75.     }
  76.     public function indexAction(SessionInterface $sessionSearchCruiseCookie $searchCruiseCookieManagerRegistry $registryAviaturChangeCoin $aviaturChangeCoinTwigFolder $twigFolder) {
  77.         $em $registry->getManager();
  78.         $cookieLastSearch $searchCruiseCookie->searchCruiseCookie();
  79.         $agency $em->getRepository(\Aviatur\AgencyBundle\Entity\Agency::class)->find($session->get('agencyId'));
  80.         $regions $em->getRepository(\Aviatur\CruiserBundle\Entity\Region::class)->findAll();
  81.         $ships $em->getRepository(\Aviatur\CruiserBundle\Entity\CruiseShip::class)->findShipByCruiseLine();
  82.         $validateChange $aviaturChangeCoin->validateChangeCoin('cruise');
  83.         $promoType '';
  84.         $promoTypeMain '-main';
  85.         $promoTypeRecommendations '-recommendations';
  86.         if($session->has('whitemark') === true){
  87.             $promoType '_' $session->get('whitemark');
  88.         }
  89.         $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'];
  90.         $agencyPromoId 172;
  91.         $validationAgencyFolder false;
  92.         foreach ($agenciesExcluded as $agencyExcluded) {
  93.             if ($agencyExcluded === $agency->getName()) {
  94.                 $agencyPromoId $session->get('agencyId');
  95.                 $validationAgencyFolder true;
  96.             }
  97.         }
  98.         $homePromoList $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(['type' => '__cruise'.$promoType'agency' => $agencyPromoId]);
  99.         if ($homePromoList != null) {
  100.             $homePromoTitle $homePromoList->getTitle();
  101.             $homePromoSubtitle $homePromoList->getSubtitle();
  102.             $homePromos $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoList, ['date' => 'DESC']);
  103.         } else {
  104.             $homePromoTitle null;
  105.             $homePromoSubtitle null;
  106.             $homePromos = [];
  107.         }
  108.         $homePromoListMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__cruise'.$promoTypeMain"agency" => $agencyPromoId]);
  109.         if ($homePromoListMain != null) {
  110.             $homePromoMainTitle $homePromoListMain->getTitle();
  111.             $homePromoMainSubtitle $homePromoListMain->getSubtitle();
  112.             $homePromosMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMain, ['date' => 'DESC']);
  113.         } else {
  114.             $homePromoMainTitle null;
  115.             $homePromoMainSubtitle null;
  116.             $homePromosMain = [];
  117.         }
  118.         $homePromoListRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__cruise'.$promoTypeRecommendations"agency" => $agencyPromoId]);
  119.         if ($homePromoListRecommendations != null) {
  120.             $homePromoRecommendationsTitle $homePromoListRecommendations->getTitle();
  121.             $homePromoRecommendationsSubtitle $homePromoListRecommendations->getSubtitle();
  122.             $homePromosRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListRecommendations, ['date' => 'DESC']);
  123.         } else {
  124.             $homePromoRecommendationsTitle null;
  125.             $homePromoRecommendationsSubtitle null;
  126.             $homePromosRecommendations = [];
  127.         }
  128.         $variables = ["regions" => $regions"ships" => $ships"cookieLastSearch" => $cookieLastSearch'homePromos' => $homePromos'titlePromo' => $homePromoTitle'subtitlePromo' => $homePromoSubtitle'promoType' => '__cruise''homePromosMain' => $homePromosMain'titlePromoMain' => $homePromoMainTitle'subtitlePromoMain' => $homePromoMainSubtitle'promoTypeMain' => '__cruise'.$promoTypeMain'homePromosRecommendations' => $homePromosRecommendations'titlePromoRecommendations' => $homePromoRecommendationsTitle'subtitlePromoRecommendations' => $homePromoRecommendationsSubtitle'promoTypeRecommendations' => '__cruise'.$promoTypeRecommendations'validationAgencyFolder' => $validationAgencyFolder];
  129.         if (isset($cookieLastSearch['ports'])) {
  130.             $variables['ports'] = $cookieLastSearch['ports'];
  131.         } elseif (isset($cookieLastSearch['region'])) {
  132.             $variables['ports'] = $em->getRepository(\Aviatur\CruiserBundle\Entity\CruiseRegionPorts::class)->getPortByRegion($cookieLastSearch['region']);
  133.         }
  134.         $agencyFolder $twigFolder->twigFlux();
  135.         return $this->render($twigFolder->twigExists('@AviaturTwig/' $agencyFolder '/Search/Cruise/cruiseSearch_index.html.twig'), $variables);
  136.     }
  137. }