apollodec/Apollo/api/application/controllers/Dashboard_Controller.php
2020-11-02 16:19:57 +05:30

497 lines
21 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
}
}
/*
* get university based student registration details for dash board
* created by kms
* */
public function getUniversityRegisteredStudent_post(){
$data = $this->post('data');
$getRegisteredDetails = $this->dashboard_model->get_univ_registered_student($data);
if ($getRegisteredDetails) {
$getRegisteredDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getRegisteredDetails, 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
}
}
/*
* get Admission and Lead summary details for dash board
* created by Tamilarasan
* */
public function getleadCountToday_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$getleadCountToday = $this->dashboard_model->leadCountDay($branchId,$requestedBy);
if ($getleadCountToday) {
$getleadCountToday['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getleadCountToday, 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 getleadCountMonth_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$getleadCountMonth = $this->dashboard_model->leadCountMonth( $branchId,$requestedBy);
if ($getleadCountMonth) {
$getleadCountMonth['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getleadCountMonth, 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 getleadCountDayClosed_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$getleadCountDayClosed = $this->dashboard_model->leadCountDayClosed($branchId, $requestedBy);
if ($getleadCountDayClosed) {
$getleadCountDayClosed['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getleadCountDayClosed, 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 getleadCountMonthClosed_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$getleadCountMonthClosed = $this->dashboard_model->leadCountMonthClosed( $branchId, $requestedBy);
if ($getleadCountMonthClosed) {
$getleadCountMonthClosed['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getleadCountMonthClosed, 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 getadmimssionMonth_post(){
$branchId = $this->post('branchId');
//print_r($branchId); die();
$getadmimssionMonth = $this->dashboard_model->admissionCountMonth($branchId);
if ($getadmimssionMonth) {
$getadmimssionMonth['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getadmimssionMonth, 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 getadmimssionYear_post(){
$branchId = $this->post('branchId');
//print_r( $branchId); die();
$requestedBy = $this->post('requestedBy');
$getadmimssionYear = $this->dashboard_model->admissionCountYear($branchId);
if ($getadmimssionYear) {
$getadmimssionYear['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getadmimssionYear, 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 getfupToday_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$getfupToday = $this->dashboard_model->followupsCountToday($branchId,$requestedBy);
if ($getfupToday) {
$getfupToday['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getfupToday, 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 feeOutstandingtotal_post()
{
$branchId = $this->post('branchId');
// $requestedBy = $this->post('requestedBy');
$gettotalbal = $this->dashboard_model->feeOutstandingtotal($branchId);
if ($gettotalbal) {
$gettotalbal['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($gettotalbal, 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 getfupMonth_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
// print_r($requestedBy);
// die();
$getfupMonth = $this->dashboard_model->followupsCountMonth($branchId,$requestedBy);
if ($getfupMonth) {
$getfupMonth['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getfupMonth, 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 leadToday_post(){
$logintype = $this->post('requestedDept');
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$leadToday = $this->dashboard_model->leadToday($branchId,$requestedBy,$logintype);
if ($leadToday) {
$leadToday['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($leadToday, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function leadMonth_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$logintype = $this->post('requestedDept');
$leadMonth = $this->dashboard_model->leadMonth($branchId,$requestedBy,$logintype);
if ($leadMonth) {
$leadMonth['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($leadMonth, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function leadTodayClosed_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$logintype = $this->post('requestedDept');
$leadTodayClosed = $this->dashboard_model->leadTodayClosed($branchId,$requestedBy,$logintype);
if ($leadTodayClosed) {
$leadTodayClosed['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($leadTodayClosed, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function leadMonthClosed_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$logintype = $this->post('requestedDept');
$leadMonthClosed = $this->dashboard_model->leadMonthClosed($branchId,$requestedBy,$logintype);
if ($leadMonthClosed) {
$leadMonthClosed['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($leadMonthClosed, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function admissionMonth_post(){
$year = $this->post('year');
$month = $this->post('month');
$branchId = $this->post('branchId');
$admissionMonth = $this->dashboard_model->admissionMonth($year,$month,$branchId);
if ($admissionMonth) {
$admissionMonth['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($admissionMonth, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function admissionYear_post(){
$fyear = $this->post('fyear');
//print_r($fyear);
$univ = $this->post('univ');
$branchId = $this->post('branchId');
$admissionYear = $this->dashboard_model->admissionYear( $fyear, $univ, $branchId);
if ($admissionYear) {
$admissionYear['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($admissionYear, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function feeOutstanding_post(){
$branchId = $this->post('branchId');
$univ = $this->post('univ');
$feeOutstanding = $this->dashboard_model->feeOutstanding($branchId, $univ);
if ($feeOutstanding) {
$feeOutstanding['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($feeOutstanding, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function followupsToday_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$logintype = $this->post('requestedDept');
$followupsToday = $this->dashboard_model->followupsToday( $branchId, $requestedBy,$logintype);
if ($followupsToday) {
$followupsToday['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($followupsToday, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function followupsPending_post(){
$branchId = $this->post('branchId');
$requestedBy = $this->post('requestedBy');
$logintype = $this->post('requestedDept');
$followupsPending = $this->dashboard_model->followupsPending( $branchId, $requestedBy,$logintype);
if ($followupsPending) {
$followupsPending['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($followupsPending, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function admissionBatch_post(){
$branchId = $this->post('branchId');
$univ = $this->post('univ');
// print_r($univ);
// print_r($branchId);
$admissionBatch = $this->dashboard_model->admissionBatch($univ,$branchId);
if ($admissionBatch) {
$admissionBatch['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($admissionBatch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
//To filters
public function filterYear_post(){
$branch = $this->post('branchId');
$univ =$this->post('univ');
//print_r($univ);
$filterYear = $this->dashboard_model->getYear($branch,$univ);
if ($filterYear) {
$filterYear['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($filterYear, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}