From 7e0d5d730bba2930b6f88a8c7f2b4606d22045a7 Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Fri, 6 Apr 2018 16:58:51 +0530 Subject: [PATCH] student login restriction by super admin : kdk --- .../application/controllers/Student_Controller.php | 3 +++ Apollo/api/application/models/Login_model.php | 13 +++++++++---- Apollo/assets/js/controllers/studentCtrl.js | 3 ++- .../assets/views/student/editStudentDetails.html | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Apollo/api/application/controllers/Student_Controller.php b/Apollo/api/application/controllers/Student_Controller.php index 8d6198f0..207f2a15 100755 --- a/Apollo/api/application/controllers/Student_Controller.php +++ b/Apollo/api/application/controllers/Student_Controller.php @@ -435,6 +435,7 @@ class Student_Controller extends REST_Controller { $req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments']; $req['IsActive'] = $data['IsActive']; + $req['LoginAccess'] = $data['LoginAccess'] == 1 ? "1" : "0"; $req['UpdatedBy'] = $updatedBy; $date = date('Y-m-d H:i:s'); @@ -495,8 +496,10 @@ class Student_Controller extends REST_Controller { $req['ProfilePicPath'] = $data['ProfilePicPath']; $req['Comments'] = $data['Comments']; $req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments']; + $req['IsActive'] = $data['IsActive'] == 1 ? "1" : "0"; + $req['LoginAccess'] = $data['LoginAccess'] == 1 ? "1" : "0"; $req['UpdatedBy'] = $updatedBy; $date = date('Y-m-d H:i:s'); diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php index 2de97c58..fa2c1e74 100755 --- a/Apollo/api/application/models/Login_model.php +++ b/Apollo/api/application/models/Login_model.php @@ -79,21 +79,26 @@ class Login_model extends CI_Model } } else if($loginDetails->ListCode == STUDENT){ - $this->db->select('LO.MobileNumber, LO.ListCode, LO.ID,ST.BranchCode'); + $this->db->select('LO.MobileNumber, LO.ListCode, LO.ID,ST.BranchCode, ST.LoginAccess'); $this->db->from('' . LOGIN . ' as LO'); $this->db->join('' . STUDENTS . ' as ST', 'LO.StaffID = ST.StudentID'); $this->db->where('LO.MobileNumber', $mobile); $this->db->where('ST.IsActive', 1); $responseDetails = $this->db->get()->first_row(); + if($responseDetails){ - $result['loginStatus'] = true; - $result['details'] = $responseDetails; + if($responseDetails->LoginAccess == 1){ + $result['loginStatus'] = true; + $result['details'] = $responseDetails; + } else { + $result['loginStatus'] = false; + $result['message'] = "Your login is de-activated."; + } } else{ $result['loginStatus'] = false; $result['message'] = "Your login is de-activated."; } - } else{ $result['loginStatus'] = false; diff --git a/Apollo/assets/js/controllers/studentCtrl.js b/Apollo/assets/js/controllers/studentCtrl.js index d26162c9..27a36b31 100755 --- a/Apollo/assets/js/controllers/studentCtrl.js +++ b/Apollo/assets/js/controllers/studentCtrl.js @@ -2884,10 +2884,11 @@ app.controller('studentSuperAdminCtrl', ["$scope", "toaster", "$filter", "ngTabl } else { // alert(p.DOB); var idProof = $scope.filesEdit[0]; - $scope.editSaveButtonDisable = true; + $scope.editSaveButtonDisable = true; var formate = "dd-MM-yyyy"; var checkDOB = $filter('date')(new Date(p.DOB), formate); p.IsActive = p.IsActive === true ? 1 : 0; + p.LoginAccess = p.LoginAccess === true ? 1 : 0; p.DOB = p.DOB == hidedob ? p.DOB : $filter('date')(new Date(p.DOB), formate); if (idProof == undefined) { diff --git a/Apollo/assets/views/student/editStudentDetails.html b/Apollo/assets/views/student/editStudentDetails.html index 113bf222..491b41e2 100755 --- a/Apollo/assets/views/student/editStudentDetails.html +++ b/Apollo/assets/views/student/editStudentDetails.html @@ -412,6 +412,20 @@ De-Active Comments is required +
+
+ +
+ +
+
+ +
+ +
+