diff --git a/Apollo/api/application/controllers/Branch_Controller.php b/Apollo/api/application/controllers/Branch_Controller.php index 2e51d020..bfdfc5d3 100755 --- a/Apollo/api/application/controllers/Branch_Controller.php +++ b/Apollo/api/application/controllers/Branch_Controller.php @@ -120,6 +120,7 @@ class Branch_Controller extends REST_Controller { * */ public function updateBranchDetails_post() { + $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $branchCode = $this->post('branchCode'); @@ -134,7 +135,9 @@ class Branch_Controller extends REST_Controller { $details['UpdatedBy'] = $this->post('createdBy'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); $details['FeesReceiptTitle'] = $this->post('feesTitle'); - + $details['Is_StudentMobileAccessActive'] = $this->post('studentsMobileAccess') == "true" ? 1 : 0; + $details['Is_StudentWebAccessActive'] = $this->post('studnetsWebAccess') == "true" ? 1 : 0; +// print_r($details);exit(); $imageStat = $this->post('imageStatus'); $imagename = $imageStat == 1 ? $_FILES['logoEdit']['name'] : ''; diff --git a/Apollo/api/application/controllers/Login_Controller.php b/Apollo/api/application/controllers/Login_Controller.php index a1812074..5d6e8550 100755 --- a/Apollo/api/application/controllers/Login_Controller.php +++ b/Apollo/api/application/controllers/Login_Controller.php @@ -40,9 +40,9 @@ class Login_Controller extends REST_Controller { { $userMobile = $this->post('userMobile'); $password = $this->post('password'); + $accessFrom = $this->post('accessFrom'); - - $loginDetails = $this->login_model->login( $userMobile, $password);// Check if the users data store contains users (in case the database result returns NULL) + $loginDetails = $this->login_model->login( $userMobile, $password, $accessFrom);// Check if the users data store contains users (in case the database result returns NULL) if ($loginDetails) { $LoginDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/controllers/StudentView_Controller.php b/Apollo/api/application/controllers/StudentView_Controller.php index 7eeb63bc..cf8d5f89 100755 --- a/Apollo/api/application/controllers/StudentView_Controller.php +++ b/Apollo/api/application/controllers/StudentView_Controller.php @@ -46,9 +46,9 @@ class StudentView_Controller extends REST_Controller $requestedBy = $this->post('requestedBy'); $requestedFrom = $this->post('requestedFrom'); $requestedBranch = $this->post('branchCode'); + $accessFrom = $this->post('accessFrom'); - - $studentListDetails = $this->studentview_model->getStudentInfo($requestedBy,$requestedFrom,$requestedBranch);// Check if the employee exist + $studentListDetails = $this->studentview_model->getStudentInfo($requestedBy,$requestedFrom,$requestedBranch,$accessFrom);// Check if the employee exist if ($studentListDetails) { $studentListDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit diff --git a/Apollo/api/application/models/Branch_model.php b/Apollo/api/application/models/Branch_model.php index 5fd0c639..d3dd2a5b 100755 --- a/Apollo/api/application/models/Branch_model.php +++ b/Apollo/api/application/models/Branch_model.php @@ -63,7 +63,7 @@ class Branch_model extends CI_Model { public function getBranch() { - $this->db->select('BranchCode,BranchName,LogoPath,MobileNumber,AlternateNumber,LandlineNumber,Address,EmailID,CreatedOn,IsActive,FeesReceiptTitle as feesTitle'); + $this->db->select('BranchCode,BranchName,LogoPath,MobileNumber,AlternateNumber,LandlineNumber,Address,EmailID,CreatedOn,IsActive,FeesReceiptTitle as feesTitle, Is_StudentMobileAccessActive as studentsMobileAccess, Is_StudentWebAccessActive As studnetsWebAccess'); $this->db->order_by('CreatedOn','DESC'); $branchDetails = $this->db->get(BRANCH); diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php index 8277d763..afb1c73a 100755 --- a/Apollo/api/application/models/Login_model.php +++ b/Apollo/api/application/models/Login_model.php @@ -20,7 +20,7 @@ class Login_model extends CI_Model * Default login abc123 -> e99a18c428cb38d5f260853678922e03 */ - public function login($mobile = null, $password = null) + public function login($mobile = null, $password = null, $accessFrom = null) { $this->db->select('t1.MobileNumber, t1.Password,t1.ListCode,t1.UpdatedOn,t1.OTP'); $this->db->from('' . LOGIN . ' as t1'); @@ -44,34 +44,72 @@ class Login_model extends CI_Model if($diff->i <= 10){ if($password == $loginDetails->OTP){ - $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($accessFrom == 'Web'){ + $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->join('' . STUDENTCOURSE . ' as SC', 'SC.StudentID = ST.StudentID'); + $this->db->join('' . BRANCH . ' as BR', 'BR.BranchCode = SC.BranchID'); + $this->db->where('LO.MobileNumber', $mobile); + $this->db->where('ST.IsActive', 1); + $this->db->where('BR.Is_StudentWebAccessActive', 1); + $responseDetails = $this->db->get()->first_row(); - if($responseDetails){ + if($responseDetails){ - $save['OTP'] = ''; - $this->db->where('MobileNumber',$mobile); - $this->db->where('ListCode',STUDENT); - - $this->db->update('T_Login',$save); - - - if($responseDetails->LoginAccess == 1){ - $result['loginStatus'] = true; - $result['details'] = $responseDetails; - } else { - $result['loginStatus'] = false; - $result['message'] = "Your login is de-activated."; - } + $save['OTP'] = ''; + $this->db->where('MobileNumber',$mobile); + $this->db->where('ListCode',STUDENT); + + $this->db->update('T_Login',$save); + + + 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 { + $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->join('' . STUDENTCOURSE . ' as SC', 'SC.StudentID = ST.StudentID'); + $this->db->join('' . BRANCH . ' as BR', 'BR.BranchCode = SC.BranchID'); + $this->db->where('LO.MobileNumber', $mobile); + $this->db->where('ST.IsActive', 1); + $this->db->where('BR.Is_StudentMobileAccessActive', 1); + $responseDetails = $this->db->get()->first_row(); + + if($responseDetails){ + + $save['OTP'] = ''; + $this->db->where('MobileNumber',$mobile); + $this->db->where('ListCode',STUDENT); + + $this->db->update('T_Login',$save); + + + 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; - $result['message'] = "Your login is de-activated."; - } + }else{ $result['loginStatus'] = false; $result['message'] = "Please Enter Valid OTP !!"; diff --git a/Apollo/api/application/models/Studentview_model.php b/Apollo/api/application/models/Studentview_model.php index 5ccaf5b8..01b65713 100755 --- a/Apollo/api/application/models/Studentview_model.php +++ b/Apollo/api/application/models/Studentview_model.php @@ -16,7 +16,7 @@ class Studentview_model extends CI_Model * */ // get student list based on login user - public function getStudentInfo($requestedBy=null,$requestFrom=null,$requestedBranch=null) + public function getStudentInfo($requestedBy=null,$requestFrom=null,$requestedBranch=null, $accessFrom=null) { if($requestFrom =='2'){ $this->db->select('ST.*'); @@ -28,7 +28,7 @@ class Studentview_model extends CI_Model $result['studentStatus'] = true; $result['studentDetails'] = $studentDetails; // get student course details - $result['courseDetails'] = $this->getStudentCourse($studentDetails->StudentID,$requestFrom,$requestedBranch); + $result['courseDetails'] = $this->getStudentCourseStudentLogin($studentDetails->StudentID,$requestFrom,$requestedBranch,$accessFrom); } else{ $result['studentStatus'] = false; @@ -77,6 +77,59 @@ class Studentview_model extends CI_Model return $result; } + + public function getStudentCourseStudentLogin($studentId=null,$requestFrom=null,$requestedBranch=null,$accessFrom=null){ + + // this sub query for avoid university duplicate id + $this->db->select('SCU.EnrollmentID,CU.CourseID,CU.CourseName,US.UniversityID,US.UniversityName,US.UniversityShortName'); + $this->db->from( STUDENTCOURSE . ' as SCU'); + $this->db->join( BRANCH . ' as BR', 'BR.BranchCode = SCU.BranchID'); + $this->db->join( COURSE . ' as CU', 'CU.CourseID = SCU.CourseID'); + $this->db->join( UNIVERSITY . ' as US', 'US.UniversityID = SCU.UniversityID AND SCU.BranchID=US.BranchCode'); + $this->db->where('SCU.StudentID',$studentId); + if($accessFrom == 'Web'){ + $this->db->where('BR.Is_StudentWebAccessActive', 1); + } else{ + $this->db->where('BR.Is_StudentMobileAccessActive', 1); + } + $courseDetails = $this->db->get(); + if($courseDetails->result()){ + $studentCourseStatus['status'] = true; + foreach ($courseDetails->result() as $row){ + $fetchData['CourseID']=$row->CourseID; + $fetchData['CourseName']=$row->CourseName; + $fetchData['UniversityID']=$row->UniversityID; + $fetchData['UniversityName']=$row->UniversityName; + $fetchData['UniveShortName'] = $row->UniversityShortName; + // $fetchData['SessionName']=$row->SessionName; + $fetchData['EnrollmentID']=$row->EnrollmentID; + // get student fees details + $fetchData['feesDetails']=$this->getStudentFeesDetails($studentId,$row->CourseID); + // get student boollet details + $fetchData['studyMaterialDetails']=$this->getStudentMaterialDetails($studentId,$row->CourseID); + // get application details + if($requestFrom!='2'){ + $fetchData['applicationDetails']=$this->getStudentApplicationDetails($studentId,$row->CourseID); + $fetchData['answerbookletDetails']=$this->getStudentAnswerbookletDetails($studentId,$row->CourseID); + + + } + $fetchData['certificateDetails']=$this->getStudentCertificateDetails($studentId,$row->CourseID); + $fetchData['markCardDetails']=$this->getMarkcardDetails($studentId,$row->CourseID); + + $CourseArray[]=$fetchData; + + + } + $studentCourseStatus['courseStatus'] = $CourseArray; + } + else{ + $studentCourseStatus['status'] = false; + } + + return $studentCourseStatus; + } + /* * get student course details * created by kms diff --git a/Apollo/assets/js/controllers/branchCtrl.js b/Apollo/assets/js/controllers/branchCtrl.js index e4c1883a..122e5b25 100755 --- a/Apollo/assets/js/controllers/branchCtrl.js +++ b/Apollo/assets/js/controllers/branchCtrl.js @@ -250,7 +250,7 @@ app.controller('branchCtrl', ["$scope","toaster", "$filter", "ngTableParams", "A * created by kms * */ $scope.updateBranch = function (myModel, form, loading) { - +// alert(JSON.stringify(myModel)); var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -284,6 +284,8 @@ app.controller('branchCtrl', ["$scope","toaster", "$filter", "ngTableParams", "A formData.append("status", myModel.IsActive); formData.append("logo", myModel.LogoPath); formData.append("feesTitle", myModel.feesTitle); + formData.append("studnetsWebAccess", myModel.studnetsWebAccess); + formData.append("studentsMobileAccess", myModel.studentsMobileAccess); var checkImg = logoEdit == undefined ? 0 : 1; formData.append("imageStatus", checkImg); diff --git a/Apollo/assets/js/controllers/loginCtrl.js b/Apollo/assets/js/controllers/loginCtrl.js index 63813711..69b8fcba 100755 --- a/Apollo/assets/js/controllers/loginCtrl.js +++ b/Apollo/assets/js/controllers/loginCtrl.js @@ -55,7 +55,8 @@ app.controller('loginCtrl', ["$scope", "$http", "API_POINTS", "$state", '$rootSc }, data: { userMobile: $scope.myModel.userMobile, - password: password + password: password, + accessFrom: 'Web' } }; $http(req).then(function (response) { diff --git a/Apollo/assets/js/controllers/studentViewCtrl.js b/Apollo/assets/js/controllers/studentViewCtrl.js index 85c44313..5d04525e 100755 --- a/Apollo/assets/js/controllers/studentViewCtrl.js +++ b/Apollo/assets/js/controllers/studentViewCtrl.js @@ -20,7 +20,8 @@ app.controller('studentViewCtrl', ["$scope","$rootScope", "toaster", "$filter", }, data: { requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - requestedFrom: 2 + requestedFrom: 2, + accessFrom: 'Web' } }; $http(getcourse).then(function (response) { diff --git a/Apollo/assets/views/editBranchDetails.html b/Apollo/assets/views/editBranchDetails.html index 1877e51f..b7c835c1 100755 --- a/Apollo/assets/views/editBranchDetails.html +++ b/Apollo/assets/views/editBranchDetails.html @@ -235,7 +235,45 @@ +