apollodec/Apollo/api/application/models/Student_model.php
venbatechnologies@gmail.com 78036cc366 notification list
2018-10-13 16:21:00 +05:30

1827 lines
92 KiB
PHP
Executable File

<?php
/**
* Date: 11/9/17
* Time: 5:28 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Student_model extends CI_Model {
/*
* 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;
}
// 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_student_tracking_details($universityid,$courseid,$MobileNumber,$loginBranch)
{
$this->db->select ('LTF.FollowupOn,LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,LT.University,LT.Course,LT.AlternateMobile,LT.Address,LT.Flag,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,AV.ActivityID,AV.ActivityName,LTF.FollowupComments');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->join(LEAD_TRACKING.' as LT','LT.TrackingID=LTF.TrackingID');
$this->db->join(LEAD_DETAILS.' as LD', 'LT.LeadID = LD.LeadID');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(ACTIVITY.' as AV', 'AV.ActivityID = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->join(UNIVERSITY.' as UM','UM.UniversityName=LT.University');
$this->db->join(COURSE.' as CM','CM.CourseName=LT.Course');
$this->db->where('LD.MobileNumber',$MobileNumber);
$this->db->where('PLD1.BranchCode',$loginBranch);
$this->db->where('UM.UniversityID',$universityid);
$this->db->where('CM.CourseID',$courseid);
//$this->db->group by('LD.LeadID');
$this->db->group_by('LD.LeadID');
$trackingDetails=$this->db->get()->result_array();
$result =$trackingDetails;
return $result;
}
// get student list based on login user
public function get_student_list($loginUserId, $loginUserBranchId, $loginUserType, $getSearchData,$batchcode) {
if ($loginUserType == SUPER_ADMIN) {
// list for super admin based on branch
if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') {
$this->db->select('S.*, SC.id as Student_Course_id , U.UniversityName,U.UniversityID, C.CourseName,C.CourseCode,C.CourseID');
$this->db->from('' . STUDENTCOURSE . ' as SC');
$this->db->join('' . STUDENTS . ' as S', 'S.StudentID = SC.StudentID', 'LEFT');
$this->db->join('' . UNIVERSITY . ' as U', 'SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode', 'LEFT');
$this->db->join('' . COURSE . ' as C', 'SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode', 'LEFT');
$this->db->where('SC.BranchID', $loginUserBranchId);
// $this->db->group_by('t2.StudentID');
$this->db->order_by('SC.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 {
// echo 'hi';
// exit();
$University = $getSearchData['University'];
$Course = $getSearchData['Course'];
$Batch = $batchcode;
$StuStatus = $getSearchData['Status'];
if ($StuStatus == '') {
if ($University != '' && $Course == '' && $batchcode=='') {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,U.UniversityID, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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 Student_Course_id,StudentID
ORDER BY S.CreatedOn";
// GROUP BY SC.StudentID
} else if ($University != '' && $Course != '' && $batchcode=='') {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,U.UniversityID, C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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 Student_Course_id,StudentID
ORDER BY S.CreatedOn";
// $subStudentCourse = "SELECT S.StudentID,
// FROM " . STUDENTCOURSE . " as S
// 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
// "
}
else if($University !='' && $Course == '' && $batchcode!='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName, U.UniversityID,C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else if($University !=''&&$Course != '' && $batchcode !='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, U.UniversityID,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
}
else
{
if ($University != '' && $Course == '' && $batchcode=='' ) {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode,U.UniversityID, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC LEFT JOIN " . STUDENTS . " as S 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 SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
} else if ($University != '' && $Course != '' && $batchcode=='') {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName, C.CourseCode,C.CourseName,C.CourseID,U.UniversityID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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 Student_Course_id,StudentID
ORDER BY S.CreatedOn";
} else {
if ($University != '' && $Course == ''&& $batchcode=='' ) {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,U.UniversityID, C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC LEFT JOIN " . STUDENTS . " as S 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 SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
} else if ($University != '' && $Course != '' && $batchcode=='') {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,U.UniversityID, C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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 Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else if($University != '' && $Course == '' && $batchcode !='' )
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName, U.UniversityID,C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else if($University != '' && $Course != '' && $batchcode !='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, U.UniversityID,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID,U.UniversityID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
}
}
$stuDetails = $this->db->query($subQuery);
$checkArr = $stuDetails->result();
//print_r( $this->db->last_query());
//die();
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('S.*, SC.id as Student_Course_id , U.UniversityName, U.UniversityID, C.CourseCode,C.CourseName,C.CourseID');
$this->db->from('' . STUDENTCOURSE . ' as SC');
$this->db->join('' . STUDENTS . ' as S', 'S.StudentID = SC.StudentID', 'LEFT');
$this->db->join('' . UNIVERSITY . ' as U', 'SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode', 'LEFT');
$this->db->join('' . COURSE . ' as C', 'SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode', 'LEFT');
$this->db->where('SC.BranchID', $loginUserBranchId);
// $this->db->group_by('t2.StudentID');
$this->db->order_by('SC.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 == '' && $batchcode=='') {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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'
ORDER BY S.CreatedOn";
} else if ($University != '' && $Course != '' && $batchcode=='') {
$subQuery = "SELECT S.* , SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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'
ORDER BY S.CreatedOn";
}
else if($University !='' && $Course == '' && $batchcode!='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName, C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else if($University !=''&&$Course != '' && $batchcode !='')
{
$subQuery = "SELECT S.* , SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
}
else
{
if ($University != '' && $Course == '' && $batchcode =='') {
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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'
ORDER BY S.CreatedOn";
}
else if ($University != '' && $Course != '' && $batchcode =='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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'
ORDER BY S.CreatedOn";
}
else if($University != '' && $Course == '' && $batchcode !='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName, C.CourseCode,C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else if($University != '' && $Course != '' && $batchcode !='')
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID
ORDER BY S.CreatedOn";
}
else
{
$subQuery = "SELECT S.*, SC.id as Student_Course_id , U.UniversityName,C.CourseCode, C.CourseName,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
ORDER BY S.CreatedOn";
}
}
$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 || $loginUserType == TRAINEE) {
// list for staff
if ($getSearchData["University"] === '' && $getSearchData["Course"] === '' && $getSearchData["Status"] === '') {
$this->db->select("S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID");
$this->db->from('' . STUDENTCOURSE . ' as SC');
$this->db->join('' . STUDENTS . ' as S', 'S.StudentID = SC.StudentID', 'LEFT');
$this->db->join('' . UNIVERSITY . ' as U', 'SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode', 'LEFT');
$this->db->join('' . COURSE . ' as C', 'SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode', 'LEFT');
$this->db->join('' . STUDENTS_FEES_PAID . ' as SFP', 'SFP.StudentID = S.StudentID', 'LEFT');
$this->db->where('SC.BranchID', $loginUserBranchId);
$this->db->group_by('SC.id');
$this->db->order_by('SC.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 == '' && $batchcode=='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.id
ORDER BY S.CreatedOn";
} else if ($University != '' && $Course != '' && $batchcode=='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.id
ORDER BY S.CreatedOn";
}
else if ($University != '' && $Course == '' && $batchcode !='')
{
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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
LEFT JOIN ".STUDENTS_FEES_STATUS." as sfs on sfs.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID,SC.id
ORDER BY S.CreatedOn";
}
else if ($University != '' && $Course != '' && $batchcode !='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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
LEFT JOIN ".STUDENTS_FEES_STATUS." as sfs on sfs.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID,SC.id
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 == '' && $batchcode=='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.id
ORDER BY S.CreatedOn";
} else if ($University != '' && $Course != '' && $batchcode=='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.id
ORDER BY S.CreatedOn";
}
else if ($University != '' && $Course == '' && $batchcode !='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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
LEFT JOIN ".STUDENTS_FEES_STATUS." as sfs on sfs.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID,SC.id
ORDER BY S.CreatedOn";
}
else if ($University != '' && $Course != '' && $batchcode!='') {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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
LEFT JOIN ".STUDENTS_FEES_STATUS." as sfs on sfs.CourseID=SC.CourseID AND sfs.StudentID=SC.StudentID
and C.CourseID=sfs.CourseID
WHERE
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
AND SC.BranchID = '$loginUserBranchId'
AND S.IsActive = '$StuStatus'
AND sfs.BatchCode = '$batchcode'
group by Student_Course_id,StudentID,SC.id
ORDER BY S.CreatedOn";
}
else {
$subQuery = "SELECT S.*, IF(SFP.ID > 0, '1' , '0') as Fee_paid_exist , SC.id as Student_Course_id , U.UniversityName, C.CourseName,C.CourseCode,C.CourseID
FROM " . STUDENTCOURSE . " as SC
LEFT JOIN " . STUDENTS . " as S 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.id
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;
}
// 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->where('t1.IsActive', '1');
$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('SC.* ,IF(SFP.ID > 0, '.'1'.' , '.'0'.') as Fee_paid_exist');
$this->db->from('' . STUDENTCOURSE . ' as SC');
$this->db->join('' . STUDENTS_FEES_STATUS . ' as SFS', 'SFS.StudentID = SC.StudentID AND SFS.CourseID = SC.CourseID AND SFS.BranchCode = SC.BranchID', 'LEFT');
$this->db->join('' . STUDENTS_FEES_PAID . ' as SFP', 'SFP.FeesId = SFS.FeesID', 'LEFT');
$this->db->group_by('SC.id');
$this->db->where('SC.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();
// print_r($courseDetails->result());
// die();
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('SD.IsActive', 1);
$batchDetails = $this->db->get();
//print_r($batchDetails->result());
//die();
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') {
} 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;
}
public function getCourseName($cours, $branch) {
$this->db->select('t2.CourseName');
$this->db->from('' . COURSE . ' as t2');
$this->db->where('t2.CourseID', $cours);
$this->db->where('t2.BranchCode', $branch);
$courseDetails = $this->db->get()->first_row();
return "$courseDetails->CourseName";
}
public function getUnivName($univ, $branch) {
$this->db->select('t2.UniversityName');
$this->db->from('' . UNIVERSITY . ' as t2');
$this->db->where('t2.UniversityID', $univ);
$this->db->where('t2.BranchCode', $branch);
$univDetails = $this->db->get()->first_row();
return "$univDetails->UniversityName";
}
// 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') {
$userId = $Arr['MobileNumber'];
$getUnivName = $this->getUnivName($courseArr['UniversityID'], $courseArr['BranchID']);
$getCourseName = $this->getCourseName($courseArr['CourseID'], $courseArr['BranchID']);
$msg = "Thanks for registering with us for Course $getCourseName -$getUnivName. For more details, please login to www.apollodec.com. User ID :$userId, Password :abc123";
$arr = $userId;
$this->smssend($arr, $msg);
$emailId = $Arr['EmailID'];
$sub = ' Apollo - Course Registration';
$this->mailsend($emailId, $msg, $sub);
$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') {
$userId = $Arr['MobileNumber'];
$getUnivName = $this->getUnivName($courseArr['UniversityID'], $courseArr['BranchID']);
$getCourseName = $this->getCourseName($courseArr['CourseID'], $courseArr['BranchID']);
$msg = "Thanks for registering with us for Course $getCourseName -$getUnivName. For more details, please login to www.apollodec.com. User ID :$userId, Password :abc123";
$arr = $userId;
$this->smssend($arr, $msg);
$emailId = $Arr['EmailID'];
$sub = ' Apollo - Course Registration';
$this->mailsend($emailId, $msg, $sub);
$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, $localData) {
$localBranch = $localData['localBranchID'];
$this->db->select('*');
$this->db->order_by('T_Student_DocumentTrack_Details.CreatedOn', 'DESC');
$this->db->from(STUDENTDOCUMENTTRACKDETAILS);
$this->db->join('T_CourseMaster','T_CourseMaster.CourseID=T_Student_DocumentTrack_Details.CourseID','left');
$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) {
//print_r($reqData);die();
$this->db->insert(STUDENTDOCUMENTTRACKDETAILS, $reqData);
if ($this->db->affected_rows() > 0) {
// Entry for call track
if ($reqData['Status'] == '1') {
$reqData['DocID']=$this->db->insert_id();
$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.';
//load call tracking model for delete track details from call tracking
$this->load->model('Calltracking_model');
$this->Calltracking_model->deletePendingDocTrack($id);
// end
} 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 Course Details
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;
}
//get login branch employee list
public function get_login_branch_Emp_list($loginUserId, $loginBranchId, $loginUserType){
$this->db->select('t2.StaffID, t2.Firstname, t2.Lastname');
$this->db->from('' . STAFF_BRANCH . ' as t1');
$this->db->join('' . STAFF . ' as t2', 't2.StaffID = t1.StaffID', 'LEFT');
$this->db->group_by('t1.StaffID');
$this->db->where('t1.BranchCode', $loginBranchId);
$this->db->where('t1.IsActive','1');
$this->db->where('t2.IsActive','1');
// $this->db->where('t1.ListCode', EMPLOYEE);
$this->db->order_by('t1.CreatedOn', 'DESC');
$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';
}
return $results;
}
// 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) {
// 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']=$fromDetails['DocumentDate'];
$arrayDetails['FollowupComments'] = $fromDetails['Details'];
$arrayDetails['PendingDocStatus'] = $fromDetails['DocID'];
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'];
}
// 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['UpdatedOn'] = $arrayDetails['CreatedOn'];
$track_Details['CreatedBranch'] = $arrayDetails['CreatedBranch'];
$track_Details['PendingDocStatus'] = $arrayDetails['PendingDocStatus'];
$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'];
$insertfollowup_Details['StatusName'] = $arrayDetails['StatusCode'];
$insertfollowup_Details['AssignedStaff'] = $arrayDetails['CreatedBy'];
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details);
// this if for insert follow up details
}
}
} else {
return false;
}
} else {
return false;
}
}
/*
* 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) {
return $leadDet;
} else {
return false;
}
}
// 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 = $arr;
$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);
$arrss = explode('<br>', $output);
$time = date('Y-m-d H:i:s');
$dateTime = $time;
$msgGroup = date('YmdHis');
for ($i = 0, $c = count($arrss);$i < $c;$i++)
{
if ($arrss[$i] === '')
{
break;
}
else
{
$a = explode(':', $arrss[$i]);
$msgIdState = $a[0];
$msgId = $a[1];
$msgNumb = $a[2];
$msgStatus = $a[4];
$data[] = array('MsgId' => $msgId, 'MobileNumber' => $msgNumb, 'MsgBody' => $msg, 'Status' => $msgStatus, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup);
continue;
}
}
$this->db->insert_batch('T_BroadcastStatus', $data);
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);
$list = $arr;
//Load email library
$this->load->library('email');
//SMTP & mail configuration
$config = array(
'protocol' => 'ssmtp',
'smtp_host' => 'ssl://smtp.example.com',
'smtp_port' => 465,
'smtp_user' => 'noreply@apollodec.com',
'smtp_pass' => 'Apollo@123',
'mailtype' => 'html',
'charset' => 'utf-8'
);
$this->email->initialize($config);
$this->email->set_mailtype("html");
$this->email->set_newline("\r\n");
//Email content
// $htmlContent = '<h1>Sending email via SMTP server</h1>';
$htmlContent = $msg;
// Email body load the html template
// $body = $this->load->view('emails/anillabs.php',$data,TRUE);
$this->email->to($list);
$this->email->from('noreply@apollodec.com','Apollo');
$subj = $sub;
$this->email->subject($subj);
$this->email->message($htmlContent);
//Send email
$result = $this->email->send();
// echo $this->email->print_debugger(); exit();
return $result;
}
public function get_All_Course($localBranchID)
{
$this->db->select('CourseID,T_CourseMaster.CourseCode,CourseName,T_CourseMaster.UniversityID,UniversityName');
$this->db->from('T_CourseMaster');
$this->db->join('T_UniversityMaster','T_UniversityMaster.UniversityID=T_CourseMaster.UniversityID');
$this->db->where('T_CourseMaster.BranchCode',$localBranchID);
$this->db->order_by('UniversityID','asc');
$courseDetails = $this->db->get();
if($courseDetails->result())
{
//print_r($searchDetails->result());
$result_array['feeStatus'] = true;
$result_array['details'] = $courseDetails->result();
}
else
{
$result_array['feeStatus'] = false;
$result_array['details'] = "No records found!";
}
// print_r($this->db->last_query());die();
return $result_array;
}
public function GetStudentNotifications($det)
{
$this->db->select('*');
$this->db->from('T_BroadcastStatus');
$this->db->like('MobileNumber', $det['Phone'], 'before');
$messagedet = $this->db->get();
if($messagedet ->result())
{
$result_array['msgStatus'] = true;
$result_array['msgdetails'] = $messagedet->result();
}
else
{
$result_array['msgStatus'] = false;
$result_array['msgdetails'] = 'No Records Found';
}
$this->db->select('*');
$this->db->from('T_BroadcastStatus');
$this->db->where('MobileNumber', $det['Email']);
$maildet = $this->db->get();
if($maildet ->result())
{
$result_array['mailStatus'] = true;
$result_array['maildetails'] = $maildet->result();
}
else
{
$result_array['mailStatus'] = false;
$result_array['maildetails'] = 'No Records Found';
}
$this->db->select('StudentID');
$this->db->from('T_StudentDetails');
$this->db->where('MobileNumber', $det['Phone']);
$studentID = $this->db->get();
if($studentID ->result())
{
$result_array['stuidStatus'] = true;
$result_array['StudentID'] = $studentID->result();
}
else
{
$result_array['stuidStatus'] = false;
$result_array['StudentID'] = 'No Records Found';
}
return $result_array;
}
}