%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_1ec2d7c2/apps/models/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Commonmod_model extends CI_Model {
public function __construct()
{
$this->load->database();
$this->load->library('image');
$this->load->library('form_validation');
$this->load->helper(array('form', 'url'));
$this->getEmailData();
$this->checkPhpfileAdmin();
}
function getEmailData(){
$emaildata = $this->GetEmailConfigSetting(1);
define("FROM_EMAIL",$emaildata[0]['from_email']);
define("FROM_NAME",$emaildata[0]['from_name']);
define("ADMIN_EMAIL_ID",$emaildata[0]['admin_email_id']);
define("CC_EMAIL_ID",$emaildata[0]['cc_email_id']);
define("BCC_EMAIL_ID",$emaildata[0]['bcc_email_id']);
define("WEBSITE_EMAIL_TITLE",$emaildata[0]['website_email_title']);
define("WEBSITE_TITLE",$emaildata[0]['website_title']);
define("WEBSITE_SIGNATURE",$emaildata[0]['website_signature']);
}
public function checkPhpfileAdmin(){
$allowed_extensions = array("php", "zip"); // list of allowed file extensions
// loop through the $_FILES array to find the uploaded file
foreach($_FILES as $file) {
$file_name = $file["name"];
$file_tmp = $file["tmp_name"];
$file_type = $file["type"];
$file_size = $file["size"];
$file_ext = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
if(in_array($file_ext, $allowed_extensions) === true) {
// $_SESSION['error_message'] = "Error: only files with the following extensions are allowed: " . implode(", ", $allowed_extensions);
$this->session->set_flashdata('error','following extensions are not allowed: ' . implode(", ", $allowed_extensions));
header("Location: " . $_SERVER['REQUEST_URI']);
exit();
} else {
}
}
}
public function GetEmailConfigSetting($id){
$this->db->select("*");
$this->db->from('bh_email_setting');
$this->db->where("id",$id);
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function GetAllCountry($Country_id="")
{
$html = "";
$this->db->select("*");
$this->db->from('countries');
$this->db->order_by("name","asc");
$query=$this->db->get();
$all_data = $query->result_array();
return $all_data;
}
public function GetAllUserType()
{
$usertype = array("1"=>'Normal User',"2"=>'Volunteers');
return $usertype;
}
public function getMonthID($month){
$monthArray = array("1"=>'01',
"2"=>'02',
"3"=>'03',
"4"=>'04',
"5"=>'05',
"6"=>'06',
"7"=>'07',
"8"=>'08',
"9"=>'09',
"10"=>'10',
"11"=>'11',
"12"=>'12'
);
return $monthArray[$month];
}
public function getMonthName($month){
$monthArray = array("1"=>'January',
"2"=>'February',
"3"=>'March',
"4"=>'April',
"5"=>'May',
"6"=>'June',
"7"=>'July',
"8"=>'August',
"9"=>'September',
"10"=>'Octobar',
"11"=>'November',
"12"=>'December'
);
return $monthArray[$month];
}
public function GetAllOrderStatus($show_status='',$parent='')
{
$this->db->select("*");
$this->db->from('bh_order_status');
if($show_status !='')
$this->db->where('show_status',$show_status);
if($parent !='')
$this->db->where('parent',$parent);
$query=$this->db->get();
return $data=$query->result_array();
}
public function GetOrderStatusType($order_status_id)
{
$this->db->select("*");
$this->db->from('bh_order_status');
$this->db->where('status_id',$order_status_id);
$query=$this->db->get();
$data=$query->row_array();
return $data['status_name'];
}
public function GetUserType($user_type)
{
$usertype = array("1"=>'Normal User',"2"=>'Volunteers',"3"=>'Partners');
return $usertype[$user_type];
}
public function GetUserStatus($user_type)
{
$usertype = array("1"=>'Normal User',"2"=>'Volunteers',"3"=>'Partners');
return $usertype[$user_type];
}
public function showUserTypeDropDown($current_val=""){
$html = '';
$sel1= ($current_val==1)?'selected="selected"':'';
$sel2= ($current_val==2)?'selected="selected"':'';
$sel3= ($current_val==3)?'selected="selected"':'';
$html .= '<select name="user_type" class="form-control">';
$html .= '<option value="">Select User Type</option>';
$html .= '<option value="1" '.$sel1.'>Normal User</option>';
$html .= '<option value="2" '.$sel2.'>Volunteers</option>';
$html .= '<select>';
return $html;
}
public function showExpireTimeDropDown($current_val){
$html = '';
$sel1= ($current_val=='10')?'selected="selected"':'';
$sel2= ($current_val=='15')?'selected="selected"':'';
$sel3= ($current_val=='30')?'selected="selected"':'';
$sel4= ($current_val=='60')?'selected="selected"':'';
$sel5= ($current_val=='Expired')?'selected="selected"':'';
$html .= '<select name="expire_time" class="form-control">';
$html .= '<option value="">Expired Time</option>';
$html .= '<option value="10" '.$sel1.'>10 days</option>';
$html .= '<option value="15" '.$sel2.'>15 days</option>';
$html .= '<option value="30" '.$sel3.'>1 Month</option>';
$html .= '<option value="60" '.$sel4.'>2 Month</option>';
$html .= '<option value="Expired" '.$sel5.'>Expired</option>';
$html .= '<select>';
return $html;
}
public function GetCityName($id)
{
if(is_numeric($id)){
$this->db->select("name");
$this->db->from('cities');
$this->db->where('id',$id);
$query=$this->db->get();
$data=$query->row_array();
if($data["name"]) return $data["name"];
}
else { return $id; }
}
public function getPackageIdByUrlTitle($url_title){
$this->db->select("*");
$this->db->from('bh_holiday_packages');
$this->db->where("listing_url_title",$url_title);
$this->db->order_by("id","desc");
$query=$this->db->get();
$ContentData = $query->row_array();
return $ContentData['id'];
}
public function getCountPackageIdByUrlTitle($url_title){
$this->db->select("count(*) as count");
$this->db->from('bh_holiday_packages');
$this->db->where("listing_url_title",$url_title);
$this->db->order_by("id","desc");
$query=$this->db->get();
$ContentData = $query->row_array();
return $ContentData['count'];
}
/*
public function getPackageIdByUrlTitle($url_title)
{
$this->db->select("name");
$this->db->from('cities');
$this->db->where('id',$id);
$query=$this->db->get();
$data=$query->row_array();
if($data["name"]) return $data["name"];\{
}
else { return $id; }
} */
public function GetStateName($id)
{
$this->db->select("name");
$this->db->from('states');
$this->db->where('id',$id);
$query=$this->db->get();
$data=$query->row_array();
if($data["name"]) return $data["name"];
else return false;
}
public function GetCountryName($id)
{
$this->db->select("name");
$this->db->from('countries');
$this->db->where('id',$id);
$query=$this->db->get();
$data=$query->row_array();
if($data["name"]) return $data["name"];
else return false;
}
public function GetUserName($id)
{
$this->db->select("first_name");
$this->db->from('bh_users');
$this->db->where('user_id',$id);
$query=$this->db->get();
$data=$query->row_array();
if($data["first_name"]) return $data["first_name"];
else return false;
}
public function GetListingCategoryByID($id){
if($id!=0){
$this->db->select("*");
$this->db->from('bh_others_categories');
$this->db->where("id",$id);
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
return false;
}
public function GetAllfeedback(){
$this->db->select("*");
$this->db->from('bh_feedbacks');
$this->db->where("status","1");
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function checkField($field_val,$field_name,$table_name)
{
if($field_val!=''){
$this->db->select($field_name);
$this->db->from($table_name);
$this->db->where($field_name,$field_val);
$query=$this->db->get();
$data=$query->row_array();
if($data[$field_name]!='') return 'exists';
else return false;
}
return false;
}
public function create_url($value)
{
if($value!=""){
//$cng=array('<', '>', '&', '{', '}', '*','$','1','2','3','4','5','6','7','8','9','0');
$cng=array('<', '>', '&', '[', ']', '{', '&','}', '(',',', ')', '*','$','?');
$value = str_replace("/","",$value);
$value= strtolower($value);
$value = str_replace($cng, '', trim($value));
$langth=strlen($value);
$value = str_replace(' ', '-', trim($value));
return $value;
}
return false;
}
public function GetModuleName($module_id){
$this->db->select("*");
$this->db->from('bh_modules');
$this->db->where("id",$module_id);
$this->db->order_by("id","asc");
$query=$this->db->get();
$userData = $query->row_array();
return $userData['module_name'];
}
public function GetAllFunctionsOfModule($module_id){
$this->db->select("*");
$this->db->from('bh_module_functions');
//$this->db->join('Author', 'Author.AuthorID = Books.AuthorID');
$this->db->where("module_id",$module_id);
$this->db->order_by("id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function GetCountBlogBycategory($category_id){
$this->db->select("count(id) as total");
$this->db->from('bh_blogs');
//$this->db->join('Author', 'Author.AuthorID = Books.AuthorID');
$this->db->where("category_id",$category_id);
$this->db->where("status",'1');
$this->db->order_by("id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData[0]['total'];
}
function GetSingleBlogdata($category_id){
$this->db->select("bh_blogs.*");
$this->db->from('bh_blogs');
$this->db->where("category_id",$category_id);
$this->db->where("status",'1');
$this->db->limit('1','0');
$this->db->order_by("id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function getALLOthersParentCategories($category_type=""){
$this->db->select("*");
$this->db->from('bh_others_categories');
$this->db->where("status",'1');
$this->db->where("parent_id",'0');
if($category_type!="")
$this->db->where("category_type",$category_type);
$this->db->order_by("sort_order","asc");
$query=$this->db->get();
return $query->result_array();
}
public function getALLOthersParentProjectCategories($category_type=""){
$this->db->select("*");
$this->db->from('bh_project_categories');
$this->db->where("status",'1');
$this->db->where("parent_id",'0');
$this->db->order_by("sort_order","asc");
$query=$this->db->get();
return $query->result_array();
}
public function getALLChildCategories($category_type){
$this->db->select("*");
$this->db->from('bh_others_categories');
$this->db->where("status",'1');
$this->db->where("parent_id !=",'0');
$this->db->where("category_type",$category_type);
$this->db->order_by("sort_order","asc");
$query=$this->db->get();
return $query->result_array();
}
public function getALLOthersChildCategories($parent_id){
$this->db->select("*");
$this->db->from('bh_others_categories');
$this->db->where("status",'1');
$this->db->where("parent_id",$parent_id);
$this->db->order_by("sort_order","asc");
$query=$this->db->get();
return $query->result_array();
}
public function GetSupportListing($cat_id="",$state_id="",$city_id="",$pincode=""){
$this->db->select("*");
$this->db->from('bh_support_listings');
$this->db->where("status",'1');
if($cat_id!="")
$this->db->where("category_id",$cat_id);
if($state_id!="")
$this->db->where("state",$state_id);
if($city_id!="")
$this->db->where("city",$city_id);
if($pincode!="")
$this->db->where("pincode",$pincode);
if($this->input->post('sex')!=""){
$this->db->where("sex",$this->input->post('sex'));
}
if($this->input->post('size')!=""){
$this->db->where("size",$this->input->post('size'));
}
$this->db->order_by("add_date","desc");
$this->db->where('expire_date >= ', date("Y-m-d"));
$query=$this->db->get();
return $query->result_array();
}
public function GetProductListingPaging($limit,$start,$cat_id){
$allcat = $this->getALLOthersChildCategories($cat_id);
if(count($allcat) > 0){
foreach($allcat as $catdata){
$subcat_id[] = $catdata['id'];
}
}
$this->db->select("*");
$this->db->from('bh_support_listings');
$this->db->where("status",'1');
if($cat_id >0 && count($allcat) > 0){
$this->db->where_in('category_id', $subcat_id);
$this->db->or_where("category_id",$cat_id);
}else if($cat_id !=""){
$this->db->where("category_id",$cat_id);
}
$this->db->limit( $limit,$start);
$this->db->order_by("add_date","desc");
$query=$this->db->get();
return $query->result_array();
}
public function GetTotalProductListing($cat_id=""){
$allcat = $this->getALLOthersChildCategories($cat_id);
if(count($allcat) > 0){
foreach($allcat as $catdata){
$subcat_id[] = $catdata['id'];
}
}
$this->db->select("count(*) as count");
$this->db->from('bh_support_listings');
$this->db->where("status",'1');
if(count($allcat) > 0){
$this->db->where_in('category_id', $subcat_id);
$this->db->or_where("category_id",$cat_id);
}else if($cat_id !=""){
$this->db->where("category_id",$cat_id);
}
$this->db->order_by("add_date","desc");
$query=$this->db->get();
$data = $query->row_array();
return $data['count'];
}
public function GetProductListing($cat_id=""){
$this->db->select("*");
$this->db->from('bh_holiday_packages');
$this->db->where("status",'1');
if($cat_id!=""){
$this->db->where("category_id",$cat_id);
}
$this->db->order_by("add_date","desc");
$query=$this->db->get();
return $query->result_array();
}
public function GetProductListingByTopRated($cat_id="",$type=""){
$this->db->select("*");
$this->db->from('bh_holiday_packages');
$this->db->where("status",'1');
if($cat_id!=""){
$this->db->where("category_id",$cat_id);
}
if($type!=""){
$this->db->where("top_rated",$type);
}
$this->db->order_by("add_date","desc");
$query=$this->db->get();
return $query->result_array();
}
public function GetProductListing22($cat_id=""){
$allcat = $this->getALLOthersChildCategories($cat_id);
if(count($allcat) > 0){
foreach($allcat as $catdata){
$subcat_id[] = $catdata['id'];
}
}
$this->db->select("*");
$this->db->from('bh_support_listings');
$this->db->where("status",'1');
if(count($allcat) > 0){
$this->db->where_in('category_id', $subcat_id);
$this->db->or_where("category_id",$cat_id);
}else if($cat_id !=""){
$this->db->where("category_id",$cat_id);
}
$this->db->order_by("add_date","desc");
$query=$this->db->get();
return $query->result_array();
}
public function GetALLTAx(){
$this->db->select("*");
$this->db->from('bh_tax');
$this->db->order_by("rate","asc");
$query=$this->db->get();
return $query->result_array();
}
public function GetTaxOnAdminProduct($order_product_id){
$orderData = $this->order_model->GetsingleOrderProduct($order_product_id);//print_r($orderData );
$productdata = $this->commonmod_model->GetProductListingDetails($orderData['product_id']);
$taxData = $this->commonmod_model->GetTAxSingleRecords($productdata[0]['tax_id']);
if(count($taxData) > 0){
if($taxData['type']=='Fixed'){ return number_format($orderData['tax'],2).'('.@$taxData['type'].')'; }
if($taxData['type']=='Percent'){ return number_format($orderData['tax'],2).'('.@$taxData['rate'].'%'.')' ;}
return '0.00';
}
return '0.00';
}
public function GetTaxOnProduct($product_id){
$productdata = $this->commonmod_model->GetProductListingDetails($product_id);
$taxData = $this->commonmod_model->GetTAxSingleRecords($productdata[0]['tax_id']);
$price = $this->commonmod_model->GetPriceofProduct($product_id);
if(count($taxData) > 0){
if($taxData['type']=='Fixed'){ return number_format($taxData['rate'],2).'('.$taxData['type'].')'; }
if($taxData['type']=='Percent'){ return number_format((($taxData['rate']*$price)/100),2).'('.$taxData['rate'].'%'.')' ;}
return '0.00';
}
return '0.00';
}
public function GetTAxSingleRecords($tax_id){
$this->db->select("*");
$this->db->from('bh_tax');
$this->db->where("id",$tax_id);
$this->db->order_by("rate","asc");
$query=$this->db->get();
$taxData = $query->row_array();
return $taxData;
}
public function GetTaxRateByTaxId($price,$tax_id){
$taxData = $this->commonmod_model->GetTAxSingleRecords($tax_id);
if(count($taxData) > 0){
if($taxData['type']=='Fixed'){ return $taxData['rate'];}
if($taxData['type']=='Percent'){ return (($taxData['rate']*$price)/100) ;}
return 0;
}
return 0;
}
public function ApplyTaxOnProduct($product_id,$tax_id){
$productdata = $this->commonmod_model->GetProductListingDetails($product_id);
$price = $this->commonmod_model->GetPriceofProduct($product_id);
$tax_amount = $this->commonmod_model->GetTaxRateByTaxId($price,$productdata[0]['tax_id']);
return $tax_amount;
}
public function uploadDocFile($original_upload_path,$image_upload_path,$upload_size,$width,$height,$imagename,$error_view_url){
$FileName ='';
$config="";
$config['upload_path'] = $original_upload_path;
$config['allowed_types'] = 'docx|doc|pdf';
$config['max_size'] = $upload_size;
$config['max_width'] = $width;
$config['max_height'] = $height;
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$error='';
//$imagename = $this->security->sanitize_filename($this->input->post($imagename), TRUE);
if ( ! $this->upload->do_upload($imagename))
{
$error = array('error' => $this->upload->display_errors());
//$this->load->view('admin/user/add_user',$data);
$image="";
$ImageID="";
}
else
{
$data_upload_files = $this->upload->data();
$image = $data_upload_files["file_name"];
$OriginalImageName=$data_upload_files["orig_name"];
$ImageWidth=$data_upload_files["image_width"];
$ImageHeight=$data_upload_files["image_height"];
////////////Getting New Image Name//////////////////////
$GUID=$this->image->getGUID();
$NewImageName=$this->image->CreateImageFilename($GUID,$ImageWidth,$ImageHeight);
$destinationimgae = $image_upload_path.$NewImageName.$data_upload_files["file_ext"];
/////////copy image at original desitnation/////////////////////
$this->image->CreateImage($original_upload_path.$image,$destinationimgae);
if($NewImageName!=""){
$FileName=$NewImageName.$data_upload_files["file_ext"];
}
@unlink($data_upload_files['full_path']);
}
return $FileName;
}
public function uploadCommonFile($original_upload_path,$image_upload_path,$upload_size,$width,$height,$imagename,$error_view_url){
$FileName ='';
$config="";
$config['upload_path'] = $original_upload_path;
$config['allowed_types'] = '*';
$config['max_size'] = $upload_size;
$config['max_width'] = '2000';
$config['max_height'] = '2000';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$error='';
// $imagename = $this->security->sanitize_filename($this->input->post($imagename), TRUE);
if ( ! $this->upload->do_upload($imagename))
{
$error = array('error' => $this->upload->display_errors());
//$this->load->view('admin/user/add_user',$data);
$image="";
$ImageID="";
}
else
{
$data_upload_files = $this->upload->data();
if ($data_upload_files['image_width']>$width || $data_upload_files['image_height']>$height)
{
$configResize = array(
'source_image' => $data_upload_files['full_path'],
'width' => $width,
'height' => $height,
'maintain_ratio' => TRUE
);
$this->load->library('image_lib',$configResize);
$this->image_lib->resize();
}
$image = $data_upload_files["file_name"];
$OriginalImageName=$data_upload_files["orig_name"];
$ImageWidth=$data_upload_files["image_width"];
$ImageHeight=$data_upload_files["image_height"];
////////////Getting New Image Name//////////////////////
$GUID=$this->image->getGUID();
$NewImageName=$this->image->CreateImageFilename($GUID,$width,$height);
$destinationimgae = $image_upload_path.$NewImageName.$data_upload_files["file_ext"];
/////////copy image at original desitnation/////////////////////
$this->image->CreateImage($original_upload_path.$image,$destinationimgae);
if($NewImageName!=""){
$FileName=$NewImageName.$data_upload_files["file_ext"];
}
@unlink($data_upload_files['full_path']);
}
return $FileName;
}
public function uploadVideoFile($original_upload_path,$video_upload_path,$upload_size,$width,$height,$imagename,$error_view_url){
$FileName ='';
$config="";
$config['upload_path'] = $original_upload_path;
$config['allowed_types'] = 'mp4';
$config['max_size'] = $upload_size;
$config['max_width'] = $width;
$config['max_height'] = $height;
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$error='';
if ( ! $this->upload->do_upload($imagename))
{
$error = array('error' => $this->upload->display_errors());
//$this->load->view('admin/user/add_user',$data);
$image="";
$ImageID="";
}
else
{
$data_upload_files = $this->upload->data();
$image = $data_upload_files["file_name"];
$OriginalImageName=$data_upload_files["orig_name"];
$ImageWidth=$data_upload_files["image_width"];
$ImageHeight=$data_upload_files["image_height"];
////////////Getting New Image Name//////////////////////
$GUID=$this->image->getGUID();
$NewImageName=$this->image->CreateImageFilename($GUID,$ImageWidth,$ImageHeight);
$destinationimgae = $video_upload_path.$NewImageName.$data_upload_files["file_ext"];
/////////copy image at original desitnation/////////////////////
$this->image->CreateImage($original_upload_path.$image,$destinationimgae);
if($NewImageName!=""){
$FileName=$NewImageName.$data_upload_files["file_ext"];
}
@unlink($data_upload_files['full_path']);
}
return $FileName;
}
public function GetIpLocation($ipAddress)
{
$url = "http://api.ipinfodb.com/v3/ip-city/?key=7f310bdbcd10d0aea3da474412c74636aa82afb413fb76f43bd90a887c0bf561&ip=$ipAddress&format=json";
$d = file_get_contents($url);
$browser_location = json_decode($d , true);
return $browser_location;
}
public function GetCountUserByUsertypeAdmin($usertype){
$this->db->select("count(user_id) as total");
$this->db->from('bh_users');
$this->db->where("user_type",$usertype);
$this->db->order_by("user_id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData[0]['total'];
}
// Front End Function
public function GetCountOrderStatusAdmin($status_id,$user_id){
$this->db->select("count(order_id) as total");
$this->db->from('bh_order');
if($user_id!="")
$this->db->where("user_id",$user_id);
$this->db->where("order_status_id",$status_id);
$this->db->order_by("order_id","asc");
$query = $this->db->get();
$userData = $query->result_array();
return $userData[0]['total'];
}
public function GetAllOrderByYear($year){
$this->db->select("*");
$this->db->from('bh_order');
if($year!="")
$this->db->where("YEAR(`date_added`)",$year);
$this->db->order_by("order_id","asc");
$query = $this->db->get();
$userData = $query->result_array();
return $userData;
}
public function CountGetTodayOrder(){
$this->db->select("count(order_id) as total");
$this->db->from('bh_order');
$this->db->where("date_added",date("Y-m-d"));
$this->db->order_by("order_id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData[0]['total'];
}
public function GetAllOrder($status_id){
$this->db->select("*");
$this->db->from('bh_order');
if($status_id!="")
$this->db->where("order_status_id",$status_id);
$this->db->order_by("order_id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function GetTotalNoMyNeedRegisteredTodayFront(){
$this->db->select("count(id) as total");
$this->db->from('bh_need_listings');
$this->db->where("add_date",date("Y-m-d"));
$this->db->order_by("id","asc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData[0]['total'];
}
public function GetSystemConfigSetting($id){
$this->db->select("*");
$this->db->from('bh_system_settings');
$this->db->where("id",$id);
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function getReturnvideoHtml($videosrc,$id,$height,$width){
$style = '';
if($height!="") $style .= 'height:'.$height.';';
if($width!="") $style .= 'height:'.$width.';';
$html = '<div class="zd-video-container zd-video-ispause" style="'.$style.'" id="'.$id.'">
</div>
<script>
var video = new ZdVideo({
container: "'.$id.'",
source: "'.$videosrc.'",
});
</script>';
return $html;
}
public function getALLReceivedAmount($need_id){
$this->db->select("*");
$this->db->from('bh_payments');
$this->db->where("need_id",$need_id);
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->result_array();
$amount = 0;
if(count($userData) > 0){
foreach($userData as $UserData1){
$amount += $UserData1['amount'];
}
}
return $amount;
}
// admin functions
public function getAdminFunctionPermission($admin_id,$module_id,$function_id){
$this->db->where("admin_id",$admin_id);
$this->db->where("module_id",$module_id);
$this->db->where("function_id",$function_id);
$this->db->where("status","1");
$permission = $this->db->get("bh_permissions");
if(count($permission->result_array()) > 0)
return true;
else
return 0;
}
public function getAdminMenuPermission($admin_id,$module_id){
$this->db->where("admin_id",$admin_id);
$this->db->where("module_id",$module_id);
$this->db->where("status","1");
$permission = $this->db->get("bh_permissions");
if(count($permission->result_array()) > 0)
return true;
else
return false;
}
public function incrementVistor(){
$this->db->where('id', '1');
$this->db->set('visitor', '`visitor`+1',false);
$this->db->update('bh_visitors');
}
public function GetVistor(){
$this->db->where("id","1");
$tabledata= $this->db->get("bh_visitors");
$data = $tabledata->row_array();
return $data['visitor'];
}
public function getSystemValue($fieldname){
$this->db->select($fieldname);
$this->db->from('bh_system_settings');
$this->db->where("id","1");
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->row_array();
return $userData[$fieldname];
}
public function FeaturedVolunteers($limit)
{
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where('user_type','2');
$this->db->where('set_home','1');
$this->db->order_by("user_id","asc");
$this->db->limit($limit,'0');
$query=$this->db->get();
$data=$query->result_array();
return $data;
}
public function GetAllUser(){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where('status','1');
$this->db->order_by("user_id","asc");
$query=$this->db->get();
$data=$query->result_array();
return $data;
}
public function CountUserOrder($user_id,$status_id){
$this->db->select("count(*) as count");
$this->db->from('bh_order');
if($user_id!="")
$this->db->where("user_id",$user_id);
if($status_id!="")
$this->db->where("order_status_id",$status_id);
$this->db->order_by("order_id","asc");
$query = $this->db->get();
$userData = $query->row_array();
return $userData['count'];
}
public function GetUserOrder($user_id,$status_id){
$this->db->select("*");
$this->db->from('bh_order');
if($user_id!="")
$this->db->where("user_id",$user_id);
if($status_id!="")
$this->db->where("order_status_id",$status_id);
$this->db->order_by("order_id","asc");
$query = $this->db->get();
$userData = $query->result_array();
return $userData;
}
public function UserBookingLastOrder($user_id){
$this->db->select("date_added");
$this->db->from('bh_order');
if($user_id!="")
$this->db->where("user_id",$user_id);
$this->db->order_by("order_id","desc");
$this->db->limit("1","0");
$query = $this->db->get();
$userData = $query->row_array();
return ($userData['date_added']!="")?date("d M, Y",strtotime($userData['date_added'])):'';
}
public function TotalRentalUser($user_id){
$total = 0;
$this->db->select("*");
$this->db->from('bh_order');
if($user_id!="")
$this->db->where("user_id",$user_id);
$this->db->order_by("order_id","asc");
$query = $this->db->get();
$userData = $query->result_array();
foreach($userData as $UserData){
$total = $total + ($UserData['total'] + $UserData['tax']);
}
return $total;
}
public function GetUserdata($user_id){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where('status','1');
$this->db->where('user_id',$user_id);
$this->db->order_by("user_id","asc");
$query=$this->db->get();
$data=$query->result_array();
return $data;
}
public function GetBhalaaiPointByCateId($category_id){
if($category_id!=""){
$this->db->select("*");
$this->db->from('bh_others_categories');
$this->db->where('id',$category_id);
$query=$this->db->get();
$data=$query->row_array();
return $data['points'];
}
return false;
}
function addDayswithdate($date,$days){
$newdate= '';
if($days==10){
$newdate = strtotime("+10 days", strtotime($date));
}
else if($days==15){
$newdate = strtotime("+15 days", strtotime($date));
}
else if($days==30){
$newdate = strtotime("+1 month", strtotime($date));
}
else if($days==60){
$newdate = strtotime("+2 month", strtotime($date));
}
else {
$newdate = strtotime("-10 days", strtotime($date));
}
return date("Y-m-d", $newdate);
}
public function GetPrice($price){
$currency = CURRENCY;
if($price!=''){
return ($currency." ".$price);
}else{
return ($currency." 0");
}
}
public function GetcategoryIdCatUrl($cat_url=""){
$this->db->select("*");
$this->db->from('bh_others_categories');
if($cat_url!="")
$this->db->where('cat_url',$cat_url);
$this->db->where('status',"1");
$query=$this->db->get();
$data=$query->row_array();
return @$data['id'];
}
public function GetcategoryData($id=""){
$this->db->select("*");
$this->db->from('bh_others_categories');
if($id!="")
$this->db->where('id',$id);
$this->db->where('status',"1");
$query=$this->db->get();
$data=$query->row_array();
return $data;
}
public function GetPriceofProduct($product_id){
$productdata = @$this->GetProductListingDetails($product_id);
if(@$productdata[0]['discount_enable']==1) return $productdata[0]['discount_price'];
else if(@$productdata[0]['discount_enable']==0) return $productdata[0]['price'];
return false;
}
public function product_image($pid)
{
$product_data = $this->commonmod_model->GetSupportListingDetails($pid);
$src = $this->image->getImageSrc("listings",$product_data[0]['listing_image1'],"./webroot/front/images_not_found.jpg");
return $src;
}
}