| 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
/*
* Catabatic Technology Pvt. Ltd.
* File Name :AgencyLeadsController.php
* File Description :AgencyLeads Controller managed all data related to AgencyLeads
* Created By : Pooja Choudhary
* Created Date: 12-Oct-2016
*/
class AgencyLeadsController extends Catabatic_ValidateGtx {
public function init() {
parent::init();
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->siteUrl = $aConfig['bootstrap']['siteUrl'];
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$this->intLoggedinUserId = $sessionLogin_user->intLoggedinUserId;
$this->intLoggedinUserAgencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
if (!empty($this->intLoggedinUserAgencySysId)) {
$this->InfoSourceSysId = '2'; // Information Source is Agent //
}
// if (empty($this->intLoggedinUserAgencySysId) && @$this->intLoggedinUserId != ADMIN_ID) {
// $this->_redirect('/login/logout');
// }
}
public function indexAction() {
$objPS = new Travel_Model_PackageSearch();
$agencysysID = $this->intLoggedinUserAgencySysId;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
$this->view->searchData = $getData;
}
$this->_crmcusttravelplan = new Travel_Model_CRM_CustomerTravelPlan();
$LeadListArr = $this->_crmcusttravelplan->GetAgencyLeadList($agencysysID,$this->intLoggedinUserId,@$getData);
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($LeadListArr);
$paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
$paginator->setCurrentPageNumber($page);
$this->view->totalLeadCount = !empty($LeadListArr) ? count($LeadListArr) : 0;
$this->view->page = $page;
$this->view->paginator = $paginator;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
//for country list
$objCountry = new Travel_Model_TblCountry();
$countryList = $objCountry->getCountryList();
$this->view->countryList=$countryList;
$ARR_SALUTION=unserialize(ARR_SALUTION);
$ARR_CUSTOMER_RELATION=unserialize(ARR_CUSTOMER_RELATION);
$this->view->ARR_CUSTOMER_RELATION = $ARR_CUSTOMER_RELATION;
$this->view->ARR_SALUTION = $ARR_SALUTION;
}
public function supplierQueryAction() {
$objsupplierlist = new Travel_Model_CRM_AgencyCustomerReqSupplierOnCall();
$agencysysID = $this->intLoggedinUserAgencySysId;
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
// echo '<pre>'; print_r($getPostData); die;
$this->view->searchData = $getData;
}
$LeadListArr = $objsupplierlist->GetSupplierLeadList($agencysysID,@$getData);
$page = $this->_getParam('page', 1);
$paginator = Zend_Paginator::factory($LeadListArr);
$paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
$paginator->setCurrentPageNumber($page);
$this->view->totalLeadCount = !empty($LeadListArr) ? count($LeadListArr) : 0;
$this->view->page = $page;
$this->view->paginator = $paginator;
$this->view->messages = $this->_helper->flashMessenger->getMessages();
}
public function previewSupplierEmailAction(){
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$agencysysID = $this->intLoggedinUserAgencySysId;
$this->_HtmlPurifier = new Zend_Filter_HtmlPurifier();
$data = base64_decode($this->_HtmlPurifier->filter($this->getRequest()->getParam('data')));
$dataRes=json_decode($data,true);
//echo "<pre>";print_r($dataRes);die;
$arrSupplierDetails=array();
$arrAgencyDetails=array();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
if(!empty($dataRes)){
$supplierSysId=$dataRes['SupplierSysId'];
if($supplierSysId > 0){
$objSupplier = new Travel_Model_TblSupplier();
$arrSupplierDetails = $objSupplier->getSupplierById($supplierSysId);
}
if(!empty($dataRes)){
$agencyId=$this->intLoggedinUserAgencySysId;
$objAgency = new Travel_Model_TblAgency();
$arrAgencyDetails = $objAgency->getUserDataByAgency($agencyId);
}
}
$fromDate = date('Y-m-d',strtotime($dataRes['StartDate']['date']));
$toDate = date('Y-m-d',strtotime($dataRes['ValidTill']['date']));
$crmcustomertravelItenaryObj = new Travel_Model_CRM_CustomerTravelPlan();
$roomDetails=$crmcustomertravelItenaryObj->GetCustomerTravelPlanItenary($dataRes['TPSysId']);
$dataRes['hotelTotalRooms']= (isset($roomDetails) && !empty($roomDetails)) ? count($roomDetails) : 0;
// input format should be 206-03-25
$totalDays = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->calculateNoOfDays($fromDate, $toDate);
$dataRes['nights']=$totalDays-1;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/agency-leads/');
$html->assign('type', 'supplierCustomerEmailPreviewForm');
$html->assign('arrSupplierDetails',$arrSupplierDetails);
$html->assign('data', $dataRes);
$html->assign('agentDetails', $sessionLogin_user);
$html->assign('agencyDetails', $arrAgencyDetails);
$html->assign('callDetails', $dataRes);
$bodyText = $html->render('email-template.phtml');
//end of send email to customer
$msg="success";
echo json_encode(array('status'=>$msg,'bodyText'=>$bodyText));
}
public function sendPreviewSupplierEmailAction(){
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$agencysysID = $this->intLoggedinUserAgencySysId;
$this->_HtmlPurifier = new Zend_Filter_HtmlPurifier();
$data = base64_decode($this->_HtmlPurifier->filter($this->getRequest()->getParam('data')));
$dataRes=json_decode($data,true);
//echo "<pre>";print_r($dataRes);die;
$arrSupplierDetails=array();
$arrAgencyDetails=array();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
if(!empty($dataRes)){
$supplierSysId=$dataRes['SupplierSysId'];
if($supplierSysId > 0){
$objSupplier = new Travel_Model_TblSupplier();
$arrSupplierDetails = $objSupplier->getSupplierById($supplierSysId);
}
if(!empty($dataRes)){
$agencyId=$this->intLoggedinUserAgencySysId;
$objAgency = new Travel_Model_TblAgency();
$arrAgencyDetails = $objAgency->getUserDataByAgency($agencyId);
}
}
$fromDate = date('Y-m-d',strtotime($dataRes['StartDate']['date']));
$toDate = date('Y-m-d',strtotime($dataRes['ValidTill']['date']));
$crmcustomertravelItenaryObj = new Travel_Model_CRM_CustomerTravelPlan();
$roomDetails=$crmcustomertravelItenaryObj->GetCustomerTravelPlanItenary($dataRes['TPSysId']);
$dataRes['hotelTotalRooms']= (isset($roomDetails) && !empty($roomDetails)) ? count($roomDetails) : 0;
// input format should be 206-03-25
$totalDays = Zend_Controller_Action_HelperBroker::getStaticHelper('DateFormat')->calculateNoOfDays($fromDate, $toDate);
$dataRes['nights']=$totalDays-1;
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/agency-leads/');
$html->assign('type', 'supplierCustomerEmailPreviewForm');
$html->assign('arrSupplierDetails',$arrSupplierDetails);
$html->assign('data', $dataRes);
$html->assign('agentDetails', $sessionLogin_user);
$html->assign('agencyDetails', $arrAgencyDetails);
$html->assign('callDetails', $dataRes);
$bodyText = $html->render('email-template.phtml');
//end of send email to customer
$msg="success";
echo json_encode(array('status'=>$msg,'bodyText'=>$bodyText));
}
}