| 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/junkdata/holidays.tripjack.comOLDSEP11bak/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 : 25 May 2017
* Updated Date : 14 Dec 2017
***************************************************************/
class StaffController 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()
{
parent::init();
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->siteName = $BootStrap['siteName'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->siteImageUrl = $BootStrap['siteImageUrl'];
$this->tollfreenumber = $BootStrap['tollfreenumber'];
$this->gtxagencysysid = $BootStrap['gtxagencysysid'];
$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('User');
$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->customerchangepasswordAPIUrlB2c = API_CUSTOMER_CHANGEPASSWORDB2C;
$this->addagencyuser = API_ADD_AGENCY_USER;
$this->updateagencyuser = API_UPDATE_AGENCY_USER;
$this->agencyuserlist = API_AGENCY_USER_LIST;
$this->deactivateagencyuser = API_DEACTIVATE_AGENCY_USER;
$this->activateagencyuser = API_ACTIVATE_AGENCY_USER;
$this->sendB2bAgentForgetPasswordMail = API_SEND_B2B_AGENT_FORGET_PASSWORD_MAIL;
$this->myNamespace = new Zend_Session_Namespace('MypopSess'); // get user end infomations
}
public function indexAction()
{
//$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($getAgencyData);
// die;
$this->view->baseUrl = $this->baseUrl;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function getUserListAction()
{
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
if ($this->getRequest()->isXmlHttpRequest()) {
$post = json_decode(file_get_contents('php://input'), true);
$apiData = array(
'B2BAgentSysId' => $this->_session->data['AgencySysId'],
);
try {
$curl_p = curl_init($this->agencyuserlist);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response = curl_exec($curl_p);
curl_close($curl_p);
} catch (Exception $error) {
print_r($error->getMessage());
die;
}
$response_decode = Zend_Json::decode($response, true);
// echo "<pre>";
// print_r($response_decode);die;
if ($response_decode['status'] == 1) {
$UserData = [];
if ($response_decode['AgencyStaffList']) {
foreach ($response_decode['AgencyStaffList'] as $val) {
// echo "<pre>";
// print_r($val);
$UserData[] = array(
'UserSysId' => $val['UserSysId'],
'AgencySysId' => $val['AgencySysId'],
'FirstName' => trim($val['FirstName']),
'LastName' => trim($val['LastName']),
'EmailId' => trim($val['EmailId']),
'ContactNo1' => trim($val['ContactNo1']),
'AgencyName' => trim($val['AgencyName']),
'countrycode' => trim($val['countrycode']),
'Salutation' => trim($val['Salutation']),
'UserRole' => trim($val['UserRole']),
'IsActive' => trim($val['IsActive']),
);
}
}
// echo "<pre>";
// print_r($UserData);die;
$response = array('success' => true, 'message' => 'successfully execute', 'UserData' => $UserData);
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'Oops somethigs went wrong.!');
echo json_encode($response);
exit;
}
print_r($response_decode);
die;
} else {
die('invalid request');
}
// echo "<pre>";
// print_r($this->_session->data);
// print_r($getAgencyData);
// die;
$this->view->baseUrl = $this->baseUrl;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function createUserAction()
{
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$post = json_decode(file_get_contents('php://input'), true);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($post);
$apiData = array(
'agencyName' => $this->_session->data['AgencyName'],
'salutation' => $post['title'],
'firstName' => $post['fname'],
'lastName' => $post['lname'],
'emailId' => $post['email'],
'countrycode' => $post['countrycode'],
'mobileNo' => $post['mobile'],
'AgencySysId' => $this->_session->data['MasterAgencySysId'],
'AgentSysId' => 0,
'B2BAgentSysId' => $this->_session->data['AgencySysId'],
);
try {
$curl_p = curl_init($this->addagencyuser);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response = curl_exec($curl_p);
curl_close($curl_p);
} catch (Exception $error) {
print_r($error->getMessage());
die;
}
$response_decode = Zend_Json::decode($response, true);
if ($response_decode['status'] == 1 && $response_decode['message'] != 'Exist') {
$response = array('success' => true, 'message' => 'User create successfully');
echo json_encode($response);
exit;
} elseif ($response_decode['status'] == 1 && $response_decode['message'] == 'Exist') {
$response = array('success' => false, 'message' => 'This user already exist.');
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'Oops somethigs went wrong.!');
echo json_encode($response);
exit;
}
print_r($response_decode);
die;
}
// echo "<pre>";
// print_r($this->_session->data);
// print_r($getAgencyData);
// die;
$this->view->baseUrl = $this->baseUrl;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function updateUserAction()
{
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$post = json_decode(file_get_contents('php://input'), true);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($post);
$apiData = array(
'AgencyName' => $this->_session->data['AgencyName'],
'salutation' => $post['title'],
'FirstName' => $post['fname'],
'LastName' => $post['lname'],
'EmailId' => $post['email'],
'countrycode' => $post['countrycode'],
'ContactNo1' => $post['mobile'],
'AgencySysId' => $this->_session->data['MasterAgencySysId'],
'AgentSysId' => 0,
'B2BAgentSysId' => $this->_session->data['AgencySysId'],
'UserSysId' => $post['UserSysId'],
);
try {
$curl_p = curl_init($this->updateagencyuser);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response = curl_exec($curl_p);
curl_close($curl_p);
} catch (Exception $error) {
print_r($error->getMessage());
die;
}
$response_decode = Zend_Json::decode($response, true);
if ($response_decode['status'] == 1 && $response_decode['message'] != 'Exist') {
$response = array('success' => true, 'message' => 'User Updated successfully');
echo json_encode($response);
exit;
} else if ($response_decode['status'] == 1 && $response_decode['message'] == 'Exist') {
$response = array('success' => false, 'message' => 'This user already exist.');
echo json_encode($response);
exit;
} else {
$response = array('success' => false, 'message' => 'Oops somethigs went wrong.!');
echo json_encode($response);
exit;
}
print_r($response_decode);
die;
}
// echo "<pre>";
// print_r($this->_session->data);
// print_r($getAgencyData);
// die;
$this->view->baseUrl = $this->baseUrl;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
}
public function deactivateUserAction()
{
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$post = json_decode(file_get_contents('php://input'), true);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($post);
$apiData = array(
'AgencySysId' => $this->_session->data['MasterAgencySysId'],
'B2BAgentSysId' => $this->_session->data['AgencySysId'],
'UserSysId' => $post['UserSysId'],
);
try {
$curl_p = curl_init($this->deactivateagencyuser);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response = curl_exec($curl_p);
//echo "<pre>"; print_r($response); die;
curl_close($curl_p);
} catch (Exception $error) {
print_r($error->getMessage());
die;
}
$response_decode = Zend_Json::decode($response, true);
$responseArr = array('success' => $response_decode['status'], 'message' => $response_decode['message']);
echo json_encode($responseArr); exit;
}
}
public function activateUserAction()
{
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$post = json_decode(file_get_contents('php://input'), true);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($post);
$apiData = array(
'AgencySysId' => $this->_session->data['MasterAgencySysId'],
'B2BAgentSysId' => $this->_session->data['AgencySysId'],
'UserSysId' => $post['UserSysId'],
);
try {
$curl_p = curl_init($this->activateagencyuser);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response = curl_exec($curl_p);
//echo "<pre>"; print_r($response); die;
curl_close($curl_p);
} catch (Exception $error) {
print_r($error->getMessage());
die;
}
$response_decode = Zend_Json::decode($response, true);
$responseArr = array('success' => $response_decode['status'], 'message' => $response_decode['message']);
echo json_encode($responseArr); exit;
}
}
public function sendUserPasswordAction()
{
$getAgencyData = Zend_Controller_Action_HelperBroker::getStaticHelper("Flight")->getAgencyData($this->gtxagencysysid);
if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->getPost()) {
$post = json_decode(file_get_contents('php://input'), true);
$apiData = array(
'FirstName' => $post['FirstName'],
'LastName' => $post['LastName'],
'EmailId' => $post['EmailId'],
'AgencySysId' => $this->_session->data['MasterAgencySysId'],
'AgentSysId' => 0,
'B2BAgentSysId' => $this->_session->data['AgencySysId'],
'userSysId' => $post['UserSysId'],
);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($apiData);die;
try {
$curl_p = curl_init($this->sendB2bAgentForgetPasswordMail);
curl_setopt($curl_p, CURLOPT_POST, true);
curl_setopt($curl_p, CURLOPT_POSTFIELDS, http_build_query($apiData));
curl_setopt($curl_p, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_p, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_p, CURLOPT_TIMEOUT, 300);
$response = curl_exec($curl_p);
// echo "<pre>";
// print_r($this->_session->data);
// print_r($response);die;
curl_close($curl_p);
} catch (Exception $error) {
print_r($error->getMessage());
die;
}
$response_decode = Zend_Json::decode($response, true);
$responseArr = array('success' => $response_decode['status'], 'message' => $response_decode['message']);
echo json_encode($responseArr); exit;
}
}
}