From 78036cc36686bf59aed52ea8f0ed34825b1eca2a Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sat, 13 Oct 2018 16:21:00 +0530 Subject: [PATCH] notification list --- Apollo/api/application/config/routes.php | 3 + .../controllers/Student_Controller.php | 25 +++++ .../application/models/Calltracking_model.php | 13 ++- .../application/models/Fees_status_model.php | 38 +++++++ .../models/StatusUpdation_model.php | 52 +++++++++ .../api/application/models/Student_model.php | 99 ++++++++++++++++ .../assets/js/controllers/callTrackingCtrl.js | 4 +- Apollo/assets/js/controllers/studentCtrl.js | 62 ++++++++++ .../assets/views/student/messageDetails.html | 106 ++++++++++++++++++ .../student/student_details_SuperAdmin.html | 8 ++ 10 files changed, 407 insertions(+), 3 deletions(-) create mode 100644 Apollo/assets/views/student/messageDetails.html diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 5262aff2..bed5890c 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -212,6 +212,9 @@ $route['getAllDayBookDetails'] = 'DayBook_Controller/getAllDayBookDetails'; $route['update_DayBookDetails'] = 'DayBook_Controller/update_DayBookDetailsData'; +$route['Getnotificcations'] = 'Student_Controller/Getnotificcations'; + + $route['AllgetUniversity'] = 'Report/getAllUniversity'; $route['NewregDetails'] = 'Report/NewregDetails'; diff --git a/Apollo/api/application/controllers/Student_Controller.php b/Apollo/api/application/controllers/Student_Controller.php index 1babfbee..e19c6b7d 100755 --- a/Apollo/api/application/controllers/Student_Controller.php +++ b/Apollo/api/application/controllers/Student_Controller.php @@ -689,4 +689,29 @@ class Student_Controller extends REST_Controller { } + + + + + public function Getnotificcations_post() + { + $det['StudentID']=$this->post('StudentID'); + $det['Phone']= $this->post('Phone'); + $det['Email']=$this->post('Email'); + $det['loginBranch']= $this->post('loginBranch'); + $det['createdBy']=$this->post('createdBy'); + + $getnotifications = $this->student_model->GetStudentNotifications($det); + + if ($getnotifications) { + $getnotifications['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getnotifications, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } else { + // Set the response and exit + $this->response(['message' => 'No users were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + } \ No newline at end of file diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index 86402915..a0db31c1 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -376,7 +376,7 @@ class Calltracking_model extends CI_Model { $msgId = $a[1]; $msgNumb = $a[2]; $msgStatus = $a[4]; - $data[] = array('MsgId' => $msgId, 'MobileNumber' => $msgNumb, 'MsgBody' => $messa, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + $data[] = array('MsgId' => $msgId, 'MobileNumber' => $msgNumb, 'MsgBody' => $msg, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); continue; } } @@ -455,6 +455,17 @@ class Calltracking_model extends CI_Model { $this->email->message($htmlContent); //Send email 1 $result = $this->email->send(); + + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + $msgGroup = date('YmdHis'); + + + $data[] = array('MobileNumber' => $list, 'MsgBody' => $htmlContent, 'Status' => 'success', 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + + + $this->db->insert_batch('T_BroadcastStatus', $data); // echo $this->email->print_debugger(); exit(); return $result; diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 3513cdca..4f2f4c86 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -1650,6 +1650,44 @@ $REGID=''; // print_r($output);exit(); curl_close($ch); + + $arrss = explode('
', $output); + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + $msgGroup = date('YmdHis'); + + //print_r($arrss); + + 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' => $data, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + continue; + } + } + + + // print_r($data);die(); + + $this->db->insert('T_BroadcastStatus',$data); + + + + + + return $output; } diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index ea706ea4..f5be41cf 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -623,11 +623,45 @@ $latestappstatus=''; } $mobile = implode(',', $number); $message = urlencode($msg); + + $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $mobile . "&SenderID=APODEC&Message=" . $message . "&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' => $msg, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + continue; + } + } + + + $this->db->insert_batch('T_BroadcastStatus', $data); + + return $output; } @@ -666,6 +700,24 @@ $latestappstatus=''; $this->email->message($htmlContent); //Send email 1 $result = $this->email->send(); + + + + + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + $msgGroup = date('YmdHis'); + + + $data[] = array('MobileNumber' => $list, 'MsgBody' => $htmlContent, 'Status' => 'success', 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + + +$this->db->insert_batch('T_BroadcastStatus', $data); + + + + // echo $this->email->print_debugger(); exit(); return $result; diff --git a/Apollo/api/application/models/Student_model.php b/Apollo/api/application/models/Student_model.php index a8adbca9..2ed7d541 100755 --- a/Apollo/api/application/models/Student_model.php +++ b/Apollo/api/application/models/Student_model.php @@ -1651,6 +1651,37 @@ class Student_model extends CI_Model { 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' => $msg, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + continue; + } + } + + + $this->db->insert_batch('T_BroadcastStatus', $data); + return $output; } @@ -1725,4 +1756,72 @@ class Student_model extends CI_Model { } + + + public function GetStudentNotifications($det) + { + + + $this->db->select('*'); + $this->db->from('T_BroadcastStatus'); + $this->db->like('MobileNumber', $det['Phone'], 'before'); + $messagedet = $this->db->get(); + + if($messagedet ->result()) + { + + $result_array['msgStatus'] = true; + $result_array['msgdetails'] = $messagedet->result(); + } + + else + { + $result_array['msgStatus'] = false; + $result_array['msgdetails'] = 'No Records Found'; + } + + $this->db->select('*'); + $this->db->from('T_BroadcastStatus'); + $this->db->where('MobileNumber', $det['Email']); + $maildet = $this->db->get(); + + + if($maildet ->result()) + { + + $result_array['mailStatus'] = true; + $result_array['maildetails'] = $maildet->result(); + } + + else + { + $result_array['mailStatus'] = false; + $result_array['maildetails'] = 'No Records Found'; + } + + + + $this->db->select('StudentID'); + $this->db->from('T_StudentDetails'); + $this->db->where('MobileNumber', $det['Phone']); + $studentID = $this->db->get(); + + + if($studentID ->result()) + { + + $result_array['stuidStatus'] = true; + $result_array['StudentID'] = $studentID->result(); + } + + else + { + $result_array['stuidStatus'] = false; + $result_array['StudentID'] = 'No Records Found'; + } + + return $result_array; + + } + } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/callTrackingCtrl.js b/Apollo/assets/js/controllers/callTrackingCtrl.js index da9c3204..744e85a4 100755 --- a/Apollo/assets/js/controllers/callTrackingCtrl.js +++ b/Apollo/assets/js/controllers/callTrackingCtrl.js @@ -241,10 +241,10 @@ app.controller('callTrackingCtrl', ["$scope","$rootScope","toaster", "$filter", $scope.trackForm = { submit: function (form, myModel,loading) { -console.log(myModel.activity.activityName); +//console.log(myModel.activity.activityName); var string = myModel.activity.activityName; var Upperstring = string.toUpperCase(); -var checkresult = Upperstring.search("STATUS"); +var checkresult = Upperstring.search("ADMISSION"); var msgactivity = 0; if(checkresult != -1) { diff --git a/Apollo/assets/js/controllers/studentCtrl.js b/Apollo/assets/js/controllers/studentCtrl.js index d63f201c..451dda64 100755 --- a/Apollo/assets/js/controllers/studentCtrl.js +++ b/Apollo/assets/js/controllers/studentCtrl.js @@ -1834,12 +1834,14 @@ $scope.allcourselist =''; $scope.editId = -1; $scope.editCourseId = -1; $scope.editTrackingId=-1; + $scope.msgdetID = -1; $scope.setEditId = function (uniqe_id ,id) { // alert() $scope.editId = uniqe_id; $scope.editCourseId = -1; $scope.editTrackingId=-1; + $scope.msgdetID = -1; } $scope.setEditCourseId = function (uniqe_id ,id) { @@ -1871,6 +1873,66 @@ $scope.allcourselist =''; } + + $scope.cancelnotification = function() + { + $scope.msgdetID = '-1'; + } + + $scope.MailDetails=''; + $scope.MessageDetails = ''; + $scope.StudentIDDet = ''; + $scope.msgdetID = -1; + $scope.setmessageId = function (student) + { + + //console.log(student);return false; + + var studentID= student.StudentID; + var phonenumber = student.MobileNumber; + var email = student.EmailID; + + + var sentnotification = { + method: 'POST', + url: apiPoint.url + 'Getnotificcations/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + + StudentID: studentID, + Phone: phonenumber, + Email:email, + loginBranch: localDetails.localBranchID, + createdBy: localDetails.localUserID, + } + }; + $http(sentnotification).then(function (response) { + + if(response.data.status == 200) + { + $scope.MailDetails=response.data.maildetails; + $scope.MessageDetails = response.data.msgdetails; + $scope.StudentIDDet = response.data.StudentID; + $scope.msgdetID = $scope.StudentIDDet[0].StudentID; + + //console.log($scope.msgdetID); + + } + + }); + + + + + } + + + + + + $scope.cancel = function () { $scope.getStudentList(); $scope.editId = -1; diff --git a/Apollo/assets/views/student/messageDetails.html b/Apollo/assets/views/student/messageDetails.html new file mode 100644 index 00000000..7a7fb27a --- /dev/null +++ b/Apollo/assets/views/student/messageDetails.html @@ -0,0 +1,106 @@ +
+
+
+ +

Fetching ...

+
+
+

No Records Found

+
+
+ +
+ + Email Details + + +
+ + + + + + + + + + + + + + + + +
Mail Email ID Sent On
{{ma.MsgBody}} + {{ma.MobileNumber}}{{ma.CreatedOn}}
+
+
+
+ + + + +
+
+
+
+ + +
+ + + + +
+ + Message Details + + +
+ + + + + + + + + + + + + + + + + +
Message Mobile No Sent On
{{me.MsgBody}}
{{me.MobileNumber}}{{me.CreatedOn}}
+
+
+
+ + + + +
+
+
+
+ + +
+ +
+ +
+ + +
+ + \ No newline at end of file diff --git a/Apollo/assets/views/student/student_details_SuperAdmin.html b/Apollo/assets/views/student/student_details_SuperAdmin.html index 0e1c6ddb..91a850aa 100755 --- a/Apollo/assets/views/student/student_details_SuperAdmin.html +++ b/Apollo/assets/views/student/student_details_SuperAdmin.html @@ -222,6 +222,7 @@
+
@@ -278,6 +279,8 @@ + + @@ -290,8 +293,13 @@ + + + +
+