403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/v2.hellogtx.com/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/v2.hellogtx.com/application/controllers/IndexController.php
<?php

/* * *************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name     : IndexController.php
 * File Desc.    : Index controller for home page front end
 * Created By    : Piyush Tiwari <piyush@catpl.co.in>
 * Created Date  : 27 June 2018
 * Updated Date  : ------------
 * ************************************************************* */

class IndexController extends Catabatic_CheckSession
{

  protected $objMdl;
  protected $tablename;
  protected $tablenameDestination;
  protected $baseUrl;
  protected $tollfreenumber;
  protected $objHelperGeneral;
  protected $per_page_record;
  public $_session;
  public $SearchSessionId;
  public $customerbookinglistAPIUrl;
  public $uploadPakcagePath;
  public $uploadDestinationPath;
  public $dummyImagePackage;
  public $dummyImageDestination;
  public $myNamespace;

  public function init()
  {
    parent::init();
    $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
    $BootStrap = $aConfig['bootstrap'];

    $this->siteName = $BootStrap['siteName'];
    $this->baseUrl = $BootStrap['siteUrl'];
    $this->tollfreenumber = $BootStrap['tollfreenumber'];
    $this->gtxagencysysid = $BootStrap['gtxagencysysid'];
    $this->gtxBtoBsite = $BootStrap['gtxBtoBsite'];
    $this->objMdl = new Admin_Model_CRUD();

    $this->tablename = "tb_tbb2c_packages_master";
    $this->tablenameTes = "tbl_testimonials";
    $this->tablenameDestination = "tb_tbb2c_destinations";
    $this->hotelTypeArr = ['Standard', 'Deluxe', 'Luxury'];

    $this->objHelperGeneral = $this->_helper->General;
    $this->per_page_record = 10;
    $this->_session = new Zend_Session_Namespace('User');
    $this->SearchSessionId = new Zend_Session_Namespace('SearchSessionId');

    $this->uploadPakcagePath = 'public/upload/tours/';
    $this->uploadDestinationPath = 'public/upload/destinations/';

    $this->dummyImagePackage = 'default-tour.jpg';
    $this->dummyImageDestination = 'default-destination.jpg';

    $this->enableCache = $BootStrap['enableCache'];
    $this->packageTypeStatic = $BootStrap['packageTypeDynamic'];


    $this->customerbookinglistAPIUrl = API_CUSTOMER_LIST; // from constant file

    $this->myNamespace = new Zend_Session_Namespace('MypopSess'); // get user end infomations
  }

