@@ -74,7 +75,7 @@ class Api_model extends CI_Model {
$email_id=$data['email_id'];
$template=getNotifTemplate();
$message.="<html>
$message="<html>
<body>
Hi,\n\r Welcome to TimeOut. \r\n Please use username:
".$email_id." and Password: ".$temp_password."
...
...
@@ -84,12 +85,13 @@ class Api_model extends CI_Model {
</html>";
$this->send_mail($subject,$email_id,$message);
$this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.profile_image AS image,customer.gender,users.id AS userId, customer.city,customer.dob');
$this->db->select('customer.name,customer.dob,customer.phone,customer.email,customer.profile_image AS image,customer.gender,users.id AS userId, customer.city');
@@ -195,9 +197,15 @@ class Api_model extends CI_Model {
return$res;
}
functionlocality(){
functionlocality($city_id=''){
try{
$rs=$this->db->select('id AS locality_id,venue_id,locality')->where('status',1)->get('locality')->result();
$cond['status']='1';
if(!empty($city_id)){
$cond['region_id']=$city_id;
}
$rs=$this->db->select('id AS locality_id,venue_id,locality')
->get_where('locality',$cond)->result();
if(count($rs)>0){
$res=array('status'=>1,'data'=>$rs);
}else{
...
...
@@ -322,7 +330,7 @@ class Api_model extends CI_Model {
$page_limit=($page-1)*$per_page;
if($count>$page_limit){
$result=$this->db->select('booking.id AS book_id,booking.event_id,booking.bookId AS bookingCode,booking.qrcode,booking.no_of_ticket,booking.amount,booking.status AS book_status,events.event_name,events.event_discription,event_gallery.media_url,venue.location')->where('customer_id',$user_id)->where('booking.status!=',3)->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')->group_by('booking.id')->limit($per_page,$page_limit)->get()->result();
$result=$this->db->select('booking.id AS book_id,booking.event_id,booking.bookId AS bookingCode,booking.qrcode,booking.no_of_ticket,booking.amount,booking.status AS book_status,events.event_name,events.event_discription,event_gallery.media_url,venue.location,event_date_time.date AS event_date,event_date_time.time AS event_time')->where('customer_id',$user_id)->where('booking.status!=',3)->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')->group_by('booking.id')->limit($per_page,$page_limit)->get()->result();
@@ -809,7 +819,11 @@ class Api_model extends CI_Model {
$count=$this->db->query("SELECT events.event_id FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id $case WHERE events.status = 1 $where GROUP BY events.event_id")->num_rows();
$res_count=$this->db->query("SELECT * FROM customer INNER JOIN `users` ON users.id = customer.customer_id AND users.user_type = 3 WHERE users.status = 1 AND (customer.email = '$email' OR customer.phone LIKE '%$phone')")->row();
$settingsDetails=$this->db->query("SELECT faq_en AS faq,contact_number FROM privacy_policy")->row_array();
$userDetails=$this->db->query("SELECT customer.name AS name, customer.profile_image AS profile_photo,customer.gender AS gender, customer.email, customer.dob, customer.city AS city_name, users.notification_status, users.email_status FROM customer INNER JOIN users ON users.id = customer.customer_id WHERE customer.customer_id = ".$user_id." AND users.status = 1 ")->row_array();
$userDetails=$this->db->query("SELECT customer.name AS name, customer.profile_image AS profile_photo,customer.gender AS gender, customer.email, customer.dob, customer.profile_city AS city_name, users.notification_status, users.email_status FROM customer INNER JOIN users ON users.id = customer.customer_id WHERE customer.customer_id = ".$user_id." AND users.status = 1 ")->row_array();
$count=$this->db->query("SELECT events.event_id FROM events INNER JOIN event_date_time ON events.event_id = event_date_time.event_id $case INNER JOIN venue on venue.id = events.venue_id WHERE events.status = 1 $where GROUP BY events.event_id")->num_rows();
//echo "hai";exit();
if($count>0){
if(isset($data['page'])){
...
...
@@ -296,7 +308,8 @@ class Webservice_model extends CI_Model {
/******************* 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")->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, 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();
$response=array();
foreach($resultas$key=>$rs){
...
...
@@ -379,7 +392,7 @@ class Webservice_model extends CI_Model {
$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 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, 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();
if(count($rs)>0){
$resultData=array();
$event_layout='';
...
...
@@ -390,7 +403,7 @@ class Webservice_model extends CI_Model {
$data=$this->db->query("SELECT name,status, (((acos(sin((".$data['latitude']."*pi()/180)) * sin((region_lat*pi()/180)) + cos((".$data['latitude']."*pi()/180)) * cos((region_lat*pi()/180)) * cos(((".$data['longitude']." - region_lng)*pi()/180))))*180/pi())*60*1.1515) as distance FROM region HAVING distance < ".$radius." AND status = '1' ORDER BY distance ASC LIMIT 1")->result_array();
$data=$this->db->query("SELECT id,name,status, (((acos(sin((".$data['latitude']."*pi()/180)) * sin((region_lat*pi()/180)) + cos((".$data['latitude']."*pi()/180)) * cos((region_lat*pi()/180)) * cos(((".$data['longitude']." - region_lng)*pi()/180))))*180/pi())*60*1.1515) as distance FROM region HAVING distance < ".$radius." AND status = '1' ORDER BY distance ASC LIMIT 1")->result_array();
@@ -659,8 +680,8 @@ class Webservice_model extends CI_Model {
$ticketDetails=$this->db->query("SELECT ticket_details FROM booking WHERE bookId = '$bookingId'")->row();
$res=json_decode($ticketDetails->ticket_details);
$kk['ticket_rate']="$res->total_price";
$settingsDetails=$this->db->query("SELECT contact_number FROM privacy_policy")->row_array();
$result=$this->db->query("SELECT booking.qrcode, events.event_discription AS instruction,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.venue_details 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();
$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();
@@ -958,7 +995,7 @@ class Webservice_model extends CI_Model {
$page_limit=($page-1)*$per_page;
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,
(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)->where('booking.status!=',3)->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')->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('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();