apollo_developers/api/application/controllers/Dashboard_Controller.php
venbatechnologies@gmail.com 1809bcf9c9 fixed table for student details
2018-04-23 18:34:11 +05:30

93 lines
3.4 KiB
PHP
Executable File

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Dashboard_Controller extends REST_Controller {
/*
* get Dashboard details
* kdk
* params:
*
* */
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
// load the dashboard model
$this->load->model('Dashboard_model', 'dashboard_model');
}
public function getTotalUsers_post() {
$data = $this->post('data');
$totalUsers = $this->dashboard_model->get_total_users( $data );// Check if the employee exist
if ($totalUsers) {
$totalUsers['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($totalUsers, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getTotalStudent_post() {
$data = $this->post('data');
$totalStudents = $this->dashboard_model->get_total_students( $data );// Check if the employee exist
if ($totalStudents) {
$totalStudents['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($totalStudents, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getTotalEmployee_post() {
$data = $this->post('data');
$totalEmployee = $this->dashboard_model->get_total_employee( $data );// Check if the employee exist
if ($totalEmployee) {
$totalEmployee['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($totalEmployee, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}