  public function indexAction()
  {
    // Zend_Session::namespaceUnset('FlightBookingData');
    // Zend_Session::namespaceUnset('FlightBookingDataInbound');
    // Zend_Session::namespaceUnset('FlightFareQuoteSession');
    // Zend_Session::namespaceUnset('FlightFareQuoteSessionInb');
    // Zend_Session::namespaceUnset('FlightSearchUrl');
    // Zend_Session::namespaceUnset('FlightSearchGuard');
    // Zend_Session::namespaceUnset('CustomerSession');
    // Zend_Session::namespaceUnset('CustomerMemberSysIds');
    // Zend_Session::namespaceUnset('FlightBookingTicketSession');
    // Zend_Session::namespaceUnset('flight_booking_id');
    // Zend_Session::namespaceUnset('SelectedMealSessionNew');
    // Zend_Session::namespaceUnset('SelectedBaggSessionNew');
    // Zend_Session::namespaceUnset('SelectedMealSessionNewInb');
    // Zend_Session::namespaceUnset('SelectedBaggSessionNewInb');
    // Zend_Session::namespaceUnset('FlightBookingDataRoundInter');
    // Zend_Session::namespaceUnset('selectedSeatSession');
    // Zend_Session::namespaceUnset('FlightSeatSession');
    //$this->objMdl->runMyQuery("ALTER TABLE `tbl_pack_type` ADD `metaTitle` VARCHAR(256) NOT NULL AFTER `image`, ADD `metaKeyword` VARCHAR(500) NOT NULL AFTER `metaTitle`, ADD `metaDescription` VARCHAR(500) NOT NULL AFTER `metaKeyword`;");
    $currencyTypeArray = $this->objHelperGeneral->getCurrencyData();
    $decodedPackageDestinationArray = array();
    $arrContextOptions = array(
      "ssl" => array(
        "verify_peer" => false,
        "verify_peer_name" => false,
      ),
    );
    $url = $this->baseUrl . 'public/data/dynamic/package_destinations.json';
    $packageDestinationArray = file_get_contents($url, false, stream_context_create($arrContextOptions));

    //  $packageDestinationArray = file_get_contents($this->baseUrl . 'public/data/dynamic/package_destinations.json');
    //  echo "<pre>";print_r($packageDestinationArray);exit();
    if (!empty($packageDestinationArray)) {
      $decodedPackageDestinationArray = Zend_Json::decode($packageDestinationArray);
    }
    //        echo "<pre>";print_r($decodedPackageDestinationArray);die;    
    $destinatonTop = $this->objMdl->rv_select_all($this->tablenameDestination, ['DesSysId', 'Title', 'Activities', 'Hotels', 'Tours', 'Image', 'DestDescription'], ['IsActive' => 1, 'IsFeatured' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0], ['rand()' => ''], 8);

    $destinatonTopArr = array();
    foreach ($destinatonTop as $topdesKey => $topdesValue) {
      $desTitleValue = $topdesValue['Title'];
      $whereCustom = ($desTitleValue) ? " ( Destinations LIKE '%{$desTitleValue}%' )" : "";

      $tourResult = $this->objMdl->rv_select_row_where_custom($this->tablename, ['count(*) as totalCount'], ['IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1, 'ItemType' => 1], $whereCustom, [], '');


      $destinatonTopArr[] = [
        'DesSysId' => $topdesValue['DesSysId'],
        'Title' => $topdesValue['Title'],
        'Activities' => $topdesValue['Activities'],
        'Hotels' => $topdesValue['Hotels'],
        'Tours' => $topdesValue['Tours'],
        'Image' => $topdesValue['Image'],
        'DestDescription' => $topdesValue['DestDescription'],
        'totalCount' => $tourResult['totalCount'],

      ];
    }

    //        echo "<pre>";print_r($destinatonTopArr);die;
    $this->view->destinations = $destinatonTopArr;
    $this->view->baseUrl = $this->baseUrl;
    $this->view->tollfreenumber = $this->tollfreenumber;
    $this->view->siteName = $this->siteName;

    $trendingTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType', 'oldPrice'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 20);
    $trendingActivities = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType', 'oldPrice'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 3, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 12);
    //$currencyRate = $this->objMdl->rv_select_all('tbl_currency_rate', ['*'], ['cid'], ['cid' => 'DESC']);
    //$lastMinuteTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType','oldPrice'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1, 'lastMinuteDeal' => 1], ['PkgSysId' => 'DESC'], 6);

    foreach ($trendingTours as $key => $value) {

      $destinationArr = explode(',', $value['Destinations']); // get the first destination only by extracting array
      $LongJsonInfo = Zend_Json::decode($value['LongJsonInfo']);

      if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
        $categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2B', $value['PackageType'], $value['PackageSubType']); // get default category
      } else {
        $categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $value['PackageType'], $value['PackageSubType']); // get default category
      }

      if (trim($LongJsonInfo['package']['ImgThumbnail']) != '') {
        $tourImage =  $LongJsonInfo['package']['ImgThumbnail'];
      } else {
        $tourImage1 = explode(',', $value['Image']);
        $tourImage = $baseUrl . 'public/upload/tours/' . $value['PkgSysId'] . '/images/medium/' . $tourImage1[0];
      }

      $defaultCategoryId = $categoryDetails['defaultCategoryId'];
      $defaultCategory = $categoryDetails['defaultCategory'];
      $defaultTourType = $categoryDetails['defaultTourType'];
      $TPId = ($value['PackageType'] == $this->packageTypeStatic) ? $LongJsonInfo['package']['TPId'] : $categoryDetails['TPId'];
      $MPType = (!empty($categoryDetails['MPType']) && ($categoryDetails['MPType'] != 'LowestCost')) ? array_search($categoryDetails['MPType'], unserialize(CONST_MEAL_PLAN_ARR)) : 0;

      $tourTypeChar = ($defaultTourType == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
      $priceArrJson = $categoryDetails['priceArrJson'];

      $displayFinalPrice = $this->objHelperGeneral->getPackagePrice($defaultCategory, $tourTypeChar, $priceArrJson, true);  // Param 4: true ( if calculate discounted price )
      $getCurrencyType = $priceArrJson[$tourTypeChar][$defaultCategory]['price'][0]['Currency'];
      $toursFinal[] = [
        'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 24),
        'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
        'img' => $tourImage,
        'night' => $value['Nights'],
        'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
        'currencyType' => $currencyTypeArray[$getCurrencyType],
        'star' => $value['StarRating'],
        'Destination' => $value['Destinations'],
        'PkgSysId' => $value['PkgSysId'],
        'GTXPkgId' => $value['GTXPkgId'],
        'defaultCategoryId' => $defaultCategoryId,
        'defaultCategory' => $defaultCategory,
        'tourtype' => $defaultTourType,
        'TPId' => $TPId,
        'PackageType' => $value['PackageType'],
        'mp' => $MPType,
        'Countries' => $value['Countries'],
        'isFixedDeparturesPackage' => $LongJsonInfo['package']['IsFixedDeparturePackage'],
        'BookingValidUntil' => $value['BookingValidUntil'],
        'oldPrice' => $value['oldPrice'],
      ];
    }
    $activityFinal = array();
    foreach ($trendingActivities as $tKey => $tVal) {

      $LongJsonInfo = json_decode($tVal['LongJsonInfo'], 1);

      if (isset($LongJsonInfo['ThumnailImg']) && trim($LongJsonInfo['ThumnailImg']) != '') {
        $imagename =     $LongJsonInfo['ThumnailImg'];
      } else {
        $imagename1 = explode(',', $tVal['Image']);
        $imagename = $this->baseUrl . 'public/upload/activities/' . $tVal['PkgSysId'] . '/images/medium/' . $imagename1[0];
      }
      $rate = 1;

      // foreach($currencyRate as $cKey => $cVal){
      //  if($cVal['FCurrencyType'] == $LongJsonInfo['Currency'] && $cVal['TCurrencyType'] == 1){
      //      $rate = $cVal['Rate'];
      //  }    
      // }
      $netPrice = 0;
      if (!empty($LongJsonInfo['SICCost'])) {
        $netPrice = (int)($LongJsonInfo['SICCost'][0]['NetAdultCost'] + $LongJsonInfo['AdultEntryFee']);
      } else if (!empty($LongJsonInfo['PvtCost'])) {
        $netPrice = (int)($LongJsonInfo['PvtCost'][0]['NetAdultCost'] + $LongJsonInfo['AdultEntryFee']);
      } else {
        $netPrice = (int)$LongJsonInfo['AdultEntryFee'];
      }
      //echo "<pre>";print_r($LongJsonInfo);die;
      $activityFinal[] = [
        'PkgSysId' => $tVal['PkgSysId'],
        'Title' => $LongJsonInfo['Title'],
        'destination' => $tVal['Destinations'],
        'oldPrice' => (isset($tVal['oldPrice']) && $tVal['oldPrice'] != 0 && $tVal['oldPrice'] != '') ? $tVal['oldPrice'] : '',
        'Image' => $imagename,
        'Duration' => $LongJsonInfo['Duration'],
        'DurationInMin' => $LongJsonInfo['DurationInMin'],
        'DurationStr' => $LongJsonInfo['DurationStr'],
        'PriceAdditional' => isset($netPrice) ? round($netPrice) : 0,
        'CurrencySymbol' => isset($LongJsonInfo['CurrencySymbol']) ? $LongJsonInfo['CurrencySymbol'] : 'INR',
        //                'CurrencySymbol' => ($currencyType) ? $currencyType : 'INR',

      ];
    }

    $testimonials = $this->objMdl->rv_select_all('tbl_feedback', ['*'], ['IsActive' => 1, 'displayOnHome' => 1], ['FeedbackId' => 'DESC'], 10);
    $bannerDetail = $this->objMdl->rv_select_all('tb_homebanner_detail', ['banner_id', 'image', 'heading', 'description', 'url', 'opt'], ['status' => 1, 'isDisplayOnHome' => 1, 'isMarkForDel' => 0], ['banner_id' => 'DESC'], 10);
    $resultsetTheme = $this->objMdl->rv_select_all('tbl_pack_type', ['*'], ['isMarkForDel' => 0, 'IsActive' => 1, 'displayOnHome' => 1], ['packType' => 'ASC'], 20);

    $homePromotionTypeOne = $this->objMdl->rv_select_all('tbl_home_promotion', ['*'], ['IsmarkForDel' => 0, 'IsFeatured' => 1, 'templatetype' => 1], ['promotionId' => 'DESC'], 10);
    $homePromotionTypeTwo = $this->objMdl->rv_select_all('tbl_home_promotion', ['*'], ['IsmarkForDel' => 0, 'IsFeatured' => 1, 'templatetype' => 2], ['promotionId' => 'DESC'], 1);
    $homePromotionTypeThree = $this->objMdl->rv_select_all('tbl_home_promotion', ['*'], ['IsmarkForDel' => 0, 'IsFeatured' => 1, 'templatetype' => 3], ['promotionId' => 'DESC'], 1);
    $tagName = json_decode($homePromotionTypeTwo[0]['promotion_name']);
    $promotionUrl = json_decode($homePromotionTypeTwo[0]['promotion_url']);
    $tabType = json_decode($homePromotionTypeTwo[0]['tab_type']);
    $finalArrayTwo = array();
    $finalArrayTwo[0] = ['tagNAme' => $tagName->promotion_tag1, 'promotionUrl' => $promotionUrl->promotion_tag_url1, 'tabType' => $tabType->tagopt1];
    $finalArrayTwo[1] = ['tagNAme' => $tagName->promotion_tag2, 'promotionUrl' => $promotionUrl->promotion_tag_url2, 'tabType' => $tabType->tagopt2];
    $finalArrayTwo[2] = ['tagNAme' => $tagName->promotion_tag3, 'promotionUrl' => $promotionUrl->promotion_tag_url3, 'tabType' => $tabType->tagopt3];
    $finalArrayTwo[3] = ['tagNAme' => $tagName->promotion_tag4, 'promotionUrl' => $promotionUrl->promotion_tag_url4, 'tabType' => $tabType->tagopt4];
    $homePromotionTypeTwoArr = array();
    if ($homePromotionTypeTwo[0]['promotionId']) {
      $homePromotionTypeTwoArr = [
        'promotionId' => $homePromotionTypeTwo[0]['promotionId'],
        'templatetype' => $homePromotionTypeTwo[0]['templatetype'],
        'promotion_image' => $homePromotionTypeTwo[0]['promotion_image'],
        'finalArrayTwo' => $finalArrayTwo,
      ];
    }

    $resultPromotionCategory = $this->objMdl->getCmsdata('tbl_promotion_category', ['*'], ['prom_cat_id'], ['prom_cat_id' => 'DESC']);
    $getCmsPageDetail = $this->objMdl->rv_select_row('tbl_static_pages', ['page_description'], ['identifier' => 'about-us', 'status' => 'Activate'], ['sid' => 'desc']);
    $getOfferDetail = $this->objMdl->rv_select_row('tbl_offers', ['*'], ['status' => 1, 'id' => 1], ['id' => 'desc']);
    $travelogues = $this->objMdl->rv_select_all('tbl_travelogues', ['*'], ['isMarkForDel' => 0, 'status' => 1, 'displayOnBanner' => 1, 'category' => 1], ['TravId' => 'DESC'], 10);

    $this->view->travelogues = $travelogues;
    $this->view->getOfferDetail = $getOfferDetail;
    //        echo "<pre>";print_r($getCmsPageDetail);die;
    $this->view->getCmsPageDetail = $getCmsPageDetail;
    $this->view->resultPromotionCategory = $resultPromotionCategory;
    $this->view->homePromotionTypeOne = $homePromotionTypeOne;
    $this->view->homePromotionTypeTwo = $homePromotionTypeTwoArr;
    $this->view->homePromotionTypeThree = $homePromotionTypeThree[0];
    $this->view->testimonials = $testimonials;
    $this->view->bannerDetail = $bannerDetail;
    $this->view->baseUrl = $this->baseUrl;
    $this->view->toursFinal = $toursFinal;
    $this->view->resultsetTheme = $resultsetTheme;
    $this->view->lastMinuteTours = $lastMinuteToursFinal;
    $this->view->packageDestinationArray = $decodedPackageDestinationArray;
    $this->view->activityFinal = $activityFinal;
    $this->view->MobileDetect = $this->objHelperGeneral->getDevice();
    //$this->view->destinationsDomestic = $destinationsDomestic;
    //$this->view->destinationsInternational = $destinationsInternational;

    $popularDestination = $this->objMdl->rv_select_all('tbl_countries', ['contSysId', 'title', 'Image', 'description', 'countryId'], ['IsActive' => 1, 'IsMarkForDel' => 0, 'displayOnVisa' => 1], ['title' => 'ASC']);
    $countryCode = $this->objMdl->rv_select_all('tb_master_geo_country', ['contId', 'code'], ['isActive' => 1, 'isMarkForDel' => 0], ['contId' => 'DESC']);
    $countryCodeArr = array();
    foreach ($countryCode as $cKey => $cVal) {
      $countryCodeArr[$cVal['contId']] = $cVal['code'];
    }
    // echo "<pre>";print_r($popularDestination);die;
    foreach ($popularDestination as $desKey => $desValue) {
      $popularDestinationArray[] = [
        'contSysId' => $desValue['contSysId'],
        'Image' => $desValue['Image'],
        'title' => $desValue['title'],
        'description' => $desValue['description'],
        'code' => $countryCodeArr[$desValue['countryId']],
      ];
    }
    $sessionFlightSearchParams = new Zend_Session_Namespace('sessionFlightSearchParams'.$this->SearchSessionId->params);
    $this->view->sessionFlightSearchParams = $sessionFlightSearchParams->params;
    $this->view->popularDestinationArray = $popularDestinationArray;
    $this->view->gtxBtoBsite = $this->gtxBtoBsite;
  }

  public function destinationAction()
  {
    $this->objMdl = new Admin_Model_CRUD();
    $destinations = $this->objMdl->getDestinationsHeader(['tbl.IsActive' => 1, 'tbl.IsPublish' => 1, 'tbl.IsMarkForDel' => 0, 'tb2.IsMarkForDel' => 0], ['tbl.DesSysId' => 'ASC'], 100);
    //        echo "<pre>";print_r($destinations);die;
    $destinationsAll = $this->objMdl->getDestinationsHeader(['tbl.IsActive' => 1, 'tbl.IsPublish' => 1, 'tbl.IsMarkForDel' => 0], ['tbl.DesSysId' => 'ASC'], 100);




    $region_names = $finalDestination = $finalDestinationAll = [];
    $regionnew = '';
    $region = trim($this->getRequest()->getParam('region'));
    $des = trim($this->getRequest()->getParam('des'));

    if (isset($region) && $region != '') {


      foreach ($destinations as $key => $value) {
        if (isset($region) && !empty($region)) {
          if ($region == $value['region_label']) {
            if (($value['region_label'] != NULL) && !in_array($value['region_label'], $region_names)) {
              $region_names[] = $value['region_label'];
              if ($region == $value['region_label']) {
                $regionnew = $value['region_name'];
              }
            }

            $finalDestination[$value['region_label']][] = [
              'DesSysId' => $value['DesSysId'],
              'Title' => $value['Title'],
              'Image' => $value['Image'],
              'Tours' => $value['Tours'],
            ];
          }
        }
      }
      //                echo "<pre>";print_r($finalDestination);die;
    } else if (isset($des) && $des != '') {
      if ($des == 'Domestic') {
        $destinationsAll = $this->objMdl->getDestinationsInd(['tbl.IsActive' => 1, 'tbl.IsPublish' => 1, 'tbl.IsMarkForDel' => 0], ['tbl.DesSysId' => 'ASC'], 100);
      } else {
        $destinationsAll = $this->objMdl->getDestinationsInt(['tbl.IsActive' => 1, 'tbl.IsPublish' => 1, 'tbl.IsMarkForDel' => 0], ['tbl.DesSysId' => 'ASC'], 100, 101);
      }
      foreach ($destinationsAll as $allkey => $allvalue) {

        $finalDestinationAll[] = [
          'DesSysId' => $allvalue['DesSysId'],
          'Title' => $allvalue['Title'],
          'Image' => $allvalue['Image'],
          'Tours' => $allvalue['Tours'],
        ];
      }
    } else {

      foreach ($destinationsAll as $allkey => $allvalue) {

        $finalDestinationAll[] = [
          'DesSysId' => $allvalue['DesSysId'],
          'Title' => $allvalue['Title'],
          'Image' => $allvalue['Image'],
          'Tours' => $allvalue['Tours'],
        ];
      }
    }
    $regionImage = $this->objMdl->getRegionImage($region);

    $this->view->baseUrl = $this->baseUrl;
    $this->view->finalDestinationAll = $finalDestinationAll;
    $this->view->finalDestination = $finalDestination;
    $this->view->region_names = $region_names;
    //        $this->view->region = $region;
    $this->view->region = $regionnew;
    $this->view->des = $des;
  }

  public function saveLetterAction()
  {
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    if ($this->getRequest()->isPost()) {
      $param = $this->getRequest()->getParams();
      $date = new Zend_Date();
      $currentDate = $date->get('YYYY-MM-dd HH:mm:ss');
      $email = $param['email'];

      $newsletter = new Travel_Model_PackagesMaster();

      $savePageData = [
        'created_date' => $currentDate,
        'news_letter_email' => $email,
        'status' => 1,
      ];

      $resultset = $newsletter->checkLetter("tb_tbb2c_newsletter", ['*'], ['news_letter_email' => $savePageData['news_letter_email']]);

      if (isset($resultset) && !empty($resultset)) {
        $response = array('success' => false, 'msg' => 'This Email Id Already Exists!!!');
        echo json_encode($response);
        exit;
      } else {
        $returnId = $newsletter->sendNewsLetter('tb_tbb2c_newsletter', $savePageData);
        if ($returnId) {
          $response = array('success' => true, 'msg' => 'Your query has been submitted successfully!');
          echo json_encode($response);
          exit;
        }
      }
    }
  }

  public function autosuggestdesAction()
  {
    try {
      $arrResponse = array();
      if ($this->getRequest()->getParam("term")) {
        $term = $this->getRequest()->getParam("term");
        $objDes = new Travel_Model_PackagesMaster();
        $arrResponse = $objDes->getDestinationAutoSuggest($term, $this->tablename);
      }
      //print_r($arrResponse);die('okkk');
      echo json_encode($arrResponse);
      exit;
    } catch (Exception $e) {
      $response = array('success' => false, 'msg' => $e->getMessage());
      echo json_encode($response);
      exit;
    }
  }

  public function autosuggestAction()
  {
    $this->_helper->viewRenderer->setNoRender(true);
    $this->_helper->layout->disableLayout();
    try {
      $arrResponse = array();
      if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
        $term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
        $countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';

        $condCity = "tbl.Title like '" . $term . "%'";
        if (isset($countryId) && !empty($countryId)) {
          $condCity .= " AND tbl.ContSysId = " . $countryId . "";
        }
        $arrResponse = $this->objMdl->getBuyHotelCityAutoSuggest($condCity);
      }
      echo json_encode($arrResponse);
      exit;
    } catch (Exception $e) {
      $response = array('success' => false, 'msg' => $e->getMessage());
      echo json_encode($response);
      exit;
    }
  }

