$res=$this->db->query("SELECT events.category_id,venue.id,venue.status, (((acos(sin((".$data['latitude']."*pi()/180)) * sin((venue.location_lat*pi()/180)) + cos((".$data['latitude']."*pi()/180)) * cos((venue.location_lat*pi()/180)) * cos(((".$data['longitude']." - venue.location_lng)*pi()/180))))*180/pi())*60*1.1515) as distance FROM venue LEFT JOIN events ON events.venue_id = venue.id GROUP BY events.category_id HAVING distance < ".$radius." AND venue.status = '1'")->result_array();
$res=$this->db->query("SELECT events.event_id,venue.id,venue.status, (((acos(sin((".$data['latitude']."*pi()/180)) * sin((venue.location_lat*pi()/180)) + cos((".$data['latitude']."*pi()/180)) * cos((venue.location_lat*pi()/180)) * cos(((".$data['longitude']." - venue.location_lng)*pi()/180))))*180/pi())*60*1.1515) as distance FROM venue RIGHT JOIN events ON events.venue_id = venue.id HAVING distance < ".$radius." AND venue.status = '1'")->result_array();
$otherV='';
$otherV='';
foreach($resas$key=>$value){
foreach($resas$key=>$value){
if($otherV)$otherV.=',';
if($otherV)$otherV.=',';
$otherV.=$value['category_id'];
$otherV.=$value['event_id'];
}
}
if($otherV!=''){
if($otherV!=''){
$where=' AND events.category_id IN ('.$otherV.')';
$where=' AND events.event_id IN ('.$otherV.')';
//print_r($where);exit();
}else{
}else{
$where=' AND events.category_id IN (0)';
$where=' AND events.category_id IN (0)';
}
}
...
@@ -301,14 +347,22 @@ class Webservice_model extends CI_Model {
...
@@ -301,14 +347,22 @@ class Webservice_model extends CI_Model {
/******************* END PAGINATION *********************/
/******************* END PAGINATION *********************/
$result=$this->db->query("SELECT events.seat_pricing,venue.location_lat AS latitude,venue.location_lng AS longitude,events.event_id AS event_id, events.event_name AS name,`event_gallery`.`media_url` AS image, COUNT(booking.id) AS attendees, event_category.category, AVG(review.rate) AS rating, venue.location, IF(events.avg_price = 0, '100','150') AS rate, IF(events.provider_id = 1,'true','false') AS is_editors_choice, IF(favourite.is_favorite = 1, 'true','false') AS is_favorite FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id ".$case." LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`media_type` = 0 LEFT JOIN booking ON booking.event_id = events.event_id LEFT JOIN event_category ON events.category_id = event_category.cat_id LEFT JOIN review ON review.event_id = events.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = ".$user_id." AND favourite.status = 1 WHERE events.status = 1 ".$where." GROUP BY events.event_id LIMIT ".$page_limit.", ".$per_page)->result();
$result=$this->db->query("SELECT events.seat_pricing,venue.location_lat AS latitude,venue.location_lng AS longitude,events.event_id AS event_id, events.event_name AS name,`event_gallery`.`media_url` AS image, (SELECT COUNT(booking.id) FROM booking WHERE booking.event_id = events.event_id) AS attendees, $cat_field AS category, CAST(AVG (review.rate) AS DECIMAL (12,1)) AS rating, venue.location, IF(events.avg_price = 0, '100','150') AS rate, IF(events.provider_id = 1,'true','false') AS is_editors_choice, IF(favourite.is_favorite = 1, 'true','false') AS is_favorite FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id ".$case." LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`media_type` = 0 LEFT JOIN booking ON booking.event_id = events.event_id LEFT JOIN event_category ON events.category_id = event_category.cat_id LEFT JOIN review ON review.event_id = events.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = ".$user_id." AND favourite.status = 1 WHERE events.status = 1 ".$where." GROUP BY events.event_id LIMIT ".$page_limit.", ".$per_page)->result();
$rs=$this->db->query("SELECT IF(host_categories.show_layout = 0,'false','true') AS is_layout,IF(events.has_payment = 0,'false','true') AS is_payment_required,IF(favourite.is_favorite = 1,'true','false') AS is_favorite,events.event_id, AVG(review.rate) AS rate, MAX(booking.id) AS attendees, events.event_name,events.event_discription AS event_description,events.seat_pricing, events.custom_seat_layout, venue.layout, venue.layout_details,venue.venue_name,venue.venue_details,venue.location,venue.location_lat AS lat,venue.location_lng AS lng,venue.venue_name AS address_name,venue.location AS address, GROUP_CONCAT(DISTINCT `event_gallery`.`media_url`) AS media_url,IF(favourite.status = 1,'true','false') AS fav_status, GROUP_CONCAT(DISTINCT tags.tag_name) AS tag, GROUP_CONCAT(DISTINCT CONCAT_WS('#',event_date_time.id,event_date_time.date,event_date_time.time)) AS date_time, events.max_booking FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`status` != 0 LEFT JOIN booking on booking.event_id = events.event_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = ".$user_id." AND favourite.status = 1 LEFT JOIN event_tags ON events.event_id = event_tags.event_id LEFT JOIN tags on tags.tag_id = event_tags.tag_id LEFT JOIN review ON events.event_id = review.event_id INNER JOIN host_categories ON venue.host_cat_id = host_categories.host_cat_id WHERE event_date_time.date >= DATE_FORMAT(NOW(),'%Y-%m-%d') AND events.event_id = ".$event_id." GROUP BY events.event_id, event_date_time.event_id")->row();
$rs=$this->db->query("SELECT IF(host_categories.show_layout = 0,'false','true') AS is_layout,IF(events.has_payment = 0,'false','true') AS is_payment_required,IF(favourite.is_favorite = 1,'true','false') AS is_favorite,events.event_id, CAST(AVG (review.rate) AS DECIMAL (12,1)) AS rate, (SELECT COUNT(booking.id) FROM booking WHERE booking.event_id = events.event_id) AS attendees, events.event_name,events.event_discription AS event_description,events.seat_pricing, events.custom_seat_layout, venue.layout, venue.layout_details,venue.venue_name,venue.venue_details,venue.location,venue.location_lat AS lat,venue.location_lng AS lng,venue.venue_name AS address_name,venue.location AS address, GROUP_CONCAT(DISTINCT `event_gallery`.`media_url`) AS media_url,IF(favourite.status = 1,'true','false') AS fav_status, GROUP_CONCAT(DISTINCT tags.tag_name) AS tag, GROUP_CONCAT(DISTINCT CONCAT_WS('#',event_date_time.id,event_date_time.date,event_date_time.time)) AS date_time, events.max_booking FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id INNER JOIN venue ON venue.id = events.venue_id LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`status` != 0 LEFT JOIN booking on booking.event_id = events.event_id LEFT JOIN favourite ON favourite.event_id = events.event_id AND favourite.user_id = ".$user_id." AND favourite.status = 1 LEFT JOIN event_tags ON events.event_id = event_tags.event_id LEFT JOIN tags on tags.tag_id = event_tags.tag_id LEFT JOIN review ON events.event_id = review.event_id INNER JOIN host_categories ON venue.host_cat_id = host_categories.host_cat_id WHERE event_date_time.date >= DATE_FORMAT(NOW(),'%Y-%m-%d') AND events.event_id = ".$event_id." GROUP BY events.event_id, event_date_time.event_id")->row();
$result=$this->db->query("SELECT events.venue_id AS region_id,event_category.cat_id AS category_id, event_category.category AS category_name, event_category.category_image AS category_image, event_category.category_description AS category_description FROM event_category LEFT JOIN events ON events.category_id = event_category.cat_id WHERE event_category.status = 1 ".$where." GROUP BY event_category.cat_id")->result();
if($lang->language=='ar'){
$cat_field='event_category.category_ar';
}else{
$cat_field='event_category.category';
}
$result=$this->db->query("SELECT events.venue_id AS region_id,event_category.cat_id AS category_id, $cat_field AS category_name, event_category.category_image AS category_image, event_category.category_description AS category_description FROM event_category LEFT JOIN events ON events.category_id = event_category.cat_id WHERE event_category.status = 1 ".$where." GROUP BY event_category.cat_id")->result();
$result=$this->db->query("SELECT region.id AS city_id, region.name AS city_name, region.region_icon AS city_image FROM region WHERE region.status = 1 GROUP BY region.name")->result();
$result=$this->db->query("SELECT region.id AS city_id, $region_name AS city_name, region.region_icon AS city_image FROM region WHERE region.status = 1 GROUP BY region.name")->result();
if(count($result)>0){
if(count($result)>0){
$resultData=array();
$resultData=array();
$resultData['cities']=$result;
$resultData['cities']=$result;
...
@@ -694,7 +762,7 @@ function event($data) {
...
@@ -694,7 +762,7 @@ function event($data) {
$bookingId=$data['booking_id'];
$bookingId=$data['booking_id'];
$ticketDetails=$this->db->query("SELECT ticket_details FROM booking WHERE bookId = '$bookingId'")->row();
$ticketDetails=$this->db->query("SELECT ticket_details FROM booking WHERE bookId = '$bookingId'")->row();
$res=json_decode($ticketDetails->ticket_details);
$res=json_decode($ticketDetails->ticket_details);
$kk['ticket_rate']="$res->total_price";
$kk['ticket_rate']="$res->price";
$settingsDetails=$this->db->query("SELECT instruction_en AS instruction,contact_number FROM privacy_policy")->row_array();
$settingsDetails=$this->db->query("SELECT instruction_en AS instruction,contact_number FROM privacy_policy")->row_array();
$result=$this->db->query("SELECT booking.qrcode, events.event_id,events.event_name, `event_gallery`.`media_url` AS event_image,event_date_time.date, booking.bookId AS ticket_id,event_date_time.time,venue.location_lat AS latitude, venue.location_lng AS longitude, venue.venue_name AS address_name, venue.location AS address, booking.amount AS total_rate, booking.no_of_ticket AS ticket_count, customer.name AS profile_name, customer.profile_image AS profile_photo FROM events LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`media_type` = 0 LEFT JOIN booking ON booking.event_id = events.event_id RIGHT JOIN event_date_time ON event_date_time.id = booking.event_date_id LEFT JOIN venue ON venue.id = events.venue_id LEFT JOIN customer ON customer.customer_id = booking.customer_id WHERE booking.bookId = '$bookingId' AND booking.customer_id = ".$user_id."")->row_array();
$result=$this->db->query("SELECT booking.qrcode, events.event_id,events.event_name, `event_gallery`.`media_url` AS event_image,event_date_time.date, booking.bookId AS ticket_id,event_date_time.time,venue.location_lat AS latitude, venue.location_lng AS longitude, venue.venue_name AS address_name, venue.location AS address, booking.amount AS total_rate, booking.no_of_ticket AS ticket_count, customer.name AS profile_name, customer.profile_image AS profile_photo FROM events LEFT JOIN `event_gallery` ON `events`.`event_id` = `event_gallery`.`event_id` AND `event_gallery`.`media_type` = 0 LEFT JOIN booking ON booking.event_id = events.event_id RIGHT JOIN event_date_time ON event_date_time.id = booking.event_date_id LEFT JOIN venue ON venue.id = events.venue_id LEFT JOIN customer ON customer.customer_id = booking.customer_id WHERE booking.bookId = '$bookingId' AND booking.customer_id = ".$user_id."")->row_array();
if(count($result)>0&&count($settingsDetails)>0){
if(count($result)>0&&count($settingsDetails)>0){
...
@@ -941,8 +1009,15 @@ function event($data) {
...
@@ -941,8 +1009,15 @@ function event($data) {
'favourite.user_id'=>$user_id,
'favourite.user_id'=>$user_id,
'events.status'=>1
'events.status'=>1
);
);
$result=$this->db->select("events.event_id,event_gallery.media_url,COUNT(booking.id) AS attendees,
event_category.category,events.event_name,AVG(review.rate) AS rating,venue.location,IF(favourite.is_favorite = 0,'false','true') AS is_favorite,IF(events.provider_id = 0,'false','true') AS is_editors_choice,events.seat_pricing,events.custom_seat_layout,venue.layout,venue.layout_details")->where($where)->from('favourite')->join('review','review.event_id = favourite.event_id','LEFT')->join('events','events.event_id = favourite.event_id')->join('booking','booking.event_id = events.event_id','LEFT')->join('venue','venue.id = events.venue_id')->join('event_category','events.category_id = event_category.cat_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->group_by('events.event_id')->get()->result();
if($lang->language=='ar'){
$cat_field='event_category.category_ar';
}else{
$cat_field='event_category.category';
}
$result=$this->db->select("events.event_id,event_gallery.media_url,(SELECT COUNT(booking.id) FROM booking WHERE booking.event_id = events.event_id) AS attendees,
$cat_field AS category,events.event_name,CAST(AVG (review.rate) AS DECIMAL (12,1)) AS rating,venue.location,IF(favourite.is_favorite = 0,'false','true') AS is_favorite,IF(events.provider_id = 0,'false','true') AS is_editors_choice,events.seat_pricing,events.custom_seat_layout,venue.layout,venue.layout_details")->where($where)->from('favourite')->join('review','review.event_id = favourite.event_id','LEFT')->join('events','events.event_id = favourite.event_id')->join('booking','booking.event_id = events.event_id','LEFT')->join('venue','venue.id = events.venue_id')->join('event_category','events.category_id = event_category.cat_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->group_by('events.event_id')->get()->result();
$count=$this->db->select('booking.bookId AS booking_id,booking.event_id,events.event_name,event_gallery.media_url AS event_image,venue.location,event_date_time.date,event_date_time.time,booking.no_of_ticket AS ticket_count,(CASE booking.status WHEN 1 THEN 0 WHEN 2 THEN 1 WHEN 0 THEN 2 ELSE 2 END) AS booking_status')->where('booking.customer_id',$user_id)->from('booking')->join('transaction','transaction.booking_id = booking.bookId AND transaction.status = 1','LEFT')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('venue','venue.id = events.venue_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->order_by('booking.id','DESC')->get()->num_rows();
if($count>0){
if($count>0){
if(isset($data['page'])){
if(isset($data['page'])){
...
@@ -1010,12 +1085,16 @@ function event($data) {
...
@@ -1010,12 +1085,16 @@ function event($data) {
$page_limit=($page-1)*$per_page;
$page_limit=($page-1)*$per_page;
if($count>$page_limit){
if($count>$page_limit){
$result=$this->db->select('booking.bookId AS booking_id,booking.event_id,events.event_name,event_gallery.media_url AS event_image,venue.location,event_date_time.date,event_date_time.time,booking.no_of_ticket AS ticket_count,
$result=$this->db->select('booking.bookId AS booking_id,booking.event_id,events.event_name,event_gallery.media_url AS event_image,venue.location,event_date_time.date,event_date_time.time,booking.no_of_ticket AS ticket_count,
(CASE booking.status WHEN 1 THEN 0 WHEN 2 THEN 1 WHEN 0 THEN 2 ELSE 2 END) AS booking_status')->where('booking.customer_id',$user_id)->from('booking')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('venue','venue.id = events.venue_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->order_by('booking.id','DESC')->limit($per_page,$page_limit)->get()->result();
(CASE booking.status WHEN 1 THEN 0 WHEN 2 THEN 1 WHEN 0 THEN 2 ELSE 2 END) AS booking_status')->where('booking.customer_id',$user_id)->from('booking')->join('transaction','transaction.booking_id = booking.bookId','LEFT')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('venue','venue.id = events.venue_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->where('booking.payment_status',1)->order_by('booking.id','DESC')->limit($per_page,$page_limit)->get()->result();
$result1=$this->db->select('booking.bookId AS booking_id,booking.event_id,events.event_name,event_gallery.media_url AS event_image,venue.location,event_date_time.date,event_date_time.time,booking.no_of_ticket AS ticket_count,
(CASE booking.status WHEN 1 THEN 0 WHEN 2 THEN 1 WHEN 0 THEN 2 ELSE 2 END) AS booking_status, transaction.status AS t_status,events.has_payment')->where('booking.customer_id',$user_id)->from('booking')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('transaction','transaction.booking_id = booking.bookId','LEFT')->join('venue','venue.id = events.venue_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->order_by('booking.id','DESC')->get()->result_array();
$result=$this->db->select('booking.bookId AS booking_id,booking.event_id,events.event_name,event_gallery.media_url AS event_image,venue.location,event_date_time.date,event_date_time.time,booking.no_of_ticket AS ticket_count,
(CASE booking.status WHEN 1 THEN 0 WHEN 2 THEN 1 WHEN 0 THEN 2 ELSE 2 END) AS booking_status, transaction.status AS t_status,events.has_payment')->where('booking.customer_id',$user_id)->from('booking')->join('events','booking.event_id = events.event_id')->join('event_date_time','booking.event_date_id = event_date_time.id')->join('transaction','transaction.booking_id = booking.bookId','LEFT')->join('venue','venue.id = events.venue_id')->join('event_gallery','events.event_id = event_gallery.event_id AND event_gallery.media_type = 0','LEFT')->order_by('booking.id','DESC')->get()->result_array();