diff --git a/Apollo/api/application/controllers/Call_Tracking_Controller.php b/Apollo/api/application/controllers/Call_Tracking_Controller.php
index d7ca1246..1425c328 100755
--- a/Apollo/api/application/controllers/Call_Tracking_Controller.php
+++ b/Apollo/api/application/controllers/Call_Tracking_Controller.php
@@ -119,10 +119,13 @@ class Call_Tracking_Controller extends REST_Controller {
$tracking_followup_details['StatusName'] = $this->post('status');
$tracking_followup_details['AssignedStaff'] = $this->post('assignedTo');
+ $message = $this->post('msgactivity');
+ // echo $message;die();
- $leadDetails = $this->Calltracking_model->addleadDetails($lead_details,$tracking_details,$tracking_followup_details);// Check if the users data store contains users (in case the database result returns NULL)
+
+ $leadDetails = $this->Calltracking_model->addleadDetails($lead_details,$tracking_details,$tracking_followup_details,$message);// Check if the users data store contains users (in case the database result returns NULL)
if ($leadDetails)
{
$leadDetails['status'] = REST_Controller::HTTP_OK;
diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php
index b4cd1c28..86402915 100755
--- a/Apollo/api/application/models/Calltracking_model.php
+++ b/Apollo/api/application/models/Calltracking_model.php
@@ -312,8 +312,11 @@ class Calltracking_model extends CI_Model {
* created by kms
* */
- public function addleadDetails($lead_Details=null,$track_Details=null,$followup_Details=null)
+ public function addleadDetails($lead_Details=null,$track_Details=null,$followup_Details=null,$messagecheck=null)
{
+
+
+ // print_r($lead_Details);die();
$this->db->insert(LEAD_DETAILS, $lead_Details);
// this if for insert lead details
if($this->db->affected_rows() == '1'){
@@ -325,10 +328,72 @@ class Calltracking_model extends CI_Model {
$followup_Details['TrackingID']=$this->db->insert_id();
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details);
// this if for insert follow up details
- if($this->db->affected_rows() == '1'){
+ if($this->db->affected_rows() == '1')
+ {
+
+
+ if($messagecheck !=0)
+ {
+ $number = $lead_Details['MobileNumber'];
+ $name = $lead_Details['LeadName'];
+ $CourseName = $track_Details['Course'];
+ $Email = $track_Details['EmailID'];
+
+
+
+
+
+ // $msg='Dear '.$name.', Thank for Enquiring with Apollo Distance Education College for the course '.$CourseName.'. Pls Feel free to call us for more information 9962012985,9962012982.Thanks.';
+
+
+ $msg='Dear '.$name.', Thank you for enquiring with Apollo Distance Education College for the course '.$CourseName.'. Pls feel free to call us for more information at 9962012985 or 9962012982.';
+
+
+ $messa = urlencode($msg);
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $number . "&SenderID=APODEC&Message=" . $messa . "&ServiceName=TEMPLATE_BASED");
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+ $output = curl_exec($ch);
+ curl_close($ch);
+
+ $arrss = explode('
', $output);
+
+ $time = date('Y-m-d H:i:s');
+ $dateTime = $time;
+ $msgGroup = date('YmdHis');
+
+ for ($i = 0, $c = count($arrss);$i < $c;$i++)
+ {
+
+ if ($arrss[$i] === '')
+ {
+ break;
+ }
+ else
+ {
+ $a = explode(':', $arrss[$i]);
+ $msgIdState = $a[0];
+ $msgId = $a[1];
+ $msgNumb = $a[2];
+ $msgStatus = $a[4];
+ $data[] = array('MsgId' => $msgId, 'MobileNumber' => $msgNumb, 'MsgBody' => $messa, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup);
+ continue;
+ }
+ }
+
+
+ $this->mailsend($Email, $msg);
+
+ $this->db->insert_batch('T_BroadcastStatus', $data);
+
+ }
+
+
$result['leadStatus'] = true;
$result['message'] = "Successfully lead details added";
- }
+
+
+ }
else{
$result['leadStatus'] = false;
$result['message'] = "Something went wrong.please try again";
@@ -351,6 +416,57 @@ class Calltracking_model extends CI_Model {
}
+
+
+
+
+
+ public function mailsend($mail, $msg) {
+
+ // $list = implode(',', $mail);
+
+ $list = $mail;
+ $sub = 'Enquiry Details';
+ //Load email library
+ $this->load->library('email');
+ //SMTP & mail configuration
+ $config = array(
+ 'protocol' => 'smtp',
+ 'smtp_host' => 'smtp.sendgrid.net',
+ 'smtp_port' => 587,
+ 'smtp_user' => 'apikey',
+ 'smtp_pass' => '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',
+ 'mailtype' => 'html',
+ 'charset' => 'utf-8'
+ );
+ $this->email->initialize($config);
+ $this->email->set_mailtype("html");
+ $this->email->set_newline("\r\n");
+ // print_r($this->email);exit();
+ //Email content
+ // $htmlContent = '