  public function customerloginAction()
  {
    //die('here');
    $request = Zend_Controller_Front::getInstance()->getRequest();
    if ($this->getRequest()->isPost()) {
      $data = $request->getPost();
      //echo "<pre>";print_r($data);die;
      $this->_session->session = $data;
      //            echo $data['redirect_link_r'];die;
      //            $this->_redirect($data['redirect_link_r']);
      $response = array('status' => true, 'msg' => 'success');
      echo json_encode($response);
      exit;
    }
  }

  public function logoutAction()
  {
    $storage = new Zend_Session_Namespace('User');
    $storage->unsetAll();
    $this->_redirect('/');
  }

  /*
     * writeSessionPopup is used to show the request a callback popup window after interval on landing page
     */

  public function writeSessionPopupAction()
  {
    $myNamespace = new Zend_Session_Namespace('MypopSess');
    $myNamespace->setPopup = true;
    $myNamespace->session_time = time();
    exit;
  }
  public function awardsAction()
  {

    $this->view->baseUrl = $this->baseUrl;
  }


  public function galleryAction()
  {

    $this->view->baseUrl = $this->baseUrl;
    $this->objMdl = new Admin_Model_CRUD();
    $galleryDetail = $this->objMdl->rv_select_all('tb_gallery_detail', ['gallery_id', 'image', 'title'], ['status' => 1], ['gallery_id' => 'DESC']);
    $this->view->galleryDetail = $galleryDetail;
  }


