| 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/b2bzend/application/controllers/ |
Upload File : |
<?php
/**
* Class General
*
* @name General
* @author Ravi Khare
* @version 1.0
* @copyright Catabatic India Pvt Ltd
* Handle General function
*
*/
class GeneralController extends Zend_Controller_Action {
public function getcitydropdownAction() {
if ($this->_request->isXmlHttpRequest()) {
$intCountryId = $this->getRequest()->getParam('intCountryId');
// $intStateId = $this->getRequest()->getParam('intStateId');
$objCity = new Travel_Model_TblCity();
$objCity->intContSysId = $intCountryId;
// $objCity->intStateId = $intStateId;
$arrCitiList = array();
if($intCountryId > 0){
$arrCitiList = $objCity->getCityList();
}
$str = '';
if (!empty($arrCitiList) ) {
foreach ($arrCitiList as $city) {
$str .= '<option value="' . $city['CityId'] . '">' . $city['Title'] . '</option>';
}
} else {
$str .= '<option value="0">No City Found.</option>';
}
// $str .= '<option value="-1">--Others--</option>';
echo $str;
exit;
}
}
public function getstatedropdownAction() {
if ($this->_request->isXmlHttpRequest()) {
// echo "<pre>";
// print_r( $this->getRequest()->getParams() );
// exit;
//
$intCountryId = $this->getRequest()->getParam('intCountyId');
$objState = new Travel_Model_TblState();
$objState->intContSysId = $intCountryId;
$arrStateList = $objState->getStates();
// echo "<pre>";
// print_r($arrStateList);
// exit;
$str = '';
if (!empty($arrStateList) ) {
foreach ($arrStateList as $state) {
$str .= '<option value="' . $state['StateId'] . '">' . $state['Title'] . '</option>';
}
}
//$str .= '<option value="-1">--Others--</option>';
echo $str;
exit;
}
}
public function privacypolicyAction() {
$this->_helper->layout->setLayout('layout-general');
}
public function termconditionAction() {
$this->_helper->layout->setLayout('layout-general');
}
public function termsofuseAction() { //Added For Internal Pages
$this->_helper->layout->setLayout('layout-general');
}
public function contactusAction() {
$this->_helper->layout->setLayout('layout-signup');
}
public function suggestCountryAction() {
$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");
$objGeneral = new Travel_Model_GeneralFunction();
$whereStatic = array('IsActive' => 1 , 'IsApprove' => 1, 'IsMarkForDel' => 0 );
$whereArr = array('Title' => $term);
$arrResponse = $objGeneral->getRecordListingWhereLike("TB_Master_Geo_Country", array('ContId','Title'), $whereStatic, $whereArr, 'Title', "ASC");
}
echo json_encode($arrResponse);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function suggestCityAction() {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
// print_r($this->getRequest()->getParam("term"));
// exit;
try {
$arrResponse = array();
if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
$term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
$countryId = $this->getRequest()->getParam("countryId") ? $this->getRequest()->getParam("countryId") : '';
// $objGeneral = new Travel_Model_GeneralFunction();
// $whereStatic = array('IsActive' => 1 , 'IsApproved' => 1, 'IsMarkForDel' => 0, 'ContSysId'=> $countryId);
// $whereArr = array('Title' => $term);
// $arrResponse = $objGeneral->getRecordListingWhereLike("TB_Master_Geo_City", array('CityId','Title','Country','ContSysId'), $whereStatic, $whereArr, 'Title', "ASC");
$objHotel = new Travel_Model_TblBuyHotel();
$condCity = "tbl.Title like '" . $term . "%'";
if (isset($countryId) && !empty($countryId)) {
$condCity .= " AND tbl.ContSysId = " . $countryId . "";
}
//echo $condCity;
$arrResponse = $objHotel->getBuyHotelCityAutoSuggest($condCity);
}
/*add country name*/
$arrResponseF = array();
foreach($arrResponse as $key=>$response){
$arrResponseF[$key]['CityId'] = $response['CityId'];
$arrResponseF[$key]['Title'] = ($response['label']);
$arrResponseF[$key]['CityName'] = stripslashes($response['CityName']);
$arrResponseF[$key]['CountryId'] = stripslashes($response['ContId']);
}
echo json_encode($arrResponseF);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function suggestStateAction() {
$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");
$objGeneral = new Travel_Model_GeneralFunction();
$whereStatic = array('IsActive' => 1 , 'IsApprove' => 1, 'IsMarkForDelete' => 0 );
$whereArr = array('Title' => $term);
$arrResponse = $objGeneral->getRecordListingWhereLike("TB_Master_Geo_State", array('StateId','Title'), $whereStatic, $whereArr, 'Title', "ASC");
}
//echo "<pre>";print_r($arrResponse);die;
echo json_encode($arrResponse);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function suggestStateFullfillmentAction() {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
try {
$arrResponse = array();
$response = array();
if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
$term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
$objGeneral = new Travel_Model_GeneralFunction();
$whereStatic = array('IsActive' => 1 , 'IsApprove' => 1, 'IsMarkForDelete' => 0 );
$whereArr = array('Title' => $term);
$arrResponse = $objGeneral->getRecordListingWhereLike("TB_Master_Geo_State", array('StateId','Title'), $whereStatic, $whereArr, 'Title', "ASC");
}
if (!empty($arrResponse) ) {
foreach ($arrResponse as $row) {
$response[] = array('StateId' => $row['StateId'],'value' => $row['Title'], 'label' => $row['Title']);
}
}
//echo "<pre>";print_r($arrResponse);die;
echo json_encode($response);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
// start : code added by Ranvir singh on 10 Apr 2017
public function isExistsAction()
{
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
$str = $this->getRequest()->getParam('str');
$master_cont_id = $this->getRequest()->getParam('master_cont_id');
$master_city_id = $this->getRequest()->getParam('master_city_id');
$master_city_name = $this->getRequest()->getParam('master_city_name');
$place_city_name = $this->getRequest()->getParam('place_city_name');
$place_cont_name = $this->getRequest()->getParam('place_cont_name');
$is_sightseeing_from_google = $this->getRequest()->getParam('is_sightseeing_from_google');
$objMdl = new Cityprofiling_Model_TblCityprofiling;
// $CitySysId_GGL = $objMdl->getRecordUniqueWhere("TB_Master_Geo_City", ['CityId'], ['Title'=> $place_city_name]);
// get country id from gtx database and supply to search city
$resultCont = $objMdl->getRecordUniqueWhere("TB_Master_Geo_Country", ['ContId'], ['Lower(Title)' => trim(strtolower($place_cont_name)), 'IsMarkForDel'=>0, 'IsActive'=>1, 'IsApprove'=>1 ]);
// if country id not found by google country than setting master country id from url city id basis
$ContID = ($resultCont['ContId']) ? $resultCont['ContId'] : $master_cont_id;
$CitySysId_GGL = $objMdl->getCityIdFromTitle('TB_Master_Geo_City', 'CityId,Title', $place_city_name , $ContID);
// print_r($CitySysId_GGL);
$place_city_id = ($CitySysId_GGL['CityId']) ? $CitySysId_GGL['CityId'] : 0;
$place_city_name = ($CitySysId_GGL['Title']) ? $CitySysId_GGL['Title'] : '-';
$msg_status = '';
if($is_sightseeing_from_google == 1) {
// check the entry exists or not in the sighseeing table by title
$result = $objMdl->getRecordUniqueWhere("TB_IC_SightSeeing", ['SSSysId','CitySysId'], ['Title' => trim($str) ]);
// print_r($result);
if($result['SSSysId']) {
// check the mapping with city into mapping table
$resultMap = $objMdl->getRecordUniqueWhere("TB_Master_Geo_City_SightSeeing_Mapping", ['CitySightSysId','CitySysId'], [ 'CitySysId'=> $master_city_id, 'SSSysId' => $result['SSSysId'] , 'IsMarkForDel'=>0, 'IsActive'=>1 ]);
// print_r($resultMap);
$mapped_city = $mapped_cityid = '';
if( $result['CitySysId'] == $master_city_id ) {
$msg_status = 'ALREADY_EXISTS';
}
else if( !$resultMap['CitySightSysId'] ) {
$msg_status = 'NOT_MAPPED';
}
else if( $resultMap['CitySightSysId'] ){
if(($resultMap['CitySysId'] == $master_city_id)) {
$msg_status = 'ALREADY_MAPPED_FOR_SAME';
$mapped_cityid= $master_city_id;
$mapped_city = $master_city_name;
}
else {
$msg_status = 'ALREADY_MAPPED';
$mapped_cityid = $resultMap['CitySysId'];
$resultCityTitle = $objMdl->getRecordUniqueWhere("TB_Master_Geo_City", ['Title'], ['CityId' => $resultMap['CitySysId'] , 'IsMarkForDel'=>0, 'IsActive'=>1 ]);
$mapped_city = $resultCityTitle['Title'];
}
}
//echo $resultMap['CitySysId'] , $master_city_id;
$responseConditional = ['SSSysId' => $result['SSSysId'], 'msg' => $msg_status, 'place_city_id'=> $place_city_id,
'place_city_name'=> $place_city_name, 'MAPPED_CITYID'=>$mapped_cityid, 'MAPPED_CITY'=>$mapped_city];
}
else {
// if new entry than do nothing
$responseConditional = ['msg' => 'NEW_ENTRY', 'place_city_id'=> $place_city_id];
}
}
else{
// $result = $objMdl->getRecordUniqueWhere("TB_IC_SightSeeing", ['SSSysId'], ['Title' => $str, 'CitySysId' => $master_city_id]);
}
$response = ['message' => 'success'];
$responseFinal = $response + $responseConditional;
echo json_encode($responseFinal);
exit;
}
// end : code added by Ranvir singh on 10 Apr 2017
//function used for get city with multiple country ids created bt Er Amit Kumar Dubey on 23june 2017 at 12:26 PM
public function suggestMultiCityAction() {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
// print_r($this->getRequest()->getParam("term"));
// exit;
try {
$arrResponse = array();
if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
$term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
$countryId = $this->getRequest()->getParam("countryId") ? implode(',',$this->getRequest()->getParam("countryId")) : '';
$objGeneral = new Travel_Model_GeneralFunction();
$whereStatic = array('IsActive' => 1 , 'IsApproved' => 1, 'IsMarkForDel' => 0);
$whereArr = array('Title' => $term);
$whereIn = array('ContSysId' => $countryId);
//print_r($whereIn);
$arrResponse = $objGeneral->getRecordListingWhereIn("TB_Master_Geo_City", array('CityId','Title','Country','ContSysId'), $whereStatic, $whereArr, $whereIn, 'Title', "ASC");
}
/*add country name*/
$arrResponseF = array();
foreach($arrResponse as $key=>$response){
$arrResponseF[$key]['CityId'] = $response['CityId'];
$arrResponseF[$key]['Title'] = stripslashes($response['Title']).' ('.trim(stripslashes($response['Country'])).')';
$arrResponseF[$key]['CityName'] = stripslashes($response['Title']);
$arrResponseF[$key]['CountryId'] = stripslashes($response['ContSysId']);
}
echo json_encode($arrResponseF);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function suggestMultiCityContactAction() {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
// print_r($this->getRequest()->getParam("term"));
// exit;
try {
$arrResponse = array();
if ($this->getRequest()->getParam("term") or $this->getRequest()->getParam("query")) {
$term = $this->getRequest()->getParam("term") ? $this->getRequest()->getParam("term") : $this->getRequest()->getParam("query");
$countryId = $this->getRequest()->getParam("countryId") ? implode(',',$this->getRequest()->getParam("countryId")) : '';
$objGeneral = new Travel_Model_GeneralFunction();
$whereStatic = array('IsActive' => 1 , 'IsApproved' => 1, 'IsMarkForDel' => 0);
$whereArr = array('Title' => $term);
$whereIn = array('ContSysId' => $countryId);
//print_r($whereIn);
$arrResponse = $objGeneral->getRecordListingWhereIn("TB_Master_Geo_City", array('CityId','Title','Country','ContSysId'), $whereStatic, $whereArr, $whereIn, 'Title', "ASC");
}
/*add country name*/
$arrResponseF = array();
foreach($arrResponse as $key=>$response){
$ContSysId = isset($response['ContSysId'])?$response['ContSysId']:'';
$arrResponseF[$key]['CityId'] = $ContSysId.'_'.$response['CityId'];
$arrResponseF[$key]['Title'] = stripslashes($response['Title']).' ('.trim(stripslashes($response['Country'])).')';
$arrResponseF[$key]['CityName'] = stripslashes($response['Title']);
$arrResponseF[$key]['CountryId'] = stripslashes($response['ContSysId']);
}
echo json_encode($arrResponseF);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function getSuggestCustomerTagAction() {
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();
try {
$customerModel = new Travel_Model_CRM_Customer();
$arrResponseF = array();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$AgencySysId = isset($sessionLogin_user->intLoggedinUserAgencySysId)?$sessionLogin_user->intLoggedinUserAgencySysId:NULL;
$arrResponse = $customerModel->getCustomerTags($AgencySysId);
foreach($arrResponse as $key=>$response){
$arrResponseF[$key]['CityId'] = $response['Id'];
$arrResponseF[$key]['Title'] = ($response['TagName']);
$arrResponseF[$key]['CityName'] = stripslashes($response['TagName']);
}
echo json_encode($arrResponseF);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
public function suggestMultiCityOtherAction() {
$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") : '';
$objHotel = new Travel_Model_TblBuyHotel();
$condCity = "tbl.Title like '" . $term . "%'";
if (isset($countryId) && !empty($countryId)) {
$condCity .= " AND tbl.ContSysId = " . $countryId . "";
}
$arrResponse = $objHotel->getBuyHotelCityAutoSuggest($condCity);
}
$arrResponseF = array();
foreach($arrResponse as $key=>$response){
$arrResponseF[$key]['CityId'] = $response['CityId'];
$arrResponseF[$key]['Title'] = ($response['label']);
$arrResponseF[$key]['CityName'] = stripslashes($response['CityName']);
$arrResponseF[$key]['CountryId'] = stripslashes($response['ContId']);
}
echo json_encode($arrResponseF);
exit;
} catch (Exception $e) {
$response = array('success' => false, 'msg' => $e->getMessage());
echo json_encode($response);
exit;
}
}
//#end
}