| 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 PackageController
*
* @name PackageController
* @author Prashant Kr Gupta
* @version 1.0
* @copyright Catabatic India Pvt Ltd
* Handle Package Related function
*
*/
class FeedbackController extends Catabatic_ValidateCustomer {
const ADMIN_ID = 1;
const CONST_SOURCE_ADMIN = 3;
private $intLoggedinUserId = '';
private $intLoggedinUserGroupSysId = '';
private $intLoggedinUserAgencySysId = '';
private $intLoggedinUserTrxCurrency = '';
public $baseUrl;
public function init() {
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->smtpUserName = $aConfig['smtpUserName'];
$this->smtpPassword = $aConfig['smtpPassword'];
$this->smtpPort = $aConfig['smtpPort'];
$this->smtpHost = $aConfig['smtpHost'];
$this->fromEmail = $aConfig['fromEmail'];
$this->fromName = $aConfig['fromName'];
$this->SMSURL = Catabatic_Helper::getSMSURL();
$this->SMSMETHOD = Catabatic_Helper::getSMSMETHOD();
$this->SMSAPIKEY = Catabatic_Helper::getSMSAPIKEY();
$this->SMSSENDER = Catabatic_Helper::getSMSSENDER();
$this->SMSFORMAT = Catabatic_Helper::getSMSFORMAT();
$this->BITLYLOGIN = 'gpurwar';
$this->BITLYAPIKEY = 'R_c1c94b5c789249d5a59d585bc0e7ef80';
$this->_crmcusttravelplan = new Travel_Model_CRM_CustomerTravelPlan();
$request = Zend_Controller_Front::getInstance()->getRequest();
$this->baseUrl = $request->getScheme() . '://' . $request->getHttpHost();
}
public function indexAction() {
$this->view->baseUrl = $this->baseUrl;
$this->_helper->layout->disableLayout();
$objAgency = new Travel_Model_TblAgency();
$param = $this->getRequest()->getParams();
$AgencySysId = base64_decode($param['id']);
$secureCode = $param['code'];
$agencyData = $objAgency->getUserDataByAgency($AgencySysId);
$this->view->agencyData = $agencyData;
$this->view->AgencySysId = $AgencySysId;
// echo "<pre>";print_r($agencyData);die;
}
public function feedbackAction() {
}
public function sendFeedbackAction(){
$objCustomerRewiew = new CustomerReview_Model_Feedback();
$this->_helper->layout->disableLayout();
$front = Zend_Controller_Front::getInstance();
$front->setParam('noViewRenderer', true);
if ($this->getRequest()->getPost()) {
$param = $this->getRequest()->getParams();
$objAgency = new Travel_Model_TblAgency();
$agencyData = $objAgency->getUserDataByAgency($param['AgencySysId']);
$saveData = [
'AgencySysId' =>$param['AgencySysId'],
'AgentSysId' =>$agencyData['PrimaryUserSysId'],
'Name' =>$param['Name'],
'EmailId' =>$param['EmailId'],
'Destination' =>$param['Destination'],
'DestinationId' =>$param['DestinationId'],
'TravelMonth' =>$param['TravelMonth'],
'ReviewStarValue' =>$param['ReviewStarValue'],
'ReviewTitle' =>$param['ReviewTitle'],
'Review' =>$param['Review'],
'TripImage' =>$param['TripImageName'],
];
// echo "<pre>";print_r($saveData);die;
$feedback = $objCustomerRewiew->insertTable('TB_Agency_Feedback', $saveData);
if($feedback){
$bodyText = '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" border: dashed 1px #ccc; font-size:14px; font-family: Roboto, sans-serif;">
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear ' . ucfirst($param['Name']) . ', <br>
<br>
Greetings from '.$agencyData['Title'].'! <br> <br>
Thank you for your feedback!</td>
</tr>
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
<hr / style="border-width: 0.6px;">
<br>
contact number: ' . $agencyData['PrimaryContactNo'] . '<br>
Email:'.$agencyData['PrimaryEmail'].'</td>
</tr>
</table>';
}
$emailId = trim($param['EmailId']);
$emailData = array('fromEmail' => $agencyData['PrimaryEmail'], 'fromName' => $agencyData['Title'], 'subject' => 'Feedback', 'to' => array(trim($emailId)), 'bodyHtml' => $bodyText, 'bodyText' => '');
try {
// Added By Pardeep Panchal For Email Count...
$arrEmailStatisticsType = array_keys(unserialize(ARR_EMAIL_STATISTICS_TYPE));
$arrEmailStatistics = array(
"TPSysId" => 0,
"TypeSysId" => 1, // 1 For Email 2 For SMS
"AgencySysId" => 0,
"AgentSysId" => 0,
"Title" => $bodyText,
"Source" => $arrEmailStatisticsType[0], // 1 For Fresh Proposals
"Status" => 0,
"RefSysId" => "",
"RefSysStatus" => "",
"CreateDate" => date('Y-m-d H:i:s')
);
// Added By Pardeep Panchal For Email Count Ends...
$returnE = $this->mailSentByElastice($emailData, $arrEmailStatistics, 1, 0);
// echo "<pre>";print_r($returnE);die;
}
catch (Exception $err) {
print_r($err, true);
}
$returnArray = array('status' =>true,'message'=>'Feedback submited succesfully!!!');
echo json_encode($returnArray);
exit;
}
}
public function sendFeedbackImageUploadAction() {
// $filename = $_FILES['file']['name'];
$orignalFIleName = isset($_FILES["file"]["name"]) ? $_FILES["file"]["name"]: '';
if (!empty($orignalFIleName)) {
$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/public/upload/feedback/image";
$originalSmallFolder = $orignalFolderName . "/small";
$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
$fileName = 'feedback_' . time() . '.' . $fileExt;
if (!file_exists($orignalFolderName)) {
@mkdir($orignalFolderName, 0777, true);
}
if (!file_exists($originalSmallFolder)) {
@mkdir($originalSmallFolder, 0777, true);
}
$temp_file_name = $_FILES["file"]["tmp_name"]; // temprary file name
if (move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName)) {
@copy($orignalFolderName . '/' . $fileName, $originalSmallFolder . "/" . $fileName); // copy uploaded file into this location directory
$objImageResize2 = new Catabatic_Imageresize($originalSmallFolder . '/' . $fileName);
$objImageResize2->resizeImage(600, 300, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize2->saveImage($originalSmallFolder . '/' . $fileName);
unlink($_SERVER["DOCUMENT_ROOT"] . "/public/upload/feedback/image/".$fileName);
$fileArray = array('status' =>true, 'fileName' => $fileName);
}
}else{
$fileArray = array('status' =>false,);
}
echo json_encode($fileArray);
exit;
}
public function enquireNowAction(){
$objCustomerRewiew = new CustomerReview_Model_Feedback();
$this->_helper->layout->disableLayout();
$front = Zend_Controller_Front::getInstance();
$front->setParam('noViewRenderer', true);
if ($this->getRequest()->getPost()) {
$param = $this->getRequest()->getParams();
$objAgency = new Travel_Model_TblAgency();
$agencyData = $objAgency->getUserDataByAgency($param['AgencySysId']);
// echo "<pre>";print_r($param);die;
$data = [
'AgencySysId' => $param['AgencySysId'],
'FirstName' => $param['fname'],
'LastName' => $param['lname'],
'Email' => $param['email'],
'MobileNumber' => $param['phone'],
'message' => $param['remark'],
];
try {
$curl = curl_init($this->baseUrl."/gtxwebservices/lead"); // b2c site url
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($curl);
curl_close($curl);
$responseArr = json_decode($response,1);
//echo "<pre>";print_r($responseArr);die;
if ($responseArr['status'] == 'success') {
$name = trim($param['fname']).' '.trim($param['lname']);
$bodyTextAdmin = '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:14px; font-family: Roboto, sans-serif;">
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear Admin, <br>
<br>
You have received a new travel query detail as below:</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Name : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$name.'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Email : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['email'].'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Phone : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['phone'].'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Destination : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['destination'].'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Date : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['date'].'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Budget : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['budget'].'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Total Travellers : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['travellers'].'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Requirement : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.implode(', ', $param['requirement']).'</td>
</tr>
<tr>
<td width="28%" style=" padding:5px 40px;vertical-align: middle;">Remark : </td>
<td width="72%" style=" padding:5px 40px;vertical-align: middle;">'.$param['remark'].'</td>
</tr>
</table>
';
$emailId = trim($param['email']);
$emailDataAdmin = array('fromEmail' => $agencyData['PrimaryEmail'], 'fromName' => $agencyData['Title'], 'subject' => 'Enquire Now', 'to' => array(trim($emailId)), 'bodyHtml' => $bodyTextAdmin, 'bodyText' => '');
$arrEmailStatisticsType = array_keys(unserialize(ARR_EMAIL_STATISTICS_TYPE));
$arrEmailStatistics = array(
"TPSysId" => 0,
"TypeSysId" => 1, // 1 For Email 2 For SMS
"AgencySysId" => 0,
"AgentSysId" => 0,
"Title" => '',
"Source" => $arrEmailStatisticsType[0], // 1 For Fresh Proposals
"Status" => 0,
"RefSysId" => "",
"RefSysStatus" => "",
"CreateDate" => date('Y-m-d H:i:s')
);
// Added By Pardeep Panchal For Email Count Ends...
try {
$returnE = $this->mailSentByElastice($emailDataAdmin, $arrEmailStatistics, 1, 0);
// echo "<pre>";print_r($returnE);die;
}
catch (Exception $err) {
print_r($err, true);
}
$bodyTextCustomer = '<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" style=" border: dashed 1px #ccc; font-size:14px; font-family: Roboto, sans-serif;">
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Dear '.$name.', <br>
</tr>
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thank you for your query!</td>
</tr>
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;"> We will call you as quickly as possible with best options for you.
If you require immediate assistance, please call us on '.$agencyData['PrimaryContactNo'].'<br><br></td>
</tr>
<tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;"> Your opinion matters to us! We\'d love to hear what you have to say about our services!<br><br>
Write in to us at '.$agencyData['PrimaryEmail'].'
</td>
</tr>
<td colspan="2" style=" padding:5px 40px;vertical-align: middle;">Thanks ! <br>
<hr / style="border-width: 0.6px;">
<br>
contact number: ' . $agencyData['PrimaryContactNo'] . '<br>
Email:'.$agencyData['PrimaryEmail'].'</td>
</tr>
</table>';
$emailId = trim($param['email']);
$emailData = array('fromEmail' => $agencyData['PrimaryEmail'], 'fromName' => $agencyData['Title'], 'subject' => 'Enquire Now', 'to' => array(trim($emailId)), 'bodyHtml' => $bodyTextCustomer, 'bodyText' => '');
try {
$returnE = $this->mailSentByElastice($emailData, $arrEmailStatistics, 1, 0);
// echo "<pre>";print_r($returnE);die;
}
catch (Exception $err) {
print_r($err, true);
}
echo json_encode(array('status'=>true,'queryType'=>'lead','message'=>'query send successfully!!!'));
} else {
echo json_encode(array('status'=>false,'queryType'=>'lead','message'=>'Something went wrong?'));
}
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
}
}
}