Merge branch 'master' of https://gitlab.techware.co.in/timeout/timeOut into tobin
# Conflicts:
# application/models/Hotel_model.php
Showing
application/models/FlightServices_model.php
0 → 100644
This diff is collapsed.
Click to expand it.
application/models/HotelServices_model.php
0 → 100644
This diff is collapsed.
Click to expand it.
application/models/Hotel_model.php
0 → 100644
This diff is collapsed.
Click to expand it.
... | @@ -218,7 +218,8 @@ class Organizer_model extends CI_Model { | ... | @@ -218,7 +218,8 @@ class Organizer_model extends CI_Model { |
array('status'=>'1','event_id'=>$postData['event_id'])); | array('status'=>'1','event_id'=>$postData['event_id'])); | ||
if($postData['show_type'] == 1){ | if($postData['show_type'] == 1){ | ||
$date = $postData['start_date']; | $date = $postData['start_date']; | ||
foreach (json_decode($postData['show_timing']) AS $time) { | $showTiming = is_array($postData['show_timing'])?$postData['show_timing']:json_decode($postData['show_timing']); | ||
foreach ($showTiming AS $time) { | |||
$insertEventDate[] = array('event_id'=>$postData['event_id'],'date'=>$date,'time'=>$time); | $insertEventDate[] = array('event_id'=>$postData['event_id'],'date'=>$date,'time'=>$time); | ||
} | } | ||
} else { | } else { | ||
... | @@ -458,7 +459,7 @@ class Organizer_model extends CI_Model { | ... | @@ -458,7 +459,7 @@ class Organizer_model extends CI_Model { |
$sql = $this->db->query("SELECT USR.* FROM users AS USR | $sql = $this->db->query("SELECT USR.* FROM users AS USR | ||
INNER JOIN provider AS PDR ON (PDR.provider_id = USR.id) | INNER JOIN provider AS PDR ON (PDR.provider_id = USR.id) | ||
WHERE USR.password='".md5($data['password'])."' AND | WHERE USR.password='".md5($data['password'])."' AND | ||
PDR.email='".$data['email_id']."' AND | ( PDR.email='".$data['email_id']."' OR USR.username='".$data['email_id']."') AND | ||
USR.user_type='".$data['user_type']."' AND | USR.user_type='".$data['user_type']."' AND | ||
USR.status='1'"); | USR.status='1'"); | ||
}else{ | }else{ | ||
... | @@ -1090,22 +1091,59 @@ class Organizer_model extends CI_Model { | ... | @@ -1090,22 +1091,59 @@ class Organizer_model extends CI_Model { |
return $res; | return $res; | ||
} | } | ||
public function acceptBooking($data){ | public function acceptBooking($data,$type=1){ | ||
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06'); | $res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06'); | ||
try{ | try{ | ||
$sql = "SELECT fcm_token FROM booking INNER JOIN customer ON customer.customer_id = booking.customer_id WHERE bookId='".$data['booking_id']."'"; | $status = 1; $title = 'Booking Approved'; | ||
$msgContent = "Hi, Your Booking is confirmed by the Organizer<br>"; | |||
if($type == 2){ | |||
$title = 'Booking Rejected'; | |||
$status = 0; | |||
$msgContent = "Hi, Your Booking is Rejected by the Organizer<br>"; | |||
} | |||
$sql = "SELECT fcm_token,email FROM booking INNER JOIN customer ON customer.customer_id = booking.customer_id WHERE bookId='".$data['booking_id']."'"; | |||
$bData = $this->db->query($sql)->row_array(); | $bData = $this->db->query($sql)->row_array(); | ||
$this->db->update('booking',array('status'=>'1'),array('bookId'=>$data['booking_id'])); | $this->db->update('booking',array('status'=>$status),array('bookId'=>$data['booking_id'])); | ||
$userData = array('id'=>$data['booking_id'], | $userData = array('id'=>$data['booking_id'], | ||
'param'=>'booking_id', | 'param'=>'booking_id', | ||
'title'=>'Booking Approved', | 'title'=>$title, | ||
'message'=>'Your Booking is Approved by the Event Provider'); | 'message'=>$data['message']); | ||
push_sent_cancel(2,$bData['fcm_token'],$userData); | push_sent_cancel(2,$bData['fcm_token'],$userData); | ||
$res = array('status'=>1,'message'=>'Booking Accepted Successfully'); | |||
$subject = "TimeOut Booking"; | |||
$message = "<html><body><p>".$msgContent."</p><p>Reason : ".$data['message']."</p></body></html>"; | |||
$this->send_mail($subject,$bData['email'],$message); | |||
$res = array('status'=>1,'message'=>(($type == 1)?'Booking Accepted Successfully':'Booking Rejected Successfully')); | |||
}catch(Exception $e){ | }catch(Exception $e){ | ||
$res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06'); | $res = array('status'=>0,'message'=>'Ohh No!! Something Went South','code'=>'ER06'); | ||
} | } | ||
return $res; | return $res; | ||
} | } | ||
function send_mail($subject,$email,$message,$attach=null) { | |||
$ci =& get_instance(); | |||
$ci->load->library('email'); | |||
$ci->email->initialize(array( | |||
'protocol' => 'smtp', | |||
'smtp_host' => 'smtp.sendgrid.net', | |||
'smtp_user' => '[email protected]', | |||
'smtp_pass' => 'Golden_123', | |||
'smtp_port' => 587, | |||
'crlf' => "\r\n", | |||
'newline' => "\r\n" | |||
)); | |||
$ci->email->from('[email protected]', 'TimeOut'); | |||
$ci->email->to($email); | |||
$ci->email->subject($subject); | |||
$ci->email->message($message); | |||
$ci->email->set_mailtype('html'); | |||
if($attach != null) { | |||
$ci->email->attach($attach); | |||
} | |||
return $ci->email->send(); | |||
} | |||
} | } | ||
?> | ?> |
Please
register
or
sign in
to comment