| 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/holidays.tripjack.com/application/controllers/ |
Upload File : |
<?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 : 26 May 2017
* Updated Date : 13 Jun 2017
***************************************************************/
class TourPackagesController extends Catabatic_CheckSession
{
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 function init() {
parent::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 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();
// 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'],
);
$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 function is used to fetch all records from database
* @param void
* @return json
**/
public function fetchallAction()
{
error_reporting(0);
$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];
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);
echo $this->objHelperGeneral->customiseForJson( $resultset );
}
/**
* This function is used to fetch all records from database
* @param void
* @return json
**/
public function filterDataAction()
{
error_reporting(0);
$this->_helper->layout()->disableLayout('');
$this->_helper->viewRenderer->setNoRender(true);
$params = $this->getRequest()->getParams();
// print_r($params); die;
$sid = $this->getRequest()->getParam('id');
$where = ['IsMarkForDel'=>0 , 'IsActive'=>1, 'IsPublish'=>1];
$whereCustom = '';
// param conditions
if(isset($params['des']) && !empty($params['des'])) {
$temp = explode("RVSTR", $params['des']);
$str = $operator = '';
foreach ($temp as $k => $val) {
$operator = ($k!=0) ? ' OR ' : '';
if($val) {
$str .= " $operator Destinations = ('".$val . "') ";
}
}
if($str) {
$whereCustom .= $str;
}
}
if(isset($params['noofday']) && !empty($params['noofday'])) {
$temp1 = explode(",", $params['noofday']);
$str = '';
foreach ($temp1 as $val) {
if($val)
$str .= ','.$val;
}
if($str)
$whereCustom .= "Nights IN(". trim($str, ',') . ")";
}
if(isset($params['pricerange']) && !empty($params['pricerange'])) {
if(strtolower($params['pricerange']) != 'all') {
$temp = explode("-", $params['pricerange']);
// if($temp[0])
// $where['MinPrice'] = $temp[0];
// if($temp[1])
// $where['MaxPrice'] = $temp[1];
}
}
$resultset = $this->objMdl->rv_select_all_custom_query($this->tablename, ['*'], $where, $whereCustom , ['PkgSysId'=>'DESC'], $this->per_page_record);
echo $this->objHelperGeneral->customiseForJson( $resultset );
}
}