| 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/views/helpers/ |
Upload File : |
<?php
class Zend_View_Helper_General extends Zend_View_Helper_Abstract
{
private $db = NULL;
public function __construct(){
#initialize db adapter
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function getPriceRange() {
$response = array('0-9999' => 'Up To Rs. 9,999',
'10000-19999' => 'Rs. 10,000 To Rs. 19,999',
'20000-29999' => 'Rs. 20,000 To Rs. 29,999',
'30000-39999' => 'Rs. 30,000 To Rs. 39,999',
'40000-49999' => 'Rs. 40,000 To Rs. 49,999',
'50000-' => 'Rs. 50,000 and Above'
);
return $response;
/*
$minPrice = floor($minPrice/$interval) * $interval;
for($i = $minPrice; $i<=($maxPrice+$interval)-1; $i+=$interval) {
if($i == $minPrice) {
$response[] = "Less than " . $interval;
}else {
$response[] = $i . " to " . ($i+$interval);
}
}
$response[] = "More than " . ($i) . " ";
return $response;
*
*/
}
public function showDayNight($intDay, $delimiter = ' ', $firstCap = false, $searchPage = false, $format = 'short') {
if(empty($intDay)){
return '';
}
if($format == 'short') {
if($intDay == 1)
return '1D';
else
return ($intDay-1) .'N/' .$intDay.'D';
}
$days = " days";
$night = " nights";
$intNight = '';
if($intDay == 1) {
$intNight = 1;
$days = " day";
$night = " night";
}else {
$intNight = $intDay - 1;
if($intNight<=1) {
$night = " night";
}
}
if($firstCap){
$days = ucfirst($days);
$night = ucfirst($night);
}
if(empty($delimiter)) {
$delimiter = " ";
}
if($searchPage) {
return $intDay .' Days' . $delimiter . $intNight . $night;
}
return $intDay .$days . $delimiter . $intNight . $night;
}
public function getStartingCity() {
#initialize db adapter
$sql = " SELECT DISTINCT city,city_name FROM tbl_package_departure
INNER JOIN tbl_city ON tbl_package_departure.city = tbl_city.id
INNER JOIN tbl_package_master ON tbl_package_departure.package_id = tbl_package_master.id
WHERE tbl_package_master.status='1' AND tbl_package_master.deleted='N' ";
$rowset = $this->db->query($sql)->fetchAll();
return $rowset;
}
public function getTotalTravelAgents() {
#initialize db adapter
$db = Zend_Db_Table::getDefaultAdapter();
$sql = " SELECT COUNT(*) AS agents FROM admin_user WHERE role = '2' ";
$rowset = $db->query($sql)->fetchAll();
return $rowset[0]['agents']+100;
}
public function getTotalDestinations() {
#initialize db adapter
$db = Zend_Db_Table::getDefaultAdapter();
$sql = " SELECT COUNT(*) AS destinations
FROM tbl_destination WHERE deleted='N' ";
$rowset = $db->query($sql)->fetchAll();
return $rowset[0]['destinations']+100;
}
public function getTotalPackages() {
#initialize db adapter
$db = Zend_Db_Table::getDefaultAdapter();
$sql = " SELECT COUNT(*) AS packages FROM tbl_package_master WHERE deleted='N' ";
$rowset = $db->query($sql)->fetchAll();
return $rowset[0]['packages']+100;
}
public function getIcon($inclusionId) {
if($inclusionId == 34) {
/* Intercity Transfers */
return 'intercity.jpg';
}
else if($inclusionId == 20) {
/* Breakfast */
return 'breakfast.jpg';
}else if($inclusionId == 36 || $inclusionId == 37) {
return 'breakfast.jpg';
}else if($inclusionId == 40) {
/* Local Transfers */
return 'transfers.jpg';
}else if($inclusionId == 41) {
/* Local Sightseeing */
return 'localS.jpg';
}else if($inclusionId == 42) {
/* Hotel */
return 'hotel.jpg';
}else if($inclusionId == 38) {
return 'welcomeDrink.jpg';
}else if($inclusionId == 31) {
return 'flight_icon2.jpg';
}
else {
return 'sight_icon4.jpg';
}
}
public function getRatingImage($rating, $size = 'smallstar') {
$fullRating = 5;
$ratingStar = '<img src="/public/images/smtRating.png">';
$ratingStar_half = '<img src="/public/images/smtRating_half.png">';
$ratingStar_light = '<img src="/public/images/smtRating1.png">';
// if($size == 'largestar') {
// $ratingStar = '<img src="/public/images/smtRating.png">';
// $ratingStar_half = '<img src="/public/images/smtRating_half.png">';
// $ratingStar_light = '<img src="/public/images/smtRating1.png">';
// }
if(strstr($rating, '.')) {
$beforeDecimal = substr($rating, 0 , strpos($rating,'.'));
$afterDecimal = substr($rating, strpos($rating,'.'));
$ratingImage = '';
for($i = 0; $i < $beforeDecimal; $i++ ) {
$ratingImage .= $ratingStar;
}
$ratingImage .= $ratingStar_half;
$grayStars = $fullRating - $beforeDecimal;
for($i = 0; $i < $grayStars - 1; $i++ ) {
$ratingImage .= $ratingStar_light;
}
return $ratingImage;
} else {
$ratingImage = '';
for($i = 0; $i < $rating; $i++ ) {
$ratingImage .= $ratingStar;
}
$grayStars = $fullRating - $rating;
for($i = 0; $i < $grayStars; $i++ ) {
$ratingImage .= $ratingStar_light;
$ratingImage;
}
return $ratingImage;
}
}
public function isLeadPopupRequired() {
$ipAddress = $_SERVER['REMOTE_ADDR'];
$sql = " SELECT entry_dt, TIMESTAMPDIFF(HOUR, entry_dt, NOW())
AS difference FROM tbl_experts_advice
WHERE 1 AND TIMESTAMPDIFF(HOUR, entry_dt, NOW()) > ". LEAD_POPUP_REQUIRED_INTERVAL ."
AND '".$ipAddress."' = ip_address LIMIT 0,1 " ;
$rowset = $this->db->query($sql)->fetchAll();
if(count($rowset) > 0) {
return true;
}
$sql = " SELECT entry_dt, TIMESTAMPDIFF(HOUR, entry_dt, NOW())
AS difference FROM tbl_speak_with_travel_expert
WHERE 1 AND TIMESTAMPDIFF(HOUR, entry_dt, NOW()) > ". LEAD_POPUP_REQUIRED_INTERVAL ."
AND '".$ipAddress."' = ip_address LIMIT 0,1 " ;
$rowset = $this->db->query($sql)->fetchAll();
if(count($rowset) > 0) {
return true;
}
return false;
}
public function number_format_indian($number)
{
$explrestunits = "";
if (strlen($number) > 3) {
$lastthree = substr($number, strlen($number) - 3, strlen($number));
$restunits = substr($number, 0, strlen($number) - 3); // extracts the last three digits
$restunits = (strlen($restunits) % 2 == 1) ? "0" . $restunits : $restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping.
$expunit = str_split($restunits, 2);
for ($i = 0; $i < sizeof($expunit); $i++) {
// creates each of the 2's group and adds a comma to the end
if ($i == 0) {
$explrestunits .= (int) $expunit[$i] . ","; // if is first value , convert into integer
} else {
$explrestunits .= $expunit[$i] . ",";
}
}
$thecash = $explrestunits . $lastthree;
} else {
$thecash = $number;
}
return $thecash; // writes the final format where $currency is the currency symbol.
}
}