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

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.         if($session->has('whitemark') === true){
  26.             $promoType '_' $session->get('whitemark');
  27.         }
  28.         $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'];
  29.         $agencyPromoId 172;
  30.         $validationAgencyFolder false;
  31.         foreach ($agenciesExcluded as $agencyExcluded) {
  32.             if ($agencyExcluded === $agency->getName()) {
  33.                 $agencyPromoId $session->get('agencyId');
  34.                 $validationAgencyFolder true;
  35.             }
  36.         }
  37.         $homePromoList $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(['type' => '__vuelos'.$promoType'agency' => $agencyPromoId]);
  38.         if ($homePromoList != null) {
  39.             $homePromoTitle $homePromoList->getTitle();
  40.             $homePromoSubtitle $homePromoList->getSubtitle();
  41.             $homePromos $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoList, ['date' => 'DESC']);
  42.         } else {
  43.             $homePromoTitle null;
  44.             $homePromoSubtitle null;
  45.             $homePromos = [];
  46.         }
  47.         $homePromoListMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos'.$promoTypeMain"agency" => $agencyPromoId]);
  48.         if ($homePromoListMain != null) {
  49.             $homePromoMainTitle $homePromoListMain->getTitle();
  50.             $homePromoMainSubtitle $homePromoListMain->getSubtitle();
  51.             $homePromosMain $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListMain, ['date' => 'DESC']);
  52.         } else {
  53.             $homePromoMainTitle null;
  54.             $homePromoMainSubtitle null;
  55.             $homePromosMain = [];
  56.         }
  57.         $homePromoListRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromoList::class)->findOneBy(["type" => '__vuelos'.$promoTypeRecommendations"agency" => $agencyPromoId]);
  58.         if ($homePromoListRecommendations != null) {
  59.             $homePromoRecommendationsTitle $homePromoListRecommendations->getTitle();
  60.             $homePromoRecommendationsSubtitle $homePromoListRecommendations->getSubtitle();
  61.             $homePromosRecommendations $em->getRepository(\Aviatur\EditionBundle\Entity\HomePromo::class)->findByHomePromoList($homePromoListRecommendations, ['date' => 'DESC']);
  62.         } else {
  63.             $homePromoRecommendationsTitle null;
  64.             $homePromoRecommendationsSubtitle null;
  65.             $homePromosRecommendations = [];
  66.         }
  67.         $configsFlightCalendarAgency $em->getRepository(\Aviatur\FlightBundle\Entity\ConfigFlightCalendarAgency::class)->findProviderForFlightsWithAgency($agency);
  68.         $providerInfo true;
  69.         $providers = [];
  70.         foreach ($configsFlightCalendarAgency as $configFlightCalendarAgency) {
  71.             $provider $configFlightCalendarAgency->getProvider()->getProvideridentifier();
  72.             if (!in_array($provider$providers)) {
  73.                 $providers[] = $provider;
  74.             }
  75.         }
  76.         $providerIds implode(';'$providers);
  77.         if(empty($providerIds)){
  78.             $providerInfo false;
  79.         }
  80.         $aviaturSearchExplore $em->getRepository(\Aviatur\GeneralBundle\Entity\Parameter::class)->findOneBy(['name' => 'aviatur_search_explore''value' => 1]);
  81.         $isFront $session->has('operatorId');
  82.         $pixelInfo = [];
  83.         $parameters json_decode($session->get($request->getHost() . '[parameters]'));
  84.         $currentDate date("Y-m-d");
  85.         $endDateCensocud $parameters->date_end_cencosud;
  86.         $activeCheckCencosud = (strtotime($endDateCensocud) >= strtotime($currentDate));
  87.         $validateExplore = !($aviaturSearchExplore === null);
  88.         $cookieLastSearch $searchFlightCookie->searchFlightCookie();
  89.         $agencyFolder $twigFolder->twigFlux();
  90.         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]);
  91.     }
  92. }