diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index de6003a1..e5fddb90 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -68,6 +68,7 @@ class StatusUpdation_model extends CI_Model { // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received, Please come and collect it."; $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); } else if($statuToMsg == 'issued' || $statuToMsg == 'Issued' || $statuToMsg == 'ISSUED') { $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $getSemYearMsg = $this->get_couser_name($arr[0]['CourseID']); @@ -75,6 +76,7 @@ class StatusUpdation_model extends CI_Model { // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Despatch - Dear $studentName, Your $getSemYearANDType had been despatched against ($CmntToMsg $statuToMsg) on $dateToMsg."; $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); } else { } @@ -121,6 +123,7 @@ class StatusUpdation_model extends CI_Model { // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received, Please come and collect it."; $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); } else if($statuToMsg == 'issued' || $statuToMsg == 'Issued' || $statuToMsg == 'ISSUED') { $cerNamtToMsg = 'Mark Card'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); @@ -128,6 +131,7 @@ class StatusUpdation_model extends CI_Model { // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Despatch - Dear $studentName, Your $getSemYearANDType had been despatched against ($CmntToMsg $statuToMsg) on $dateToMsg."; $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); } else { } // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; @@ -174,6 +178,15 @@ class StatusUpdation_model extends CI_Model { return $roleDetails->MobileNumber; } + // self function for getting registered email for mail send + public function get_registered_email($num) { + $this->db->select('EmailID'); + $this->db->from(STUDENTS); + $this->db->where('StudentID', $num); + $roleDetails = $this->db->get()->first_row(); + return $roleDetails->EmailID; + } + // self function for getting the status for the LISTCODE public function get_ListCode_status($listCode) { $this->db->select('ListName'); @@ -297,8 +310,23 @@ class StatusUpdation_model extends CI_Model { $this->db->insert_batch(ANSWER_BOOKLET, $arr); if ($this->db->affected_rows() >= 1) { $this->updateBookletStatusInCallTrack($arr, $reqDetails); - $result['addStatus'] = true; - $result['message'] = "Successfully Answer Booklet Status Updated"; + $studentName = $this->getStudentName($arr[0]['StudentID']); + $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); + // $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); + if( $statuToMsg == 'received' || $statuToMsg == 'Received' || $statuToMsg == 'RECEIVED'){ + $cerNamtToMsg = 'Answer booklet'; + $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); + $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; + // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; + $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received."; + $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); + $result['addStatus'] = true; + $result['message'] = "Successfully Answer Booklet Status Updated"; + }else{ + $result['addStatus'] = true; + $result['message'] = "Successfully Answer Booklet Status Updated"; + } } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; @@ -340,6 +368,7 @@ class StatusUpdation_model extends CI_Model { // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received, Please come and collect it."; $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); } else if($statuToMsg == 'issued' || $statuToMsg == 'Issued' || $statuToMsg == 'ISSUED') { $cerNamtToMsg = 'Study Material'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); @@ -347,6 +376,7 @@ class StatusUpdation_model extends CI_Model { // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Despatch - Dear $studentName, Your $getSemYearANDType had been despatched against ($CmntToMsg $statuToMsg) on $dateToMsg."; $this->smssend($arr, $mesg); + $this->mailsend($arr, $mesg, $cerNamtToMsg); } else { } } @@ -549,34 +579,44 @@ class StatusUpdation_model extends CI_Model { return $output; } - // public function mailsend() { - // //Load email library - // $this->load->library('email'); - // //SMTP & mail configuration - // $config = array( - // 'protocol' => 'smtp', - // 'smtp_host' => 'ssl://smtp.example.com', - // 'smtp_port' => 465, - // 'smtp_user' => 'email@example.com', - // 'smtp_pass' => 'email_password', - // 'mailtype' => 'html', - // 'charset' => 'utf-8' - // ); - // $this->email->initialize($config); - // $this->email->set_mailtype("html"); - // $this->email->set_newline("\r\n"); - // //Email content - // $htmlContent = '

Sending email via SMTP server

'; - // $htmlContent .= '

This email has sent via SMTP server from CodeIgniter application.

'; - // // Email body load the html template - // // $body = $this->load->view('emails/anillabs.php',$data,TRUE); - // $this->email->to('recipient@example.com'); - // $this->email->from('sender@example.com','MyWebsite'); - // $this->email->subject('How to send email via SMTP server in CodeIgniter'); - // $this->email->message($htmlContent); - // //Send email - // $this->email->send(); - // } + public function mailsend($arr, $msg, $sub) { + $emails = array(); + foreach ($arr as $ar) { + $mobi = $this->get_registered_email($ar['StudentID']); + array_push($emails, "$mobi"); + } + $list = implode(',', $emails); + //Load email library + $this->load->library('email'); + //SMTP & mail configuration + $config = array( + 'protocol' => 'ssmtp', + 'smtp_host' => 'ssl://smtp.example.com', + 'smtp_port' => 465, + 'smtp_user' => 'noreply@apollodec.com', + 'smtp_pass' => 'Apollo@123', + 'mailtype' => 'html', + 'charset' => 'utf-8' + ); + $this->email->initialize($config); + $this->email->set_mailtype("html"); + $this->email->set_newline("\r\n"); + //Email content + // $htmlContent = '

Sending email via SMTP server

'; + $htmlContent = $msg; + // Email body load the html template + // $body = $this->load->view('emails/anillabs.php',$data,TRUE); + $this->email->to($list); + $this->email->from('noreply@apollodec.com','Apollo'); + $subj = $sub; + $this->email->subject($subj); + $this->email->message($htmlContent); + //Send email + $result = $this->email->send(); + // echo $this->email->print_debugger(); exit(); + return $result; + + } /* * update followup details for booklet details in call tracking * created by kms diff --git a/Apollo/api/application/models/Student_model.php b/Apollo/api/application/models/Student_model.php index f49ced43..cb79bda7 100755 --- a/Apollo/api/application/models/Student_model.php +++ b/Apollo/api/application/models/Student_model.php @@ -592,6 +592,9 @@ class Student_model extends CI_Model { $msg = "Thanks for registering with us for Course $getCourseName -$getUnivName. For more details, please login to www.apollodec.com. User ID :$userId, Password :abc123"; $arr = $userId; $this->smssend($arr, $msg); + $emailId = $Arr['EmailID']; + $sub = ' Apollo - Course Registration'; + $this->mailsend($emailId, $msg, $sub); $result['addStudentStatus'] = true; $result['message'] = "Successfully student details added"; } else { @@ -636,11 +639,15 @@ class Student_model extends CI_Model { $this->db->insert(LOGIN, $loginArr); if ($this->db->affected_rows() == '1') { $userId = $Arr['MobileNumber']; + $getUnivName = $this->getUnivName($courseArr['UniversityID'], $courseArr['BranchID']); $getCourseName = $this->getCourseName($courseArr['CourseID'], $courseArr['BranchID']); $msg = "Thanks for registering with us for Course $getCourseName -$getUnivName. For more details, please login to www.apollodec.com. User ID :$userId, Password :abc123"; $arr = $userId; $this->smssend($arr, $msg); + $emailId = $Arr['EmailID']; + $sub = ' Apollo - Course Registration'; + $this->mailsend($emailId, $msg, $sub); $result['addStudentStatus'] = true; $result['message'] = "Successfully student details added"; } else { @@ -1170,4 +1177,44 @@ class Student_model extends CI_Model { return $output; } + public function mailsend($arr, $msg, $sub) { + // $emails = array(); + // foreach ($arr as $ar) { + // $mobi = $this->get_registered_email($ar['StudentID']); + // array_push($emails, "$mobi"); + // } + // $list = implode(',', $emails); + $list = $arr; + //Load email library + $this->load->library('email'); + //SMTP & mail configuration + $config = array( + 'protocol' => 'ssmtp', + 'smtp_host' => 'ssl://smtp.example.com', + 'smtp_port' => 465, + 'smtp_user' => 'noreply@apollodec.com', + 'smtp_pass' => 'Apollo@123', + 'mailtype' => 'html', + 'charset' => 'utf-8' + ); + $this->email->initialize($config); + $this->email->set_mailtype("html"); + $this->email->set_newline("\r\n"); + //Email content + // $htmlContent = '

Sending email via SMTP server

'; + $htmlContent = $msg; + // Email body load the html template + // $body = $this->load->view('emails/anillabs.php',$data,TRUE); + $this->email->to($list); + $this->email->from('noreply@apollodec.com','Apollo'); + $subj = $sub; + $this->email->subject($subj); + $this->email->message($htmlContent); + //Send email + $result = $this->email->send(); + // echo $this->email->print_debugger(); exit(); + return $result; + + } + } \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index 6898b6e5..f2cdad8a 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -104,8 +104,9 @@ "MAIN": "UPDATE STATUS ", "STUDYMATERIAL": "STUDY MATERIAL", "ANSWERBOOKLET": "ANSWER BOOKLET", - "CERTIFICATION": "MARK CARD", - "APPLICATION" : "DOCUMENTS" + "MARKCARD": "MARK CARD", + "APPLICATION" : "DOCUMENTS", + "CERTIFICATE": "CERTIFICATE" } }, "status": { diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 165e47e5..7c846dc0 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -153,11 +153,11 @@ app.constant('JS_REQUIRES', { /* * student Certification status updation * */ - 'certificationStatusCtrl': 'assets/js/controllers/certificationStatusCtrl.js', + 'markcardStatusCtrl': 'assets/js/controllers/markcardStatusCtrl.js', /* * student Certification status updation * */ - 'applicationStatusCtrl': 'assets/js/controllers/applicationStatusCtrl.js', + 'certificateStatusCtrl': 'assets/js/controllers/certificateStatusCtrl.js', /* * Certificate Type * */ diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index 053d2cf3..e384da6e 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -307,22 +307,22 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com label: 'Answer Booklet' }, // resolve: loadSequence('wizardCtrl') - }).state('app.student.status.certificationstatus', { - url: '/certificationstatus', - templateUrl: "assets/views/status-update/certification_status.html", + }).state('app.student.status.markcardstatus', { + url: '/markcardstatus', + templateUrl: "assets/views/status-update/markcard_status.html", title: 'Mark Card', - resolve: loadSequence('ui.select','spin', 'ui.mask', 'spin', 'ladda', 'angular-ladda', 'ngTable', 'certificationStatusCtrl'), + resolve: loadSequence('ui.select','spin', 'ui.mask', 'spin', 'ladda', 'angular-ladda', 'ngTable', 'markcardStatusCtrl'), ncyBreadcrumb: { label: 'Mark Card' }, // resolve: loadSequence('wizardCtrl') - }).state('app.student.status.applicationstatus', { - url: '/applicationstatus', - templateUrl: "assets/views/status-update/application_status.html", - title: 'Documents Status', - resolve: loadSequence('ui.select','spin', 'ui.mask', 'spin', 'ladda', 'angular-ladda', 'ngTable', 'applicationStatusCtrl'), + }).state('app.student.status.certificatestatus', { + url: '/certificatestatus', + templateUrl: "assets/views/status-update/certificate_status.html", + title: 'Certificate Status', + resolve: loadSequence('ui.select','spin', 'ui.mask', 'spin', 'ladda', 'angular-ladda', 'ngTable', 'certificateStatusCtrl'), ncyBreadcrumb: { - label: 'Documents Status' + label: 'Certificate Status' }, // resolve: loadSequence('wizardCtrl') }).state('app.status.application', { diff --git a/Apollo/assets/js/controllers/applicationStatusCtrl.js b/Apollo/assets/js/controllers/certificateStatusCtrl.js old mode 100755 new mode 100644 similarity index 99% rename from Apollo/assets/js/controllers/applicationStatusCtrl.js rename to Apollo/assets/js/controllers/certificateStatusCtrl.js index 9ed53ff7..54d7a0b0 --- a/Apollo/assets/js/controllers/applicationStatusCtrl.js +++ b/Apollo/assets/js/controllers/certificateStatusCtrl.js @@ -1,6 +1,6 @@ 'use strict'; /*** controller for Wizard Form example***/ -app.controller('applicationStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', 'dateListDescService', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie ,dateListDescService) { +app.controller('certificateStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', 'dateListDescService', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie ,dateListDescService) { /** * Application status update search / Document status update diff --git a/Apollo/assets/js/controllers/certificationStatusCtrl.js b/Apollo/assets/js/controllers/markcardStatusCtrl.js old mode 100755 new mode 100644 similarity index 98% rename from Apollo/assets/js/controllers/certificationStatusCtrl.js rename to Apollo/assets/js/controllers/markcardStatusCtrl.js index e67f0b91..4a263ded --- a/Apollo/assets/js/controllers/certificationStatusCtrl.js +++ b/Apollo/assets/js/controllers/markcardStatusCtrl.js @@ -1,6 +1,6 @@ 'use strict'; /*** controller for Wizard Form example***/ -app.controller('certificationStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', 'dateListDescService', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie, dateListDescService) { +app.controller('markcardStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', 'dateListDescService', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie, dateListDescService) { /** * Certification status update search / Mark card status update diff --git a/Apollo/assets/views/partials/nav.html b/Apollo/assets/views/partials/nav.html index 04e3c930..8ddcfff2 100755 --- a/Apollo/assets/views/partials/nav.html +++ b/Apollo/assets/views/partials/nav.html @@ -199,13 +199,13 @@
  • - + Certification
  • - - Application + + Certificate
  • @@ -643,13 +643,13 @@
  • - - Certification + + Markcard
  • - - Application + + Certificate
  • @@ -1010,12 +1010,12 @@
  • - - Certification + + Markcard
  • - + Application
  • @@ -1266,12 +1266,12 @@
  • - - Certification + + Markcard
  • - + Application
  • diff --git a/Apollo/assets/views/status-update/application_status.html b/Apollo/assets/views/status-update/certificate_status.html old mode 100755 new mode 100644 similarity index 98% rename from Apollo/assets/views/status-update/application_status.html rename to Apollo/assets/views/status-update/certificate_status.html index 6010dc41..e6d00097 --- a/Apollo/assets/views/status-update/application_status.html +++ b/Apollo/assets/views/status-update/certificate_status.html @@ -2,7 +2,7 @@
    -

    {{ mainTitle }}

    +

    {{ mainTitle }}

    Update certificate status.
    @@ -14,7 +14,7 @@
    -
    +
    @@ -241,25 +241,25 @@
    - Document Type is Required + Certificate Type is Required
    - Document Number is Required + Certificate Number is Required
    @@ -352,25 +352,25 @@
    - Document Type is Required + Certificate Type is Required
    - Document Number is Required + Certificate Number is Required
    diff --git a/Apollo/assets/views/status-update/certification_status.html b/Apollo/assets/views/status-update/markcard_status.html old mode 100755 new mode 100644 similarity index 99% rename from Apollo/assets/views/status-update/certification_status.html rename to Apollo/assets/views/status-update/markcard_status.html index ae8fef58..17634fbd --- a/Apollo/assets/views/status-update/certification_status.html +++ b/Apollo/assets/views/status-update/markcard_status.html @@ -2,8 +2,8 @@
    -

    {{ mainTitle }}

    - Update certification status. +

    {{ mainTitle }}

    + Update markcard status.
    @@ -14,7 +14,7 @@
    -
    +