| 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/travnet.co.in/application/controllers/ |
Upload File : |
<?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 $customerbookinglistAPIUrl;
public $uploadPakcagePath;
public $uploadDestinationPath;
public $dummyImagePackage;
public $dummyImageDestination;
public $myNamespace;
public function init() {
error_reporting('E_ALL');
//echo "jhjhj"; exit;
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->customerbookinglistAPIUrl = API_CUSTOMER_LIST; // from constant file
$this->myNamespace = new Zend_Session_Namespace('MypopSess'); // get user end infomations
}
public function indexAction() {
$packageThemes = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title','image'], [ 'IsActive' => 1, 'DisplayOnHome' => 1, 'isMarkForDel' => 0], ['packType' => 'ASC'], 8);
foreach ($packageThemes as $key => $value) {
$test = $this->objMdl->test($value['Title'],['ItemType'=>1,'IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0]);
if($test[0]['count(*)'] != 0){
$finalPackageThemes[] = [
'count' => $test[0]['count(*)'],
'Title' => $value['Title'],
'packType' => $value['packType'],
'image' => $value['image'],
];
}
}
$this->view->destinations = $this->objMdl->rv_select_all($this->tablenameDestination, ['DesSysId', 'Title', 'Activities', 'Hotels', 'Tours', 'Image', 'DestDescription'], ['IsActive' => 1, 'IsFeatured' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0], ['DesSysId'=>'DESC'], 8);
$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'], ['IsActive' => 1, 'IsPublish' => 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];
$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 )
$toursFinal[] = [
'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 30),
'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
'img' => $tourImage,
'night' => $value['Nights'],
'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
'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'],
'BookingValidUntil' => $value['BookingValidUntil'],
];
}
$bannerDetail = $this->objMdl->rv_select_all('tb_homebanner_detail', ['banner_id', 'image', 'heading', 'description', 'url', 'opt'], [ 'status' => 1, 'isDisplayOnHome' => 1, 'isMarkForDel' => 0], ['banner_id' => 'ASC'], 10);
// echo "<pre>";print_r($bannerDetail);exit;
$mainSliderBannerDetail = $this->objMdl->rv_select_all('tb_homebanner_detail', ['banner_id', 'image', 'heading', 'description', 'url', 'opt'], [ 'status' => 1, 'isDisplayOnBanner' => 1, 'isMarkForDel' => 0], ['banner_id' => 'DESC'], 10);
$resullatestBlog = $this->objMdl->rv_select_all('tbl_blog', ['*'], ['IsMarkForDel'=>0,'status'=>1], ['BlogId'=>'DESC'],'3');
$this->view->mainSliderBannerDetail = $mainSliderBannerDetail;
$this->view->bannerDetail = $bannerDetail;
$this->view->baseUrl = $this->baseUrl;
$this->view->toursFinal = $toursFinal;
$this->view->finalPackageThemes = $finalPackageThemes;
$this->view->bolglist = $resullatestBlog;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function destinationAction() {
$destinations = $this->objMdl->getDestinationsHeader(['tbl.IsActive' => 1, 'tbl.IsPublish' => 1, 'tbl.IsMarkForDel' => 0, 'tb2.IsMarkForDel' => 0], ['tbl.DesSysId' => 'ASC'], 50);
$region_names = $finalDestination = [];
foreach ($destinations as $key => $value) {
if (($value['region_name'] != NULL) && !in_array($value['region_name'], $region_names)) {
$region_names[] = $value['region_name'];
}
$finalDestination[$value['region_name']][] = [
'DesSysId' => $value['DesSysId'],
'Title' => $value['Title'],
'Image' => $value['Image'],
'Tours' => $value['Tours'],
];
}
$this->view->baseUrl = $this->baseUrl;
$this->view->finalDestination = $finalDestination;
$this->view->region_names = $region_names;
}
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() {
$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('Users');
$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;
}
}