sparqapi/api/application/controllers/Request_DataDump_Controller.php

73 lines
2.0 KiB
PHP
Executable File

<?php
/**
* Created by PhpStorm.
* User: kms
* Date: 11/13/17
* Time: 7:40 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';
include_once APPPATH.'/vendor/autoload.php';
require APPPATH.'/vendor/autoload.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 Request_DataDump_Controller extends REST_Controller {
function __construct()
{
parent::__construct();
$this->load->model('Data_Dump_Model','Data_Dump_Model');
}
### Request the Details For XL-Data-Dump.
public function saveDatadumpRequest_post(){
$records = $this->post();
if(!empty($records)){
$id = $this->Data_Dump_Model->saveRecords($records, DATADUMPREQUEST);
if ($id) {
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $id;
} else {
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Something went wrong..! Try Later...!';
}
}else{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Parameter are Empty..! Try Later...!';
}
$this->response($data, REST_Controller::HTTP_OK);
}
public function getDatadumpRequestList_get(){
$result_data = $this->Data_Dump_Model->getDataDumpRequestList();
if (count($result_data)) {
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_data;
$this->response($data, REST_Controller::HTTP_OK);
} else {
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$this->response($data, REST_Controller::HTTP_OK);
}
}
}// Class Closed Here.