111 lines
3.7 KiB
PHP
Executable File
111 lines
3.7 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Date: 11/9/17
|
|
* Time: 5:28 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Dashboard_model extends CI_Model
|
|
{
|
|
/*
|
|
* dashboard model
|
|
*
|
|
*/
|
|
/*
|
|
* get Dashboard Details
|
|
*/
|
|
|
|
// get total number of users
|
|
public function get_total_users( $data ) {
|
|
$sql1 = "SELECT * from ".STUDENTS."";
|
|
$count1 = $this->db->query($sql1);
|
|
$sql2 = "SELECT * from ".STAFF."";
|
|
$count2 = $this->db->query($sql2);
|
|
|
|
if( $count2->num_rows() > 0) {
|
|
$result['status'] = true;
|
|
$result['total_student'] = $count1->num_rows();
|
|
$result['total_staff'] = $count2->num_rows();
|
|
$result['message'] = "Total Number of Users";
|
|
} else {
|
|
$result['status'] = true;
|
|
$result['total_student'] = $count1->num_rows();
|
|
$result['total_staff'] = $count2->num_rows();
|
|
$result['message'] = "No student Users";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
// get total number of students
|
|
public function get_total_students($data) {
|
|
// print_r($data);exit();
|
|
$sql = "SELECT * from ".STUDENTS."";
|
|
$count = $this->db->query($sql);
|
|
if( $count->num_rows() > 0) {
|
|
$result['status'] = true;
|
|
$result['total_student'] = $count->num_rows();
|
|
$result['message'] = "Total Number of Students";
|
|
} else {
|
|
$result['status'] = true;
|
|
$result['total_student'] = $count->num_rows();
|
|
$result['message'] = "No student exist";
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
// get total number of employees
|
|
public function get_total_employee($data) {
|
|
// print_r($data);exit();
|
|
$sql = "SELECT * from ".STAFF."";
|
|
$count = $this->db->query($sql);
|
|
if( $count->num_rows() > 0) {
|
|
$result['status'] = true;
|
|
$result['total_employee'] = $count->num_rows();
|
|
$result['message'] = "Total Number of Employee";
|
|
} else {
|
|
$result['status'] = true;
|
|
$result['total_employee'] = $count->num_rows();
|
|
$result['message'] = "No Employee exist";
|
|
}
|
|
return $result;
|
|
}
|
|
/*
|
|
* get university registerd student details
|
|
* created by kms
|
|
* */
|
|
public function get_univ_registered_student($details){
|
|
$this->db->distinct();
|
|
$this->db->select('UniversityID,UniversityName');
|
|
$this->db->from(UNIVERSITY);
|
|
$this->db->order_by('ID','DESC');
|
|
$this->db->where('BranchCode',$details['localBranchID']);
|
|
$getUnivDetails = $this->db->get();
|
|
if($getUnivDetails->result()){
|
|
$resultDetails['resultStatus']=true;
|
|
foreach ($getUnivDetails->result() as $rows){
|
|
$fetchDetails['UniversityID']=$rows->UniversityID;
|
|
$fetchDetails['UniversityName']=$rows->UniversityName;
|
|
$this->db->select('StudentID');
|
|
$this->db->from(STUDENTCOURSE);
|
|
$this->db->where('BranchID',$details['localBranchID']);
|
|
$this->db->where('UniversityID',$rows->UniversityID);
|
|
$getRegisterDetails = $this->db->get();
|
|
if($getRegisterDetails->num_rows()>0){
|
|
$fetchDetails['StudentCounts']=$getRegisterDetails->num_rows();
|
|
}
|
|
else{
|
|
$fetchDetails['StudentCounts']=0;
|
|
}
|
|
$getArray[]=$fetchDetails;
|
|
}
|
|
$resultDetails['details']=$getArray;
|
|
}
|
|
else{
|
|
$resultDetails['resultStatus']=false;
|
|
$resultDetails['Message']="No records found!";
|
|
}
|
|
return $resultDetails;
|
|
}
|
|
|
|
|
|
} |