  public function sendSearchFlightEmailAction()
  {
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    $arrPrefferedAirlines = unserialize(CONST_FLIGHT_PREFERRED_AIRLINES);
    $arrCabinClass = unserialize(CONST_FLIGHT_CABIN_CLASS);

    if ($this->getRequest()->isPost()) {
      $param = $this->getRequest()->getParams();
      $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
      //            echo "<pre>";print_r($param);die;

      $sourceName = $param['sourceName'];
      $destinationName = $param['destinationName'];
      $depart_date = isset($param['depart_date']) ? $param['depart_date'] : '';
      $return_date = isset($param['return_date']) ? $param['return_date'] : '';
      $adults = $param['adults'];
      $childs = $param['childs'];
      $infants = $param['infants'];
      $cabin_class = $arrCabinClass[$param['cabin_class']];
      $subject = "Flight Enquiry Details";
      $message = '';
      $message .= '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:14px; font-family: Roboto, sans-serif;">
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
                                    <br>
                                    You have received a new flight query detail as below:</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">From Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $sourceName . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">To Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $destinationName . '</td>
                                </tr>
                                
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Departing : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $depart_date . '</td>
                                </tr>';
      if ($return_date != '') {
        $message .= '<tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Returning : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $return_date . '</td>
                                </tr>';
      }

      $message .= '<tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Travelers : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">Adult(s) : ' . $adults . ', Child(s) : ' . $childs . ', Infant(s) : ' . $infants . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Cabin Class : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cabin_class . '</td>
                                </tr>
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
                                    <hr / style="border-width: 0.6px;">
                                    <br>
                                    <br>
                                    contact number: ' . $contactDetail_mail["mobile"] . '<br>
                                    Email: ' . $contactDetail_mail["email"] . '</td>
                                </tr>
                              </table>
                              <div style="text-align:center;">
                                   <img style="width:100px;" src="' . $this->baseUrl . 'public/images/logo.png" />
                                </div>
                              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" >
                              <tr>
                                  <td style=" text-align:right;">Powered by &#45; <a  href="http://www.hellogtx.com/" target="_blank" style="font-family:AvantGarde Bk BT;color:#0b74c4; text-decoration:none">hello<span style="font-family:AvantGarde Bk BT;color:#fb5a2d;">GTX</span></a></td>
                                </tr>
                              </table>';




      $configs = [
        'to' => $contactDetail_mail['email'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $message,
      ];

      $emailres = $this->_helper->General->mailSentByElastice($configs, 'Flight');



      if ($emailres) {
        $response = array('status' => true, 'msg' => 'Flight enquiry sent successfully.');
        echo json_encode($response);
        exit;
      } else {
        $response = array('status' => false, 'msg' => 'Unable to send enquiry.');
        echo json_encode($response);
        exit;
      }
    }
  }

  public function sendSearchHotelEmailAction()
  {
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    $arrPrefferedAirlines = unserialize(CONST_FLIGHT_PREFERRED_AIRLINES);
    $arrCabinClass = unserialize(CONST_FLIGHT_CABIN_CLASS);

    if ($this->getRequest()->isPost()) {
      $param = $this->getRequest()->getParams();
      $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
      //            echo "<pre>";print_r($param);die;

      $cityName = $param['cityNameVal'];
      $cityId = $param['cityId'];
      echo $cityName;
      echo $cityId;
      die();
      $check_in = isset($param['check_in']) ? $param['check_in'] : '';
      $check_out = isset($param['check_out']) ? $param['check_out'] : '';
      $roomDetail = '';
      for ($m = 1; $m <= $param['roomcount']; $m++) {

        $roomDetail .= 'Room ' . $m . ' : Adult : ' . $param['traveler_hotel_adult_' . $m] . ', Child : ' . $param['traveler_hotel_child_' . $m] . '<br>';
      }

      $cabin_class = $arrCabinClass[$param['cabin_class']];
      $subject = "Hotel Enquiry Details";
      $message = '';
      $message .= '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:14px; font-family: Roboto, sans-serif;">
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
                                    <br>
                                    You have received a new hotel query detail as below:</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cityName . '</td>
                                </tr>
                                
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Check In  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $check_in . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Check Out  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $check_out . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Travelers : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $roomDetail . '</td>
                                </tr>
                               
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
                                    <hr / style="border-width: 0.6px;">
                                    <br>
                                    <br>
                                    contact number: ' . $contactDetail_mail["mobile"] . '<br>
                                    Email: ' . $contactDetail_mail["email"] . '</td>
                                </tr>
                              </table>
                              <div style="text-align:center;">
                                   <img style="width:100px;" src="' . $this->baseUrl . 'public/images/logo.png" />
                                </div>
                              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" >
                              <tr>
                                  <td style=" text-align:right;">Powered by &#45; <a  href="http://www.hellogtx.com/" target="_blank" style="font-family:AvantGarde Bk BT;color:#0b74c4; text-decoration:none">hello<span style="font-family:AvantGarde Bk BT;color:#fb5a2d;">GTX</span></a></td>
                                </tr>
                              </table>';

      $configs = [
        'to' => $contactDetail_mail['email'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $message,
      ];

      $emailres = $this->_helper->General->mailSentByElastice($configs, 'Hotel');



      if ($emailres) {
        $response = array('status' => true, 'msg' => 'Hotel enquiry sent successfully.');
        echo json_encode($response);
        exit;
      } else {
        $response = array('status' => false, 'msg' => 'Unable to send enquiry.');
        echo json_encode($response);
        exit;
      }
    }
  }

  public function sendSearchCabsEmailAction()
  {
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    $arrPrefferedAirlines = unserialize(CONST_FLIGHT_PREFERRED_AIRLINES);
    $arrCabinClass = unserialize(CONST_FLIGHT_CABIN_CLASS);

    if ($this->getRequest()->isPost()) {
      $param = $this->getRequest()->getParams();
      $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
      //            echo "<pre>";print_r($param);die;

      $cabFromDestinationName = $param['cabFromDestinationName'];
      $cabToDestinationName = $param['cabToDestinationName'];
      $cab_start_date = isset($param['cab_start_date']) ? $param['cab_start_date'] : '';
      $cab_end_date = isset($param['cab_end_date']) ? $param['cab_end_date'] : '';


      $subject = "Cabs Enquiry Details";
      $message = '';
      $message .= '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:14px; font-family: Roboto, sans-serif;">
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
                                    <br>
                                    You have received a new hotel query detail as below:</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">From Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cabFromDestinationName . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">To Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cabToDestinationName . '</td>
                                </tr>
                                
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Start Date  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cab_start_date . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">End Date  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cab_end_date . '</td>
                                </tr>
                                
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
                                    <hr / style="border-width: 0.6px;">
                                    <br>
                                    <br>
                                    contact number: ' . $contactDetail_mail["mobile"] . '<br>
                                    Email: ' . $contactDetail_mail["email"] . '</td>
                                </tr>
                              </table>
                              <div style="text-align:center;">
                                   <img style="width:100px;" src="' . $this->baseUrl . 'public/images/logo.png" />
                                </div>
                              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" >
                              <tr>
                                  <td style=" text-align:right;">Powered by &#45; <a  href="http://www.hellogtx.com/" target="_blank" style="font-family:AvantGarde Bk BT;color:#0b74c4; text-decoration:none">hello<span style="font-family:AvantGarde Bk BT;color:#fb5a2d;">GTX</span></a></td>
                                </tr>
                              </table>';

      $configs = [
        'to' => $contactDetail_mail['email'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $message,
      ];

      $emailres = $this->_helper->General->mailSentByElastice($configs, 'Cabs');



      if ($emailres) {
        $response = array('status' => true, 'msg' => 'Cab enquiry sent successfully.');
        echo json_encode($response);
        exit;
      } else {
        $response = array('status' => false, 'msg' => 'Unable to send enquiry.');
        echo json_encode($response);
        exit;
      }
    }
  }

  public function sendSearchForexEmailAction()
  {
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    $arrPrefferedAirlines = unserialize(CONST_FLIGHT_PREFERRED_AIRLINES);
    $arrCabinClass = unserialize(CONST_FLIGHT_CABIN_CLASS);

    if ($this->getRequest()->isPost()) {
      $param = $this->getRequest()->getParams();
      $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
      //            echo "<pre>";print_r($param);die;

      $forexFromDestinationName = $param['forexFromDestinationName'];
      $forexToDestinationName = $param['forexToDestinationName'];
      $forex_depart_date = isset($param['forex_depart_date']) ? $param['forex_depart_date'] : '';
      $forex_return_date = isset($param['forex_return_date']) ? $param['forex_return_date'] : '';


      $subject = "Forex Enquiry Details";
      $message = '';
      $message .= '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:14px; font-family: Roboto, sans-serif;">
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
                                    <br>
                                    You have received a new hotel query detail as below:</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">From Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $forexFromDestinationName . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">To Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $forexToDestinationName . '</td>
                                </tr>
                                
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Departing Date  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $forex_depart_date . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Returning Date  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $forex_return_date . '</td>
                                </tr>
                                
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
                                    <hr / style="border-width: 0.6px;">
                                    <br>
                                    <br>
                                    contact number: ' . $contactDetail_mail["mobile"] . '<br>
                                    Email: ' . $contactDetail_mail["email"] . '</td>
                                </tr>
                              </table>
                              <div style="text-align:center;">
                                   <img style="width:100px;" src="' . $this->baseUrl . 'public/images/logo.png" />
                                </div>
                              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" >
                              <tr>
                                  <td style=" text-align:right;">Powered by &#45; <a  href="http://www.hellogtx.com/" target="_blank" style="font-family:AvantGarde Bk BT;color:#0b74c4; text-decoration:none">hello<span style="font-family:AvantGarde Bk BT;color:#fb5a2d;">GTX</span></a></td>
                                </tr>
                              </table>';

      $configs = [
        'to' => $contactDetail_mail['email'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $message,
      ];

      $emailres = $this->_helper->General->mailSentByElastice($configs, 'Forex');



      if ($emailres) {
        $response = array('status' => true, 'msg' => 'Forex enquiry sent successfully.');
        echo json_encode($response);
        exit;
      } else {
        $response = array('status' => false, 'msg' => 'Unable to send enquiry.');
        echo json_encode($response);
        exit;
      }
    }
  }


  public function sendSearchTrainEmailAction()
  {
    $this->view->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
    $arrPrefferedAirlines = unserialize(CONST_FLIGHT_PREFERRED_AIRLINES);
    $arrCabinClass = unserialize(CONST_TRAIN_CABIN_CLASS);

    if ($this->getRequest()->isPost()) {
      $param = $this->getRequest()->getParams();
      $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
      //            echo "<pre>";print_r($param);die;

      $trainFromDestinationName = $param['trainFromDestinationName'];
      $trainToDestinationName = $param['trainToDestinationName'];
      $train_depart_date = isset($param['train_depart_date']) ? $param['train_depart_date'] : '';
      $train_return_date = isset($param['train_return_date']) ? $param['train_return_date'] : '';

      $adults = $param['adults'];
      $childs = $param['childs'];
      $infants = $param['infants'];
      $cabin_class = $arrCabinClass[$param['train_class']];
      $subject = "Train Enquiry Details";
      $message = '';
      $message .= '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:14px; font-family: Roboto, sans-serif;">
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
                                    <br>
                                    You have received a new hotel query detail as below:</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">From Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $trainFromDestinationName . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">To Destination : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $trainToDestinationName . '</td>
                                </tr>
                                
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Departing Date  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $train_depart_date . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Returning Date  : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $train_return_date . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Travelers : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">Adult(s) : ' . $adults . ', Child(s) : ' . $childs . ', Infant(s) : ' . $infants . '</td>
                                </tr>
                                <tr>
                                  <td width="30%" style=" padding:5px 40px;vertical-align: middle;">Cabin Class : </td>
                                  <td width="70%" style=" padding:5px 40px;vertical-align: middle;">' . $cabin_class . '</td>
                                </tr>
                                
                                <tr>
                                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
                                    <hr / style="border-width: 0.6px;">
                                    <br>
                                    <br>
                                    contact number: ' . $contactDetail_mail["mobile"] . '<br>
                                    Email: ' . $contactDetail_mail["email"] . '</td>
                                </tr>
                              </table>
                              <div style="text-align:center;">
                                   <img style="width:100px;" src="' . $this->baseUrl . 'public/images/logo.png" />
                                </div>
                              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" >
                              <tr>
                                  <td style=" text-align:right;">Powered by &#45; <a  href="http://www.hellogtx.com/" target="_blank" style="font-family:AvantGarde Bk BT;color:#0b74c4; text-decoration:none">hello<span style="font-family:AvantGarde Bk BT;color:#fb5a2d;">GTX</span></a></td>
                                </tr>
                              </table>';

      $configs = [
        'to' => $contactDetail_mail['email'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $message,
      ];

      $emailres = $this->_helper->General->mailSentByElastice($configs, 'Forex');



      if ($emailres) {
        $response = array('status' => true, 'msg' => 'Train enquiry sent successfully.');
        echo json_encode($response);
        exit;
      } else {
        $response = array('status' => false, 'msg' => 'Unable to send enquiry.');
        echo json_encode($response);
        exit;
      }
    }
  }


  public function getCitydataAction()
  {
    $this->_helper->viewRenderer->setNoRender(true);
    $this->_helper->layout->disableLayout();
    $crud = new Admin_Model_CRUD();
    //       print_r($this->getRequest()->getParam("term"));
    //       exit;
    try {
      $arrResponse = array();
      if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
        $term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
        $countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';

        $condCity = "tbl.Title like '" . $term . "%'";
        if (isset($countryId) && !empty($countryId)) {
          $condCity .= " AND tbl.ContSysId = " . $countryId . "";
        }
        //echo $condCity;
        $arrResponse = $crud->getBuyHotelCityAutoSuggest($condCity);
        //                 print_r($arrResponse);die;
      }
      echo json_encode($arrResponse);
      exit;
    } catch (Exception $e) {
      $response = array('success' => false, 'msg' => $e->getMessage());
      echo json_encode($response);
      exit;
    }
  }

  public function thanksAction()
  {
    $this->view->baseUrl = $this->baseUrl;
  }
  function curl_get($url, array $get = NULL, array $options = array())
  {
    $defaults = array(
      CURLOPT_URL => $url . (strpos($url, '?') === FALSE ? '?' : '') . http_build_query($get),
      CURLOPT_HEADER => 0,
      CURLOPT_RETURNTRANSFER => TRUE,
      CURLOPT_TIMEOUT => 4
    );

    $ch = curl_init();
    curl_setopt_array($ch, ($options + $defaults));
    if (!$result = curl_exec($ch)) {
      trigger_error(curl_error($ch));
    }
    curl_close($ch);
    return $result;
  }
  public function sendFeedbackImageUploadAction()
  {
    //        $filename = $_FILES['file']['name'];
    $orignalFIle = @$_FILES["file1"]["name"];


    //        echo "<pre>";print_r($_FILES);die;
    if (isset($_FILES) && !empty($_FILES)) {
      foreach ($_FILES as $key => $orignalFIleName) {
        if (!empty($orignalFIleName)) {
          $orignalFIleName = $_FILES[$key]["name"];
          $orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/public/upload/feedback/image";
          $originalSmallFolder = $orignalFolderName . "/small";
          $fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
          $fileName = 'feedback_' . $key . '_' . time() . '.' . $fileExt;
          if (!file_exists($orignalFolderName)) {
            @mkdir($orignalFolderName, 0777, true);
          }
          if (!file_exists($originalSmallFolder)) {
            @mkdir($originalSmallFolder, 0777, true);
          }
          $temp_file_name = $_FILES[$key]["tmp_name"]; // temprary file name
          if (move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName)) {
            $fileNameArray[] = $fileName;
          }
        }
      }
      $resultArr = array('status' => true, 'fileNameArray' => $fileNameArray, 'total' => count($fileNameArray));
    } else {
      $resultArr = array('status' => false, 'total' => 0);
    }
    echo json_encode($resultArr);
    exit;
  }




  public function sendFeedbackAction()
  {
    //         $objCustomerRewiew = new CustomerReview_Model_Feedback();
    $this->_helper->layout->disableLayout();
    $front = Zend_Controller_Front::getInstance();
    $front->setParam('noViewRenderer', true);
    if ($this->getRequest()->getPost()) {
      $param = $this->getRequest()->getParams();
      $contactDetail_mail = Zend_Controller_Action_HelperBroker::getStaticHelper('Custom')->getContactDetailForFooter();
      $date = date('Y');
      $TravelMonthArr = [
        1 => 'Jan ' . $date,
        2 => 'Feb ' . $date,
        3 => 'Mar ' . $date,
        4 => 'Apr ' . $date,
        5 => 'May ' . $date,
        6 => 'Jun ' . $date,
        7 => 'Jul ' . $date,
        8 => 'Aug ' . $date,
        9 => 'Sep ' . $date,
        10 => 'Oct ' . $date,
        11 => 'Nov ' . $date,
        12 => 'Dec ' . $date,
      ];

      //            $objAgency = new Travel_Model_TblAgency();

      //            $agencyData = $objAgency->getUserDataByAgency($param['AgencySysId']); 

      $TripImageName = (isset($param['TripImageName']) && !empty($param['TripImageName'])) ? implode(',', $param['TripImageName']) : '';
      $saveData = [
        'AgencySysId' => $this->gtxagencysysid,
        'Name' => $param['Name'],
        'EmailId' => $param['EmailId'],
        'Destination' => $param['Destination'],
        'DestinationId' => 1,
        'TravelMonth' => $param['TravelMonth'],
        'ReviewStarValue' => $param['ReviewStarValue'],
        'ReviewTitle' => $param['ReviewTitle'],
        'Review' => $param['Review'],
        'TripImage' =>  $TripImageName,
        'isActive' => 1,
        'isMarkForDel' => 0
      ];
      ////           echo "<pre>";print_r($saveData);die;
      $crud = new Admin_Model_CRUD();
      $feedback = $crud->rv_insert('tbl_feedback', $saveData);

      $html = '';
      $htmlImage = '';
      if (isset($param['TripImageName']) && !empty($param['TripImageName'])) {
        $mi = 1;
        foreach ($param['TripImageName'] as $key => $val) {
          $TripImageName = $val;
          $html .= '<a href="' . $this->baseUrl . 'public/upload/feedback/image/' . $TripImageName . '">Image Url ' . $mi . '</a><br>';
          $mi++;
        }
        $htmlImage =  '<tr>
                    <td style=" padding:5px 40px;vertical-align: middle;">Trip Images : </td>
                    <td style=" padding:5px 40px;vertical-align: middle;">' . $html . '</td>
                  </tr>';
      }
      // echo "<pre>";print_r($html);die;
      if ($feedback) {

        $mailBody = '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" border: dashed 1px #ccc; font-size:14px; font-family: Roboto, sans-serif;">
                
                <tr>
                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear ' . ucfirst($param['Name']) . ', <br>
                    <br>
                    Greetings from ' . $this->siteName . '!  <br> <br>
                    Thank you for your feedback!</td>
                </tr>
                <tr>
            <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
              <hr / style="border-width: 0.6px;">
              <br>
              contact number: ' . $contactDetail_mail['phone'] . '<br>
              Email:' . $contactDetail_mail['email'] . '</td>
          </tr>
              </table>';



        $mailBodyAdmin = '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" border: dashed 1px #ccc; font-size:14px; font-family: Roboto, sans-serif;">
                
                <tr>
                  <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
                    <br>
                    Greetings !  <br> <br>
                    You have received a new feedback detail as below:</td>
                </tr>
                <tr>
    <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">&nbsp;</td>
    
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">Name :</td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ucfirst($param['Name']) . '</td>
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">Email :</td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ($param['EmailId']) . '</td>
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">Destination : </td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ($param['Destination']) . '</td>
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">Month : </td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ($TravelMonthArr[$param['TravelMonth']]) . '</td>
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">Experience : </td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ($param['ReviewStarValue']) . ' Star</td>
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">ReviewTitle : </td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ($param['ReviewTitle']) . '</td>
  </tr>
  <tr>
    <td style=" padding:5px 40px;vertical-align: middle;">Review : </td>
    <td style=" padding:5px 40px;vertical-align: middle;">' . ($param['Review']) . '</td>
  </tr>
  ' . $htmlImage . '
  
                <tr>
            <td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
              <hr / style="border-width: 0.6px;">
              <br>
              contact number: ' . $contactDetail_mail['phone'] . '<br>
              Email:' . $contactDetail_mail['email'] . '</td>
          </tr>
              </table>';
      }

      $subject = 'Feedback';
      $configs = [
        'to' => $param['EmailId'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $mailBody,
      ];

      $custMail = $this->objHelperGeneral->mailSentByElastice($configs, 'package');
      $configsAdmin = [
        'to' => $contactDetail_mail['email'],
        'fromName' => $this->siteName,
        'fromEmail' => $contactDetail_mail['email'],
        'subject' => $subject,
        'bodyHtml' => $mailBodyAdmin,
      ];

      $adminMail = $this->objHelperGeneral->mailSentByElastice($configsAdmin, 'package');

      $returnArray = array('status' => true, 'message' => 'Feedback submitted successfully!!!');
      echo json_encode($returnArray);
      exit;
    }
  }
  public function dealsAction()
  {
    $this->view->baseUrl = $this->baseUrl;
    $this->view->siteName = $this->siteName;

    $lastMinuteTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1, 'lastMinuteDeal' => 1], ['PkgSysId' => 'DESC'], 6);

    foreach ($lastMinuteTours as $key => $values) {

      $destinationArr = explode(',', $values['Destinations']); // get the first destination only by extracting array
      $LongJsonInfo = Zend_Json::decode($values['LongJsonInfo']);

      $categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $values['PackageType'], $values['PackageSubType']); // get default category

      $tourImage1 = explode(',', $values['Image']);
      $tourImage = $tourImage1[0];

      $defaultCategoryId = $categoryDetails['defaultCategoryId'];
      $defaultCategory = $categoryDetails['defaultCategory'];
      $defaultTourType = $categoryDetails['defaultTourType'];
      $TPId = ($values['PackageType'] == $this->packageTypeStatic) ? $LongJsonInfo['package']['TPId'] : $categoryDetails['TPId'];
      $MPType = (!empty($categoryDetails['MPType']) && ($categoryDetails['MPType'] != 'LowestCost')) ? array_search($categoryDetails['MPType'], unserialize(CONST_MEAL_PLAN_ARR)) : 0;

      $tourTypeChar = ($defaultTourType == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
      $priceArrJson = $categoryDetails['priceArrJson'];

      $displayFinalPrice = $this->objHelperGeneral->getPackagePrice($defaultCategory, $tourTypeChar, $priceArrJson, true);  // Param 4: true ( if calculate discounted price )

      $lastMinuteToursFinal[] = [
        'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 24),
        'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
        'img' => $tourImage,
        'night' => $values['Nights'],
        'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
        'star' => $values['StarRating'],
        'Destination' => $values['Destinations'],
        'PkgSysId' => $values['PkgSysId'],
        'GTXPkgId' => $values['GTXPkgId'],
        'defaultCategoryId' => $defaultCategoryId,
        'defaultCategory' => $defaultCategory,
        'tourtype' => $defaultTourType,
        'TPId' => $TPId,
        'PackageType' => $values['PackageType'],
        'mp' => $MPType,
        'Countries' => $values['Countries'],
        'isFixedDeparturesPackage' => $LongJsonInfo['package']['IsFixedDeparturePackage'],
        'BookingValidUntil' => $values['BookingValidUntil'],
      ];
    }
    $this->view->lastMinuteTours = $lastMinuteToursFinal;
    $getPageDetail = $this->objMdl->rv_select_row('tbl_static_pages', ['*'], ['sid' => 194, 'status' => 'Activate'], ['sid' => 'desc']);

    $this->view->getPageDetail    = $getPageDetail;
  }

  public function offerAction()
  {

    $this->view->baseUrl = $this->baseUrl;
    $this->objMdl = new Admin_Model_CRUD();
    $offerDetail = $this->objMdl->rv_select_row('tbl_offers', ['*'], ['status' => 1, 'id' => 1], ['id' => 'DESC']);
    $this->view->offerDetail = $offerDetail;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit