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 WHERE SM.StudentActivityCode = '$statusCode' AND SM.BranchCode = '$reqBranch' AND SM.IsActive = '1'"; $queryDetails = $this->db->query($subQuery); $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 . ' as t2'); $this->db->where('t2.CourseID', $cours); $roleDetails = $this->db->get()->first_row(); return "$roleDetails->CourseName"; } // update Application status 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'])) { $dateToMsg = $arr[0]['AppDate']; $CmntToMsg = $arr[0]['Comments']; $studentName = $this->getStudentName($arr[0]['StudentID']); $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); if( $statuToMsg == 'received' || $statuToMsg == 'Received' || $statuToMsg == 'RECEIVED'){ $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $getSemYearMsg = $this->get_couser_name($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received, Please come and collect it."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); } else if($statuToMsg == 'issued' || $statuToMsg == 'Issued' || $statuToMsg == 'ISSUED') { $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); $getSemYearMsg = $this->get_couser_name($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Despatch - Dear $studentName, Your $getSemYearANDType had been despatched against ($CmntToMsg $statuToMsg) on $dateToMsg."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); } else { } // $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); // $getCourseName = $this->get_couser_name($arr[0]['CourseID']); // $mesg = "Status Update : $cerNamtToMsg $getCourseName - $statuToMsg $dateToMsg."; // $this->smssend($arr, $mesg); } $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"; } return $result; } // update certificate stauts public function update_certificateStatus($arr) { $this->db->insert_batch(CERTIFICATION_STATUS, $arr); if ($this->db->affected_rows() >= 1) { //If condition for Check ANSWERBOOKLET_STATUS, If it is null or 'Issued to Student' for do not send sms. $answerBookletStatus = $this->getAnswerBookletStatus($arr[0]['StudentID'],$arr[0]['CourseID'],$arr[0]['BranchCode'],$arr[0]['Sem']); //print_r($answerBookletStatus);die(); //echo "COURSE ====$arr[0]['CourseID']"; // echo "PARENT -- $answerBookletStatus"; if($answerBookletStatus['isIssueToStudentExist'] == 0 && $answerBookletStatus['statusCount'] != 0) { //echo "SEND SMS"; if ($this->get_ListCode_status($arr[0]['ListCode'])) { $dateToMsg = $arr[0]['CDate']; $studentName = $this->getStudentName($arr[0]['StudentID']); $CmntToMsg = $arr[0]['Comments']; $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); // $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); if( $statuToMsg == 'received' || $statuToMsg == 'Received' || $statuToMsg == 'RECEIVED'){ $cerNamtToMsg = 'Mark Card'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received, Please come and collect it."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); } else if($statuToMsg == 'issued' || $statuToMsg == 'Issued' || $statuToMsg == 'ISSUED') { $cerNamtToMsg = 'Mark Card'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Despatch - Dear $studentName, Your $getSemYearANDType had been despatched against ($CmntToMsg $statuToMsg) on $dateToMsg."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); } else { } // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; // $mesg = "Status Update : $cerNamtToMsg - $statuToMsg $dateToMsg."; // $this->smssend($arr, $mesg); } }///else {echo "DO NOT SEND SMS";} $result['addStatus'] = true; $result['message'] = "Successfully Mark Card Status Updated"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } // get certificate list 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'); $this->db->from(STUDENTS); $this->db->where('StudentID', $num); $roleDetails = $this->db->get()->first_row(); return $roleDetails->MobileNumber; } // self function for getting registered email for mail send public function get_registered_email($num) { $this->db->select('EmailID'); $this->db->from(STUDENTS); $this->db->where('StudentID', $num); $roleDetails = $this->db->get()->first_row(); return $roleDetails->EmailID; } // self function for getting the status for the LISTCODE public function get_ListCode_status($listCode) { $this->db->select('ListName'); $this->db->from(PICK_LIST_DETAILS); $this->db->where('ListCode', $listCode); $statusDetails = $this->db->get()->first_row(); if ($statusDetails->ListName == 'RECEIVED' || $statusDetails->ListName == 'ISSUED') { return true; } else { return false; } } 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->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->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } else if ($reqDetailsFor == 'CERTIFICATE_STATUS') { $searchFor = 'A001'; $searchTableFor = APPLICATION_STATUS; $this->db->select('t1.*, t4.Firstname, t5.ListName, t6.CertificateName'); $this->db->from('' . $searchTableFor . ' as t1'); $this->db->where('t1.StudentID', $reqDetails['student']); $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['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } 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->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->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } 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->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->order_by('t1.CreatedOn', 'DESC'); $statusDetails = $this->db->get(); $prevStatusDetails = $statusDetails->result(); if (count($prevStatusDetails) > 0) { $results['preStatusDetails'] = true; $results['preStatus_details_list'] = $prevStatusDetails; } else { $results['preStatusDetails'] = false; $results['message'] = 'No record found'; } } return $results; } public function get_status_name_ListCode($listCode) { $this->db->select('ListName'); $this->db->from(PICK_LIST_DETAILS); $this->db->where('ListCode', $listCode); $statusDetails = $this->db->get()->first_row(); return $statusDetails->ListName; } // self function for getting certificate name for the CERTIFICATECODE public function get_certificate_name($listCode) { $this->db->select('CertificateName'); $this->db->from(CERTIFICATION); $this->db->where('CertificationID', $listCode); $cerfDetails = $this->db->get()->first_row(); return $cerfDetails->CertificateName; } // update answer booklet status public function update_answerbooklet($arr, $reqDetails) { $this->db->insert_batch(ANSWER_BOOKLET, $arr); if ($this->db->affected_rows() >= 1) { $this->updateBookletStatusInCallTrack($arr, $reqDetails); $studentName = $this->getStudentName($arr[0]['StudentID']); $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); // $cerNamtToMsg = $this->get_certificate_name($arr[0]['CertificationType']); if( $statuToMsg == 'received' || $statuToMsg == 'Received' || $statuToMsg == 'RECEIVED'){ $cerNamtToMsg = 'Answer booklet'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; // $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received."; $mesg = "Answer booklet Received - Dear $studentName, Your answer booklet for $getSemYearANDType has been received."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); $result['addStatus'] = true; $result['message'] = "Successfully Answer Booklet Status Updated"; }else{ $result['addStatus'] = true; $result['message'] = "Successfully Answer Booklet Status Updated"; } } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } public function get_couser_sem_yr_msg($cours) { $this->db->select('t1.Sem_Year, t2.CourseName'); $this->db->from('' . COURSE_FEES . ' as t1'); $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"; } public function getStudentName($stdId) { $this->db->select('t1.Firstname'); $this->db->from('' . STUDENTS . ' as t1'); $this->db->where('StudentID', $stdId); $nameDetails = $this->db->get()->first_row(); return "$nameDetails->Firstname"; } // update study material status public function update_semyear($arr) { $this->db->insert_batch(STUDY_MATERIAL_STATUS, $arr); if ($this->db->affected_rows() >= 1) { if ($this->get_ListCode_status($arr[0]['ListCode']) == true) { $dateToMsg = $arr[0]['SDate']; $CmntToMsg = $arr[0]['Comments']; $studentName = $this->getStudentName($arr[0]['StudentID']); $statuToMsg = $this->get_status_name_ListCode($arr[0]['ListCode']); if( $statuToMsg == 'received' || $statuToMsg == 'Received' || $statuToMsg == 'RECEIVED'){ $cerNamtToMsg = 'Study Material'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Received - Dear $studentName, Your $getSemYearANDType had been received, Please come and collect it."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); } else if($statuToMsg == 'issued' || $statuToMsg == 'Issued' || $statuToMsg == 'ISSUED') { $cerNamtToMsg = 'Study Material'; $getSemYearMsg = $this->get_couser_sem_yr_msg($arr[0]['CourseID']); $getSemYearANDType = "$getSemYearMsg $cerNamtToMsg"; // $mesg = "Status Update : $cerNamtToMsg $getSemYearMsg - $statuToMsg $dateToMsg."; $mesg = "$cerNamtToMsg Despatch - Dear $studentName, Your $getSemYearANDType had been despatched against ($CmntToMsg $statuToMsg) on $dateToMsg."; $this->smssend($arr, $mesg); $this->mailsend($arr, $mesg, $cerNamtToMsg); } else { } } $result['addStatus'] = true; $result['message'] = "Successfully Study Material Status Updated"; } else { $result['addStatus'] = false; $result['message'] = "Something went wrong.please try again"; } return $result; } // get sem/Year for the course public function get_semyear_result($reqData, $stuFor, $reqBranch) { $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 WHERE SFS.CourseID = '$reqData' AND SFS.StudentID = '$stuFor'"; $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) { $University = $reqData['University']; $Course = $reqData['Course']; $Batch = $reqData['Batch']; $branch = $req['localBranchID']; 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'"; $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'"; $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 WHERE SFS.CourseID = SC.CourseID AND SFS.BatchCode = '$Batch' AND SC.UniversityID = '$University' AND S.IsActive = '1' 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 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'"; $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.UniversityID = '$University' AND S.IsActive = '1' AND SC.BranchID = '$branch' 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'"; $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 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' GROUP BY SFS.StudentID "; $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 LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID AND SC.BranchID = SFS.BranchCode AND SFS.CourseID = C.CourseID 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' GROUP BY SFS.StudentID"; $queryDetails = $this->db->query($subQuery); $results['searchResult'] = true; $results['search_result_details'] = $queryDetails->result(); } } 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->where('BranchCode', $branch); $this->db->where('IsActive', 1); $univDetails = $this->db->get(); $universityDetails = $univDetails->result(); $endResult = []; 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->where('t2.UniversityID', $clip->UniversityID); $this->db->where('t2.IsActive', 1); $this->db->where('t2.BranchCode', $branch); $courDetails = $this->db->get(); $courseDetails = $courDetails->result(); $resultArr['Course'] = $courseDetails; // Batch Details $this->db->select('t3.BatchName, t3.BatchCode,t3.BatchDate'); $this->db->from('' . BATCH . ' as t3'); $this->db->where('t3.UniversityID', $clip->UniversityID); $this->db->where('t3.IsActive', 1); $this->db->where('t3.BranchCode', $branch); $batDetails = $this->db->get(); $batchDetails = $batDetails->result(); $resultArr['Batch'] = $batchDetails; array_push($endResult, $resultArr); } $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"); } $mobile = implode(',', $number); $message = urlencode($msg); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $mobile . "&SenderID=APODEC&Message=" . $message . "&ServiceName=TEMPLATE_BASED"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($ch); curl_close($ch); return $output; } public function mailsend($arr, $msg, $sub) { $emails = array(); foreach ($arr as $ar) { $mobi = $this->get_registered_email($ar['StudentID']); array_push($emails, "$mobi"); } $list = implode(',', $emails); //Load email library $this->load->library('email'); //SMTP & mail configuration $config = array( 'protocol' => 'smtp', 'smtp_host' => 'smtp.sendgrid.net', 'smtp_port' => 587, 'smtp_user' => 'apikey', 'smtp_pass' => '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', 'mailtype' => 'html', 'charset' => 'utf-8' ); $this->email->initialize($config); $this->email->set_mailtype("html"); $this->email->set_newline("\r\n"); // print_r($this->email);exit(); //Email content // $htmlContent = '