This commit is contained in:
velz 2018-06-13 19:03:23 +05:30
commit 4588e22c3f
10 changed files with 173 additions and 37 deletions

View File

@ -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'] : '';

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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 !!";

View File

@ -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

View File

@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -235,7 +235,45 @@
</form>
</div>
</div>
<div class="row">
<fieldset>
<legend>
Manage Student Login Access Details
</legend>
<div class="row">
<div class="col-md-4">
<label>
Student Web Access Active/De-Active
</label>
<div ng-if="p.studnetsWebAccess==true">
<switch ng-model="p.studnetsWebAccess" ng-init="p.studnetsWebAccess = true" class="green"></switch>
</div>
<div ng-if="p.studnetsWebAccess==false">
<switch ng-model="p.studnetsWebAccess" ng-init="p.studnetsWebAccess = false" class="green"></switch>
</div>
</div>
<div class="col-md-4">
<label>
Student Mobile Access Active/De-Active
</label>
<div ng-if="p.studentsMobileAccess==true">
<switch ng-model="p.studentsMobileAccess" ng-init="p.studentsMobileAccess = true" class="green"></switch>
</div>
<div ng-if="p.studentsMobileAccess==false">
<switch ng-model="p.studentsMobileAccess" ng-init="p.studentsMobileAccess = false" class="green"></switch>
</div>
</div>
</div>
</fieldset>
</div>
</fieldset>
<div class="col-md-12">
<div class="pull-right">