| 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/prathamtour.com/application/modules/tours/controllers/ |
Upload File : |
<?php
/* * ***********************************************************
* Catabatic Technology Pvt. Ltd.
* File Name : PackageController.php
* File Desc. : Index controller for home page front end
* Created By : Piyush Tiwari <piyush@catpl.co.in>
* Created Date : 04 July 2018
* Updated Date : 21 July 2018
* Tours_PackageController | Tours Module / Index controller
* *************************************************************
*/
class Tours_ActivityController extends Zend_Controller_Action {
protected $objMdl;
protected $objHelperGeneral;
protected $tablename;
public $baseUrl = '';
protected $gtxwebservicesURL;
protected $gtxagencysysid;
protected $CONST_PACKAGE_TRAVELER_MAX_ROOM;
protected $CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
protected $CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
protected $CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
public $defaultTourListingImage;
public function init() {
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->siteName = $BootStrap['siteName'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->gtxwebservicesURL = $BootStrap['gtxwebserviceurl']; // get gtxwebserviceurl from application config
$this->gtxagencysysid = $BootStrap['gtxagencysysid']; // get gtxagencysysid from application config
$this->CONST_PACKAGE_TRAVELER_MAX_ROOM = $BootStrap['CONST_PACKAGE_TRAVELER_MAX_ROOM']; // get variable from application config
$this->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = $BootStrap['CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM']; // get variable from application config
$this->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = $BootStrap['CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM']; // get variable from application config
$this->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = $BootStrap['CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM']; // get variable from application config
$this->per_page_record = '100';
$this->objMdl = new Admin_Model_CRUD();
$this->tablename = "tb_tbb2c_packages_master";
$this->objHelperGeneral = $this->_helper->General;
$this->defaultTourListingImage = "default-tour-listing.jpg";
}
/*
* This function is used to search packages based on keywords typed by user on home page..
* @param void
* @return void
*/
public function indexAction() {
$params = $this->getRequest()->getParams();
// echo "<pre>";print_r($params); die('here');
$destinationname = explode('-', $params['des']);
$catnameArr = explode('-', $params['cat']);
$destname = '';
foreach ($destinationname as $desKey => $desValue) {
$destname .= $desValue.' ';
}
foreach ($catnameArr as $catKey => $catValue) {
$catname .= $catValue.' ';
}
$keywords = !empty($destname)?trim($destname):'';
// echo ($keywords); die();
// $keywords = !empty($params['key']) ? trim($params['key']) : '';
$category = $catname;
// Get maximum total night
$getMaxResults = $this->objMdl->rv_select_row($this->tablename, ['GROUP_CONCAT(MinPrice) as minPriceArray', 'MAX(Nights) as maxnight', 'MAX(MinPrice) as MaxPrice', 'MIN(MinPrice) as MinPrice'], ['IsFeatured' => 1, 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1], ['PkgSysId' => 'DESC']);
$staticPage = $this->objMdl->rv_select_all("tbl_pack_type", ['packType','banner_image'], ['Title'=>$category,'IsActive' => 1, 'IsMarkForDel' => 0], ['packType' => 'DESC'], '');
/*** chandra*******************/
$regionDescription = $this->objMdl->rv_select_all('tb_tbb2c_destinations', ['regionDescription','DesSysId','Title'], ['IsActive' => 1, 'IsMarkForDel' => 0,'Title'=>$keywords],['DesSysId'=>'ASC']);
// echo "<pre>" ; print_r($destinationContent);die();
$minPriceArray = explode(',', $getMaxResults['minPriceArray']);
$priceRange = $this->objHelperGeneral->getPriceDropdown($getMaxResults['MinPrice'], $getMaxResults['MaxPrice'], 5000, $minPriceArray);
$getData = array(
'destination' => trim($keywords),
'noofday' => $this->getRequest()->getParam("noofday"),
'pricerange' => $this->getRequest()->getParam("pricerange"),
'maxnight' => $getMaxResults['maxnight'],
);
if ($getData['destination'] != "") {
$selectTitle = explode(",", $getData['destination']);
$checkdata = $this->objMdl->selectOne('tb_tbb2c_destinations', ['Bannerimg', 'DesSysId','Keyword','Description','Metatag','regionDescription','seoHcontent','seoFcontent'], ['Title' => $selectTitle[0]]);
// echo "<pre>";print_r($checkdata);die;
$bannerImage = $checkdata['Bannerimg'];
$this->view->bannerImage = $bannerImage;
$this->view->DesSysId = $checkdata['DesSysId'];
/* SEO KEYWORD */
$detailLayout = array();
$detailLayout['Keyword'] = $checkdata['Keyword']; // get package Keyword
$detailLayout['Description'] = $checkdata['Description']; // get package Description
$detailLayout['Metatag'] = $checkdata['Metatag']; // get package Metatag
$detailLayout['regionDescription'] = $checkdata['regionDescription']; // get package Metatag
$detailLayout['seoHcontent'] = $checkdata['seoHcontent']; // get package Metatag
$detailLayout['seoFcontent'] = $checkdata['seoFcontent']; // get package Metatag
$detailLayout['PackageTitle'] = ucwords($getData['destination']).' Packages';
$this->view->detailLayout = $detailLayout;
if($detailLayout['Keyword'] == ''){
$checkdataC = $this->objMdl->selectOne('tbl_countries', ['*'], ['seotitle' => strtolower(Catabatic_Helper::getSeoName($keywords))]);
$detailLayout = array();
$detailLayout['Keyword'] = ($checkdataC['metaKeyword'] !='' ) ? $checkdataC['metaKeyword'] : strtolower($getData['destination']).' holiday packages, '.strtolower($getData['destination']).' honeymoon packages, '.strtolower($getData['destination']).' travel package, '.strtolower($getData['destination']).' travel and tours, travel agency, '.strtolower($getData['destination']).' vacation tours, '.strtolower($getData['destination']).' deals on holiday, '.strtolower($getData['destination']).' honeymoon deals, '.strtolower($getData['destination']).' budget tour packages, '.strtolower($getData['destination']).' destination packages, '.strtolower($getData['destination']).' group tours, '.strtolower($getData['destination']).' tour package, '.strtolower($getData['destination']).' holiday tours, '.strtolower($getData['destination']).'honeymoon tours. '; // get package Keyword
$detailLayout['Description'] = ($checkdataC['metaDescription'] !='') ? $checkdataC['metaDescription'] : 'Book '.ucwords($getData['destination']).' holiday and honeymoon packages from Ds Tours and Travels and get great deals on tours packages. Plan your holidays and honeymoon with us.'; // get package Description
$detailLayout['Metatag'] = $checkdataC['metaTitle']; // get package Metatag
$detailLayout['regionDescription'] = ''; // get package Metatag
$detailLayout['seoHcontent'] = $checkdataC['meta_header']; // get package Metatag
$detailLayout['seoFcontent'] = $checkdataC['meta_footer']; // get package Metatag
$detailLayout['PackageTitle'] = 'Book '.ucwords($getData['destination']).' Holiday and Honeymoon Tour Packages ';
$this->view->detailLayout = $detailLayout;
}
// echo "<pre>";print_r($detailLayout);die;
}
if ($keywords == "" && $category != "") {
$staticPage = $this->objMdl->rv_select_all("tbl_pack_type", ['*'], ['IsActive' => 1, 'IsMarkForDel' => 0, 'Title' => ucwords($category)], ['packType' => 'DESC'], 1);
/* SEO KEYWORD */
$detailLayout = array();
$detailLayout['Keyword'] = $staticPage[0]['Keyword']; // get package Keyword
$detailLayout['Description'] = $staticPage[0]['Description']; // get package Description
$detailLayout['Metatag'] = $staticPage[0]['Metatag']; // get package Metatag
$detailLayout['PackageTitle'] = ucwords($category).' Packages';
$this->view->detailLayout = $detailLayout;
}
$noofday = isset($params['noofday']) ? $params['noofday'] : 1;
$noofdayMax = 6;
$filterDurationListArr = [];
for ($a = $noofday; $a <= $noofdayMax; $a++) {
$filterDurationListArr[] = $a;
}
$decodedPackageDestinationArray = array();
$packageDestinationArray = $this->curl_get($this->baseUrl . 'public/data/dynamic/package_destinations.json');
if(!empty($packageDestinationArray)){
$decodedPackageDestinationArray = Zend_Json::decode($packageDestinationArray);
}
$this->view->hcode = $hcode = !empty($this->getRequest()->getParam("hcode")) ? trim($this->getRequest()->getParam("hcode")) : '';
$this->view->cityid = $cityid = !empty($this->getRequest()->getParam("cid")) ? trim($this->getRequest()->getParam("cid")) : '';
$this->view->strcat = $strcat = ($keywords) ? trim($keywords) : '';
$this->view->citytxt = $citytxt = ($keywords) ? trim($keywords) : '';
$this->view->UniqueSessionId = Zend_Session::getId();
$this->view->getData = $getData;
$this->view->priceRange = $priceRange;
$this->view->filterDurationListArr = $filterDurationListArr;
$this->view->baseUrl = $this->baseUrl;
$this->view->params = $params;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->defaultTourListingImage = $this->defaultTourListingImage;
$this->view->mydevice = $this->objHelperGeneral->getDevice();
$this->view->keywords = $keywords;
$this->view->themeImage = $staticPage;
$this->view->regionDescription = $regionDescription;
$this->view->packageDestinationArray = $decodedPackageDestinationArray;
}
public function getsearchdataactivitiesAction() {
$crud = new Admin_Model_CRUD;
$currencyType = $this->objHelperGeneral->getCurrencyData();
try {
$arrResponse = array();
if ($this->getRequest()->getParam("key")) {
$params = $this->getRequest()->getParams();
$keywords = !empty($params['key']) ? trim($params['key']) : '';
$currencyRate = $this->objMdl->rv_select_all('tbl_currency_rate', ['*'], ['cid'], ['cid' => 'DESC']);
$activitiesNew = $crud->rv_select_all($this->tablename, ['StarRating', 'IsFeatured', 'Destinations', 'LongJsonInfo', 'PkgValidFrom', 'MinPrice', 'MaxPrice', 'PkgSysId', 'Image', 'GTXPkgId'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 3, /* 'PkgValidFrom'=> date('Y-m-d 00:00:00') */], ['StarRating' => 'DESC']);
$jsonData = $ActivityCategory = $ActivityPrice = [];
$temp = '';
foreach ($activitiesNew as $resultkey => $resultvalue) {
// check for json error or invalid json's here
try {
$LongJsonInfo = Zend_Json::decode($resultvalue['LongJsonInfo'], true);
$temp = '';
} catch (Zend_Exception $e) {
$temp = "error";
}
// create only if error not found
if ($temp !== "error") {
// var_dump($resultvalue['Image']);
// if($resultvalue['PkgSysId']==280) die;
if ($resultvalue['Image']) {
$imagename1 = explode(',', $resultvalue['Image']);
$imagename = $imagename1[0];
} else {
$imagename = '';
}
$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'];
}
$jsonData[$resultkey]['PkgSysId'] = $resultvalue['PkgSysId'];
$jsonData[$resultkey]['GTXPkgId'] = $resultvalue['GTXPkgId'];
$jsonData[$resultkey]['star'] = $resultvalue['StarRating'];
$jsonData[$resultkey]['city'] = $resultvalue['Destinations'];
$jsonData[$resultkey]['pRng'] = $this->_helper->General->getRangeByValue(unserialize(CONST_PRICE_RANGE_500), $netPrice);
// write data from LongJsonInfo
$jsonData[$resultkey]['Title'] = ucfirst($LongJsonInfo['Title']);
$jsonData[$resultkey]['Details'] = strip_tags($LongJsonInfo['Details']);
$jsonData[$resultkey]['Img'] = $imagename;
$jsonData[$resultkey]['Price'] = isset($netPrice) ? round($netPrice) :0;
$jsonData[$resultkey]['PriceOrderBy'] = isset($netPrice) ? round($netPrice) :0;
$jsonData[$resultkey]['CurrencySymbol'] = isset($LongJsonInfo['CurrencySymbol']) ? $LongJsonInfo['CurrencySymbol'] : 'INR';
// $jsonData[$resultkey]['CurrencySymbol'] = 'INR';
try {
if (isset($LongJsonInfo['ActivityGrType']) && !empty($LongJsonInfo['ActivityGrType'])) {
$jsonData[$resultkey]['ActivityGrType'] = Zend_Json::decode($LongJsonInfo['ActivityGrType']);
}
} catch (Zend_Exception $err) {
$jsonData[$resultkey]['ActivityGrType'] = [];
}
try {
if (isset($LongJsonInfo['ActivityType']) && !empty($LongJsonInfo['ActivityType'])) {
$jsonData[$resultkey]['ActivityType'] = Zend_Json::decode($LongJsonInfo['ActivityType']);
}
} catch (Zend_Exception $err) {
$jsonData[$resultkey]['ActivityType'] = [];
}
$jsonData[$resultkey]['duration']['min'] = (isset($LongJsonInfo['DurationStr'])) ? $LongJsonInfo['DurationStr'] : '';
$jsonData[$resultkey]['duration']['day'] = (isset($LongJsonInfo['DurationInMin'])) ? $LongJsonInfo['DurationInMin'] : '';
// inner loop
if (isset($jsonData[$resultkey]['ActivityGrType']) && count($jsonData[$resultkey]['ActivityGrType'])) {
foreach ($jsonData[$resultkey]['ActivityGrType'] as $key => $value) {
// $ActivityCategory[] = $value['Title'];
$ActivityCategory[] = $value;
}
}
$ActivityPrice[] = $jsonData[$resultkey]['pRng'];
}
}
asort($ActivityPrice);
$dataArray = array_unique($ActivityCategory);
$ActivityCategory1 = array_values($dataArray);
$ActivityPrice1 = array_filter($ActivityPrice);
$dataArray = array_unique($ActivityPrice1);
$ActivityPrice1 = array_values($dataArray);
$resultFinal = [ 'rows' => $jsonData, 'filterCat' => $ActivityCategory1, 'filterPrice' => $ActivityPrice1];
$resultFinalArr = Zend_Json::encode($resultFinal, true);
echo ($resultFinalArr);
exit;
} else {
}
echo '<pre>';print_r($resultFinalArr);die('data');
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
/*
* This function is used to search packages based on keywords typed by user on home page..
* @param void
* @return void
*/
public function newAction() {
$params = $this->getRequest()->getParams();
// print_r($params); die;
// Get maximum total night
$getMaxResults = $this->objMdl->rv_select_row($this->tablename, ['GROUP_CONCAT(MinPrice) as minPriceArray', 'MAX(Nights) as maxnight', 'MAX(MinPrice) as MaxPrice', 'MIN(MinPrice) as MinPrice'], ['IsFeatured' => 1, 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1], ['PkgSysId' => 'DESC']);
$minPriceArray = explode(',', $getMaxResults['minPriceArray']);
$priceRange = $this->objHelperGeneral->getPriceDropdown($getMaxResults['MinPrice'], $getMaxResults['MaxPrice'], 10000, $minPriceArray);
$getData = array(
'destination' => trim($this->getRequest()->getParam("des")),
'noofday' => $this->getRequest()->getParam("noofday"),
'pricerange' => $this->getRequest()->getParam("pricerange"),
'maxnight' => $getMaxResults['maxnight'],
);
if ($getData['destination'] != "") {
$selectTitle = explode(",", $getData['destination']);
$checkdata = $this->objMdl->selectOne('tb_tbb2c_destinations', ['Bannerimg'], ['Title' => $selectTitle[0]]);
$bannerImage = $checkdata['Bannerimg'];
$this->view->bannerImage = $bannerImage;
}
$this->view->getData = $getData;
$this->view->priceRange = $priceRange;
$noofday = isset($params['noofday']) ? $params['noofday'] : 1;
$noofdayMax = 6;
$filterDurationListArr = [];
for ($a = $noofday; $a <= $noofdayMax; $a++) {
$filterDurationListArr[] = $a;
}
$this->view->filterDurationListArr = $filterDurationListArr;
$this->view->baseUrl = $this->baseUrl;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = $this->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->defaultTourListingImage = $this->defaultTourListingImage;
}
/**
* This function is used to fetch all records from database
* @param void
* @return json
* */
public function fetchallAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$params = $this->getRequest()->getParams();
// print_r($params); die;
$sid = $this->getRequest()->getParam('id');
$whereNights = $whereDestination = $wherePrice = '';
$where = [
'IsMarkForDel' => 0,
'IsActive' => 1,
'IsPublish' => 1,
'ItemType' => 1 // for Tour Package 1
];
if ($sid) {
$where['PkgSysId'] = $sid;
}
// param conditions
$str2 = '';
if (isset($params['noofday']) && !empty($params['noofday'])) {
$val = $params['noofday'];
$whereNights .= ' ( Nights >= ' . $val . ') ';
}
if ((isset($params['des']) && !empty($params['des'])) && ($params['des'] != 'all')) {
$temp = explode("RVSTR", $params['des']);
$str = $operator = '';
foreach ($temp as $k => $val) {
$operator = ($k != 0) ? ' OR ' : '';
if ($val) {
$str .= " $operator Destinations LIKE ('%" . $val . "%') OR Countries LIKE ('%" . $val . "%') ";
}
}
if ($str) {
$whereDestination .= ' (' . $str . ') ';
}
}
$str1 = '';
if (isset($params['pricerange']) && !empty($params['pricerange'])) {
if (strtolower($params['pricerange']) != 'all') {
$temp = explode("-", $params['pricerange']);
$operator = ( isset($temp[1]) && ( isset($temp[0]) && $temp[0]) ) ? ' AND ' : '';
if ($temp[0]) {
$val = $temp[0];
$str1 .= " MinPrice >= ('" . $val . "') ";
}
if ($temp[1]) {
$val = $temp[1];
$str1 .= " $operator MinPrice <= ('" . $val . "') ";
}
if ($str1) {
$wherePrice .= ' (' . $str1 . ')';
}
}
}
$whereCustom = " (1=1) ";
$whereCustom .= ($whereNights) ? " AND $whereNights " : "";
$whereCustom .= ($whereDestination) ? " AND $whereDestination " : "";
$whereCustom .= ($wherePrice) ? " AND $wherePrice " : "";
$currentTime = date('Y-m-d 00:00:00');
$whereCustom .= " AND ( (`PkgValidFrom` <= '$currentTime') AND (`PkgValidUntil` >= '$currentTime') ) ";
$whereCustom .= " AND ( `BookingValidUntil` >= '$currentTime') ";
$resultset = $this->objMdl->rv_select_all_custom_query($this->tablename, ['*'], $where, $whereCustom, ['MinPrice' => 'ASC'], $this->per_page_record);
// Zend_Debug::dump($resultset);
echo $this->objHelperGeneral->customiseForJsonV2($resultset, 'B2C');
}
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;
}
}