From 062b103cc13995345400565f6bc254b539541e9d Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Thu, 26 Apr 2018 11:51:02 +0530 Subject: [PATCH] status updation screen changes : kdk --- .../controllers/StatusUpdation_Controller.php | 359 +-- .../controllers/Student_Controller.php | 785 +++--- .../models/StatusUpdation_model.php | 796 +++--- .../api/application/models/Student_model.php | 2196 +++++++---------- 4 files changed, 1699 insertions(+), 2437 deletions(-) diff --git a/Apollo/api/application/controllers/StatusUpdation_Controller.php b/Apollo/api/application/controllers/StatusUpdation_Controller.php index ffbaf0c0..0b2eae72 100755 --- a/Apollo/api/application/controllers/StatusUpdation_Controller.php +++ b/Apollo/api/application/controllers/StatusUpdation_Controller.php @@ -1,11 +1,9 @@ methods['getUniversity_post']['limit'] = 100; + $this->methods['getUniversity_post']['limit'] = 100; $this->methods['chkUnivIdExistDetail_post']['limit'] = 100; - // load the university model + // load the university model $this->load->model('StatusUpdation_model', 'statusupdation_model'); } - + // get University, Course, Branch Detailss public function getUniveCourseBratch_post() { $reqData = $this->post('data'); $loginUserId = $reqData['localUserID']; $loginUserBranchId = $reqData['localBranchID']; $loginUserType = $reqData['localType']; - $getUniversityListDetails = $this->statusupdation_model->get_university_course_batch($loginUserBranchId);// Check if the employee exist - if ($getUniversityListDetails) - { - $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getUniversityListDetails = $this->statusupdation_model->get_university_course_batch($loginUserBranchId); // Check if the employee exist + if ($getUniversityListDetails) { + $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } - + // ger Result fot searched keyword details public function getSearchDetails_post() { $reqSearchData = $this->post('data'); $reqData = $this->post('requestDetails'); - // print_r($reqSearchData);exit(); - - $getSearchDetails = $this->statusupdation_model->get_search_result($reqSearchData, $reqData);// Check if the employee exist - if ($getSearchDetails) - { - $getSearchDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getSearchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getSearchDetails = $this->statusupdation_model->get_search_result($reqSearchData, $reqData); // Check if the employee exist + if ($getSearchDetails) { + $getSearchDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getSearchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } - + // get Sem/year for the respective course public function getSemYearForCourse_post() { $reqData = $this->post('data'); $stuFor = $this->post('stuFor'); $reqBranch = $this->post('reqBranch'); - $getSemYeatList = $this->statusupdation_model->get_semyear_result($reqData, $stuFor, $reqBranch);// Check if the employee exist - if ($getSemYeatList) - { - $getSemYeatList['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getSemYeatList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getSemYeatList = $this->statusupdation_model->get_semyear_result($reqData, $stuFor, $reqBranch); // Check if the employee exist + if ($getSemYeatList) { + $getSemYeatList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getSemYeatList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } - } // update the study material Status public function updateStudentMaterialStatus_post() { $reqData = $this->post('data'); $reqDetails = $this->post('requestDetails'); - $time = date('Y-m-d H:i:s'); $dateTime = $time; - $count = count($reqData); - // echo $reqDetails['localUserID'];exit(); - - for($i=0; $i < $count; $i++) { - $data[] = array( - 'StudentID' => $reqData[$i]['StudentID'], - 'CourseID' => $reqData[$i]['CourseID'], - 'BranchCode' => $reqData[$i]['BranchCode'], - 'ListCode' => $reqData[$i]['ListCode'], - 'SDate' => $reqData[$i]['SDate'], - 'Coursedetail' => $reqData[$i]['Coursedetail'], - 'Comments' => $reqData[$i]['Comments'], - 'Sem' => $reqData[$i]['Sem'], - 'CreatedBy' => $reqDetails['localUserID'], - 'CreatedOn' => $dateTime, - ); + for ($i = 0;$i < $count;$i++) { + $data[] = array('StudentID' => $reqData[$i]['StudentID'], 'CourseID' => $reqData[$i]['CourseID'], 'BranchCode' => $reqData[$i]['BranchCode'], 'ListCode' => $reqData[$i]['ListCode'], 'SDate' => $reqData[$i]['SDate'], 'Coursedetail' => $reqData[$i]['Coursedetail'], 'Comments' => $reqData[$i]['Comments'], 'Sem' => $reqData[$i]['Sem'], 'CreatedBy' => $reqDetails['localUserID'], 'CreatedOn' => $dateTime,); } - - $updateStudentMaterialSta = $this->statusupdation_model->update_semyear($data);// Check if the employee exist - if ($updateStudentMaterialSta) - { - $updateStudentMaterialSta['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($updateStudentMaterialSta, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $updateStudentMaterialSta = $this->statusupdation_model->update_semyear($data); // Check if the employee exist + if ($updateStudentMaterialSta) { + $updateStudentMaterialSta['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateStudentMaterialSta, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } @@ -150,110 +111,63 @@ class StatusUpdation_Controller extends REST_Controller { public function updateAnswerBookLetStatus_post() { $reqData = $this->post('data'); $reqDetails = $this->post('requestDetails'); - $time = date('Y-m-d H:i:s'); $dateTime = $time; - $count = count($reqData); - // echo $reqDetails['localUserID'];exit(); - - for($i=0; $i < $count; $i++) { - $data[] = array( - 'StudentID' => $reqData[$i]['StudentID'], - 'CourseID' => $reqData[$i]['CourseID'], - 'BranchCode' => $reqData[$i]['BranchCode'], - 'ListCode' => $reqData[$i]['ListCode'], - 'AnsDate' => $reqData[$i]['SDate'], - 'Coursedetail' => $reqData[$i]['Coursedetail'], - 'Comments' => $reqData[$i]['Comments'], - 'Sem' => $reqData[$i]['Sem'], - 'CreatedBy' => $reqDetails['localUserID'], - 'CreatedOn' => $dateTime, - ); + for ($i = 0;$i < $count;$i++) { + $data[] = array('StudentID' => $reqData[$i]['StudentID'], 'CourseID' => $reqData[$i]['CourseID'], 'BranchCode' => $reqData[$i]['BranchCode'], 'ListCode' => $reqData[$i]['ListCode'], 'AnsDate' => $reqData[$i]['SDate'], 'Coursedetail' => $reqData[$i]['Coursedetail'], 'Comments' => $reqData[$i]['Comments'], 'Sem' => $reqData[$i]['Sem'], 'CreatedBy' => $reqDetails['localUserID'], 'CreatedOn' => $dateTime,); } - - $updateAnswerBookletStat = $this->statusupdation_model->update_answerbooklet($data,$reqDetails);// Check if the employee exist - if ($updateAnswerBookletStat) - { - $updateAnswerBookletStat['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($updateAnswerBookletStat, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $updateAnswerBookletStat = $this->statusupdation_model->update_answerbooklet($data, $reqDetails); // Check if the employee exist + if ($updateAnswerBookletStat) { + $updateAnswerBookletStat['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateAnswerBookletStat, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } - + // get certification type list public function getCertificateList_post() { $reqData = $this->post('data'); - - $certificateList = $this->statusupdation_model->get_certificate_list();// Check if the employee exist - if ($certificateList) - { - $certificateList['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($certificateList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $certificateList = $this->statusupdation_model->get_certificate_list($reqData['localBranchID']); // Check if the employee exist + if ($certificateList) { + $certificateList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($certificateList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } - } // update certification status public function updateCertificationStatus_post() { $reqData = $this->post('data'); $reqDetails = $this->post('requestDetails'); - $time = date('Y-m-d H:i:s'); $dateTime = $time; - $count = count($reqData); - // echo $reqDetails['localUserID'];exit(); - - for($i=0; $i < $count; $i++) { - $data[] = array( - 'StudentID' => $reqData[$i]['StudentID'], - 'CourseID' => $reqData[$i]['CourseID'], - 'BranchCode' => $reqData[$i]['BranchCode'], - 'ListCode' => $reqData[$i]['ListCode'], - 'CDate' => $reqData[$i]['SDate'], - 'Coursedetail' => $reqData[$i]['Coursedetail'], - 'Comments' => $reqData[$i]['Comments'], - 'Sem' => $reqData[$i]['Sem'], - 'CreatedBy' => $reqDetails['localUserID'], - 'CreatedOn' => $dateTime, - // 'CertificationType' => $reqData[$i]['CertificateType'], - 'CertificationType' => 'MARK CARD', - 'CertificationNo' =>$reqData[$i]['CertificateNumber'], - ); + for ($i = 0;$i < $count;$i++) { + $data[] = array('StudentID' => $reqData[$i]['StudentID'], 'CourseID' => $reqData[$i]['CourseID'], 'BranchCode' => $reqData[$i]['BranchCode'], 'ListCode' => $reqData[$i]['ListCode'], 'CDate' => $reqData[$i]['SDate'], 'Coursedetail' => $reqData[$i]['Coursedetail'], 'Comments' => $reqData[$i]['Comments'], 'Sem' => $reqData[$i]['Sem'], 'CreatedBy' => $reqDetails['localUserID'], 'CreatedOn' => $dateTime, + // 'CertificationType' => $reqData[$i]['CertificateType'], + 'CertificationType' => 'MARK CARD', 'CertificationNo' => $reqData[$i]['CertificateNumber'],); } - - $updateCertificateStatus = $this->statusupdation_model->update_certificateStatus($data);// Check if the employee exist - if ($updateCertificateStatus) - { - $updateCertificateStatus['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($updateCertificateStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $updateCertificateStatus = $this->statusupdation_model->update_certificateStatus($data); // Check if the employee exist + if ($updateCertificateStatus) { + $updateCertificateStatus['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateCertificateStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } @@ -261,42 +175,22 @@ class StatusUpdation_Controller extends REST_Controller { public function updateApplicationStatus_post() { $reqData = $this->post('data'); $reqDetails = $this->post('requestDetails'); - $time = date('Y-m-d H:i:s'); $dateTime = $time; - $count = count($reqData); - // echo $reqDetails['localUserID'];exit(); - - for($i=0; $i < $count; $i++) { - $data[] = array( - 'StudentID' => $reqData[$i]['StudentID'], - 'CourseID' => $reqData[$i]['CourseID'], - 'BranchCode' => $reqData[$i]['BranchCode'], - 'ListCode' => $reqData[$i]['ListCode'], - 'AppDate' => $reqData[$i]['SDate'], - 'Comments' => $reqData[$i]['Comments'], - 'CreatedBy' => $reqDetails['localUserID'], - 'CreatedOn' => $dateTime, - 'CertificationType' => $reqData[$i]['CertificateType'], - 'CertificationNo' =>$reqData[$i]['CertificateNumber'], - ); + for ($i = 0;$i < $count;$i++) { + $data[] = array('StudentID' => $reqData[$i]['StudentID'], 'CourseID' => $reqData[$i]['CourseID'], 'BranchCode' => $reqData[$i]['BranchCode'], 'ListCode' => $reqData[$i]['ListCode'], 'AppDate' => $reqData[$i]['SDate'], 'Comments' => $reqData[$i]['Comments'], 'CreatedBy' => $reqDetails['localUserID'], 'CreatedOn' => $dateTime, 'CertificationType' => $reqData[$i]['CertificateType'], 'CertificationNo' => $reqData[$i]['CertificateNumber'],); } - - $updateApplicationStatus = $this->statusupdation_model->update_applicationStatus($data,$reqDetails);// Check if the employee exist - if ($updateApplicationStatus) - { - $updateApplicationStatus['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($updateApplicationStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $updateApplicationStatus = $this->statusupdation_model->update_applicationStatus($data, $reqDetails); // Check if the employee exist + if ($updateApplicationStatus) { + $updateApplicationStatus['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateApplicationStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } @@ -305,20 +199,16 @@ class StatusUpdation_Controller extends REST_Controller { $reqData = $this->post('data'); $reqDetails = $this->post('statusFor'); $reqBranch = $this->post('reqBranch'); - $getStatusList = $this->statusupdation_model->get_status_list($reqData, $reqBranch);// Check if the employee exist - if ($getStatusList) - { - $getStatusList['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getStatusList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getStatusList = $this->statusupdation_model->get_status_list($reqData, $reqBranch); // Check if the employee exist + if ($getStatusList) { + $getStatusList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getStatusList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } @@ -326,23 +216,16 @@ class StatusUpdation_Controller extends REST_Controller { $reqData = $this->post('data'); $reqDetailsFor = $this->post('statusFor'); $reqDetails = $this->post('getDetailsFor'); - - $getPrevStatusList = $this->statusupdation_model->get_prev_status_list($reqDetailsFor, $reqDetails);// Check if the employee exist - if ($getPrevStatusList) - { - $getPrevStatusList['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getPrevStatusList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getPrevStatusList = $this->statusupdation_model->get_prev_status_list($reqDetailsFor, $reqDetails); // Check if the employee exist + if ($getPrevStatusList) { + $getPrevStatusList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getPrevStatusList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } - } - } diff --git a/Apollo/api/application/controllers/Student_Controller.php b/Apollo/api/application/controllers/Student_Controller.php index 5ec6577b..66862fa3 100755 --- a/Apollo/api/application/controllers/Student_Controller.php +++ b/Apollo/api/application/controllers/Student_Controller.php @@ -1,11 +1,9 @@ methods['addStudent_post']['limit'] = 100; - // load the employee model + // load the employee model $this->load->model('Student_model', 'student_model'); - } - + // list of branch for admin student add screen public function getBranchListDetails_post() { - $reqData = $this->post('data'); - $branchListDetails = $this->student_model->get_branch_list();// Get Branch list - if ($branchListDetails) - { - $branchListDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($branchListDetails, 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 + $reqData = $this->post('data'); + $branchListDetails = $this->student_model->get_branch_list(); // Get Branch list + if ($branchListDetails) { + $branchListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($branchListDetails, 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 + } } // check the branch active for add a new student public function getBranchActiveStatusforStuAdd_post() { - $reqData = $this->post('data'); - $branchId = $reqData['localBranchID']; - // print_r($reqData);exit(); - $checkBranchActiveStatis = $this->student_model->getBranchActiveStatusforStuAdd($branchId);// Get Branch list - if ($checkBranchActiveStatis) - { - $checkBranchActiveStatis['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($checkBranchActiveStatis, 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 + $reqData = $this->post('data'); + $branchId = $reqData['localBranchID']; + $checkBranchActiveStatis = $this->student_model->getBranchActiveStatusforStuAdd($branchId); // Get Branch list + if ($checkBranchActiveStatis) { + $checkBranchActiveStatis['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkBranchActiveStatis, 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 + } } @@ -85,23 +70,17 @@ class Student_Controller extends REST_Controller { $loginUserId = $reqData['localUserID']; $loginUserBranchId = $reqData['localBranchID']; $loginUserType = $reqData['localType']; - - $studentListDetails = $this->student_model->get_student_list( $loginUserId, $loginUserBranchId, $loginUserType, $searchReqData);// Check if the employee exist - if ($studentListDetails) - { - $studentListDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentListDetails, 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 + $studentListDetails = $this->student_model->get_student_list($loginUserId, $loginUserBranchId, $loginUserType, $searchReqData); // Check if the employee exist + if ($studentListDetails) { + $studentListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentListDetails, 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 + } - } public function getStudentUniversity_post() { @@ -109,89 +88,71 @@ class Student_Controller extends REST_Controller { $loginUserId = $reqData['localUserID']; $loginUserBranchId = $reqData['localBranchID']; $loginUserType = $reqData['localType']; - $getUniversityListDetails = $this->student_model->get_university_list($loginUserBranchId);// Check if the employee exist - if ($getUniversityListDetails) - { - $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getUniversityListDetails = $this->student_model->get_university_list($loginUserBranchId); // Check if the employee exist + if ($getUniversityListDetails) { + $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } public function getStudentCourseList_post() { - $studentID = $this->post('studentID'); - $reqData = $this->post('updatedBy'); - $studentCourse = $this->student_model->get_student_course_list( $studentID, $reqData );// Check if the employee exist - if ($studentCourse) - { - $studentCourse['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentCourse, 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 - } + $studentID = $this->post('studentID'); + $reqData = $this->post('updatedBy'); + $studentCourse = $this->student_model->get_student_course_list($studentID, $reqData); // Check if the employee exist + if ($studentCourse) { + $studentCourse['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentCourse, 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 + + } } public function getStudentCourseDetails_post() { - $studentCourseID = $this->post('studentcourseId'); - $studentCourse = $this->student_model->get_student_course( $studentCourseID );// Check if the employee exist - if ($studentCourse) - { - $studentCourse['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentCourse, 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 - } + $studentCourseID = $this->post('studentcourseId'); + $studentCourse = $this->student_model->get_student_course($studentCourseID); // Check if the employee exist + if ($studentCourse) { + $studentCourse['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentCourse, 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 + + } } public function chkUpdateStuExistDetail_post() { $exceptId = $this->post('exceptId'); $datas = $this->post('datas'); $checkFor = $this->post('check'); - - $checkRes = $this->student_model->check_update_exist( $exceptId, $datas, $checkFor );// Check if the employee exist - if ($checkRes) - { - $checkRes['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($checkRes, 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 - } + $checkRes = $this->student_model->check_update_exist($exceptId, $datas, $checkFor); // Check if the employee exist + if ($checkRes) { + $checkRes['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkRes, 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 + + } } - + public function updateStudentCourseDetail_post() { $data = $this->post('data'); $updatedBy = $this->post('updatedBy'); $id = $data['ID']; - $req['StudentID'] = $data['StudentID']; $req['UniversityID'] = $data['UniversityID']; $req['CourseID'] = $data['CourseID']; @@ -200,122 +161,89 @@ class Student_Controller extends REST_Controller { $req['IsActive'] = $data['IsActive']; $req['BranchID'] = $data['BranchID']; $req['EnrollmentID'] = $data['EnrollmentID']; - $req['Specilization1'] = $data['Specilization1']; + $req['Specilization1'] = $data['Specilization1']; $req['Specilization2'] = $data['Specilization2']; - $req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments']; + $req['DeactiveComments'] = $data['IsActive'] == 1 ? '' : $data['DeactiveComments']; $req['UpdatedBy'] = $updatedBy; $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; - - $studentCourseUpdate = $this->student_model->update_student_course( $req, $id ); - if ($studentCourseUpdate) - { - $studentCourseUpdate['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentCourseUpdate, 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 - } + $studentCourseUpdate = $this->student_model->update_student_course($req, $id); + if ($studentCourseUpdate) { + $studentCourseUpdate['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentCourseUpdate, 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 + + } } - // get student entrollment document details + // get student entrollment document details public function getListofStuDocDetails_post() { $StudentID = $this->post('exceptId'); $localdata = $this->post('localData'); - $studentDocDetails = $this->student_model->getStudent_doc_details($StudentID); - if ($studentDocDetails) - { - $studentDocDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentDocDetails, 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 - } + if ($studentDocDetails) { + $studentDocDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentDocDetails, 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 + + } } public function deleteStuDocDetails_post() { $StudentID = $this->post('exceptId'); $docEntryId = $this->post('docDetailsID'); $localdata = $this->post('localData'); - $stuDocDeleteDetails = $this->student_model->deleteStu_doc_details($StudentID, $docEntryId); - if ($stuDocDeleteDetails) - { + if ($stuDocDeleteDetails) { $stuDocDeleteDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($stuDocDeleteDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { + + } 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 + $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 + } - } public function addStudentEntrollDocDetails_post() { - // echo $this->post('stuDocProof_Status');exit(); - $docName = $_FILES['stuDocProof']['name'] ; - $docsize = $_FILES['stuDocProof']['size'] ; + $docName = $_FILES['stuDocProof']['name']; + $docsize = $_FILES['stuDocProof']['size']; $docSource = $_FILES['stuDocProof']['tmp_name']; - - - $temp= $this->post('data'); + $temp = $this->post('data'); $data = json_decode($temp, true); $updatedBy = $this->post('updatedBy'); $studentId = $this->post('studentID'); - $doc_upload_status = $this->post('stuDocProof_Status'); - $req['doc_name'] = $docName; $req['doc_size'] = $docsize; $req['doc_source'] = $docSource; - - $req['document_type_name'] = $data['documentName']; - $req['document_status'] = ''; - $req['document_comments'] = $data['documentComments']; - + $req['document_type_name'] = $data['documentName']; + $req['document_status'] = ''; + $req['document_comments'] = $data['documentComments']; $req['student_id'] = $studentId; - $req['CreatedBy'] = $updatedBy; $date = date('Y-m-d H:i:s'); $req['CreatedOn'] = $date; - - $studentEntrollDocAdd = $this->student_model->student_entroll_doc_add( $req, $doc_upload_status);// Check if the employee exist - if ($studentEntrollDocAdd) - { - $studentEntrollDocAdd['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentEntrollDocAdd, 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 - } - // print_r($temp); - // echo $docName, $studentId, $data['documentName']; - // exit(); - + $studentEntrollDocAdd = $this->student_model->student_entroll_doc_add($req, $doc_upload_status); // Check if the employee exist + if ($studentEntrollDocAdd) { + $studentEntrollDocAdd['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentEntrollDocAdd, 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 + + } } // get student pending enrollment document details @@ -323,48 +251,37 @@ class Student_Controller extends REST_Controller { $StudentID = $this->post('exceptId'); $localdata = $this->post('localData'); $studentPendingDocDetails = $this->student_model->getStudent_PendingDoc_Details($StudentID); - if ($studentPendingDocDetails) - { - $studentPendingDocDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentPendingDocDetails, 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 - } + if ($studentPendingDocDetails) { + $studentPendingDocDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentPendingDocDetails, 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 + + } } public function addStudentEnrollPendingDocDetails_post() { $updateDetails = $this->post('updateDetails'); - $localdata = $this->post('localData'); - - $reqData['StudentID'] = $updateDetails['student']; + $localdata = $this->post('localData'); + $reqData['StudentID'] = $updateDetails['student']; $reqData['Details'] = $updateDetails['doc_Details']; $reqData['Status'] = $updateDetails['checkTracking']; $reqData['CreatedBy'] = $localdata['localUserID']; $date = date('Y-m-d H:i:s'); $reqData['CreatedOn'] = $date; - - $addStudentPendingDocDetails = $this->student_model->addStu_PendingDoc_Details($reqData,$localdata); - - if ($addStudentPendingDocDetails) - { + $addStudentPendingDocDetails = $this->student_model->addStu_PendingDoc_Details($reqData, $localdata); + if ($addStudentPendingDocDetails) { $addStudentPendingDocDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($addStudentPendingDocDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { + + } 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 + $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 + } } @@ -372,44 +289,33 @@ class Student_Controller extends REST_Controller { public function deleteDocPendingDetails_post() { $expID = $this->post('exceptId'); $localData = $this->post('localData'); - // echo $expID; - // print_r($localData);exit(); $stuEnrollPendingDocDeleteDetails = $this->student_model->deleteStu_entrollPending_doc_details($expID); - if ($stuEnrollPendingDocDeleteDetails) - { + if ($stuEnrollPendingDocDeleteDetails) { $stuEnrollPendingDocDeleteDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($stuEnrollPendingDocDeleteDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { + + } 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 + $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 + } } public function updateStudentImgDetails_post() { - $imagename = $_FILES['idStuUpProof']['name']; $size = $_FILES['idStuUpProof']['size']; $imageSource = $_FILES['idStuUpProof']['tmp_name']; - - $temp= $this->post('data'); + $temp = $this->post('data'); $data = json_decode($temp, true); - $updatedBy = $this->post('updatedBy'); $updateStudent = $data['StudentID']; - $req['MobileNumber'] = $data['MobileNumber']; $req['Firstname'] = $data['Firstname']; $req['Lastname'] = $data['Lastname']; $req['Fathername'] = $data['Fathername']; $req['EmailID'] = $data['EmailID']; $req['MotherName'] = $data['MotherName']; - $req['AlternateNumber'] = $data['AlternateNumber']; $req['Gender'] = $data['Gender']; $req['DOB'] = $data['DOB']; @@ -419,7 +325,6 @@ class Student_Controller extends REST_Controller { $req['OtherID'] = $data['OtherID']; $req['OtherIDDetails'] = $data['OtherIDDetails']; $req['Qualification'] = $data['Qualification']; - $req['PreQualification'] = $data['PreQualification']; $req['Caste'] = $data['Caste']; $req['Category'] = $data['Category']; @@ -431,214 +336,169 @@ class Student_Controller extends REST_Controller { $req['ReferredBy'] = $data['ReferredBy']; $req['ReferersMobileNumber'] = $data['ReferersMobileNumber']; $req['ProfilePicPath'] = $data['ProfilePicPath']; - $req['Comments'] = $data['Comments']; - $req['DeactiveComments'] = $data['IsActive'] == 1 ? '': $data['DeactiveComments']; - + $req['Comments'] = $data['Comments']; + $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'); $req['UpdatedOn'] = $date; - $studentUpdate = $this->student_model->update_student( $req, $updateStudent, $imagename, $imageSource, $size );// Check if the employee exist - if ($studentUpdate) - { - $studentUpdate['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentUpdate, 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 - } - + $studentUpdate = $this->student_model->update_student($req, $updateStudent, $imagename, $imageSource, $size); // Check if the employee exist + if ($studentUpdate) { + $studentUpdate['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentUpdate, 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 + + } } - public function updateStudentExistDetail_post(){ - $data = $this->post('data'); - $updatedBy = $this->post('updatedBy'); - $updateStudent = $data['StudentID']; - $imagename = ''; - $size = ''; - $imageSource = ''; - - $req['MobileNumber'] = $data['MobileNumber']; - $req['Firstname'] = $data['Firstname']; - $req['Lastname'] = $data['Lastname']; - $req['Fathername'] = $data['Fathername']; - $req['EmailID'] = $data['EmailID']; - $req['MotherName'] = $data['MotherName']; + public function updateStudentExistDetail_post() { + $data = $this->post('data'); + $updatedBy = $this->post('updatedBy'); + $updateStudent = $data['StudentID']; + $imagename = ''; + $size = ''; + $imageSource = ''; + $req['MobileNumber'] = $data['MobileNumber']; + $req['Firstname'] = $data['Firstname']; + $req['Lastname'] = $data['Lastname']; + $req['Fathername'] = $data['Fathername']; + $req['EmailID'] = $data['EmailID']; + $req['MotherName'] = $data['MotherName']; + $req['AlternateNumber'] = $data['AlternateNumber']; + $req['Gender'] = $data['Gender']; + $req['DOB'] = $data['DOB']; + $req['PresentAddress'] = $data['PresentAddress']; + $req['PermanentAddress'] = $data['PermanentAddress']; + $req['AadharNumber'] = $data['AadharNumber']; + $req['OtherID'] = $data['OtherID']; + $req['OtherIDDetails'] = $data['OtherIDDetails']; + $req['Qualification'] = $data['Qualification']; + $req['PreQualification'] = $data['PreQualification']; + $req['Caste'] = $data['Caste']; + $req['Category'] = $data['Category']; + $req['Religion'] = $data['Religion']; + $req['Nationality'] = $data['Nationality']; + $req['Occupation'] = $data['Occupation']; + $req['Designation'] = $data['Designation']; + $req['Companyname'] = $data['Companyname']; + $req['ReferredBy'] = $data['ReferredBy']; + $req['ReferersMobileNumber'] = $data['ReferersMobileNumber']; + $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'); + $req['UpdatedOn'] = $date; + $studentUpdate = $this->student_model->update_student($req, $updateStudent, $imagename, $imageSource, $size); // Check if the employee exist + if ($studentUpdate) { + $studentUpdate['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - $req['AlternateNumber'] = $data['AlternateNumber']; - $req['Gender'] = $data['Gender']; - $req['DOB'] = $data['DOB']; - $req['PresentAddress'] = $data['PresentAddress']; - $req['PermanentAddress'] = $data['PermanentAddress']; - $req['AadharNumber'] = $data['AadharNumber']; - $req['OtherID'] = $data['OtherID']; - $req['OtherIDDetails'] = $data['OtherIDDetails']; - $req['Qualification'] = $data['Qualification']; - - $req['PreQualification'] = $data['PreQualification']; - $req['Caste'] = $data['Caste']; - $req['Category'] = $data['Category']; - $req['Religion'] = $data['Religion']; - $req['Nationality'] = $data['Nationality']; - $req['Occupation'] = $data['Occupation']; - $req['Designation'] = $data['Designation']; - $req['Companyname'] = $data['Companyname']; - $req['ReferredBy'] = $data['ReferredBy']; - $req['ReferersMobileNumber'] = $data['ReferersMobileNumber']; - $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"; + } 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 - $req['UpdatedBy'] = $updatedBy; - $date = date('Y-m-d H:i:s'); - $req['UpdatedOn'] = $date; - - $studentUpdate = $this->student_model->update_student( $req, $updateStudent, $imagename, $imageSource, $size );// Check if the employee exist - if ($studentUpdate) - { - $studentUpdate['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentUpdate, 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 - } + } } public function getCourseBatch_post() { $data = $this->post('data'); $reqDetails = $this->post('reqDetails'); - - $getCourseBatchListDetails = $this->student_model->get_courseBatch_list($data, $reqDetails['localBranchID']);// Check if the employee exist - if ($getCourseBatchListDetails) - { - $getCourseBatchListDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getCourseBatchListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No list were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + $getCourseBatchListDetails = $this->student_model->get_courseBatch_list($data, $reqDetails['localBranchID']); // Check if the employee exist + if ($getCourseBatchListDetails) { + $getCourseBatchListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getCourseBatchListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } public function chkStudentExistDetail_post() { $data = $this->post('data'); $checkData = $this->post('check'); - $checkRes = $this->student_model->check_exist( $data, $checkData );// Check if the employee exist - if ($checkRes) - { - $checkRes['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($checkRes, 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 - } - + $checkRes = $this->student_model->check_exist($data, $checkData); // Check if the employee exist + if ($checkRes) { + $checkRes['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkRes, 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 + + } } - public function getExistingStudentDetails_post() { - $data = $this->post('data'); - $reqDetails = $this->post('check'); - $checkExisRes = $this->student_model->get_exist_stu_details( $data, $reqDetails );// Check if the employee exist - if ($checkExisRes) - { - $checkExisRes['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($checkExisRes, 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 - } + $data = $this->post('data'); + $reqDetails = $this->post('check'); + $checkExisRes = $this->student_model->get_exist_stu_details($data, $reqDetails); // Check if the employee exist + if ($checkExisRes) { + $checkExisRes['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkExisRes, 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 + + } } - + // add new course for student - public function insertStudentCourse_post(){ - - $addStudent = $this->post('addStudent'); - $coursedata = $this->post('coursedata'); - $createdBy = $this->post('createdBy'); - $createdBranch = $this->post('loginBranch'); - - $reqCourse['StudentID'] = $addStudent; - $reqCourse['UniversityID'] = $coursedata['university']; - $reqCourse['CourseID'] = $coursedata['course']; - $reqCourse['SessionID'] = $coursedata['batch']; - $reqCourse['DOJ'] = $coursedata['dateofjoining']; - $reqCourse['EnrollmentID'] = $coursedata['enrollmentid']; - - $reqCourse['Specilization1'] = $coursedata['specilization1']; - $reqCourse['Specilization2'] = $coursedata['specilization2']; - - $reqCourse['BranchID'] = $createdBranch; - $reqCourse['IsActive'] = '1'; - $reqCourse['CreatedBy'] = $createdBy; - $date = date('Y-m-d H:i:s'); - $reqCourse['CreatedOn'] = $date; -// print_r($reqCourse);exit(); - $studentAddCourse = $this->student_model->add_student_course( $addStudent , $reqCourse);// Check if the employee exist - if ($studentAddCourse) - { - $studentAddCourse['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentAddCourse, 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 - } + public function insertStudentCourse_post() { + $addStudent = $this->post('addStudent'); + $coursedata = $this->post('coursedata'); + $createdBy = $this->post('createdBy'); + $createdBranch = $this->post('loginBranch'); + $reqCourse['StudentID'] = $addStudent; + $reqCourse['UniversityID'] = $coursedata['university']; + $reqCourse['CourseID'] = $coursedata['course']; + $reqCourse['SessionID'] = $coursedata['batch']; + $reqCourse['DOJ'] = $coursedata['dateofjoining']; + $reqCourse['EnrollmentID'] = $coursedata['enrollmentid']; + $reqCourse['Specilization1'] = $coursedata['specilization1']; + $reqCourse['Specilization2'] = $coursedata['specilization2']; + $reqCourse['BranchID'] = $createdBranch; + $reqCourse['IsActive'] = '1'; + $reqCourse['CreatedBy'] = $createdBy; + $date = date('Y-m-d H:i:s'); + $reqCourse['CreatedOn'] = $date; + // print_r($reqCourse);exit(); + $studentAddCourse = $this->student_model->add_student_course($addStudent, $reqCourse); // Check if the employee exist + if ($studentAddCourse) { + $studentAddCourse['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentAddCourse, 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 + + } } public function insertStudentImg_post() { - // print_r($this->post('idProof'));exit(); $imagename = $_FILES['idStuProof']['name']; $size = $_FILES['idStuProof']['size']; $imageSource = $_FILES['idStuProof']['tmp_name']; - // echo $size;exit(); $temp = $this->post('data'); $tempBranch = $this->post('coursedata'); $data = json_decode($temp, true); $coursedata = json_decode($tempBranch, true); - $createdBy = $this->post('createdBy'); $createdBranch = $this->post('loginBranch'); - $req['Firstname'] = $data['firstname']; $req['Lastname'] = $data['lastname']; $req['Fathername'] = $data['fathername']; @@ -664,57 +524,46 @@ class Student_Controller extends REST_Controller { $req['ReferersMobileNumber'] = $data['referredmobilenumber']; $req['PreQualification'] = $data['prequalification']; $req['IsActive'] = $data['switchsetting']; - $req['Comments'] = $data['Comments']; + $req['Comments'] = $data['Comments']; $req['BranchCode'] = $createdBranch; - - $req['DeactiveComments'] = $data['switchsetting'] == 1 ? '': $data['DeactiveComments']; - + $req['DeactiveComments'] = $data['switchsetting'] == 1 ? '' : $data['DeactiveComments']; $req['CreatedBy'] = $createdBy; $date = date('Y-m-d H:i:s'); $req['CreatedOn'] = $date; - $reqCourse['UniversityID'] = $coursedata['university']; $reqCourse['CourseID'] = $coursedata['course']; $reqCourse['SessionID'] = $coursedata['batch']; $reqCourse['DOJ'] = $coursedata['dateofjoining']; - $reqCourse['BranchID'] = $createdBranch; + $reqCourse['BranchID'] = $createdBranch; $reqCourse['IsActive'] = $data['switchsetting']; $reqCourse['EnrollmentID'] = $coursedata['enrollmentid']; - $reqCourse['Specilization1'] = $coursedata['specilization1']; $reqCourse['Specilization2'] = $coursedata['specilization2']; - $reqCourse['CreatedBy'] = $createdBy; $date = date('Y-m-d H:i:s'); $reqCourse['CreatedOn'] = $date; - - $studentAdd = $this->student_model->add_student( $req , $reqCourse, $imagename, $imageSource, $size);// Check if the employee exist - if ($studentAdd) { - $studentAdd['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentAdd, 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 - } + $studentAdd = $this->student_model->add_student($req, $reqCourse, $imagename, $imageSource, $size); // Check if the employee exist + if ($studentAdd) { + $studentAdd['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentAdd, 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 + + } } // add student public function addStudent_post() { - - $imagename = ''; $size = ''; $imageSource = ''; - $data = $this->post('data'); $coursedata = $this->post('coursedata'); $createdBy = $this->post('createdBy'); $createdBranch = $this->post('loginBranch'); - $req['Firstname'] = $data['firstname']; $req['Lastname'] = $data['lastname']; $req['Fathername'] = $data['fathername']; @@ -740,44 +589,34 @@ class Student_Controller extends REST_Controller { $req['ReferersMobileNumber'] = $data['referredmobilenumber']; $req['PreQualification'] = $data['prequalification']; $req['IsActive'] = $data['switchsetting']; - $req['Comments'] = $data['Comments']; + $req['Comments'] = $data['Comments']; $req['BranchCode'] = $createdBranch; - - $req['DeactiveComments'] = $data['switchsetting'] == 1 ? '': $data['DeactiveComments']; - + $req['DeactiveComments'] = $data['switchsetting'] == 1 ? '' : $data['DeactiveComments']; $req['CreatedBy'] = $createdBy; $date = date('Y-m-d H:i:s'); $req['CreatedOn'] = $date; - $reqCourse['UniversityID'] = $coursedata['university']; $reqCourse['CourseID'] = $coursedata['course']; $reqCourse['SessionID'] = $coursedata['batch']; $reqCourse['DOJ'] = $coursedata['dateofjoining']; - $reqCourse['BranchID'] = $createdBranch; + $reqCourse['BranchID'] = $createdBranch; $reqCourse['IsActive'] = $data['switchsetting']; $reqCourse['EnrollmentID'] = $coursedata['enrollmentid']; - $reqCourse['Specilization1'] = $coursedata['specilization1']; $reqCourse['Specilization2'] = $coursedata['specilization2']; - $reqCourse['CreatedBy'] = $createdBy; $date = date('Y-m-d H:i:s'); $reqCourse['CreatedOn'] = $date; - - - $studentAdd = $this->student_model->add_student( $req , $reqCourse, $imagename, $imageSource, $size);// Check if the employee exist - if ($studentAdd) { - $studentAdd['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($studentAdd, 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 - } + $studentAdd = $this->student_model->add_student($req, $reqCourse, $imagename, $imageSource, $size); // Check if the employee exist + if ($studentAdd) { + $studentAdd['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($studentAdd, 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 + + } } - - } diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php index fbb8a207..0d37fba2 100755 --- a/Apollo/api/application/models/StatusUpdation_model.php +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -4,137 +4,118 @@ * Time: 5:28 PM */ defined('BASEPATH') OR exit('No direct script access allowed'); - -class StatusUpdation_model extends CI_Model -{ - +class StatusUpdation_model extends CI_Model { /* * status updation details * params: * created by kdk * */ - public function get_status_list_code($reqDetails) { - if( $reqDetails == 'STUDY_MATERIAL') { + if ($reqDetails == 'STUDY_MATERIAL') { $searchFor = 'M001'; - } else if ( $reqDetails == 'APPICATION_STATUS' ) { + } else if ($reqDetails == 'APPICATION_STATUS') { $searchFor = 'A001'; - } else if ( $reqDetails == 'CERTIFICATION_STATUS' ) { + } else if ($reqDetails == 'CERTIFICATION_STATUS') { $searchFor = 'C001'; - } else if ( $reqDetails == 'ANSWERBOOKLET_STATUS' ) { + } else if ($reqDetails == 'ANSWERBOOKLET_STATUS') { $searchFor = 'B001'; } return $searchFor; } - + // get status list public function get_status_list($reqDetails, $reqBranch) { $statusCode = $this->get_status_list_code($reqDetails); $subQuery = "SELECT P.ListCode , P.ListName - FROM ".PICK_LIST_DETAILS." as P LEFT JOIN ".DEFAULTACTIVITY." as SM ON SM.StatusCode = P.ListCode + FROM " . PICK_LIST_DETAILS . " as P LEFT JOIN " . DEFAULTACTIVITY . " as SM ON SM.StatusCode = P.ListCode WHERE SM.StudentActivityCode = '$statusCode' AND SM.BranchCode = '$reqBranch' - AND SM.IsActive = '1'"; - + AND SM.IsActive = '1'"; $queryDetails = $this->db->query($subQuery); - // $this->db->select('ListCode, ListName'); - // $this->db->order_by('CreatedOn', 'DESC'); - // $this->db->from('T_PickListDetails'); - // $this->db->where('ListCode', 'S034'); - // $staDetails = $this->db->get(); - $statusDetails = $queryDetails->result(); - if (count($statusDetails) > 0) { - $results['statusList'] = true; - $results['statusList_details'] = $statusDetails; - } else { - $results['statusList'] = false; - $results['message'] = 'No record found'; - } + $statusDetails = $queryDetails->result(); + if (count($statusDetails) > 0) { + $results['statusList'] = true; + $results['statusList_details'] = $statusDetails; + } else { + $results['statusList'] = false; + $results['message'] = 'No record found'; + } return $results; } public function get_couser_name($cours) { $this->db->select('t2.CourseName'); - // $this->db->from('' . COURSE_FEES . ' as t1'); $this->db->from('' . COURSE . ' as t2'); $this->db->where('t2.CourseID', $cours); $roleDetails = $this->db->get()->first_row(); - return "$roleDetails->CourseName"; + return "$roleDetails->CourseName"; } - + // update Application status - public function update_applicationStatus($arr,$reqDetails) { + public function update_applicationStatus($arr, $reqDetails) { $this->db->insert_batch(APPLICATION_STATUS, $arr); if ($this->db->affected_rows() >= 1) { - if($this->get_ListCode_status($arr[0]['ListCode'])){ + if ($this->get_ListCode_status($arr[0]['ListCode'])) { $dateToMsg = $arr[0]['AppDate']; $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $getCourseName = $this->get_couser_name($arr[0]['CourseID']); - $mesg = "Status Update : $cerNamtToMsg $getCourseName - $statuToMsg $dateToMsg."; + $mesg = "Status Update : $cerNamtToMsg $getCourseName - $statuToMsg $dateToMsg."; $this->smssend($arr, $mesg); } - // $result['addStatus'] = true; - // $result['message'] = "Successfully Certification Status Updated"; - $this->updateDocumentStatusInCallTrack($arr,$reqDetails); - $result['addStatus'] = true; - $result['message'] = "Successfully Documents Status Updated"; + $this->updateDocumentStatusInCallTrack($arr, $reqDetails); + $result['addStatus'] = true; + $result['message'] = "Successfully Documents Status Updated"; } else { - $result['addStatus'] = false; - $result['message'] = "Something went wrong.please try again"; + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; } - return $result; + return $result; } // update certificate stauts public function update_certificateStatus($arr) { - // $this->get_status_name_ListCode($arr[0]['ListCode']); - // $dateToMsg = $arr[0]['CDate']; - // print_r($arr);exit(); - // echo $this->get_status_name_ListCode($arr[0]['ListCode']);exit(); $this->db->insert_batch(CERTIFICATION_STATUS, $arr); if ($this->db->affected_rows() >= 1) { - // if( ($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Received' || 'received' || 'RECEIVED') || ($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Issued' || 'issued' || 'ISSUED')) { - if($this->get_ListCode_status($arr[0]['ListCode'])){ + if ($this->get_ListCode_status($arr[0]['ListCode'])) { $dateToMsg = $arr[0]['CDate']; $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); // $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $cerNamtToMsg = 'MARK CARD'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); - $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; - - // $mesg = "Status Update : $cerNamtToMsg - $statuToMsg $dateToMsg."; + $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; + // $mesg = "Status Update : $cerNamtToMsg - $statuToMsg $dateToMsg."; $this->smssend($arr, $mesg); } - $result['addStatus'] = true; - $result['message'] = "Successfully Mark Card Status Updated"; + $result['addStatus'] = true; + $result['message'] = "Successfully Mark Card Status Updated"; } else { - $result['addStatus'] = false; - $result['message'] = "Something went wrong.please try again"; + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; } - return $result; + return $result; } - + // get certificate list - public function get_certificate_list() { - $this->db->select('*'); - $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from(CERTIFICATION); - $this->db->where('IsActive', 1); - $cerfDetails = $this->db->get(); - $certificateDetails = $cerfDetails->result(); - if (count($certificateDetails) > 0) { - $results['certificateStatus'] = true; - $results['certificate_details'] = $certificateDetails; - } else { - $results['certificateStatus'] = false; - $results['message'] = 'No record found'; - } + public function get_certificate_list($branchId) { + $this->db->select('*'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(CERTIFICATION); + $this->db->where('IsActive', 1); + $this->db->where('BranchCode', $branchId); + $cerfDetails = $this->db->get(); + $certificateDetails = $cerfDetails->result(); + if (count($certificateDetails) > 0) { + $results['certificateStatus'] = true; + $results['certificate_details'] = $certificateDetails; + } else { + $results['certificateStatus'] = false; + $results['message'] = 'No record found'; + } return $results; } - // self function for getting registered mobile for sms public function get_registered_mobile($num) { $this->db->select('MobileNumber'); @@ -146,27 +127,23 @@ class StatusUpdation_model extends CI_Model // self function for getting the status for the LISTCODE public function get_ListCode_status($listCode) { - // print_r ($listCode);exit(); $this->db->select('ListName'); $this->db->from(PICK_LIST_DETAILS); $this->db->where('ListCode', $listCode); - // $this->db->or_like('ListName', 'RECEIVED'); - // $this->db->or_like('ListName', 'ISSUED'); $statusDetails = $this->db->get()->first_row(); - // echo $statusDetails->ListName;exit(); - if ( $statusDetails->ListName == 'RECEIVED' || $statusDetails->ListName == 'ISSUED') { + if ($statusDetails->ListName == 'RECEIVED' || $statusDetails->ListName == 'ISSUED') { return true; } else { - return false; + return false; } } - public function get_prev_status_list($reqDetailsFor, $reqDetails){ - if( $reqDetailsFor == 'STUDY_MATERIAL') { + public function get_prev_status_list($reqDetailsFor, $reqDetails) { + if ($reqDetailsFor == 'STUDY_MATERIAL') { $searchFor = 'M001'; $searchTableFor = STUDY_MATERIAL_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t2.Sem_Year, t2.ProgramType'); - $this->db->from(''. $searchTableFor . ' as t1'); + $this->db->from('' . $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); $this->db->where('t2.CourseID', $reqDetails['CourseID']); @@ -177,20 +154,18 @@ class StatusUpdation_model extends CI_Model $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { - $results['preStatusDetails'] = true; + $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } - } else if ( $reqDetailsFor == 'APPICATION_STATUS' ) { + } else if ($reqDetailsFor == 'APPICATION_STATUS') { $searchFor = 'A001'; $searchTableFor = APPLICATION_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t6.CertificateName'); - $this->db->from(''. $searchTableFor . ' as t1'); + $this->db->from('' . $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); - // $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); - // $this->db->where('t2.CourseID', $reqDetails['CourseID']); $this->db->join('' . LOGIN . ' as t3', 't3.ID = t1.CreatedBy', 'LEFT'); $this->db->join('' . STAFF . ' as t4', 't4.StaffID = t3.StaffID', 'LEFT'); $this->db->join('' . PICK_LIST_DETAILS . ' as t5', 't5.ListCode = t1.ListCode', 'LEFT'); @@ -199,39 +174,38 @@ class StatusUpdation_model extends CI_Model $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { - $results['preStatusDetails'] = true; + $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } - } else if ( $reqDetailsFor == 'CERTIFICATION_STATUS' ) { + } else if ($reqDetailsFor == 'CERTIFICATION_STATUS') { $searchFor = 'C001'; $searchTableFor = CERTIFICATION_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t2.Sem_Year, t2.ProgramType'); - $this->db->from(''. $searchTableFor . ' as t1'); + $this->db->from('' . $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); $this->db->where('t2.CourseID', $reqDetails['CourseID']); $this->db->join('' . LOGIN . ' as t3', 't3.ID = t1.CreatedBy', 'LEFT'); $this->db->join('' . STAFF . ' as t4', 't4.StaffID = t3.StaffID', 'LEFT'); $this->db->join('' . PICK_LIST_DETAILS . ' as t5', 't5.ListCode = t1.ListCode', 'LEFT'); - // $this->db->join('' . CERTIFICATION . ' as t6', 't6.CertificationID = t1.CertificationType', 'LEFT'); $this->db->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { - $results['preStatusDetails'] = true; + $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } - } else if ( $reqDetailsFor == 'ANSWERBOOKLET_STATUS' ) { + } else if ($reqDetailsFor == 'ANSWERBOOKLET_STATUS') { $searchFor = 'B001'; $searchTableFor = ANSWER_BOOKLET; $this->db->select('t1.*, t4.Firstname, t5.ListName, t2.Sem_Year, t2.ProgramType'); - $this->db->from(''. $searchTableFor . ' as t1'); + $this->db->from('' . $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $this->db->join('' . COURSE_FEES . ' as t2', 't2.ID = t1.CourseID', 'LEFT'); $this->db->where('t2.CourseID', $reqDetails['CourseID']); @@ -242,11 +216,11 @@ class StatusUpdation_model extends CI_Model $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { - $results['preStatusDetails'] = true; + $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } } return $results; @@ -268,21 +242,19 @@ class StatusUpdation_model extends CI_Model $cerfDetails = $this->db->get()->first_row(); return $cerfDetails->CertificateName; } - + // update answer booklet status - public function update_answerbooklet($arr,$reqDetails) { - // print_r($arr);exit(); + public function update_answerbooklet($arr, $reqDetails) { $this->db->insert_batch(ANSWER_BOOKLET, $arr); if ($this->db->affected_rows() >= 1) { - $this->updateBookletStatusInCallTrack($arr,$reqDetails); - // $this->smssend($arr); - $result['addStatus'] = true; - $result['message'] = "Successfully Answer Booklet Status Updated"; + $this->updateBookletStatusInCallTrack($arr, $reqDetails); + $result['addStatus'] = true; + $result['message'] = "Successfully Answer Booklet Status Updated"; } else { - $result['addStatus'] = false; - $result['message'] = "Something went wrong.please try again"; + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; } - return $result; + return $result; } public function get_couser_sem_yr_msg($cours) { @@ -291,284 +263,216 @@ class StatusUpdation_model extends CI_Model $this->db->join('' . COURSE . ' as t2', 't2.CourseID = t1.CourseID', 'LEFT'); $this->db->where('ID', $cours); $roleDetails = $this->db->get()->first_row(); - return "$roleDetails->Sem_Year $roleDetails->CourseName"; - + return "$roleDetails->Sem_Year $roleDetails->CourseName"; } // update study material status public function update_semyear($arr) { - // echo $cours;exit(); - // $this->get_status_name_ListCode($arr[0]['ListCode']); $this->db->insert_batch(STUDY_MATERIAL_STATUS, $arr); if ($this->db->affected_rows() >= 1) { - // if(($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Received' || 'received' || 'Active') || ($this->get_status_name_ListCode($arr[0]['ListCode']) == 'Issued' || 'issued')) { - if($this->get_ListCode_status($arr[0]['ListCode']) == true) { - $dateToMsg = $arr[0]['SDate']; - $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); - $cerNamtToMsg = 'Study Material'; - $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); - $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; - $this->smssend($arr, $mesg); - } - // $this->smssend($arr); - $result['addStatus'] = true; - $result['message'] = "Successfully Study Material Status Updated"; + if ($this->get_ListCode_status($arr[0]['ListCode']) == true) { + $dateToMsg = $arr[0]['SDate']; + $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); + $cerNamtToMsg = 'Study Material'; + $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); + $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; + $this->smssend($arr, $mesg); + } + $result['addStatus'] = true; + $result['message'] = "Successfully Study Material Status Updated"; } else { - $result['addStatus'] = false; - $result['message'] = "Something went wrong.please try again"; + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; } - return $result; + return $result; } // get sem/Year for the course public function get_semyear_result($reqData, $stuFor, $reqBranch) { - // echo $stuFor;exit(); $subQuery = "SELECT CF.Sem_Year, CF.ID , IF(CF.ProgramType = 'Y001', '0', '1') as SEM_YEAR_TYPE - FROM ".COURSE_FEES." as CF LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.FeesType = CF.ID + FROM " . COURSE_FEES . " as CF LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.FeesType = CF.ID WHERE SFS.CourseID = '$reqData' AND SFS.StudentID = '$stuFor'"; - // AND CF.ProgramType ='Y001'"; - $queryDetails = $this->db->query($subQuery); - $results['semYearResult'] = true; - $results['semYear_result_details'] = $queryDetails->result(); - return $results; + $queryDetails = $this->db->query($subQuery); + $results['semYearResult'] = true; + $results['semYear_result_details'] = $queryDetails->result(); + return $results; } - + // get serach result public function get_search_result($reqData, $req) { - // print_r($reqData['University']); - // print_r($req); - // exit(); $University = $reqData['University']; $Course = $reqData['Course']; $Batch = $reqData['Batch']; $branch = $req['localBranchID']; - if( $branch == 'All' ) { - - // echo $University; - // echo $branch - - if($University != '' && $Course == '' && $Batch == '') { - $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON + if ($branch == 'All') { + if ($University != '' && $Course == '' && $Batch == '') { + $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID WHERE SC.UniversityID = '$University' AND S.IsActive = '1' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); - } else if ($University != '' && $Course != '' && $Batch == '' ) { - $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + } else if ($University != '' && $Course != '' && $Batch == '') { + $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND S.IsActive = '1' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); - } else if ( $University != '' && $Course == '' && $Batch != '' ) { - $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + } else if ($University != '' && $Course == '' && $Batch != '') { + $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID - LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.StudentID = SC.StudentID + LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID WHERE SFS.CourseID = SC.CourseID AND SFS.BatchCode = '$Batch' AND SC.UniversityID = '$University' AND S.IsActive = '1' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); - }else if ( $University != '' && $Course != '' && $Batch != '' ) { - $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + } else if ($University != '' && $Course != '' && $Batch != '') { + $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID - LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.StudentID = SC.StudentID + LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID WHERE SFS.CourseID = SC.CourseID AND SFS.BatchCode = '$Batch' AND SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND S.IsActive = '1' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); } } else { - // echo $University; - // echo $branch; - - if($University != '' && $Course == '' && $Batch == '') { - $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode LEFT JOIN ".COURSE." as C ON + if ($University != '' && $Course == '' && $Batch == '') { + $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.UniversityID = '$University' AND S.IsActive = '1' AND SC.BranchID = '$branch' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); - } else if ($University != '' && $Course != '' && $Batch == '' ) { - $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode LEFT JOIN ".COURSE." as C ON + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + } else if ($University != '' && $Course != '' && $Batch == '') { + $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND S.IsActive = '1' AND SC.BranchID = '$branch' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); - } else if ( $University != '' && $Course == '' && $Batch != '' ) { + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + } else if ($University != '' && $Course == '' && $Batch != '') { $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode - LEFT JOIN ".COURSE." as C ON C.CourseID = SC.CourseID AND SC.BranchID = C.BranchCode - LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.StudentID = SC.StudentID AND SC.BranchID = SFS.BranchCode + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON C.CourseID = SC.CourseID AND SC.BranchID = C.BranchCode + LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID AND SC.BranchID = SFS.BranchCode WHERE SFS.CourseID = SC.CourseID AND SFS.BatchCode = '$Batch' AND SC.UniversityID = '$University' AND S.IsActive = '1' AND SC.BranchID = '$branch' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' - $queryDetails = $this->db->query($subQuery); - $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); - } else if ( $University != '' && $Course != '' && $Batch != '' ) { + AND SC.IsActive = '1'"; + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + } else if ($University != '' && $Course != '' && $Batch != '') { $subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName - FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID - LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode LEFT JOIN ".COURSE." as C ON + FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode - LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.StudentID = SC.StudentID AND SC.BranchID = SFS.BranchCode + LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID AND SC.BranchID = SFS.BranchCode WHERE SFS.CourseID = SC.CourseID AND SFS.BatchCode = '$Batch' AND SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND S.IsActive = '1' AND SC.BranchID = '$branch' - AND SC.IsActive = '1'"; - // AND S.BranchCode = '$branch' - // SC.UniversityID LIKE '%$University%' - // AND SC.CourseID LIKE '%$Course%' - // AND SC.BatchCode LIKE '%$Batch%' + AND SC.IsActive = '1'"; $queryDetails = $this->db->query($subQuery); $results['searchResult'] = true; - $results['search_result_details'] = $queryDetails->result(); + $results['search_result_details'] = $queryDetails->result(); } } - return $results; + return $results; } - + // get list of universities, course, batch public function get_university_course_batch($branch) { $this->db->select('t1.UniversityID, t1.UniversityName'); $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from(''.UNIVERSITY. ' as t1'); + $this->db->from('' . UNIVERSITY . ' as t1'); $this->db->where('BranchCode', $branch); $this->db->where('IsActive', 1); - // $this->db->join('' . COURSE . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT'); $univDetails = $this->db->get(); $universityDetails = $univDetails->result(); $endResult = []; - foreach($universityDetails as $clip){ + foreach ($universityDetails as $clip) { // University Details $resultArr['UniversityID'] = $clip->UniversityID; $resultArr['UniversityName'] = $clip->UniversityName; // Course Details $this->db->select('t2.CourseID, t2.CourseName, t2.CourseCode'); - $this->db->from(''.COURSE. ' as t2'); + $this->db->from('' . COURSE . ' as t2'); $this->db->where('t2.UniversityID', $clip->UniversityID); $this->db->where('t2.IsActive', 1); - $this->db->where('BranchCode', $branch); + $this->db->where('t2.BranchCode', $branch); $courDetails = $this->db->get(); $courseDetails = $courDetails->result(); - $resultArr['Course'] =$courseDetails; + $resultArr['Course'] = $courseDetails; // Batch Details $this->db->select('t3.BatchName, t3.BatchCode'); - $this->db->from(''.BATCH. ' as t3'); + $this->db->from('' . BATCH . ' as t3'); $this->db->where('t3.UniversityID', $clip->UniversityID); $this->db->where('t3.IsActive', 1); - $this->db->where('BranchCode', $branch); - - //Session Details - // $this->db->select('B.SessionID, B.SessionName'); - // $this->db->from(SESSIONMASTER . ' as B'); - // $this->db->join(SESSIONDETAILS . ' SD', 'SD.SessionID = B.SessionID'); - // $this->db->where('SD.UniversityID', $clip->UniversityID); - // $this->db->where('B.IsActive', 1); - // $this->db->where('SD.IsActive', 1); - + $this->db->where('t3.BranchCode', $branch); $batDetails = $this->db->get(); $batchDetails = $batDetails->result(); - $resultArr['Batch'] =$batchDetails; + $resultArr['Batch'] = $batchDetails; array_push($endResult, $resultArr); } - $results['univList'] = true; + $results['univList'] = true; $results['university_details'] = $endResult; return $results; } - // http://www.24x7sms.com/downloads/24X7SMS_http_API2.0.pdf // API Key : xegCdYUIMf3 // Your new password for logging into Apollo student portal is (Password). Please change the password as soon as you login. // This is the template to be used. - public function smssend($arr, $msg) - { - $number =array(); - foreach($arr as $ar){ - $mobi = $this->get_registered_mobile($ar['StudentID']); - array_push($number, "91$mobi"); + public function smssend($arr, $msg) { + $number = array(); + foreach ($arr as $ar) { + $mobi = $this->get_registered_mobile($ar['StudentID']); + array_push($number, "91$mobi"); } $mobile = implode(',', $number); - // $message ="Your new password for logging into Apollo student portal is SAMPLE. Please change the password as soon as you login."; - // $mobile = "91$mobile"; - $message = urlencode($msg); - // echo $mobile , $message; - $ch=curl_init(); - curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=".$mobile."&SenderID=APOLLO&Message=".$message."&ServiceName=TEMPLATE_BASED"); - + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $mobile . "&SenderID=APOLLO&Message=" . $message . "&ServiceName=TEMPLATE_BASED"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - $output =curl_exec($ch); - - // print_r($output);exit(); + $output = curl_exec($ch); curl_close($ch); return $output; } @@ -576,7 +480,6 @@ class StatusUpdation_model extends CI_Model // public function mailsend() { // //Load email library // $this->load->library('email'); - // //SMTP & mail configuration // $config = array( // 'protocol' => 'smtp', @@ -590,87 +493,74 @@ class StatusUpdation_model extends CI_Model // $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(); // } - /* * update followup details for booklet details in call tracking * created by kms * */ - public function updateBookletStatusInCallTrack($fromDetails=null,$reqDetails=null){ + public function updateBookletStatusInCallTrack($fromDetails = null, $reqDetails = null) { // get student details $this->db->select('PLD.ListCode'); - $this->db->from(PICK_LIST_DETAILS.' as PLD'); - $this->db->where('PLD.ListName','ISSUED TO STUDENTS'); - $this->db->where('PLD.ListCode',$fromDetails[0]['ListCode']); - $this->db->where('PLD.IsActive','1'); - $checkStatus=$this->db->get()->last_row(); - if($checkStatus){ - - + $this->db->from(PICK_LIST_DETAILS . ' as PLD'); + $this->db->where('PLD.ListName', 'ISSUED TO STUDENTS'); + $this->db->where('PLD.ListCode', $fromDetails[0]['ListCode']); + $this->db->where('PLD.IsActive', '1'); + $checkStatus = $this->db->get()->last_row(); + if ($checkStatus) { $studentDetails = $this->studentInfo($fromDetails); - if($studentDetails){ - $arrayDetails['MobileNumber']=$studentDetails->MobileNumber; - $arrayDetails['LeadName']=$studentDetails->Firstname; - $arrayDetails['University']=$studentDetails->UniversityName; - $arrayDetails['Course']=$studentDetails->CourseName; - $arrayDetails['StatusCode']=$fromDetails[0]['ListCode']; - $arrayDetails['CreatedBranch']=$fromDetails[0]['BranchCode']; - $arrayDetails['CreatedOn']=$fromDetails[0]['CreatedOn']; - $arrayDetails['FollowupOn']=$fromDetails[0]['AnsDate']; - $arrayDetails['FollowupComments']=$fromDetails[0]['Comments']; - if($reqDetails['localType']==SUPER_ADMIN){ + if ($studentDetails) { + $arrayDetails['MobileNumber'] = $studentDetails->MobileNumber; + $arrayDetails['LeadName'] = $studentDetails->Firstname; + $arrayDetails['University'] = $studentDetails->UniversityName; + $arrayDetails['Course'] = $studentDetails->CourseName; + $arrayDetails['StatusCode'] = $fromDetails[0]['ListCode']; + $arrayDetails['CreatedBranch'] = $fromDetails[0]['BranchCode']; + $arrayDetails['CreatedOn'] = $fromDetails[0]['CreatedOn']; + $arrayDetails['FollowupOn'] = $fromDetails[0]['AnsDate']; + $arrayDetails['FollowupComments'] = $fromDetails[0]['Comments']; + if ($reqDetails['localType'] == SUPER_ADMIN) { $this->db->select('LO.ID'); - $this->db->from(STAFF_BRANCH.' as STB'); - $this->db->join(LOGIN.' as LO', 'LO.StaffID = STB.StaffID'); - $this->db->where('STB.BranchCode',$fromDetails[0]['BranchCode']); - $this->db->where('LO.ListCode',ADMIN); - $this->db->where('STB.IsActive','1'); - $this->db->where('LO.IsActive','1'); - $assignDet=$this->db->get()->last_row(); - if($assignDet){ - $arrayDetails['CreatedBy']=$assignDet->ID; + $this->db->from(STAFF_BRANCH . ' as STB'); + $this->db->join(LOGIN . ' as LO', 'LO.StaffID = STB.StaffID'); + $this->db->where('STB.BranchCode', $fromDetails[0]['BranchCode']); + $this->db->where('LO.ListCode', ADMIN); + $this->db->where('STB.IsActive', '1'); + $this->db->where('LO.IsActive', '1'); + $assignDet = $this->db->get()->last_row(); + if ($assignDet) { + $arrayDetails['CreatedBy'] = $assignDet->ID; + } else { + $arrayDetails['CreatedBy'] = $fromDetails[0]['CreatedBy']; } - else{ - $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; - } - + } else { + $arrayDetails['CreatedBy'] = $fromDetails[0]['CreatedBy']; } - else{ - $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; - } - // create activity in call tracking $this->db->select('ActivityID,ActivityName'); $this->db->like('ActivityName', 'Answer Booklet', 'after'); $this->db->where('IsActive', '1'); - $activityDetails=$this->db->get(ACTIVITY)->last_row(); - if($activityDetails){ - + $activityDetails = $this->db->get(ACTIVITY)->last_row(); + if ($activityDetails) { $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; $newLeadDetails['LeadName'] = $arrayDetails['LeadName']; $newLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_DETAILS, $newLeadDetails); // this if for insert lead details - if($this->db->affected_rows() == '1'){ + if ($this->db->affected_rows() == '1') { // get and store insert id from db - $track_Details['LeadID']=$this->db->insert_id(); + $track_Details['LeadID'] = $this->db->insert_id(); $track_Details['ActivityStatus'] = $activityDetails->ActivityID; $track_Details['University'] = $arrayDetails['University']; $track_Details['Course'] = $arrayDetails['Course']; @@ -678,25 +568,21 @@ class StatusUpdation_model extends CI_Model $track_Details['StatusCode'] = $arrayDetails['StatusCode']; $track_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $track_Details['CreatedOn'] = $arrayDetails['CreatedOn']; - $track_Details['CreatedBranch']=$arrayDetails['CreatedBranch']; + $track_Details['CreatedBranch'] = $arrayDetails['CreatedBranch']; $this->db->insert(LEAD_TRACKING, $track_Details); // this if for insert tracking details - if($this->db->affected_rows() == '1'){ - $insertfollowup_Details['TrackingID']=$this->db->insert_id(); - $insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn']; - $insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments']; + if ($this->db->affected_rows() == '1') { + $insertfollowup_Details['TrackingID'] = $this->db->insert_id(); + $insertfollowup_Details['FollowupOn'] = $arrayDetails['FollowupOn']; + $insertfollowup_Details['FollowupComments'] = $arrayDetails['FollowupComments']; $insertfollowup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); // this if for insert follow up details - + } - - } - // hide tracking updated code - /*$this->db->select('LD.LeadID,LT.TrackingID'); $this->db->from(LEAD_DETAILS.' as LD'); $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID'); @@ -705,7 +591,7 @@ class StatusUpdation_model extends CI_Model $this->db->like('LT.University',$arrayDetails['University'],'after'); $this->db->like('LT.Course',$arrayDetails['Course'],'after'); $leadDet=$this->db->get()->last_row(); - + if($leadDet){ $this->db->select('FollowupOn'); $this->db->where('TrackingID',$leadDet->TrackingID); @@ -716,7 +602,7 @@ class StatusUpdation_model extends CI_Model $changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy']; $changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn']; $changeStatusCode['CreatedBranch']=$arrayDetails['CreatedBranch']; - + $this->db->where('TrackingID',$leadDet->TrackingID); $this->db->update(LEAD_TRACKING, $changeStatusCode); // end update status @@ -726,9 +612,9 @@ class StatusUpdation_model extends CI_Model $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $updateTrackDetails); - + } - + else{ $this->db->select('LeadID'); $this->db->where('MobileNumber',$arrayDetails['MobileNumber']); @@ -753,9 +639,9 @@ class StatusUpdation_model extends CI_Model $followup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details); // this if for insert follow up details - + } - + } else{ $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; @@ -785,100 +671,87 @@ class StatusUpdation_model extends CI_Model $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); // this if for insert follow up details - + } - - + + } - + } - - + + }*/ - - } } - return true; - } - else{ + } else { return false; } } - /* - * update followup details for application status in call tracking - * created by kms - * */ - public function updateDocumentStatusInCallTrack($fromDetails=null,$reqDetails=null){ - - + * update followup details for application status in call tracking + * created by kms + * */ + public function updateDocumentStatusInCallTrack($fromDetails = null, $reqDetails = null) { // check certificate type $this->db->select('CFM.CertificationID'); - $this->db->from(CERTIFICATION_MASTER.' as CFM'); - $this->db->where('CFM.CertificateName','APPLICATION'); - $this->db->where('CFM.CertificationID',$fromDetails[0]['CertificationType']); - $this->db->where('CFM.IsActive','1'); - $checkApplicationStatus=$this->db->get()->last_row(); - if($checkApplicationStatus){ + $this->db->from(CERTIFICATION_MASTER . ' as CFM'); + $this->db->where('CFM.CertificateName', 'APPLICATION'); + $this->db->where('CFM.CertificationID', $fromDetails[0]['CertificationType']); + $this->db->where('CFM.IsActive', '1'); + $checkApplicationStatus = $this->db->get()->last_row(); + if ($checkApplicationStatus) { // get student details $this->db->select('PLD.ListCode'); - $this->db->from(PICK_LIST_DETAILS.' as PLD'); - $this->db->where('PLD.ListName','PENDING'); - $this->db->where('PLD.ListCode',$fromDetails[0]['ListCode']); - $this->db->where('PLD.IsActive','1'); - $checkStatus=$this->db->get()->last_row(); - if($checkStatus){ - + $this->db->from(PICK_LIST_DETAILS . ' as PLD'); + $this->db->where('PLD.ListName', 'PENDING'); + $this->db->where('PLD.ListCode', $fromDetails[0]['ListCode']); + $this->db->where('PLD.IsActive', '1'); + $checkStatus = $this->db->get()->last_row(); + if ($checkStatus) { $studentDetails = $this->studentInfoForDocumentStatus($fromDetails); - if($studentDetails){ - $arrayDetails['MobileNumber']=$studentDetails->MobileNumber; - $arrayDetails['LeadName']=$studentDetails->Firstname; - $arrayDetails['University']=$studentDetails->UniversityName; - $arrayDetails['Course']=$studentDetails->CourseName; - $arrayDetails['StatusCode']=$fromDetails[0]['ListCode']; - $arrayDetails['CreatedBranch']=$fromDetails[0]['BranchCode']; - $arrayDetails['CreatedOn']=$fromDetails[0]['CreatedOn']; - $arrayDetails['FollowupOn']=$fromDetails[0]['AppDate']; - $arrayDetails['FollowupComments']=$fromDetails[0]['Comments']; - if($reqDetails['localType']==SUPER_ADMIN){ + if ($studentDetails) { + $arrayDetails['MobileNumber'] = $studentDetails->MobileNumber; + $arrayDetails['LeadName'] = $studentDetails->Firstname; + $arrayDetails['University'] = $studentDetails->UniversityName; + $arrayDetails['Course'] = $studentDetails->CourseName; + $arrayDetails['StatusCode'] = $fromDetails[0]['ListCode']; + $arrayDetails['CreatedBranch'] = $fromDetails[0]['BranchCode']; + $arrayDetails['CreatedOn'] = $fromDetails[0]['CreatedOn']; + $arrayDetails['FollowupOn'] = $fromDetails[0]['AppDate']; + $arrayDetails['FollowupComments'] = $fromDetails[0]['Comments']; + if ($reqDetails['localType'] == SUPER_ADMIN) { $this->db->select('LO.ID'); - $this->db->from(STAFF_BRANCH.' as STB'); - $this->db->join(LOGIN.' as LO', 'LO.StaffID = STB.StaffID'); - $this->db->where('STB.BranchCode',$fromDetails[0]['BranchCode']); - $this->db->where('LO.ListCode',ADMIN); - $this->db->where('STB.IsActive','1'); - $this->db->where('LO.IsActive','1'); - $assignDet=$this->db->get()->last_row(); - if($assignDet){ - $arrayDetails['CreatedBy']=$assignDet->ID; + $this->db->from(STAFF_BRANCH . ' as STB'); + $this->db->join(LOGIN . ' as LO', 'LO.StaffID = STB.StaffID'); + $this->db->where('STB.BranchCode', $fromDetails[0]['BranchCode']); + $this->db->where('LO.ListCode', ADMIN); + $this->db->where('STB.IsActive', '1'); + $this->db->where('LO.IsActive', '1'); + $assignDet = $this->db->get()->last_row(); + if ($assignDet) { + $arrayDetails['CreatedBy'] = $assignDet->ID; + } else { + $arrayDetails['CreatedBy'] = $fromDetails[0]['CreatedBy']; } - else{ - $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; - } - + } else { + $arrayDetails['CreatedBy'] = $fromDetails[0]['CreatedBy']; } - else{ - $arrayDetails['CreatedBy']=$fromDetails[0]['CreatedBy']; - } - // create activity in call tracking $this->db->select('ActivityID,ActivityName'); $this->db->like('ActivityName', 'Application', 'after'); $this->db->where('IsActive', '1'); - $activityDetails=$this->db->get(ACTIVITY)->last_row(); - if($activityDetails){ - + $activityDetails = $this->db->get(ACTIVITY)->last_row(); + if ($activityDetails) { $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; $newLeadDetails['LeadName'] = $arrayDetails['LeadName']; $newLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_DETAILS, $newLeadDetails); // this if for insert lead details - if($this->db->affected_rows() == '1'){ + if ($this->db->affected_rows() == '1') { // get and store insert id from db - $track_Details['LeadID']=$this->db->insert_id(); + $track_Details['LeadID'] = $this->db->insert_id(); $track_Details['ActivityStatus'] = $activityDetails->ActivityID; $track_Details['University'] = $arrayDetails['University']; $track_Details['Course'] = $arrayDetails['Course']; @@ -886,25 +759,21 @@ class StatusUpdation_model extends CI_Model $track_Details['StatusCode'] = $arrayDetails['StatusCode']; $track_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $track_Details['CreatedOn'] = $arrayDetails['CreatedOn']; - $track_Details['CreatedBranch']=$arrayDetails['CreatedBranch']; + $track_Details['CreatedBranch'] = $arrayDetails['CreatedBranch']; $this->db->insert(LEAD_TRACKING, $track_Details); // this if for insert tracking details - if($this->db->affected_rows() == '1'){ - $insertfollowup_Details['TrackingID']=$this->db->insert_id(); - $insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn']; - $insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments']; + if ($this->db->affected_rows() == '1') { + $insertfollowup_Details['TrackingID'] = $this->db->insert_id(); + $insertfollowup_Details['FollowupOn'] = $arrayDetails['FollowupOn']; + $insertfollowup_Details['FollowupComments'] = $arrayDetails['FollowupComments']; $insertfollowup_Details['CreatedBy'] = $arrayDetails['CreatedBy']; $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); // this if for insert follow up details - + } - - } - /// hide seperate track id - /* $this->db->select('LD.LeadID,LT.TrackingID'); $this->db->from(LEAD_DETAILS.' as LD'); $this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID'); @@ -913,7 +782,7 @@ class StatusUpdation_model extends CI_Model $this->db->like('LT.University',$arrayDetails['University'],'after'); $this->db->like('LT.Course',$arrayDetails['Course'],'after'); $leadDet=$this->db->get()->last_row(); - + if($leadDet){ $this->db->select('FollowupOn'); $this->db->where('TrackingID',$leadDet->TrackingID); @@ -924,7 +793,7 @@ class StatusUpdation_model extends CI_Model $changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy']; $changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn']; $changeStatusCode['CreatedBranch']=$arrayDetails['CreatedBranch']; - + $this->db->where('TrackingID',$leadDet->TrackingID); $this->db->update(LEAD_TRACKING, $changeStatusCode); // end update status @@ -934,9 +803,9 @@ class StatusUpdation_model extends CI_Model $updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy']; $updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $updateTrackDetails); - + } - + else{ $this->db->select('LeadID'); $this->db->where('MobileNumber',$arrayDetails['MobileNumber']); @@ -961,9 +830,9 @@ class StatusUpdation_model extends CI_Model $followup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details); // this if for insert follow up details - + } - + } else{ $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; @@ -993,80 +862,63 @@ class StatusUpdation_model extends CI_Model $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); // this if for insert follow up details - + } - - + + } - + } - - + + }*/ - - } } - - return true; - } - else{ + } else { return false; } - } - else{ + } else { return false; } - } - /* * get student info * created by kms * */ - public function studentInfo($details=null){ - + public function studentInfo($details = null) { $this->db->select('ST.Firstname,ST.MobileNumber,US.UniversityName,CU.CourseName'); - $this->db->from(COURSE_FEES.' as CF'); - $this->db->join(STUDENTCOURSE.' as STC', 'STC.CourseID = CF.CourseID'); - $this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID'); - $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); - $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID'); - $this->db->where('ST.StudentID',$details[0]['StudentID']); - $this->db->where('CF.ID',$details[0]['CourseID']); - $leadDet=$this->db->get()->last_row(); - if($leadDet){ + $this->db->from(COURSE_FEES . ' as CF'); + $this->db->join(STUDENTCOURSE . ' as STC', 'STC.CourseID = CF.CourseID'); + $this->db->join(STUDENTS . ' as ST', 'ST.StudentID = STC.StudentID'); + $this->db->join(COURSE . ' as CU', 'CU.CourseID = STC.CourseID'); + $this->db->join(UNIVERSITY . ' as US', 'US.UniversityID = STC.UniversityID'); + $this->db->where('ST.StudentID', $details[0]['StudentID']); + $this->db->where('CF.ID', $details[0]['CourseID']); + $leadDet = $this->db->get()->last_row(); + if ($leadDet) { return $leadDet; + } else { + return false; } - else{ - return false; - } - } /* * get student info for documet updates * created by kms * */ - public function studentInfoForDocumentStatus($details=null){ - + public function studentInfoForDocumentStatus($details = null) { $this->db->select('ST.Firstname,ST.MobileNumber,US.UniversityName,CU.CourseName'); - $this->db->from(STUDENTCOURSE.' as STC'); - $this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID'); - $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); - $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID'); - $this->db->where('ST.StudentID',$details[0]['StudentID']); - $this->db->where('STC.CourseID',$details[0]['CourseID']); - $leadDet=$this->db->get()->last_row(); - if($leadDet){ + $this->db->from(STUDENTCOURSE . ' as STC'); + $this->db->join(STUDENTS . ' as ST', 'ST.StudentID = STC.StudentID'); + $this->db->join(COURSE . ' as CU', 'CU.CourseID = STC.CourseID'); + $this->db->join(UNIVERSITY . ' as US', 'US.UniversityID = STC.UniversityID'); + $this->db->where('ST.StudentID', $details[0]['StudentID']); + $this->db->where('STC.CourseID', $details[0]['CourseID']); + $leadDet = $this->db->get()->last_row(); + if ($leadDet) { return $leadDet; - } - else{ + } else { return false; } - } - - - -} \ No newline at end of file +} diff --git a/Apollo/api/application/models/Student_model.php b/Apollo/api/application/models/Student_model.php index 5413e658..ea272438 100755 --- a/Apollo/api/application/models/Student_model.php +++ b/Apollo/api/application/models/Student_model.php @@ -4,141 +4,89 @@ * Time: 5:28 PM */ defined('BASEPATH') OR exit('No direct script access allowed'); -class Student_model extends CI_Model +class Student_model extends CI_Model { + /* + * student details + * + * created by kdk + * */ -{ - /* - * student details - * - * created by kdk - * */ + // get List of Branches + public function get_branch_list() { + $this->db->select('t1.BranchCode,t1.BranchName'); + $this->db->from('' . BRANCH . ' as t1'); + $branchDetails = $this->db->get(); + $checkArr = $branchDetails->result(); + if (count($checkArr) > 0) { + $result['branDetailstatus'] = true; + $result['branch_details'] = $branchDetails->result(); + } else { + $result['branDetailstatus'] = false; + } + return $result; + } - // get List of Branches + // check the branch active status for student add + public function getBranchActiveStatusforStuAdd($branchId) { + $this->db->select('t1.IsActive'); + $this->db->from('' . BRANCH . ' as t1'); + $this->db->where('BranchCode', $branchId); + $statusDetails = $this->db->get()->first_row(); + $result['branch_active_status'] = $statusDetails->IsActive; + return $result; + } - public function get_branch_list() - { - $this->db->select('t1.BranchCode,t1.BranchName'); - $this->db->from('' . BRANCH . ' as t1'); - - // $this->db->where('t1.IsActive', 1); - - $branchDetails = $this->db->get(); - $checkArr = $branchDetails->result(); - if (count($checkArr) > 0) { - $result['branDetailstatus'] = true; - $result['branch_details'] = $branchDetails->result(); - } - else { - $result['branDetailstatus'] = false; - } - - return $result; - } - - // check the branch active status for student add - - public function getBranchActiveStatusforStuAdd($branchId) - { - $this->db->select('t1.IsActive'); - $this->db->from('' . BRANCH . ' as t1'); - $this->db->where('BranchCode', $branchId); - $statusDetails = $this->db->get()->first_row(); - - // echo $statusDetails->IsActive;exit(); - - $result['branch_active_status'] = $statusDetails->IsActive; - return $result; - - // if (count($checkArr) > 0) { - // $result['branDetailstatus'] = true; - // $result['branch_details'] = $branchDetails->result(); - // } else { - // $result['branDetailstatus'] = false; - // } - // return $result; - - } - - // get student list based on login user - - public function get_student_list($loginUserId, $loginUserBranchId, $loginUserType, $getSearchData) - { - - // print_r($getSearchData);exit(); - // echo $loginUserId, $loginUserBranchId, $loginUserType; exit(); - - if ($loginUserType == SUPER_ADMIN) { - - // list for super admin based on branch - - if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') { - $this->db->select('t1.*'); - $this->db->from('' . STUDENTS . ' as t1'); - - // $this->db->order_by('CreatedOn', 'DESC'); - // $this->db->where('BranchCode', $loginUserBranchId); - - $this->db->join('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); - $this->db->where('t2.BranchID', $loginUserBranchId); - $this->db->group_by('t2.StudentID'); - $this->db->order_by('t2.CreatedOn', 'DESC'); - $stuDetails = $this->db->get(); - $checkArr = $stuDetails->result(); - if (count($checkArr) > 0) { - $results['studentList'] = true; - $results['student_details'] = $stuDetails->result(); - } - else { - $results['studentList'] = false; - } - } - else { - - // print_r($getSearchData);exit(); - // $this->db->select('t1.*'); - // // $this->db->from(STUDENTS); - // $this->db->from('' . STUDENTS . ' as t1'); - // $this->db->order_by('t1.CreatedOn', 'DESC'); - // $this->db->where('t1.BranchCode', $loginUserBranchId); - // $this->db->from('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); - // $this->db->where('t2.UniversityID', $getSearchData["University"]); - // $this->db->where('t2.CourseID', $getSearchData["Course"]); - - $University = $getSearchData['University']; - $Course = $getSearchData['Course']; - - // $Batch = $getSearchData['Batch']; - - $Batch = ''; - $StuStatus = $getSearchData['Status']; - if ($StuStatus == '') { - if ($University != '' && $Course == '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + // get student list based on login user + public function get_student_list($loginUserId, $loginUserBranchId, $loginUserType, $getSearchData) { + if ($loginUserType == SUPER_ADMIN) { + // list for super admin based on branch + if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') { + $this->db->select('t1.*'); + $this->db->from('' . STUDENTS . ' as t1'); + $this->db->join('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); + $this->db->where('t2.BranchID', $loginUserBranchId); + $this->db->group_by('t2.StudentID'); + $this->db->order_by('t2.CreatedOn', 'DESC'); + $stuDetails = $this->db->get(); + $checkArr = $stuDetails->result(); + if (count($checkArr) > 0) { + $results['studentList'] = true; + $results['student_details'] = $stuDetails->result(); + } else { + $results['studentList'] = false; + } + } else { + $University = $getSearchData['University']; + $Course = $getSearchData['Course']; + $Batch = ''; + $StuStatus = $getSearchData['Status']; + if ($StuStatus == '') { + if ($University != '' && $Course == '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - else - if ($University != '' && $Course != '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else if ($University != '' && $Course != '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - } - else { - if ($University != '' && $Course == '') { - $subQuery = "SELECT S.* + } + } else { + if ($University != '' && $Course == '') { + $subQuery = "SELECT S.* FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID @@ -148,1236 +96,976 @@ class Student_model extends CI_Model AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - else - if ($University != '' && $Course != '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else if ($University != '' && $Course != '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } else { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - } - - $stuDetails = $this->db->query($subQuery); - - // $stuDetails = $this->db->get(); - - $checkArr = $stuDetails->result(); - if (count($checkArr) > 0) { - $results['studentList'] = true; - $results['student_details'] = $stuDetails->result(); - } - else { - $results['studentList'] = false; - } - } - - // if ($loginUserBranchId == 'All') { - // // for getting all branch details - // $staffId = $this->selfGetEmpId($loginUserId); - // $this->db->select('*'); - // $this->db->order_by('CreatedOn', 'DESC'); - // $this->db->from(STAFF); - // // not for SuperAdmin and Student Role code - // $this->db->where_not_in('StaffID', $staffId); - // // $this->db->where('BranchCode', $loginUserBranchId); - // $empDetails = $this->db->get(); - // $checkArr = $empDetails->result(); - // if (count($checkArr) > 0) { - // $results['employeeList'] = true; - // $results['employees_details'] = $empDetails->result(); - // } else { - // $results['employeeList'] = false; - // $results['message'] = 'No record found'; - // } - // } else { - // $staffId = $this->selfGetEmpId($loginUserId); - // $this->db->select('*'); - // $this->db->order_by('CreatedOn', 'DESC'); - // $this->db->from(STAFF); - // // not for SuperAdmin and Student Role code - // $this->db->where_not_in('StaffID', $staffId); - // $this->db->where('BranchCode', $loginUserBranchId); - // $empDetails = $this->db->get(); - // $checkArr = $empDetails->result(); - // if (count($checkArr) > 0) { - // $results['employeeList'] = true; - // $results['employees_details'] = $empDetails->result(); - // } else { - // $results['employeeList'] = false; - // $results['message'] = 'No record found'; - // } - // } - - } - else if ($loginUserType == ADMIN) { - - // list for admin - - if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') { - - // print_r($getSearchData);exit(); - - $this->db->select('t1.*'); - $this->db->from('' . STUDENTS . ' as t1'); - - // $this->db->where('BranchCode', $loginUserBranchId); - // $this->db->group_by('user_id'); - - $this->db->join('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); - $this->db->where('t2.BranchID', $loginUserBranchId); - $this->db->group_by('t2.StudentID'); - $this->db->order_by('t2.CreatedOn', 'DESC'); - $stuDetails = $this->db->get(); - $checkArr = $stuDetails->result(); - if (count($checkArr) > 0) { - $results['studentList'] = true; - $results['student_details'] = $stuDetails->result(); - } - else { - $results['studentList'] = false; - } - } - else { - $University = $getSearchData['University']; - $Course = $getSearchData['Course']; - - // $Batch = $getSearchData['Batch']; - - $Batch = ''; - $StuStatus = $getSearchData['Status']; - if ($StuStatus == '') { - if ($University != '' && $Course == '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } + } + $stuDetails = $this->db->query($subQuery); + $checkArr = $stuDetails->result(); + if (count($checkArr) > 0) { + $results['studentList'] = true; + $results['student_details'] = $stuDetails->result(); + } else { + $results['studentList'] = false; + } + } + } else if ($loginUserType == ADMIN) { + // list for admin + if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') { + $this->db->select('t1.*'); + $this->db->from('' . STUDENTS . ' as t1'); + $this->db->join('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); + $this->db->where('t2.BranchID', $loginUserBranchId); + $this->db->group_by('t2.StudentID'); + $this->db->order_by('t2.CreatedOn', 'DESC'); + $stuDetails = $this->db->get(); + $checkArr = $stuDetails->result(); + if (count($checkArr) > 0) { + $results['studentList'] = true; + $results['student_details'] = $stuDetails->result(); + } else { + $results['studentList'] = false; + } + } else { + $University = $getSearchData['University']; + $Course = $getSearchData['Course']; + $Batch = ''; + $StuStatus = $getSearchData['Status']; + if ($StuStatus == '') { + if ($University != '' && $Course == '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - else if ($University != '' && $Course != '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else if ($University != '' && $Course != '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - } - else { - if ($University != '' && $Course == '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } + } else { + if ($University != '' && $Course == '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - else if ($University != '' && $Course != '') { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else if ($University != '' && $Course != '') { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - }else { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - } - - $stuDetails = $this->db->query($subQuery); - - // $stuDetails = $this->db->get(); - - $checkArr = $stuDetails->result(); - if (count($checkArr) > 0) { - $results['studentList'] = true; - $results['student_details'] = $stuDetails->result(); - } - else { - $results['studentList'] = false; - } - } - } - else if ($loginUserType == EMPLOYEE) { - - // list for staff - // list for admin - - if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') { - - // print_r($getSearchData);exit(); - - $this->db->select("t1.*, IF(t3.ID > 0, '1' , '0') as Fee_paid_exist"); - $this->db->from('' . STUDENTS . ' as t1'); - $this->db->join('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); - $this->db->join('' . STUDENTS_FEES_PAID . ' as t3', 't3.StudentID = t1.StudentID', 'LEFT'); - $this->db->where('t2.BranchID', $loginUserBranchId); - $this->db->group_by('t2.StudentID'); - // $this->db->from(STUDENTS); - $this->db->order_by('t2.CreatedOn', 'DESC'); - $stuDetails = $this->db->get(); - $checkArr = $stuDetails->result(); - if (count($checkArr) > 0) { - $results['studentList'] = true; - $results['student_details'] = $stuDetails->result(); - } - else { - $results['studentList'] = false; - } - } - else { - - // print_r($getSearchData);exit(); - // $this->db->select('t1.*'); - // // $this->db->from(STUDENTS); - // $this->db->from('' . STUDENTS . ' as t1'); - // $this->db->order_by('t1.CreatedOn', 'DESC'); - // $this->db->where('t1.BranchCode', $loginUserBranchId); - // $this->db->from('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); - // $this->db->where('t2.UniversityID', $getSearchData["University"]); - // $this->db->where('t2.CourseID', $getSearchData["Course"]); - - $University = $getSearchData['University']; - $Course = $getSearchData['Course']; - - // $Batch = $getSearchData['Batch']; - - $Batch = ''; - $StuStatus = $getSearchData['Status']; - if ($StuStatus == '') { - if ($University != '' && $Course == '') { - $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID LEFT JOIN ". STUDENTS_FEES_PAID ." as SFP ON SFP.StudentID = S.StudentID + } + } + $stuDetails = $this->db->query($subQuery); + $checkArr = $stuDetails->result(); + if (count($checkArr) > 0) { + $results['studentList'] = true; + $results['student_details'] = $stuDetails->result(); + } else { + $results['studentList'] = false; + } + } + } else if ($loginUserType == EMPLOYEE) { + // list for staff + if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') { + $this->db->select("t1.*, IF(t3.ID > 0, '1' , '0') as Fee_paid_exist"); + $this->db->from('' . STUDENTS . ' as t1'); + $this->db->join('' . STUDENTCOURSE . ' as t2', 't2.StudentID = t1.StudentID', 'LEFT'); + $this->db->join('' . STUDENTS_FEES_PAID . ' as t3', 't3.StudentID = t1.StudentID', 'LEFT'); + $this->db->where('t2.BranchID', $loginUserBranchId); + $this->db->group_by('t2.StudentID'); + $this->db->order_by('t2.CreatedOn', 'DESC'); + $stuDetails = $this->db->get(); + $checkArr = $stuDetails->result(); + if (count($checkArr) > 0) { + $results['studentList'] = true; + $results['student_details'] = $stuDetails->result(); + } else { + $results['studentList'] = false; + } + } else { + $University = $getSearchData['University']; + $Course = $getSearchData['Course']; + $Batch = ''; + $StuStatus = $getSearchData['Status']; + if ($StuStatus == '') { + if ($University != '' && $Course == '') { + $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode + LEFT JOIN " . STUDENTS_FEES_PAID . " as SFP ON SFP.StudentID = S.StudentID WHERE SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - else if ($University != '' && $Course != '') { - $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID LEFT JOIN ". STUDENTS_FEES_PAID ." as SFP ON SFP.StudentID = S.StudentID + } else if ($University != '' && $Course != '') { + $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode + LEFT JOIN " . STUDENTS_FEES_PAID . " as SFP ON SFP.StudentID = S.StudentID WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } // ### query branch code changed from student branch code to student course branch code - - // AND S.BranchCode = '$loginUserBranchId' -> SC.BranchCode = '$loginUserBranchId' - // (SC.UniversityID = '$University' - // OR (SC.CourseID = '$Course' AND SC.UniversityID = '$University')) - - } - else { - if ($University != '' && $Course == '') { - $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID LEFT JOIN ". STUDENTS_FEES_PAID ." as SFP ON SFP.StudentID = S.StudentID + } // ### query branch code changed from student branch code to student course branch code + // AND S.BranchCode = '$loginUserBranchId' -> SC.BranchCode = '$loginUserBranchId' + // (SC.UniversityID = '$University' + // OR (SC.CourseID = '$Course' AND SC.UniversityID = '$University')) + } else { + if ($University != '' && $Course == '') { + $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode + LEFT JOIN " . STUDENTS_FEES_PAID . " as SFP ON SFP.StudentID = S.StudentID WHERE SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } - else if ($University != '' && $Course != '') { - $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID LEFT JOIN ". STUDENTS_FEES_PAID ." as SFP ON SFP.StudentID = S.StudentID + } else if ($University != '' && $Course != '') { + $subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode + LEFT JOIN " . STUDENTS_FEES_PAID . " as SFP ON SFP.StudentID = S.StudentID WHERE SC.CourseID = '$Course' AND SC.UniversityID = '$University' AND SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } else { - $subQuery = "SELECT S.* - FROM " . STUDENTS . " as S LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID - LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID LEFT JOIN " . COURSE . " as C ON - SC.CourseID = C.CourseID + } else { + $subQuery = "SELECT S.* + FROM " . STUDENTS . " as S + LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID + LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode + LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode WHERE SC.BranchID = '$loginUserBranchId' AND S.IsActive = '$StuStatus' GROUP BY SC.StudentID ORDER BY S.CreatedOn"; - } + } + // ### query branch code changed from student branch code to student course branch code + // AND S.BranchCode = '$loginUserBranchId' -> SC.BranchCode = '$loginUserBranchId + } + $stuDetails = $this->db->query($subQuery); + $checkArr = $stuDetails->result(); + if (count($checkArr) > 0) { + $results['studentList'] = true; + $results['student_details'] = $stuDetails->result(); + } else { + $results['studentList'] = false; + } + } + } else { + $results['studentList'] = false; + } + return $results; + } - // ### query branch code changed from student branch code to student course branch code - // AND S.BranchCode = '$loginUserBranchId' -> SC.BranchCode = '$loginUserBranchId' + // get a student cource list + public function get_student_course_list($studentId, $req) { + $this->db->select("t1.*,t2.UniversityName,t3.CourseName,t3.CourseCode,t4.SessionName, IF(t6.ID > 0, '1' , '0') as Fee_paid_exist"); + $this->db->from('' . STUDENTCOURSE . ' as t1'); + $this->db->join('' . UNIVERSITY . ' as t2', 't2.UniversityID = t1.UniversityID AND t2.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . COURSE . ' as t3', 't3.CourseID = t1.CourseID AND t3.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . SESSIONMASTER . ' as t4', 't4.SessionID = t1.SessionID AND t4.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . STUDENTS_FEES_STATUS . ' as t5', 't5.StudentID = ' . $studentId . ' AND t5.CourseID = t1.CourseID AND t5.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . STUDENTS_FEES_PAID . ' as t6', 't6.FeesId = t5.FeesID', 'LEFT'); + $this->db->where('t1.BranchID', $req['localBranchID']); + $this->db->where('t1.StudentID', $studentId); + $this->db->group_by('t1.CourseID'); + $courseDetails = $this->db->get(); + $checkArr = $courseDetails->result(); + if (count($checkArr) > 0) { + $result['stuCourseDetails'] = true; + $result['course_details'] = $courseDetails->result(); + } else { + $result['stuCourseDetails'] = false; + } + return $result; + } - } + // get student course details + public function get_student_course($studentcourseId) { + $this->db->select('*'); + $this->db->from(STUDENTCOURSE); + $this->db->where('ID', $studentcourseId); + $courseDetails = $this->db->get(); + $checkArr = $courseDetails->result(); + if (count($checkArr) > 0) { + $result['stuCourseDetails'] = true; + $result['course_details'] = $courseDetails->result(); + } else { + $result['stuCourseDetails'] = false; + } + return $result; + } - $stuDetails = $this->db->query($subQuery); + // get university list + public function get_university_list($branch) { + $this->db->select('*'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(UNIVERSITY); + $this->db->where('IsActive', 1); + $this->db->where('BranchCode', $branch); + $univDetails = $this->db->get(); + $universityDetails = $univDetails->result(); + if (count($universityDetails) > 0) { + $results['univList'] = true; + $results['university_details'] = $universityDetails; + } else { + $results['univList'] = false; + $results['message'] = 'No record found'; + } + return $results; + } - // $stuDetails = $this->db->get(); - - $checkArr = $stuDetails->result(); - if (count($checkArr) > 0) { - $results['studentList'] = true; - $results['student_details'] = $stuDetails->result(); - } - else { - $results['studentList'] = false; - } - } - } - else { - $results['studentList'] = false; - } - - return $results; - } - - // get a student cource list - - public function get_student_course_list($studentId, $req) - { - - // echo $req['localBranchID'];exit(); - - $this->db->select("t1.*,t2.UniversityName,t3.CourseName,t3.CourseCode,t4.SessionName, IF(t6.ID > 0, '1' , '0') as Fee_paid_exist"); - $this->db->from('' . STUDENTCOURSE . ' as t1'); - $this->db->join('' . UNIVERSITY . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT'); - $this->db->join('' . COURSE . ' as t3', 't3.CourseID = t1.CourseID', 'LEFT'); - $this->db->join('' . SESSIONMASTER . ' as t4', 't4.SessionID = t1.SessionID', 'LEFT'); - $this->db->join(''.STUDENTS_FEES_STATUS.' as t5', 't5.StudentID = '.$studentId.' AND t5.CourseID = t1.CourseID', 'LEFT'); - $this->db->join(''.STUDENTS_FEES_PAID.' as t6', 't6.FeesId = t5.FeesID', 'LEFT'); - $this->db->where('t1.BranchID', $req['localBranchID']); - $this->db->where('t1.StudentID', $studentId); - $this->db->group_by('t1.CourseID'); - $courseDetails = $this->db->get(); - $checkArr = $courseDetails->result(); - if (count($checkArr) > 0) { - $result['stuCourseDetails'] = true; - $result['course_details'] = $courseDetails->result(); - } - else { - $result['stuCourseDetails'] = false; - } - - return $result; - } - - // get student course details - - public function get_student_course($studentcourseId) - { - $this->db->select('*'); - $this->db->from(STUDENTCOURSE); - $this->db->where('ID', $studentcourseId); - $courseDetails = $this->db->get(); - $checkArr = $courseDetails->result(); - if (count($checkArr) > 0) { - $result['stuCourseDetails'] = true; - $result['course_details'] = $courseDetails->result(); - } - else { - $result['stuCourseDetails'] = false; - } - - return $result; - } - - // get university list - - public function get_university_list($branch) - { - $this->db->select('*'); - $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from(UNIVERSITY); - $this->db->where('IsActive', 1); - $this->db->where('BranchCode', $branch); - $univDetails = $this->db->get(); - $universityDetails = $univDetails->result(); - if (count($universityDetails) > 0) { - $results['univList'] = true; - $results['university_details'] = $universityDetails; - } - else { - $results['univList'] = false; - $results['message'] = 'No record found'; - } - - return $results; - } - - // get course, batch for university - - public function get_courseBatch_list($univId, $branch) - { - $this->db->select('C.CourseID, C.CourseName,C.Specilization1,C.Specilization2, C.CourseCode'); - $this->db->from(COURSE . ' as C'); - $this->db->where('UniversityID', $univId); - $this->db->where('IsActive', 1); - $this->db->where('BranchCode', $branch); - $courseDetails = $this->db->get(); - if ($courseDetails->result()) { - $this->db->select('B.SessionID, B.SessionName'); - $this->db->from(SESSIONMASTER . ' as B'); + // get course, batch for university + public function get_courseBatch_list($univId, $branch) { + $this->db->select('C.CourseID, C.CourseName,C.Specilization1,C.Specilization2, C.CourseCode'); + $this->db->from(COURSE . ' as C'); + $this->db->where('UniversityID', $univId); + $this->db->where('IsActive', 1); + $this->db->where('BranchCode', $branch); + $courseDetails = $this->db->get(); + if ($courseDetails->result()) { + $this->db->select('B.SessionID, B.SessionName'); + $this->db->from(SESSIONMASTER . ' as B'); $this->db->join(SESSIONDETAILS . ' SD', 'SD.SessionID = B.SessionID'); $this->db->where('SD.UniversityID', $univId); - $this->db->where('B.IsActive', 1); + $this->db->where('B.IsActive', 1); $this->db->where('SD.IsActive', 1); - $batchDetails = $this->db->get(); - if ($batchDetails->result()) { - $result['courseStatus'] = true; - $result['course_details'] = $courseDetails->result(); - $result['batch_details'] = $batchDetails->result(); - } - else { - $result['courseStatus'] = false; - $result['message'] = "No records found!"; - } - } - else { - $result['courseStatus'] = false; - $result['message'] = "No records found!"; - } - - return $result; - } + $batchDetails = $this->db->get(); + if ($batchDetails->result()) { + $result['courseStatus'] = true; + $result['course_details'] = $courseDetails->result(); + $result['batch_details'] = $batchDetails->result(); + } else { + $result['courseStatus'] = false; + $result['message'] = "No records found!"; + } + } else { + $result['courseStatus'] = false; + $result['message'] = "No records found!"; + } + return $result; + } // Get exist student details + public function get_exist_stu_details($data, $reqArr) { + // echo $data;exit(); + $this->db->select('t0.*'); + $this->db->from('' . STUDENTS . ' as t0'); + $this->db->where('t0.StudentID', $data); + $personalDetails = $this->db->get()->result(); + $this->db->select('t1.*,t2.UniversityName,t3.CourseName,t3.Specilization1,t3.Specilization2,t4.SessionName, t5.BranchName'); + // $this->db->from('' . STUDENTS . ' as t0'); + $this->db->from('' . STUDENTCOURSE . ' as t1'); + $this->db->join('' . UNIVERSITY . ' as t2', 't2.UniversityID = t1.UniversityID AND t2.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . COURSE . ' as t3', 't3.CourseID = t1.CourseID AND t3.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . SESSIONMASTER . ' as t4', 't4.SessionID = t1.SessionID AND t4.BranchCode = t1.BranchID', 'LEFT'); + $this->db->join('' . BRANCH . ' as t5', 't5.BranchCode = t1.BranchID', 'LEFT'); + $this->db->where('t1.StudentID', $data); + // $this->db->group_by('t1.StudentID'); + $courseDetails = $this->db->get()->result(); + $result['personalDetails'] = $personalDetails; + $result['courseDetails'] = $courseDetails; + $result['existingStudentDetailsStatus'] = true; + return $result; + } + + // check exist + public function check_exist($data, $checkData) { + if ($checkData == 'studentId') { - public function get_exist_stu_details($data, $reqArr) - { - - // echo $data;exit(); - - $this->db->select('t0.*'); - $this->db->from('' . STUDENTS . ' as t0'); - $this->db->where('t0.StudentID', $data); - $personalDetails = $this->db->get()->result(); - $this->db->select('t1.*,t2.UniversityName,t3.CourseName,t3.Specilization1,t3.Specilization2,t4.SessionName, t5.BranchName'); - - // $this->db->from('' . STUDENTS . ' as t0'); - - $this->db->from('' . STUDENTCOURSE . ' as t1'); - $this->db->join('' . UNIVERSITY . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT'); - $this->db->join('' . COURSE . ' as t3', 't3.CourseID = t1.CourseID', 'LEFT'); - $this->db->join('' . SESSIONMASTER . ' as t4', 't4.SessionID = t1.SessionID', 'LEFT'); - $this->db->join('' . BRANCH . ' as t5', 't5.BranchCode = t1.BranchID', 'LEFT'); - $this->db->where('t1.StudentID', $data); - - // $this->db->group_by('t1.StudentID'); - - $courseDetails = $this->db->get()->result(); - $result['personalDetails'] = $personalDetails; - $result['courseDetails'] = $courseDetails; - $result['existingStudentDetailsStatus'] = true; - return $result; - } - - // check exist - - public function check_exist($data, $checkData) - { - if ($checkData == 'studentId') { - - // check for student id - // $this->db->select('*'); - // $this->db->from(STAFF); - // $this->db->where('StaffID', $data); - // if ($this->db->get()->first_row()) { - // $result['existEmpId'] = true; - // $result['message'] = "This Employee ID is already exist!"; - // } else { - // $result['existEmpId'] = false; - // } - - } - else if ($checkData == 'mobileNumber') { - - // check for mobile number - - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('MobileNumber', $data); - $details = $this->db->get()->result(); - - // echo count($details);exit(); - - if (count($details) > 0) { - - // print_r($details);exit(); - // echo $details[0]->StudentID;exit(); - - $datas['studentId'] = $details[0]->StudentID; - $datas['type'] = 'R001'; - $result['details'] = $datas; - $result['existMobile'] = true; - $result['message'] = "This Mobile Number is already exist!"; - } - else { - $this->db->select('*'); - $this->db->from(LOGIN); - $this->db->where('MobileNumber', $data); - $details1 = $this->db->get()->result(); - if ($details1 > 0) { - $datas['studentId'] = $details1[0]->StaffID; - $datas['type'] = $details1[0]->ListCode; - $result['details'] = $datas; - $result['existMobile'] = true; - $result['message'] = "This Mobile Number is already exist!"; - } - else { - $result['existMobile'] = false; - } - } - } - else if ($checkData == 'emailId') { - - // check for email id - - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('EmailID', $data); - if ($this->db->get()->first_row()) { - $result['existEmailId'] = true; - $result['message'] = "This EmailId is already exist!"; - } - else { - $result['existEmailId'] = false; - } - } - else { - } - - return $result; - } - - // add student course - - public function add_student_course($studID, $Arr) - { - if ($this->getBranchActiveStatusforStuAdd($Arr['BranchID']) ['branch_active_status'] === '1') { - $this->db->select('*'); - $this->db->from(STUDENTCOURSE); - $this->db->where('StudentID', $studID); - $this->db->where('CourseID', $Arr['CourseID']); - if ($this->db->get()->first_row()) { - $result['addStuCourseStatus'] = false; - $result['message'] = "This Student Already exist for this course"; - } - else { - $this->db->insert(STUDENTCOURSE, $Arr); - if ($this->db->affected_rows() == '1') { - $result['addStuCourseStatus'] = true; - $result['message'] = "Successfully Student Course Details Updated"; - } - else { - $result['addStuCourseStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - } - else { - $result['addStuCourseStatus'] = false; - $result['message'] = "New Cource Cannot able to create for In-Active Branch"; - } - - return $result; - } - - // add student - - public function add_student($Arr, $courseArr, $imagename, $imageSource, $size) - { - - // echo $this->getBranchActiveStatusforStuAdd($courseArr['BranchID'])['branch_active_status'];exit(); - - if ($this->getBranchActiveStatusforStuAdd($courseArr['BranchID']) ['branch_active_status'] === '1') { - - // echo 'in';exit(); - - if ($imageSource == '') { // add employee without image - $imageNameDb = 'default.jpeg'; - $Arr['ProfilePicPath'] = "student/" . $imageNameDb; - - // print_r($Arr); - // print_r($courseArr);exit(); - - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('MobileNumber', $Arr['MobileNumber']); - if ($this->db->get()->first_row()) { - $result['addStudentStatus'] = false; - $result['message'] = "This Student Already exist"; - } - else { - $this->db->insert(STUDENTS, $Arr); - $insert_id = $this->db->insert_id('StudentID'); - $courseArr['StudentID'] = $insert_id; - if ($this->db->affected_rows() == '1') { - $this->db->insert(STUDENTCOURSE, $courseArr); - if ($this->db->affected_rows() == '1') { - $loginArr['StaffID'] = $courseArr['StudentID']; - $loginArr['ListCode'] = STUDENT; - $loginArr['MobileNumber'] = $Arr['MobileNumber']; - $loginArr['EmailId'] = $Arr['EmailID']; - $loginArr['IsActive'] = $Arr['IsActive']; - $loginArr['CreatedBy'] = $Arr['CreatedBy']; - $loginArr['CreatedOn'] = $Arr['CreatedOn']; - $loginArr['Password'] = ENCR_PASSWORD; - $this->db->insert(LOGIN, $loginArr); - if ($this->db->affected_rows() == '1') { - $result['addStudentStatus'] = true; - $result['message'] = "Successfully student details added"; - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - } - else { - $target = "../images/student/"; - $getUploadStatus = $this->upload_image($imageSource, $size, $target); - $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; - $Arr['ProfilePicPath'] = "student/" . $imageNameDb; - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('MobileNumber', $Arr['MobileNumber']); - if ($this->db->get()->first_row()) { - $result['addStudentStatus'] = false; - $result['message'] = "This Student Already exist"; - } - else { - $this->db->insert(STUDENTS, $Arr); - $insert_id = $this->db->insert_id('StudentID'); - $courseArr['StudentID'] = $insert_id; - if ($this->db->affected_rows() == '1') { - $this->db->insert(STUDENTCOURSE, $courseArr); - if ($this->db->affected_rows() == '1') { - $loginArr['StaffID'] = $courseArr['StudentID']; - $loginArr['ListCode'] = STUDENT; - $loginArr['MobileNumber'] = $Arr['MobileNumber']; - $loginArr['EmailId'] = $Arr['EmailID']; - $loginArr['IsActive'] = $Arr['IsActive']; - $loginArr['CreatedBy'] = $Arr['CreatedBy']; - $loginArr['CreatedOn'] = $Arr['CreatedOn']; - $loginArr['Password'] = ENCR_PASSWORD; - $this->db->insert(LOGIN, $loginArr); - if ($this->db->affected_rows() == '1') { - $result['addStudentStatus'] = true; - $result['message'] = "Successfully student details added"; - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - } - } - else { - $result['addStudentStatus'] = false; - $result['message'] = "New Student cannot able to create for In-Active Branch"; - } - - return $result; - } - - // check existing data while update - - public function check_update_exist($exceptId, $datas, $checkFor) - { - if ($checkFor == 'mobileNumber') { - - // check update for mobile number - - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('MobileNumber', $datas); - $this->db->where_not_in('StudentID', $exceptId); - if ($this->db->get()->first_row()) { - $result['existMobile'] = true; - $this->db->select('MobileNumber'); - $this->db->from(STUDENTS); - $this->db->where('StudentID', $exceptId); - $result['resetValue'] = $this->db->get()->first_row(); - $result['message'] = "This Mobile Number is already exist!"; - } - else { - - // check login - - $this->db->select('*'); - $this->db->from(LOGIN); - $this->db->where('MobileNumber', $datas); - $this->db->where_not_in('StaffID', $exceptId); - if ($this->db->get()->first_row()) { - $result['existMobile'] = true; - $this->db->select('MobileNumber'); - $this->db->from(STUDENTS); - $this->db->where('StudentID', $exceptId); - $result['resetValue'] = $this->db->get()->first_row(); - $result['message'] = "This Mobile Number is already exist!"; - } - else { - $result['existMobile'] = false; - } - } - } - else if ($checkFor == 'emailId') { - - // check update for email - - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('EmailID', $datas); - $this->db->where_not_in('StudentID', $exceptId); - if ($this->db->get()->first_row()) { - $result['existEmailId'] = true; - $this->db->select('EmailID'); - $this->db->from(STUDENTS); - $this->db->where('StudentID', $exceptId); - $result['resetValue'] = $this->db->get()->first_row(); - $result['message'] = "This EmailId is already exist!"; - } - else { - $result['existEmailId'] = false; - } - } - else { - } - - return $result; - } - - // get the student entrollment doc details - - public function getStudent_doc_details($stuId) - { - $this->db->select('*'); - $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from(STUDENTDOCUMENTDETAILS); - $this->db->where('StudentID', $stuId); - $getDocDetails = $this->db->get(); - $documentDetails = $getDocDetails->result(); - if (count($documentDetails) > 0) { - $results['docListStatus'] = true; - $results['student_doc_details'] = $documentDetails; - } - else { - $results['docListStatus'] = false; - $results['message'] = 'No record found'; - } - return $results; - } - - public function deleteStu_doc_details($stuId, $docId) - { - $sql1 = "SELECT * FROM ".STUDENTDOCUMENTDETAILS." WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; - $resultSql1 = $this->db->query($sql1)->result(); - if(count($resultSql1) > 0){ - // print_r($resultSql1); - // echo $resultSql1[0]->DocumentStorePath;exit(); - $sql = "DELETE FROM ".STUDENTDOCUMENTDETAILS." WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; - if ($this->db->query($sql)) { - try{ - if(!file_exists('../images/' . $resultSql1[0]->DocumentStorePath)) { - throw new Exception("File Not Found."); - }else { - unlink('../images/' . $resultSql1[0]->DocumentStorePath); - } - } catch(Exception $e){ - // echo "Error :"; - } finally { - $results['message'] = 'Deleted Successfully.'; - $results['deleteStatus'] = true; - } - } - else { - $results['deleteStatus'] = false; - $results['message'] = 'Something went wrong.please try again'; - } - }else{ - $results['deleteStatus'] = false; - $results['message'] = 'Something went wrong.please try again'; - } - return $results; - } - - // add student entroll doc details - - public function student_entroll_doc_add($req, $doc_status) - { - - // if( $doc_status == "true") { - - $target = "../images/documents/"; - $getUploadStatus = $this->upload_doc_student($req['doc_source'], $req['doc_name'], $req['doc_size'], $target, $req['student_id']); - if ($imageNameDb = $getUploadStatus['status'] == true) { - $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; - - // echo $imageNameDb;exit(); - - $strPath = "documents/" . $imageNameDb; - $stuId = $req['student_id']; - $docTypeName = $req['document_type_name']; - $docStatus = $req['document_status']; - $docComments = $req['document_comments']; - $docCreatedBy = $req['CreatedBy']; - $docCreatadOn = $req['CreatedOn']; - - // echo $docCreatadOn;exit(); - // ".STAFF_BRANCH." - - $sql1 = "INSERT INTO ".STUDENTDOCUMENTDETAILS." (StudentID, DocumentName, Status, DocumentStorePath, Comments, CreatedBy, CreatedOn) - VALUES ('$stuId', '$docTypeName', '$docStatus', '$strPath', '$docComments', '$docCreatedBy', '$docCreatadOn')"; - - // update branch to staff_branch table - - if ($this->db->query($sql1) == '1') { - $result['stuDocUpdateStatus'] = true; - $result['message'] = "Successfully Student document details updated"; - } - else { - $result['stuDocUpdateStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['stuDocUpdateStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - - return $result; - } - - // student document upload target path - - public function upload_doc_student($imageSource, $doc_name, $size, $target, $stu_id) - { - $key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') , 0, 12); - $new_regNo = "Dri_" . $key2 . "_" . $stu_id . "_" . $doc_name; - $targetPlace = $target . $new_regNo; - - // echo $targetPlace;exit(); - - if (!move_uploaded_file($imageSource, $targetPlace)) { - return $result['status'] = false; - } - else { - $result['status'] = true; - $result['imageName'] = $new_regNo; - return $result; - } - } - - public function getStudent_PendingDoc_Details($stuID) { - $this->db->select('*'); - $this->db->order_by('CreatedOn', 'DESC'); - $this->db->from(STUDENTDOCUMENTTRACKDETAILS); - $this->db->where('StudentID', $stuID); - $getPendDocDetails = $this->db->get(); - $documentPendingDetails = $getPendDocDetails->result(); - if (count($documentPendingDetails) > 0) { - $results['PendingDocListStatus'] = true; - $results['student_pending_doc_details'] = $documentPendingDetails; - } - else { - $results['PendingDocListStatus'] = false; - $results['message'] = 'No record found'; - } - return $results; - } - - // add student enrollment pending document details - public function addStu_PendingDoc_Details($reqData,$localdata) { - // echo "model"; - // print_r($reqData);exit(); - $this->db->insert(STUDENTDOCUMENTTRACKDETAILS, $reqData); - if ($this->db->affected_rows() > 0) { - // Entry for call track - if($reqData['Status']=='1'){ - $this->updatePendingDocumentInCallTrack($reqData,$localdata); + } else if ($checkData == 'mobileNumber') { + // check for mobile number + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('MobileNumber', $data); + $details = $this->db->get()->result(); + // echo count($details);exit(); + if (count($details) > 0) { + // print_r($details);exit(); + // echo $details[0]->StudentID;exit(); + $datas['studentId'] = $details[0]->StudentID; + $datas['type'] = 'R001'; + $result['details'] = $datas; + $result['existMobile'] = true; + $result['message'] = "This Mobile Number is already exist!"; + } else { + $this->db->select('*'); + $this->db->from(LOGIN); + $this->db->where('MobileNumber', $data); + $details1 = $this->db->get()->result(); + if ($details1 > 0) { + $datas['studentId'] = $details1[0]->StaffID; + $datas['type'] = $details1[0]->ListCode; + $result['details'] = $datas; + $result['existMobile'] = true; + $result['message'] = "This Mobile Number is already exist!"; + } else { + $result['existMobile'] = false; } + } + } else if ($checkData == 'emailId') { + // check for email id + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('EmailID', $data); + if ($this->db->get()->first_row()) { + $result['existEmailId'] = true; + $result['message'] = "This EmailId is already exist!"; + } else { + $result['existEmailId'] = false; + } + } else { + } + return $result; + } - // end call track entry - $results['AddStuPendingDocStatus'] = true; - $results['message'] = "Added Successfully."; - } else { - $results['AddStuPendingDocStatus'] = false; - $results['message'] = "Something went wrong.please try again."; - } - return $results; - } + // add student course + public function add_student_course($studID, $Arr) { + if ($this->getBranchActiveStatusforStuAdd($Arr['BranchID']) ['branch_active_status'] === '1') { + $this->db->select('*'); + $this->db->from(STUDENTCOURSE); + $this->db->where('StudentID', $studID); + $this->db->where('CourseID', $Arr['CourseID']); + if ($this->db->get()->first_row()) { + $result['addStuCourseStatus'] = false; + $result['message'] = "This Student Already exist for this course"; + } else { + $this->db->insert(STUDENTCOURSE, $Arr); + if ($this->db->affected_rows() == '1') { + $result['addStuCourseStatus'] = true; + $result['message'] = "Successfully Student Course Details Updated"; + } else { + $result['addStuCourseStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + } else { + $result['addStuCourseStatus'] = false; + $result['message'] = "New Cource Cannot able to create for In-Active Branch"; + } + return $result; + } + + // add student + public function add_student($Arr, $courseArr, $imagename, $imageSource, $size) { + // echo $this->getBranchActiveStatusforStuAdd($courseArr['BranchID'])['branch_active_status'];exit(); + if ($this->getBranchActiveStatusforStuAdd($courseArr['BranchID']) ['branch_active_status'] === '1') { + // echo 'in';exit(); + if ($imageSource == '') { // add employee without image + $imageNameDb = 'default.jpeg'; + $Arr['ProfilePicPath'] = "student/" . $imageNameDb; + // print_r($Arr); + // print_r($courseArr);exit(); + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('MobileNumber', $Arr['MobileNumber']); + if ($this->db->get()->first_row()) { + $result['addStudentStatus'] = false; + $result['message'] = "This Student Already exist"; + } else { + $this->db->insert(STUDENTS, $Arr); + $insert_id = $this->db->insert_id('StudentID'); + $courseArr['StudentID'] = $insert_id; + if ($this->db->affected_rows() == '1') { + $this->db->insert(STUDENTCOURSE, $courseArr); + if ($this->db->affected_rows() == '1') { + $loginArr['StaffID'] = $courseArr['StudentID']; + $loginArr['ListCode'] = STUDENT; + $loginArr['MobileNumber'] = $Arr['MobileNumber']; + $loginArr['EmailId'] = $Arr['EmailID']; + $loginArr['IsActive'] = $Arr['IsActive']; + $loginArr['CreatedBy'] = $Arr['CreatedBy']; + $loginArr['CreatedOn'] = $Arr['CreatedOn']; + $loginArr['Password'] = ENCR_PASSWORD; + $this->db->insert(LOGIN, $loginArr); + if ($this->db->affected_rows() == '1') { + $result['addStudentStatus'] = true; + $result['message'] = "Successfully student details added"; + } else { + $result['addStudentStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['addStudentStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['addStudentStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + } else { + $target = "../images/student/"; + $getUploadStatus = $this->upload_image($imageSource, $size, $target); + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + $Arr['ProfilePicPath'] = "student/" . $imageNameDb; + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('MobileNumber', $Arr['MobileNumber']); + if ($this->db->get()->first_row()) { + $result['addStudentStatus'] = false; + $result['message'] = "This Student Already exist"; + } else { + $this->db->insert(STUDENTS, $Arr); + $insert_id = $this->db->insert_id('StudentID'); + $courseArr['StudentID'] = $insert_id; + if ($this->db->affected_rows() == '1') { + $this->db->insert(STUDENTCOURSE, $courseArr); + if ($this->db->affected_rows() == '1') { + $loginArr['StaffID'] = $courseArr['StudentID']; + $loginArr['ListCode'] = STUDENT; + $loginArr['MobileNumber'] = $Arr['MobileNumber']; + $loginArr['EmailId'] = $Arr['EmailID']; + $loginArr['IsActive'] = $Arr['IsActive']; + $loginArr['CreatedBy'] = $Arr['CreatedBy']; + $loginArr['CreatedOn'] = $Arr['CreatedOn']; + $loginArr['Password'] = ENCR_PASSWORD; + $this->db->insert(LOGIN, $loginArr); + if ($this->db->affected_rows() == '1') { + $result['addStudentStatus'] = true; + $result['message'] = "Successfully student details added"; + } else { + $result['addStudentStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['addStudentStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['addStudentStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + } + } else { + $result['addStudentStatus'] = false; + $result['message'] = "New Student cannot able to create for In-Active Branch"; + } + return $result; + } + + // check existing data while update + public function check_update_exist($exceptId, $datas, $checkFor) { + if ($checkFor == 'mobileNumber') { + // check update for mobile number + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('MobileNumber', $datas); + $this->db->where_not_in('StudentID', $exceptId); + if ($this->db->get()->first_row()) { + $result['existMobile'] = true; + $this->db->select('MobileNumber'); + $this->db->from(STUDENTS); + $this->db->where('StudentID', $exceptId); + $result['resetValue'] = $this->db->get()->first_row(); + $result['message'] = "This Mobile Number is already exist!"; + } else { + // check login + $this->db->select('*'); + $this->db->from(LOGIN); + $this->db->where('MobileNumber', $datas); + $this->db->where_not_in('StaffID', $exceptId); + if ($this->db->get()->first_row()) { + $result['existMobile'] = true; + $this->db->select('MobileNumber'); + $this->db->from(STUDENTS); + $this->db->where('StudentID', $exceptId); + $result['resetValue'] = $this->db->get()->first_row(); + $result['message'] = "This Mobile Number is already exist!"; + } else { + $result['existMobile'] = false; + } + } + } else if ($checkFor == 'emailId') { + // check update for email + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('EmailID', $datas); + $this->db->where_not_in('StudentID', $exceptId); + if ($this->db->get()->first_row()) { + $result['existEmailId'] = true; + $this->db->select('EmailID'); + $this->db->from(STUDENTS); + $this->db->where('StudentID', $exceptId); + $result['resetValue'] = $this->db->get()->first_row(); + $result['message'] = "This EmailId is already exist!"; + } else { + $result['existEmailId'] = false; + } + } else { + } + return $result; + } + + // get the student entrollment doc details + public function getStudent_doc_details($stuId) { + $this->db->select('*'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(STUDENTDOCUMENTDETAILS); + $this->db->where('StudentID', $stuId); + $getDocDetails = $this->db->get(); + $documentDetails = $getDocDetails->result(); + if (count($documentDetails) > 0) { + $results['docListStatus'] = true; + $results['student_doc_details'] = $documentDetails; + } else { + $results['docListStatus'] = false; + $results['message'] = 'No record found'; + } + return $results; + } + + public function deleteStu_doc_details($stuId, $docId) { + $sql1 = "SELECT * FROM " . STUDENTDOCUMENTDETAILS . " WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; + $resultSql1 = $this->db->query($sql1)->result(); + if (count($resultSql1) > 0) { + // print_r($resultSql1); + // echo $resultSql1[0]->DocumentStorePath;exit(); + $sql = "DELETE FROM " . STUDENTDOCUMENTDETAILS . " WHERE StudentID = '" . $stuId . "' AND ID = '" . $docId . "'"; + if ($this->db->query($sql)) { + try { + if (!file_exists('../images/' . $resultSql1[0]->DocumentStorePath)) { + throw new Exception("File Not Found."); + } else { + unlink('../images/' . $resultSql1[0]->DocumentStorePath); + } + } + catch(Exception $e) { + // echo "Error :"; + + } + finally { + $results['message'] = 'Deleted Successfully.'; + $results['deleteStatus'] = true; + } + } else { + $results['deleteStatus'] = false; + $results['message'] = 'Something went wrong.please try again'; + } + } else { + $results['deleteStatus'] = false; + $results['message'] = 'Something went wrong.please try again'; + } + return $results; + } + + // add student entroll doc details + public function student_entroll_doc_add($req, $doc_status) { + // if( $doc_status == "true") { + $target = "../images/documents/"; + $getUploadStatus = $this->upload_doc_student($req['doc_source'], $req['doc_name'], $req['doc_size'], $target, $req['student_id']); + if ($imageNameDb = $getUploadStatus['status'] == true) { + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + // echo $imageNameDb;exit(); + $strPath = "documents/" . $imageNameDb; + $stuId = $req['student_id']; + $docTypeName = $req['document_type_name']; + $docStatus = $req['document_status']; + $docComments = $req['document_comments']; + $docCreatedBy = $req['CreatedBy']; + $docCreatadOn = $req['CreatedOn']; + // echo $docCreatadOn;exit(); + // ".STAFF_BRANCH." + $sql1 = "INSERT INTO " . STUDENTDOCUMENTDETAILS . " (StudentID, DocumentName, Status, DocumentStorePath, Comments, CreatedBy, CreatedOn) + VALUES ('$stuId', '$docTypeName', '$docStatus', '$strPath', '$docComments', '$docCreatedBy', '$docCreatadOn')"; + // update branch to staff_branch table + if ($this->db->query($sql1) == '1') { + $result['stuDocUpdateStatus'] = true; + $result['message'] = "Successfully Student document details updated"; + } else { + $result['stuDocUpdateStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['stuDocUpdateStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + + // student document upload target path + public function upload_doc_student($imageSource, $doc_name, $size, $target, $stu_id) { + $key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 12); + $new_regNo = "Dri_" . $key2 . "_" . $stu_id . "_" . $doc_name; + $targetPlace = $target . $new_regNo; + // echo $targetPlace;exit(); + if (!move_uploaded_file($imageSource, $targetPlace)) { + return $result['status'] = false; + } else { + $result['status'] = true; + $result['imageName'] = $new_regNo; + return $result; + } + } + + public function getStudent_PendingDoc_Details($stuID) { + $this->db->select('*'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(STUDENTDOCUMENTTRACKDETAILS); + $this->db->where('StudentID', $stuID); + $getPendDocDetails = $this->db->get(); + $documentPendingDetails = $getPendDocDetails->result(); + if (count($documentPendingDetails) > 0) { + $results['PendingDocListStatus'] = true; + $results['student_pending_doc_details'] = $documentPendingDetails; + } else { + $results['PendingDocListStatus'] = false; + $results['message'] = 'No record found'; + } + return $results; + } + + // add student enrollment pending document details + public function addStu_PendingDoc_Details($reqData, $localdata) { + $this->db->insert(STUDENTDOCUMENTTRACKDETAILS, $reqData); + if ($this->db->affected_rows() > 0) { + // Entry for call track + if ($reqData['Status'] == '1') { + $this->updatePendingDocumentInCallTrack($reqData, $localdata); + } + // end call track entry + $results['AddStuPendingDocStatus'] = true; + $results['message'] = "Added Successfully."; + } else { + $results['AddStuPendingDocStatus'] = false; + $results['message'] = "Something went wrong.please try again."; + } + return $results; + } public function deleteStu_entrollPending_doc_details($id) { - // echo $id;exit(); - $sql = "DELETE FROM ".STUDENTDOCUMENTTRACKDETAILS." WHERE ID = '" . $id . "'"; - if ($this->db->query($sql)) { - $results['deleteStatus'] = true; - $results['message'] = 'Document pending track details deleted.'; - } else { - $results['deleteStatus'] = false; - $results['message'] = 'Something went wrong.please try again'; - } - return $results; - } + // echo $id;exit(); + $sql = "DELETE FROM " . STUDENTDOCUMENTTRACKDETAILS . " WHERE ID = '" . $id . "'"; + if ($this->db->query($sql)) { + $results['deleteStatus'] = true; + $results['message'] = 'Document pending track details deleted.'; + } else { + $results['deleteStatus'] = false; + $results['message'] = 'Something went wrong.please try again'; + } + return $results; + } - - // update student personal details - - public function update_student($empArr, $updateFor, $imagename, $imageSource, $size) - { - // print_r($empArr);exit(); - if ($imageSource == '') { - // print_r($empArr); - // print_r($updateFor); - // exit(); - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('MobileNumber', $empArr['MobileNumber']); - $this->db->where_not_in('StudentID', $updateFor); - if ($this->db->get()->first_row()) { - $result['updateStuStatus'] = false; - $result['message'] = "This Mobile Number Already Exist"; - } - else { - $this->db->select('*'); - $this->db->from(LOGIN); - $this->db->where('MobileNumber', $empArr['MobileNumber']); - $this->db->where_not_in('StaffID', $updateFor); - if ($this->db->get()->first_row()) { - $result['updateStuStatus'] = false; - $result['message'] = "This Mobile Number Already Exist"; - } - else { - $this->db->where('StudentID', $updateFor); - $this->db->update(STUDENTS, $empArr); - if ($this->db->affected_rows() == '1') { - $mobile = $empArr['MobileNumber']; - $email = $empArr['EmailID']; - $active = $empArr['IsActive']; - $updatedBy = $empArr['UpdatedBy']; - $updatedOn = $empArr['UpdatedOn']; - $sql = "UPDATE " . LOGIN . " SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; - if ($this->db->query($sql) == '1') { - $result['updateStuStatus'] = true; - $result['message'] = "Successfully student details Updated"; - } - else { - $result['updateStuStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['updateStuStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - } - } - else { - $this->db->select('*'); - $this->db->from(STUDENTS); - $this->db->where('MobileNumber', $empArr['MobileNumber']); - $this->db->where_not_in('StudentID', $updateFor); - if ($this->db->get()->first_row()) { - $result['updateStuStatus'] = false; - $result['message'] = "This Mobile Number Already Exist"; - } - else { - $this->db->select('*'); - $this->db->from(LOGIN); - $this->db->where('MobileNumber', $empArr['MobileNumber']); - $this->db->where_not_in('StaffID', $updateFor); - if ($this->db->get()->first_row()) { - $result['updateStuStatus'] = false; - $result['message'] = "This Mobile Number Already Exist"; - } - else { - $target = "../images/student/"; - $getUploadStatus = $this->upload_image($imageSource, $size, $target); - $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; - $empArr['ProfilePicPath'] = "student/" . $imageNameDb; - $this->db->select('ProfilePicPath'); - $this->db->from(STUDENTS); - $this->db->where('StudentID', $updateFor); - $roleDetails = $this->db->get()->first_row(); - - // echo $roleDetails->ProfilePicPath; - // exit(); - - if ($roleDetails->ProfilePicPath != '' && $roleDetails->ProfilePicPath != 'student/default.jpeg') { - unlink('../images/' . $roleDetails->ProfilePicPath); - } - else { - } - $this->db->where('StudentID', $updateFor); - $this->db->update(STUDENTS, $empArr); - if ($this->db->affected_rows() == '1') { - $mobile = $empArr['MobileNumber']; - $email = $empArr['EmailID']; - $active = $empArr['IsActive']; - $updatedBy = $empArr['UpdatedBy']; - $updatedOn = $empArr['UpdatedOn']; - $sql = "UPDATE " . LOGIN . " SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; - if ($this->db->query($sql) == '1') { - $result['updateStuStatus'] = true; - $result['message'] = "Successfully student details Updated"; - } - else { - $result['updateStuStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - else { - $result['updateStuStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - } - } - return $result; - } + // update student personal details + public function update_student($empArr, $updateFor, $imagename, $imageSource, $size) { + // print_r($empArr);exit(); + if ($imageSource == '') { + // print_r($empArr); + // print_r($updateFor); + // exit(); + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('MobileNumber', $empArr['MobileNumber']); + $this->db->where_not_in('StudentID', $updateFor); + if ($this->db->get()->first_row()) { + $result['updateStuStatus'] = false; + $result['message'] = "This Mobile Number Already Exist"; + } else { + $this->db->select('*'); + $this->db->from(LOGIN); + $this->db->where('MobileNumber', $empArr['MobileNumber']); + $this->db->where_not_in('StaffID', $updateFor); + if ($this->db->get()->first_row()) { + $result['updateStuStatus'] = false; + $result['message'] = "This Mobile Number Already Exist"; + } else { + $this->db->where('StudentID', $updateFor); + $this->db->update(STUDENTS, $empArr); + if ($this->db->affected_rows() == '1') { + $mobile = $empArr['MobileNumber']; + $email = $empArr['EmailID']; + $active = $empArr['IsActive']; + $updatedBy = $empArr['UpdatedBy']; + $updatedOn = $empArr['UpdatedOn']; + $sql = "UPDATE " . LOGIN . " SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; + if ($this->db->query($sql) == '1') { + $result['updateStuStatus'] = true; + $result['message'] = "Successfully student details Updated"; + } else { + $result['updateStuStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['updateStuStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + } + } else { + $this->db->select('*'); + $this->db->from(STUDENTS); + $this->db->where('MobileNumber', $empArr['MobileNumber']); + $this->db->where_not_in('StudentID', $updateFor); + if ($this->db->get()->first_row()) { + $result['updateStuStatus'] = false; + $result['message'] = "This Mobile Number Already Exist"; + } else { + $this->db->select('*'); + $this->db->from(LOGIN); + $this->db->where('MobileNumber', $empArr['MobileNumber']); + $this->db->where_not_in('StaffID', $updateFor); + if ($this->db->get()->first_row()) { + $result['updateStuStatus'] = false; + $result['message'] = "This Mobile Number Already Exist"; + } else { + $target = "../images/student/"; + $getUploadStatus = $this->upload_image($imageSource, $size, $target); + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + $empArr['ProfilePicPath'] = "student/" . $imageNameDb; + $this->db->select('ProfilePicPath'); + $this->db->from(STUDENTS); + $this->db->where('StudentID', $updateFor); + $roleDetails = $this->db->get()->first_row(); + // echo $roleDetails->ProfilePicPath; + // exit(); + if ($roleDetails->ProfilePicPath != '' && $roleDetails->ProfilePicPath != 'student/default.jpeg') { + unlink('../images/' . $roleDetails->ProfilePicPath); + } else { + } + $this->db->where('StudentID', $updateFor); + $this->db->update(STUDENTS, $empArr); + if ($this->db->affected_rows() == '1') { + $mobile = $empArr['MobileNumber']; + $email = $empArr['EmailID']; + $active = $empArr['IsActive']; + $updatedBy = $empArr['UpdatedBy']; + $updatedOn = $empArr['UpdatedOn']; + $sql = "UPDATE " . LOGIN . " SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; + if ($this->db->query($sql) == '1') { + $result['updateStuStatus'] = true; + $result['message'] = "Successfully student details Updated"; + } else { + $result['updateStuStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['updateStuStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + } + } + return $result; + } // Update Student Course Details - - public function update_student_course($reqArr, $id) - { - - // print_r($id); - // print_r($reqArr); - // exit(); - + public function update_student_course($reqArr, $id) { $this->db->select('*'); - $this->db->from(STUDENTCOURSE); - $this->db->where('StudentID', $reqArr['StudentID']); - $this->db->where('CourseID', $reqArr['CourseID']); - $this->db->where_not_in('ID', $id); - if ($this->db->get()->first_row()) { - $result['updateStuCourseStatus'] = false; - $result['message'] = "This Student Already exist for this course"; - } - else { - $this->db->where('ID', $id); - $this->db->update(STUDENTCOURSE, $reqArr); - if ($this->db->affected_rows() == '1') { - $result['updateStuCourseStatus'] = true; - $result['message'] = "Successfully Student Course Details Updated"; - } - else { - $result['updateStuCourseStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } - } - return $result; - } - - // image upload in taget path - - public function upload_image($imageSource, $size, $target) - { - $key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') , 0, 12); - $new_regNo = "Dri_" . $key2 . "." . 'jpeg'; - $targetPlace = $target . $new_regNo; - - // echo $targetPlace;exit(); - - if (!move_uploaded_file($imageSource, $targetPlace)) { - return $result['status'] = false; - } - else { - $result['status'] = true; - $result['imageName'] = $new_regNo; - return $result; - } - } - + $this->db->from(STUDENTCOURSE); + $this->db->where('StudentID', $reqArr['StudentID']); + $this->db->where('CourseID', $reqArr['CourseID']); + $this->db->where_not_in('ID', $id); + if ($this->db->get()->first_row()) { + $result['updateStuCourseStatus'] = false; + $result['message'] = "This Student Already exist for this course"; + } else { + $this->db->where('ID', $id); + $this->db->update(STUDENTCOURSE, $reqArr); + if ($this->db->affected_rows() == '1') { + $result['updateStuCourseStatus'] = true; + $result['message'] = "Successfully Student Course Details Updated"; + } else { + $result['updateStuCourseStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + return $result; + } + // image upload in taget path + public function upload_image($imageSource, $size, $target) { + $key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 12); + $new_regNo = "Dri_" . $key2 . "." . 'jpeg'; + $targetPlace = $target . $new_regNo; + // echo $targetPlace;exit(); + if (!move_uploaded_file($imageSource, $targetPlace)) { + return $result['status'] = false; + } else { + $result['status'] = true; + $result['imageName'] = $new_regNo; + return $result; + } + } + /* - * update followup details for application status in call tracking - * created by kms - * */ - public function updatePendingDocumentInCallTrack($fromDetails=null,$localdata=null){ - + * update followup details for application status in call tracking + * created by kms + * */ + public function updatePendingDocumentInCallTrack($fromDetails = null, $localdata = null) { // check document type $this->db->select('AC.ActivityID,PLD.ListCode'); - $this->db->from(ACTIVITY_STATUS.' as AS'); - $this->db->join(ACTIVITY.' as AC', 'AC.ActivityID = AS.ActivityID'); - $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AS.StatusName'); - $this->db->where('AC.ActivityName','DOCUMENT FOLLOWUP'); - $this->db->where('PLD.ListName','PENDING'); - $this->db->where('AC.IsActive','1'); - $this->db->where('AS.IsActive','1'); - $this->db->where('AC.BranchCode',$localdata['localBranchID']); - $this->db->where('PLD.BranchCode',$localdata['localBranchID']); - $checkApplicationStatus=$this->db->get()->last_row(); - if($checkApplicationStatus){ - - $studentDetails = $this->studentInfoForDocumentStatus($fromDetails,$localdata); - if($studentDetails){ - $arrayDetails['MobileNumber']=$studentDetails->MobileNumber; - $arrayDetails['LeadName']=$studentDetails->Firstname; - $arrayDetails['University']=$studentDetails->UniversityName;; - $arrayDetails['Course']=$studentDetails->CourseName;; - $arrayDetails['ActivityStatus'] = $checkApplicationStatus->ActivityID;; - $arrayDetails['StatusCode']=$checkApplicationStatus->ListCode; - $arrayDetails['CreatedBranch']=$localdata['localBranchID']; - $arrayDetails['CreatedOn']=$fromDetails['CreatedOn']; - $arrayDetails['FollowupOn']=$date = date('d-m-Y'); - $arrayDetails['FollowupComments']=$fromDetails['Details']; - if($localdata['localType']==SUPER_ADMIN){ - $this->db->select('LO.ID'); - $this->db->from(STAFF_BRANCH.' as STB'); - $this->db->join(LOGIN.' as LO', 'LO.StaffID = STB.StaffID'); - $this->db->where('STB.BranchCode',$localdata['localBranchID']); - $this->db->where('LO.ListCode',ADMIN); - $this->db->where('STB.IsActive','1'); - $this->db->where('LO.IsActive','1'); - $assignDet=$this->db->get()->last_row(); - if($assignDet){ - $arrayDetails['CreatedBy']=$assignDet->ID; + $this->db->from(ACTIVITY_STATUS . ' as AS'); + $this->db->join(ACTIVITY . ' as AC', 'AC.ActivityID = AS.ActivityID'); + $this->db->join(PICK_LIST_DETAILS . ' as PLD', 'PLD.ListCode = AS.StatusName'); + $this->db->where('AC.ActivityName', 'DOCUMENT FOLLOWUP'); + $this->db->where('PLD.ListName', 'PENDING'); + $this->db->where('AC.IsActive', '1'); + $this->db->where('AS.IsActive', '1'); + $this->db->where('AC.BranchCode', $localdata['localBranchID']); + $this->db->where('PLD.BranchCode', $localdata['localBranchID']); + $checkApplicationStatus = $this->db->get()->last_row(); + if ($checkApplicationStatus) { + $studentDetails = $this->studentInfoForDocumentStatus($fromDetails, $localdata); + if ($studentDetails) { + $arrayDetails['MobileNumber'] = $studentDetails->MobileNumber; + $arrayDetails['LeadName'] = $studentDetails->Firstname; + $arrayDetails['University'] = $studentDetails->UniversityName;; + $arrayDetails['Course'] = $studentDetails->CourseName;; + $arrayDetails['ActivityStatus'] = $checkApplicationStatus->ActivityID;; + $arrayDetails['StatusCode'] = $checkApplicationStatus->ListCode; + $arrayDetails['CreatedBranch'] = $localdata['localBranchID']; + $arrayDetails['CreatedOn'] = $fromDetails['CreatedOn']; + $arrayDetails['FollowupOn'] = $date = date('d-m-Y'); + $arrayDetails['FollowupComments'] = $fromDetails['Details']; + if ($localdata['localType'] == SUPER_ADMIN) { + $this->db->select('LO.ID'); + $this->db->from(STAFF_BRANCH . ' as STB'); + $this->db->join(LOGIN . ' as LO', 'LO.StaffID = STB.StaffID'); + $this->db->where('STB.BranchCode', $localdata['localBranchID']); + $this->db->where('LO.ListCode', ADMIN); + $this->db->where('STB.IsActive', '1'); + $this->db->where('LO.IsActive', '1'); + $assignDet = $this->db->get()->last_row(); + if ($assignDet) { + $arrayDetails['CreatedBy'] = $assignDet->ID; + } else { + $arrayDetails['CreatedBy'] = $fromDetails['CreatedBy']; + } + } else { + $arrayDetails['CreatedBy'] = $fromDetails['CreatedBy']; } - else{ - $arrayDetails['CreatedBy']=$fromDetails['CreatedBy']; + // new lead details + $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; + $newLeadDetails['LeadName'] = $arrayDetails['LeadName']; + $newLeadDetails['CreatedBy'] = $fromDetails['CreatedBy']; + $newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; + $this->db->insert(LEAD_DETAILS, $newLeadDetails); + // this if for insert lead details + if ($this->db->affected_rows() == '1') { + // get and store insert id from db + $track_Details['LeadID'] = $this->db->insert_id(); + $track_Details['ActivityStatus'] = $arrayDetails['ActivityStatus']; + $track_Details['University'] = $arrayDetails['University']; + $track_Details['Course'] = $arrayDetails['Course']; + $track_Details['AssignedTo'] = $arrayDetails['CreatedBy']; + $track_Details['StatusCode'] = $arrayDetails['StatusCode']; + $track_Details['CreatedBy'] = $fromDetails['CreatedBy']; + $track_Details['CreatedOn'] = $arrayDetails['CreatedOn']; + $track_Details['CreatedBranch'] = $arrayDetails['CreatedBranch']; + $this->db->insert(LEAD_TRACKING, $track_Details); + // this if for insert tracking details + if ($this->db->affected_rows() == '1') { + $insertfollowup_Details['TrackingID'] = $this->db->insert_id(); + $insertfollowup_Details['FollowupOn'] = $arrayDetails['FollowupOn']; + $insertfollowup_Details['FollowupComments'] = $arrayDetails['FollowupComments']; + $insertfollowup_Details['CreatedBy'] = $fromDetails['CreatedBy']; + $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; + $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); + // this if for insert follow up details + + } } - - } - else{ - $arrayDetails['CreatedBy']=$fromDetails['CreatedBy']; - } - - // new lead details - $newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber']; - $newLeadDetails['LeadName'] = $arrayDetails['LeadName']; - $newLeadDetails['CreatedBy'] = $fromDetails['CreatedBy']; - $newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn']; - $this->db->insert(LEAD_DETAILS, $newLeadDetails); - // this if for insert lead details - if($this->db->affected_rows() == '1'){ - // get and store insert id from db - $track_Details['LeadID']=$this->db->insert_id(); - $track_Details['ActivityStatus'] = $arrayDetails['ActivityStatus']; - $track_Details['University'] = $arrayDetails['University']; - $track_Details['Course'] = $arrayDetails['Course']; - $track_Details['AssignedTo'] = $arrayDetails['CreatedBy']; - $track_Details['StatusCode'] = $arrayDetails['StatusCode']; - $track_Details['CreatedBy'] = $fromDetails['CreatedBy']; - $track_Details['CreatedOn'] = $arrayDetails['CreatedOn']; - $track_Details['CreatedBranch']=$arrayDetails['CreatedBranch']; - $this->db->insert(LEAD_TRACKING, $track_Details); - // this if for insert tracking details - if($this->db->affected_rows() == '1'){ - $insertfollowup_Details['TrackingID']=$this->db->insert_id(); - $insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn']; - $insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments']; - $insertfollowup_Details['CreatedBy'] = $fromDetails['CreatedBy']; - $insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn']; - $this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details); - // this if for insert follow up details - - } - - - } - - - - } - - - else{ + } else { return false; } - } - else{ + } else { return false; } - } - /* - * get student info for documet updates - * created by kms - * */ - public function studentInfoForDocumentStatus($details=null,$localdata=null){ - + * get student info for documet updates + * created by kms + * */ + public function studentInfoForDocumentStatus($details = null, $localdata = null) { $this->db->select('ST.Firstname,ST.MobileNumber,US.UniversityName,CU.CourseName'); - $this->db->from(STUDENTCOURSE.' as STC'); - $this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID'); - $this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID'); - $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID'); - $this->db->where('ST.StudentID',$details['StudentID']); - $this->db->where('US.BranchCode',$localdata['localBranchID']); - // $this->db->where('STC.CourseID',$details[0]['CourseID']); - $leadDet=$this->db->get()->last_row(); - - if($leadDet){ + $this->db->from(STUDENTCOURSE . ' as STC'); + $this->db->join(STUDENTS . ' as ST', 'ST.StudentID = STC.StudentID'); + $this->db->join(COURSE . ' as CU', 'CU.CourseID = STC.CourseID'); + $this->db->join(UNIVERSITY . ' as US', 'US.UniversityID = STC.UniversityID'); + $this->db->where('ST.StudentID', $details['StudentID']); + $this->db->where('US.BranchCode', $localdata['localBranchID']); + // $this->db->where('STC.CourseID',$details[0]['CourseID']); + $leadDet = $this->db->get()->last_row(); + if ($leadDet) { return $leadDet; - } - else{ + } else { return false; } - } }