Commit ad75e20c by Tobin

sms noti

parent f514e8fb
......@@ -134,21 +134,20 @@ class Customer extends CI_Controller {
$subject = "Your TimeOut Account is now activated";
$email_id = $_POST['email'];
$template = getNotifTemplate();
$message = "<html>
<body>
Hi,\n\r Welcome to TimeOut. \r\n Please use username:
".$_POST['email']." for access your account <br>
</body>
</html>";
$msgContent = "Hi, Welcome to TimeOut. Please use username: ".$_POST['email']."
for access your account.";
$message = "<html><body>".$msgContent."<br></body></html>";
if(isset($template['registration_mail']) && !empty($template['registration_mail'])){
$message = str_replace(array('{:email}'),array($email_id),
$template['registration_mail']);
$message=str_replace(array('{:email}'),array($email_id),$template['registration_mail']);
}
$this->Api_model->send_mail($subject,$email_id,$message);
if(isset($template['registration_sms']) && !empty($template['registration_sms'])){
$msgContent=str_replace(array('{:email}'),array($email_id),$template['registration_sms']);
}
$this->Api_model->sendSMS($_POST['phone'],$msgContent);
$flashMsg =array('message'=>'Successfully Updated User Details..!','class'=>'success');
$this->session->set_flashdata('message', $flashMsg);
redirect(base_url('Customer/viewCustomers'));
......
......@@ -46,9 +46,15 @@ class Notification extends CI_Controller {
if(!isset($_POST['forgot_sms']) || empty($_POST['forgot_sms'])){
unset($_POST['forgot_sms']);
}
if(!isset($_POST['booking_sms']) || empty($_POST['booking_sms'])){
unset($_POST['booking_sms']);
}
if(!isset($_POST['verify_mail']) || empty($_POST['verify_mail'])){
unset($_POST['verify_mail']);
}
if(!isset($_POST['booking_mail']) || empty($_POST['booking_mail'])){
unset($_POST['booking_mail']);
}
if(!isset($_POST['staff_reg_mail']) || empty($_POST['staff_reg_mail'])){
unset($_POST['staff_reg_mail']);
}
......
......@@ -4,6 +4,7 @@ class Webservice_model extends CI_Model {
public function _consruct(){
parent::_construct();
$this->load->model('Api_model');
}
function update_fcm_token($data) {
......@@ -161,10 +162,24 @@ class Webservice_model extends CI_Model {
'language'=>$data['language']
);
$this->db->insert('customer', $customer_data);
$subject = "New account created successfully";
$email_id = $data['email'];
$message = "Hi,\n\r Welcome to TimeOut.\r\n Please use username: ".$email_id." and Password: ".$temp_password." for access your account";
$this->send_mail($subject,$email_id,$message);
$email = $data['email'];
$subject = "New account created successfully";
$message = "Hi, Welcome to TimeOut. Please use username: ".$email.
" for access your account";
if(isset($template['registration_mail']) && !empty($template['registration_mail'])){
$message = str_replace(array('{:email}'),
array($email),$template['registration_mail']);
}
$this->send_mail($subject,$email,$message);
if(isset($template['registration_sms']) && !empty($template['registration_sms'])){
$message = str_replace(array('{:email}'),
array($email),$template['registration_sms']);
}
$this->sendSMS($data['phone'],$message);
$this->db->select("customer.name AS user_name,customer.phone,customer.email,customer.profile_image AS profile_photo,users.id AS user_id, IF(customer.phone_verified = 0,'false','true') AS is_phone_verified");
$this->db->where('users.id',$id);
$this->db->from('users');
......@@ -629,6 +644,31 @@ class Webservice_model extends CI_Model {
return $ci->email->send();
}
function sendSMS($phone_no, $message) {
$phone_no = trim($phone_no);
$phone_no = trim($phone_no,'+');
if(empty($phone_no) && count($phone_no) < 10 && empty($message)){
return;
}
$user = "eventstimeout";
$senderid = "SMSCountry";
$password = "timeout2030";
$url = "http://www.smscountry.com/SMSCwebservice_Bulk.aspx";
$message = urlencode($message);
if($ch = curl_init()){
$ret = curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "User=$user&passwd=$password&mobilenumber=$phone_no&message=$message&sid=$senderid&mtype=N&DR=Y");
$ret = curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$curlresponse = curl_exec ($ch);
}
}
function get_category_list($data) {
try {
......@@ -989,6 +1029,42 @@ class Webservice_model extends CI_Model {
$id = $this->db->insert_id();
if($id){
$res = array('status'=>1,'data'=>array('bookingCode'=>$post_data['bookId']));
if($post_data['status'] == 1){
$bkData = $this->db->query("
SELECT EVT.event_name,CUST.name,CUST.email,CUST.phone,
CONCAT(EDATE.date,' ',EDATE.time) AS show_time
FROM booking AS BK
INNER JOIN events AS EVT ON (EVT.event_id=BK.event_id)
INNER JOIN customer AS CUST ON (CUST.customer_id=BK.customer_id)
INNER JOIN event_date_time AS EDATE ON (EDATE.id=BK.event_date_id)
WHERE BK.bookId='".$post_data['bookId']."' AND EVT.status='1' AND
BK.status='1' AND EDATE.status='1'")->row_array();
$subject = "Your Tickets - TimeOut";
$showTime = date("d'S F Y - h:i, (l)",strtotime($bkData['show_time']));
$msgContent = "Hi, Your booking is confirmed for the event '".
$bkData['event_name']."' and show is on '".$showTime."'.
Booking ID ".$post_data['bookId'];
$message = "<html><body><p>".$msgContent."</p></body></html>";
$template = getNotifTemplate();
if(isset($template['booking_mail']) && !empty($template['booking_mail'])){
$msgContent = str_replace(
array('{:event_name}','{:booking_id}','{:time}'),
array($bkData['event_name'],$post_data['bookId'],$showTime),
$template['booking_mail']);
}
$this->send_mail($subject,$bkData['email'],$message);
if(isset($template['booking_sms']) && !empty($template['booking_sms'])){
$msgContent = str_replace(
array('{:event_name}','{:booking_id}','{:time}'),
array($bkData['event_name'],$post_data['bookId'],$showTime),
$template['booking_sms']);
}
$this->sendSMS($bkData['phone'],$msgContent);
}
} else {
$res = array('status'=>0,'message'=>'Seat booking failed','code'=>'ER37');
}
......
......@@ -85,6 +85,17 @@
</div>
</div>
</div>
<div class="col-sm-12">
<div class="col-sm-6">
<div class="form-group">
<label>Booking Mail</label>
<p>Event Name => {:event_name} , Booking ID => {:booking_id} , Time => {:time}</p>
<textarea id="rich_editor_10" type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Booking Mail" name="booking_mail"
style="height:108px;" data-parsley-trigger="change"><?= $notificationData->booking_mail ?></textarea>
</div>
</div>
</div>
</div>
<div class="box-header with-border">
......@@ -95,15 +106,25 @@
<div class="col-sm-6">
<div class="form-group">
<label>Registration SMS</label>
<p>Email => {:email}</p>
<textarea type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Registration SMS" name="registration_sms" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->registration_sms ?></textarea>
</div>
</div>
<div class="col-sm-6">
<!-- <div class="col-sm-6">
<div class="form-group">
<label>Forgot SMS</label>
<p>URL => {:url}</p>
<textarea type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Forgot SMS" name="forgot_sms" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->forgot_sms ?></textarea>
</div>
</div> -->
<div class="col-sm-6">
<div class="form-group">
<label>Booking SMS</label>
<p>Event Name => {:event_name} , Booking ID => {:booking_id} , Time => {:time}</p>
<textarea type="text" class="ip_reg_form_input form-control reset-form-custom" placeholder="Booking SMS" name="booking_sms" style="height:108px;" data-parsley-trigger="change"><?= $notificationData->booking_sms ?></textarea>
</div>
</div>
</div>
......
......@@ -32,6 +32,7 @@
if(jQuery('#rich_editor_6').length==1){CKEDITOR.replace('rich_editor_6');}
if(jQuery('#rich_editor_8').length==1){CKEDITOR.replace('rich_editor_8');}
if(jQuery('#rich_editor_9').length==1){CKEDITOR.replace('rich_editor_9');}
if(jQuery('#rich_editor_10').length==1){CKEDITOR.replace('rich_editor_10');}
if(jQuery('#rich_editor_3').length==1){CKEDITOR.replace('rich_editor_3',{language:'ar'});}
if(jQuery('#rich_editor_4').length==1){CKEDITOR.replace('rich_editor_4',{language:'ar'});}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment