| 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/prathamtour.com/application/modules/activities/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 : 06 Dec2017
* Updated Date : 03 Nov 2017
* Activities_IndexController | Activities Module / Index controller
**************************************************************
*/
class Activities_IndexController extends Zend_Controller_Action {
public $baseUrl = '';
public $AgencyId;
protected $objMdl;
protected $objHelperGeneral;
protected $tablename;
protected $imageUrl;
public function init() {
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->siteName = $BootStrap['siteName'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->appmode = $aConfig['bootstrap']['appmode'];
$this->AgencyId = $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->objHelperGeneral = $this->_helper->General;
$this->current_time = time();
$this->imageUrl = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/activities/';
$this->img_w_thumb = 64;
$this->img_h_thumb = 64;
$this->img_w_small = 200;
$this->img_h_small = 150;
$this->img_w_medium = 488;
$this->img_h_medium = 350;
$this->img_w_large = 1000;
$this->img_h_large = 555;
$this->img_w_banner = 800;
$this->img_h_banner = 300;
$this->DIR_WRITE_MODE = 0777;
}
public function homeAction() {
$currencyTypeArray = $this->objHelperGeneral->getCurrencyData();
$decodedPackageDestinationArray = array();
$arrContextOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
);
$url = $this->baseUrl . 'public/data/dynamic/package_destinations.json';
$packageDestinationArray = file_get_contents($url, false, stream_context_create($arrContextOptions));
// $packageDestinationArray = file_get_contents($this->baseUrl . 'public/data/dynamic/package_destinations.json');
// echo "<pre>";print_r($packageDestinationArray);exit();
if(!empty($packageDestinationArray)){
$decodedPackageDestinationArray = Zend_Json::decode($packageDestinationArray);
}
// echo "<pre>";print_r($decodedPackageDestinationArray);die;
$destinatonTop = $this->objMdl->rv_select_all($this->tablenameDestination, ['DesSysId', 'Title', 'Activities', 'Hotels', 'Tours', 'Image', 'DestDescription'], ['IsActive' => 1, 'displayOnActivity' => 1, 'IsMarkForDel' => 0], ['rand()' => ''], 8);
$destinatonTopArr = array();
foreach ($destinatonTop as $topdesKey => $topdesValue) {
$desTitleValue =$topdesValue['Title'];
$whereCustom = ($desTitleValue) ? " ( Destinations LIKE '%{$desTitleValue}%' )" : "";
$tourResult = $this->objMdl->rv_select_row_where_custom($this->tablename, ['count(*) as totalCount'], ['IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1, 'ItemType' => 3], $whereCustom, [], '');
$destinatonTopArr[] = [
'DesSysId' => $topdesValue['DesSysId'],
'Title' => $topdesValue['Title'],
'Activities' => $topdesValue['Activities'],
'Hotels' => $topdesValue['Hotels'],
'Tours' => $topdesValue['Tours'],
'Image' => $topdesValue['Image'],
'DestDescription' => $topdesValue['DestDescription'],
'totalCount' => $tourResult['totalCount'],
];
}
// echo "<pre>";print_r($destinatonTopArr);die;
$this->view->destinations = $destinatonTopArr;
$this->view->baseUrl = $this->baseUrl;
$this->view->tollfreenumber = $this->tollfreenumber;
$this->view->siteName = $this->siteName;
$trendingTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType','oldPrice'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 20);
$trendingActivities = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType','oldPrice'], ['IsActive' => 1, 'IsMarkForDel' => 0, 'ItemType' => 3, 'IsFeatured' => 1], ['PkgSysId' => 'DESC'], 12);
//$currencyRate = $this->objMdl->rv_select_all('tbl_currency_rate', ['*'], ['cid'], ['cid' => 'DESC']);
//$lastMinuteTours = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['PkgSysId', 'Image', 'GTXPkgId', 'Destinations', 'Countries', 'BookingValidUntil', 'LongJsonInfo', 'Nights', 'StarRating', 'PackageType', 'PackageSubType','oldPrice'], ['IsActive' => 1, 'IsPublish' => 1, 'IsMarkForDel' => 0, 'ItemType' => 1, 'lastMinuteDeal' => 1], ['PkgSysId' => 'DESC'], 6);
foreach ($trendingTours as $key => $value) {
$destinationArr = explode(',', $value['Destinations']); // get the first destination only by extracting array
$LongJsonInfo = Zend_Json::decode($value['LongJsonInfo']);
if(isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])){
$categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2B', $value['PackageType'], $value['PackageSubType']); // get default category
}else {
$categoryDetails = $this->objHelperGeneral->getCategoryAndPriceArray($LongJsonInfo['package']['TourTypes']['MarketType'], 'B2C', $value['PackageType'], $value['PackageSubType']); // get default category
}
$tourImage1 = explode(',', $value['Image']);
$tourImage = $tourImage1[0];
$defaultCategoryId = $categoryDetails['defaultCategoryId'];
$defaultCategory = $categoryDetails['defaultCategory'];
$defaultTourType = $categoryDetails['defaultTourType'];
$TPId = ($value['PackageType'] == $this->packageTypeStatic) ? $LongJsonInfo['package']['TPId'] : $categoryDetails['TPId'];
$MPType = (!empty($categoryDetails['MPType']) && ($categoryDetails['MPType'] != 'LowestCost')) ? array_search($categoryDetails['MPType'], unserialize(CONST_MEAL_PLAN_ARR)) : 0;
$tourTypeChar = ($defaultTourType == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
$priceArrJson = $categoryDetails['priceArrJson'];
$displayFinalPrice = $this->objHelperGeneral->getPackagePrice($defaultCategory, $tourTypeChar, $priceArrJson, true); // Param 4: true ( if calculate discounted price )
$getCurrencyType = $priceArrJson[$tourTypeChar][$defaultCategory]['price'][0]['Currency'];
$toursFinal[] = [
'name' => $this->objHelperGeneral->trimContent($LongJsonInfo['package']['Name'], 24),
'nameF' => $LongJsonInfo['package']['Name'], // full name of package name
'img' => $tourImage,
'night' => $value['Nights'],
'price' => $this->objHelperGeneral->moneyFormatINR(round($displayFinalPrice)),
'currencyType' => $currencyTypeArray[$getCurrencyType],
'star' => $value['StarRating'],
'Destination' => $value['Destinations'],
'PkgSysId' => $value['PkgSysId'],
'GTXPkgId' => $value['GTXPkgId'],
'defaultCategoryId' => $defaultCategoryId,
'defaultCategory' => $defaultCategory,
'tourtype' => $defaultTourType,
'TPId' => $TPId,
'PackageType' => $value['PackageType'],
'mp' => $MPType,
'Countries' => $value['Countries'],
'isFixedDeparturesPackage' => $LongJsonInfo['package']['IsFixedDeparturePackage'],
'BookingValidUntil' => $value['BookingValidUntil'],
'oldPrice' => $value['oldPrice'],
];
}
$activityFinal = array();
foreach($trendingActivities as $tKey => $tVal){
$LongJsonInfo = json_decode($tVal['LongJsonInfo'],1);
if(isset($LongJsonInfo['ThumnailImg']) && trim($LongJsonInfo['ThumnailImg']) !=''){
$imagename = $LongJsonInfo['ThumnailImg'];
}else{
$imagename1 = explode(',', $tVal['Image']);
$imagename = $this->baseUrl.'public/upload/activities/'.$tVal['PkgSysId'].'/images/medium/'.$imagename1[0];
}
$rate = 1;
// foreach($currencyRate as $cKey => $cVal){
// if($cVal['FCurrencyType'] == $LongJsonInfo['Currency'] && $cVal['TCurrencyType'] == 1){
// $rate = $cVal['Rate'];
// }
// }
$netPrice = 0;
if(!empty($LongJsonInfo['SICCost'])){
$netPrice = (int)($LongJsonInfo['SICCost'][0]['NetAdultCost'] + $LongJsonInfo['AdultEntryFee']);
}else if(!empty($LongJsonInfo['PvtCost'])){
$netPrice = (int)($LongJsonInfo['PvtCost'][0]['NetAdultCost'] + $LongJsonInfo['AdultEntryFee']);
}else{
$netPrice = (int)$LongJsonInfo['AdultEntryFee'];
}
$activityFinal[] = [
'PkgSysId' => $tVal['PkgSysId'],
'Title' => $LongJsonInfo['Title'],
'destination' => $tVal['Destinations'],
'oldPrice' => (isset($tVal['oldPrice']) && $tVal['oldPrice'] != 0 && $tVal['oldPrice'] != '') ? $tVal['oldPrice'] : '',
'Image' => $imagename,
'Duration' => $LongJsonInfo['Duration'],
'DurationInMin' => $LongJsonInfo['DurationInMin'],
'DurationStr' => $LongJsonInfo['DurationStr'],
'PriceAdditional' => isset($netPrice) ? round($netPrice) : 0,
// 'CurrencySymbol' => isset($LongJsonInfo['PriceAdditional'][0]['CurrencySymbol']) ? $LongJsonInfo['PriceAdditional'][0]['CurrencySymbol'] : 'INR',
'currencyType' => ($LongJsonInfo['CurrencySymbol']) ? $LongJsonInfo['CurrencySymbol'] : 'INR',
];
}
$bannerDetail = $this->objMdl->rv_select_all('tb_homebanner_detail', ['banner_id', 'image', 'heading', 'description', 'url', 'opt'], [ 'status' => 1, 'isDisplayOnHome' => 1, 'isMarkForDel' => 0], ['banner_id' => 'DESC'], 10);
$resultsetTravelogue = $this->objMdl->rv_select_all('tbl_travelogues', ['*'], ['isMarkForDel' => 0,'status'=>1,'displayOnBanner'=>1,'category'=>2], ['TravId' => 'DESC'], 10);
$this->view->getOfferDetail = $getOfferDetail;
// echo "<pre>";print_r($getCmsPageDetail);die;
$this->view->getCmsPageDetail = $getCmsPageDetail;
$getPageDetail = $this->objMdl->rv_select_row('tbl_static_pages', ['*'], ['identifier' => 'activity'], ['sid' => 'desc']);
// echo"<pre>";print_r($getPageDetail);die;
$this->view->getPageDetail = $getPageDetail;
$this->view->bannerDetail = $bannerDetail;
$this->view->baseUrl = $this->baseUrl;
$this->view->toursFinal = $toursFinal;
$this->view->travelogues = $resultsetTravelogue;
$this->view->lastMinuteTours = $lastMinuteToursFinal;
$this->view->packageDestinationArray = $decodedPackageDestinationArray;
$this->view->activityFinal = $activityFinal;
$this->view->MobileDetect = $this->objHelperGeneral->getDevice();
//$this->view->destinationsDomestic = $destinationsDomestic;
//$this->view->destinationsInternational = $destinationsInternational;
}
public function indexAction()
{
// code here
$params = $this->getRequest()->getParams();
$crud = new Admin_Model_CRUD();
$paramsss = explode('-', trim($params['actname'] , '.html'));
krsort($paramsss); // reverse sort the array to find all url param ids for fetching recor
$listkeys = ['pkgid'];
$i =0;
foreach ( $paramsss as $value ) {
if($i == count($listkeys)) break;
$param[$listkeys[$i]] = $value;
$i++;
}
// echo '<pre>'; print_r($param); die;
$pkgid = (int)$param['pkgid'];
$this->view->baseUrl = $this->baseUrl;
$this->view->readmore = isset($params['readmore']) && !empty($params['readmore'])?$params['readmore']:'no';
$where = [
'PkgSysId'=> $pkgid ,
'IsMarkForDel'=>0,
'IsActive'=>1,
'IsPublish'=>1,
'ItemType'=> 3 // 3 for activities
];
$whereCustom = "";
// $whereCustom = ($value) ? " ( Destinations LIKE '%{$value}%' )" : "";
$detail = $this->objMdl->rv_select_row_where_custom( $this->tablename , [
'PkgSysId' ,
'GTXPkgId' ,
'AgencySysId' ,
'LongJsonInfo' ,
'Destinations' ,
'MinPrice' ,
'MaxPrice' ,
'Nights' ,
'Image' ,
'PkgValidFrom' ,
'PkgValidUntil' ,
'BookingValidUntil' ,
'StarRating' ,
'Countries' ,
] , $where , $whereCustom , ['MinPrice'=>'ASC']);
if( $detail['LongJsonInfo'] ) {
$LongJsonInfo = Zend_Json::decode($detail['LongJsonInfo']);
}
$detailFinal = [];
$detailFinal = $LongJsonInfo;
$detailFinal['star'] = $detail['StarRating']; // additional fields here
try {
$detailFinal['ActivityGrType'] = Zend_Json::decode($LongJsonInfo['ActivityGrType']); // additional fields here
} catch ( Zend_Exception $err ) {
$detailFinal['ActivityGrType'] = [];
}
try {
$detailFinal['ActivityType'] = Zend_Json::decode($LongJsonInfo['ActivityType']); // additional fields here
} catch ( Zend_Exception $err ) {
$detailFinal['ActivityType'] = [];
}
try {
$detailFinal['ThingsToCarry'] = Zend_Json::decode($LongJsonInfo['ThingsToCarry']); // additional fields here
} catch ( Zend_Exception $err ) {
$detailFinal['ThingsToCarry'] = [];
}
try {
$detailFinal['transport'] = (isset($LongJsonInfo['transport']) && !empty($LongJsonInfo['transport'])) ? (Zend_Json::decode($LongJsonInfo['transport'])) : ''; // additional fields here
} catch ( Zend_Exception $err ) {
$detailFinal['transport'] = [];
}
$detailFinal['icon'] = ($LongJsonInfo['Icon']!='0') ? $LongJsonInfo['Icon'] : ''; // additional fields here
$detailFinal['Destinations'] = $detail['Destinations']; // additional fields here
// $detailFinal['main_image'] = '1.jpg'; // additional fields here
// $detailFinal['images'] = ['1.jpg','2.jpg','3.jpg','4.jpg','5.jpg','6.jpg','7.jpg']; // additional fields here
$detailFinal['PkgSysId'] = $detail['PkgSysId'];
$detailFinal['GTXPkgId'] = $LongJsonInfo['gtxPkgId'];
$detailFinal['title'] = $LongJsonInfo['Title'];
$detailFinal['images'] = ($detail['Image']) ? explode(',', $detail['Image']) : [];
$detail_image = array();
if (!empty($detailFinal['images'])) {
// $explodedImages = explode(',', $detailFinal['images']);
$countImages = count($detailFinal['images']);
foreach ($detailFinal['images'] as $explodedvalue) {
$tourImage = $this->baseUrl . "public/upload/activities/" . $detail['PkgSysId'] . "/small/" . $explodedvalue;
$tourImage1 = (get_headers($tourImage,1));
if (strpos($tourImage1[0], '200 OK') !== false ) {
$detail_image[] = $tourImage;
}
}
} else {
$tourImage1 = (get_headers($detailFinal['ThumnailImg'],1));
if (strpos($tourImage1[0], '200 OK') !== false ) {
$detail_image[] = $detailFinal['ThumnailImg'];
}
}
$this->view->detail_image = $detail_image;
if($detailFinal['Destinations']!=""){
$selectTitle=explode(",",$getData['destination']);
$checkdata = $this->objMdl->selectOne('tb_tbb2c_destinations', ['Bannerimg','DesSysId'], ['Title' => $detailFinal['Destinations']]);
$bannerImage = $checkdata['Bannerimg'];
$this->view->bannerImage = $bannerImage;
$this->view->DesSysId = $checkdata['DesSysId'];
}
$currencyType = $this->objHelperGeneral->getCurrencyData();
$detailFinal['currencyType'] = isset($LongJsonInfo['CurrencySymbol']) ? $LongJsonInfo['CurrencySymbol'] : 'INR';
// echo '<pre>';print_r($detailFinal); die;
// start : code for download image
$pId = $detail['PkgSysId'];
$ImgThumbnail = end(explode('/', $detailFinal['icon']));
// echo $this->imageUrl . $pId . "/images/" . $ImgThumbnail;die;
if(!file_exists($this->imageUrl . $pId . "/images/" . $ImgThumbnail)) {
if($detailFinal['icon']) {
$defaultImage = $detailFinal['icon'];
// echo $defaultImage;die;
if(isset($defaultImage) && !empty($defaultImage)) {
$ImgThumbnailContent = file_get_contents( $defaultImage );
$fileExt = $this->_helper->General->getFileExtension($defaultImage);
$ImgThumbnail = end(explode('/', $defaultImage));
$fileName = $ImgThumbnail;
$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $pId . "/images/";
$originalThumbFolder = $orignalFolderName. "/thumb";
$originalSmallFolder = $orignalFolderName. "/small";
$originalMediumFolder = $orignalFolderName. "/medium";
$originalLargeFolder = $orignalFolderName. "/large";
if (!file_exists($orignalFolderName)) {
mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalThumbFolder)) {
mkdir($originalThumbFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalSmallFolder)) {
mkdir($originalSmallFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalMediumFolder)) {
mkdir($originalMediumFolder, $this->DIR_WRITE_MODE, true);
}
if (!file_exists($originalLargeFolder)) {
mkdir($originalLargeFolder, $this->DIR_WRITE_MODE, true);
}
if(!file_exists($fileName)){
file_put_contents( $orignalFolderName . $fileName , $ImgThumbnailContent);
@copy($orignalFolderName . '/' . $fileName, $originalLargeFolder . "/" . $fileName); // copy uploaded file into this location directory
$objImageResize4 = new Catabatic_Imageresize($originalLargeFolder . '/' . $fileName);
$objImageResize4->resizeImage($this->img_w_large, $this->img_h_large, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize4->saveImage($originalLargeFolder . '/' . $fileName);
@copy($originalLargeFolder . '/' . $fileName, $originalThumbFolder . "/" . $fileName); // copy uploaded file into this location directory
$objImageResize1 = new Catabatic_Imageresize($originalThumbFolder . '/' . $fileName);
$objImageResize1->resizeImage($this->img_w_thumb, $this->img_h_thumb, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize1->saveImage($originalThumbFolder . '/' . $fileName);
@copy($originalLargeFolder . '/' . $fileName, $originalMediumFolder . "/" . $fileName); // copy uploaded file into this location directory
$objImageResize2 = new Catabatic_Imageresize($originalMediumFolder . '/' . $fileName);
$objImageResize2->resizeImage($this->img_w_medium, $this->img_h_medium, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize2->saveImage($originalMediumFolder . '/' . $fileName);
@copy($originalLargeFolder . '/' . $fileName, $originalSmallFolder . "/" . $fileName); // copy uploaded file into this location directory
$objImageResize3 = new Catabatic_Imageresize($originalSmallFolder . '/' . $fileName);
$objImageResize3->resizeImage($this->img_w_small, $this->img_h_small, 'exact'); // param : width , height , (exact|portrait|landscape|auto|crop)
$objImageResize3->saveImage($originalSmallFolder . '/' . $fileName);
}
}
$updatedata = ['Image' => $fileName ];
$result = $crud->rv_update($this->tablename, $updatedata, ['PkgSysId =?' => $pId]);
}
}
// end : code for download image
// echo '<pre>';print_r($detailFinal); die;
$currencyRate = $this->objMdl->rv_select_all('tbl_currency_rate', ['*'], ['cid'], ['cid' => 'DESC']);
$this->view->detail = $detailFinal;
$this->view->currencyRate = $currencyRate;
}
public function mailAction()
{
// adminEmail
$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout(); // disable layouts
$bodyText = 'Hello,<br/>
An Insurance Policy has been issued on production!<br/><br/>
Best Regards,<br/>
GTX Team.';
$mailSubject= "Insurance Policy Issued on Production";
$fromName = 'travelkaro';
$emailId = 'ranvir@catpl.co.in';
$emailIdcc = 'pardeep@catpl.co.in';
$mail = new Zend_Mail("iso-8859-1");
$mail->addTo($emailId)
->addCc($emailIdcc)
// ->addBcc($this->bcc_email_for_attachment)
->setSubject($mailSubject)
->setBodyHtml($bodyText)
->setFrom( $emailId , $fromName );
$mail->addHeader('X-Priority', '1');
$mail->addHeader('X-MSMail-Priority', 'High');
$mail->addHeader('Importance', 'High');
try {
$issend = $mail->send(); //send mail
} catch (Exception $err) {
print_r($err, true);
}
var_dump($issend);
}
}