191 lines
5.6 KiB
PHP
Executable File
191 lines
5.6 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by Visual Studio Code.
|
|
* User: Surendiran
|
|
* Date: 12/05/17
|
|
* Time: 01:05 PM
|
|
*/
|
|
|
|
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 Report extends REST_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
// Construct the parent class
|
|
parent::__construct();
|
|
|
|
// load the model
|
|
$this->load->model('Reports_model', 'report_model');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function status_post()
|
|
{
|
|
$bat = $this->post('bname');
|
|
$br = $this->post('brname');
|
|
$u = $this->post('univ');
|
|
$getStatus = $this->report_model->status($bat,$br,$u);
|
|
//print_r($getStatus);
|
|
if ($getStatus)
|
|
{
|
|
$getStatus['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
public function mstatus_post()
|
|
{
|
|
$bat = $this->post('bname');
|
|
$br = $this->post('brname');
|
|
$u = $this->post('univ');
|
|
$getStatus = $this->report_model->mstatus($bat,$br,$u);
|
|
//print_r($getStatus);
|
|
if ($getStatus)
|
|
{
|
|
$getStatus['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
public function cert_status_post()
|
|
{
|
|
$bat = $this->post('bname');
|
|
$br = $this->post('brname');
|
|
$u = $this->post('univ');
|
|
$getStatus = $this->report_model->certificate_status($bat,$br,$u);
|
|
//print_r($getStatus);
|
|
if ($getStatus)
|
|
{
|
|
$getStatus['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
public function markcert_status_post()
|
|
{
|
|
$bat = $this->post('bname');
|
|
$br = $this->post('brname');
|
|
$u = $this->post('univ');
|
|
$from = $this->post('from');
|
|
$to = $this->post('to');
|
|
$getStatus = $this->report_model->mark_cert_status($bat,$br,$u,$from,$to);
|
|
//print_r($getStatus);
|
|
if ($getStatus)
|
|
{
|
|
$getStatus['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
public function expense_post()
|
|
{
|
|
|
|
$from = $this->post('from');
|
|
$to = $this->post('to');
|
|
$getStatus = $this->report_model->expense($from,$to);
|
|
//print_r($getStatus);
|
|
if ($getStatus)
|
|
{
|
|
$getStatus['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
public function batch_post()
|
|
{
|
|
|
|
$getStatus = $this->report_model->batch();
|
|
//print_r($getStatus);
|
|
if ($getStatus)
|
|
{
|
|
$getStatus['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |