74 lines
2.2 KiB
PHP
Executable File
74 lines
2.2 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;
|
|
}
|
|
|
|
|
|
} |