src/Aviatur/SearchBundle/Controller/FlightController.php line 16

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\FlightBundle\Services\SearchFlightCookie;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  11. class FlightController extends AbstractController {
  12.     public function indexAction(Request $requestManagerRegistry $registrySessionInterface $sessionAviaturChangeCoin $aviaturChangeCoinServiceSearchFlightCookie $searchFlightCookieTwigFolder $twigFolderParameterBagInterface $parameterBag) {
  13.         // $carpeta = $parameterBag->get('kernel.project_dir') .'/app/quotationLogs/flightQuotation/';        
  14.         // // if (!chmod($carpeta, 0755)) {   
  15.         // //     // Manejo de errores si chmod falla
  16.         // //    var_dump('No se pudieron establecer los permisos correctamente.', 500);
  17.         // // }
  18.         $em $registry->getManager();
  19.         $agencyId $session->get('agencyId');
  20.         $agency $em->getRepository(\Aviatur\AgencyBundle\Entity\Agency::class)->find($agencyId);
  21.         $validateChange $aviaturChangeCoinService->validateChangeCoin('flight');
  22.         $promoType '';
  23.         $promoTypeMain '-main';
  24.         $promoTypeRecommendations '-recommendations';
  25.         $promoTypeFaq '-faq';
  26.         if($session->has('whitemark') === true){
  27.             $promoType '_' $session->get('whitemark');
  28.         }
  29.         $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'];
  30.         $agencyPromoId 172;
  31.         $validationAgencyFolder false;
  32.         foreach ($agenciesExcluded as $agencyExcluded) {
  33.             if ($agencyExcluded === $agency->getName()) {
  34.                 $agencyPromoId $session->get('agencyId');
  35.                 $validationAgencyFolder true;
  36.             }
  37.         }
  38.         $homePromoList $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(['type' => '__vuelos'.$promoType'agency' => $agencyPromoId'online' => true]);
  39.         if ($homePromoList != null) {
  40.             $homePromoTitle $homePromoList->getTitle();
  41.             $homePromoSubtitle $homePromoList->getSubtitle();
  42.             $homePromos $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoList, ['date' => 'DESC']);
  43.         } else {
  44.             $homePromoTitle null;
  45.             $homePromoSubtitle null;
  46.             $homePromos = [];
  47.         }
  48.         $homePromoListMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos'.$promoTypeMain"agency" => $agencyPromoId"online" => true]);
  49.         if ($homePromoListMain != null) {
  50.             $homePromoMainTitle $homePromoListMain->getTitle();
  51.             $homePromoMainSubtitle $homePromoListMain->getSubtitle();
  52.             $homePromosMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMain, ['date' => 'DESC']);
  53.         } else {
  54.             $homePromoMainTitle null;
  55.             $homePromoMainSubtitle null;
  56.             $homePromosMain = [];
  57.         }
  58.         $homePromoListRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos'.$promoTypeRecommendations"agency" => $agencyPromoId"online" => true]);
  59.         if ($homePromoListRecommendations != null) {
  60.             $homePromoRecommendationsTitle $homePromoListRecommendations->getTitle();
  61.             $homePromoRecommendationsSubtitle $homePromoListRecommendations->getSubtitle();
  62.             $homePromosRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListRecommendations, ['date' => 'DESC']);
  63.         } else {
  64.             $homePromoRecommendationsTitle null;
  65.             $homePromoRecommendationsSubtitle null;
  66.             $homePromosRecommendations = [];
  67.         }
  68.         $homePromoListFaq $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos' $promoTypeFaq"agency" => $agencyPromoId"online" => true]);
  69.         if ($homePromoListFaq != null) {
  70.             $homePromoFaqTitle $homePromoListFaq->getTitle();
  71.             $homePromoFaqSubtitle $homePromoListFaq->getSubtitle();
  72.             $homePromosFaq $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListFaq, ['date' => 'DESC']);
  73.         } else {
  74.             $homePromoFaqTitle null;
  75.             $homePromoFaqSubtitle null;
  76.             $homePromosFaq = [];
  77.         }
  78.         $configsFlightCalendarAgency $em->getRepository(\Aviatur\FlightBundle\Entity\ConfigFlightCalendarAgency::class)->findProviderForFlightsWithAgency($agency);
  79.         $providerInfo true;
  80.         $providers = [];
  81.         foreach ($configsFlightCalendarAgency as $configFlightCalendarAgency) {
  82.             $provider $configFlightCalendarAgency->getProvider()->getProvideridentifier();
  83.             if (!in_array($provider$providers)) {
  84.                 $providers[] = $provider;
  85.             }
  86.         }
  87.         $providerIds implode(';'$providers);
  88.         if(empty($providerIds)){
  89.             $providerInfo false;
  90.         }
  91.         $aviaturSearchExplore $em->getRepository(\Aviatur\GeneralBundle\Entity\Parameter::class)->findOneBy(['name' => 'aviatur_search_explore''value' => 1]);
  92.         $isFront $session->has('operatorId');
  93.         $pixelInfo = [];
  94.         $parameters json_decode($session->get($request->getHost() . '[parameters]'));
  95.         $currentDate date("Y-m-d");
  96.         $endDateCensocud $parameters->date_end_cencosud;
  97.         $activeCheckCencosud = (strtotime($endDateCensocud) >= strtotime($currentDate));
  98.         $validateExplore = !($aviaturSearchExplore === null);
  99.         $cookieLastSearch $searchFlightCookie->searchFlightCookie();
  100.         $agencyFolder $twigFolder->twigFlux();
  101.         return $this->render($twigFolder->twigExists('@AviaturTwig/' $agencyFolder '/Search/Flight/flightSearch_index.html.twig'), ['validateExplore' => $validateExplore'pixel_info' => $pixelInfo'providerInfo' => $providerInfo'cookieLastSearch' => $cookieLastSearch'homePromos' => $homePromos'titlePromo' => $homePromoTitle'subtitlePromo' => $homePromoSubtitle'promoType' => '__vuelos''homePromosMain' => $homePromosMain'titlePromoMain' => $homePromoMainTitle'subtitlePromoMain' => $homePromoMainSubtitle'promoTypeMain' => '__vuelos'.$promoTypeMain'homePromosRecommendations' => $homePromosRecommendations'titlePromoRecommendations' => $homePromoRecommendationsTitle'subtitlePromoRecommendations' => $homePromoRecommendationsSubtitle'promoTypeRecommendations' => '__vuelos'.$promoTypeRecommendations'activeCheckCencosud' => $activeCheckCencosud'validationAgencyFolder' => $validationAgencyFolder'homePromosFaq' => $homePromosFaq'titlePromoFaq' => $homePromoFaqTitle'subtitlePromoFaq' => $homePromoFaqSubtitle'promoTypeFaq' => '__vuelos' $promoTypeFaq]);
  102.     }
  103. }