apollodec/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php
2018-09-05 11:31:18 +05:30

260 lines
11 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 8/28/18
* Time: 11:01 AM
*/
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 Receive_Enrolment_Fees_Univ_Controller extends REST_Controller {
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
$this->methods['receiveEnrolmentFromUniv_post']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['formIDFeeCompareDetails_post']['limit'] = 500;
$this->methods['getUniversitySessionDetails_post']['limit'] = 500;
$this->methods['getExistStudentEnrolmentDetails_post']['limit'] = 1000;
$this->methods['addManualEnrolmentDetails_post']['limit'] = 1000;
// load the model
$this->load->model('Receive_Enrolment_Fees_Univ_model', 'receive_model');
}
/*
* This method used to add received enrolment details
* created by kms
* */
public function receiveEnrolmentFromUniv_post()
{
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$enrolmentDetails = $this->post('details');
$localDetails = $this->post('localDetails');
$fromDetails['CreatedOn'] = $now->format('Y-m-d H:i:s');
$fromDetails['CreatedBy'] = $localDetails['localUserID'];
$fromDetails['UniversityCode']=$this->post('universityID');
$fromDetails['UniversityName']=$this->post('universityName');
$fromDetails['BranchCode']=$localDetails['localBranchID'];
$updatedDetails = $this->receive_model->updateEnrolmentDetails($enrolmentDetails,$fromDetails);// Check if the users data store contains users (in case the database result returns NULL)
if ($updatedDetails['status'])
{
$updatedDetails['status'] = true;
// Set the response and exit
$this->response($updatedDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* This method used to add formid related student fee details form university
* created by kdk
* */
public function insertFormIdUnivFeeDetails_post(){
$formIdDetails = $this->post('details');
$localDetails = $this->post('localDetails');
$updatedDetails = $this->receive_model->formIdFeeDetails($formIdDetails,$localDetails);// Check if the users data store contains users (in case the database result returns NULL)
if ($updatedDetails)
{
$updatedDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($updatedDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getStudentUnivFeeCompareDetails_post(){
$searchData = $this->post('search');
$univID = $searchData['University'];
$sessionID = $searchData['Session'];
$getUnivStudentFeeCompare = $this->receive_model->getStudentUnivFeeCompareDetails($univID,$sessionID);// Check if the users data store contains users (in case the database result returns NULL)
if ($getUnivStudentFeeCompare)
{
$getUnivStudentFeeCompare['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getUnivStudentFeeCompare, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* get form id bases get fees comparsion details
* created by kms
* */
public function formIDFeeCompareDetails_post(){
$formData['FormID'] = $this->post('formId');
$formData['EnrolmentNo'] = $this->post('enrolmentId');;
$getDetails = $this->receive_model->getFormIDFeeDetails($formData);
if ($getDetails['status']=true)
{
// Set the response and exit
$this->response($getDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else if($getDetails['status']=false){
$this->response([
'message' => $getDetails['Message'],
], REST_Controller::HTTP_OK); // NOT_FOUND (404) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => false
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getUnmatchedRecordDetails_post(){
$getDetailsFor = $this->post('getDetailsFor');
$getUnmatchedFormDetails = $this->receive_model->getUnmatchedFormDetails($getDetailsFor);// Check if the users data store contains users (in case the database result returns NULL)
if ($getUnmatchedFormDetails)
{
$getUnmatchedFormDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getUnmatchedFormDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getUniversitySessionDetails_post(){
$reqData = $this->post('data');
$loginUserId = $reqData['localUserID'];
$loginUserBranchId = $reqData['localBranchID'];
$loginUserType = $reqData['localType'];
$getUniversityListDetails = $this->receive_model->getUniversitySessionList($loginUserBranchId); // Check if the employee exist
if ($getUniversityListDetails['status']) {
// $getUniversityListDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else if($getUniversityListDetails['status']==false){
$this->response(['message' => 'No list were found', 'status' => false], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
else {
// Set the response and exit
$this->response(['message' => 'No list were found', 'status' => false], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* get exist enrolment student details
* created by kms
* */
public function getExistStudentEnrolmentDetails_post(){
$localData = $this->post('localDetails');
$enrolmentID=$this->post('enrolmentID');
$getEnrolmentDetails=$this->receive_model->getExistStudentEnrolmentDetails($enrolmentID,$localData);
if($getEnrolmentDetails['status']==true){
$this->response($getEnrolmentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else if($getEnrolmentDetails['status']==false){
$this->response($getEnrolmentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else{
$this->response(['message' => 'No list were found', 'status' => false], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* add manual enrolment details
* cretaed by kms
* */
public function addManualEnrolmentDetails_post(){
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$localData = $this->post('localDetails');
$studentInfo=$this->post('studentInfo');
$semDetails=$this->post('sem');
$studentInfo['CreatedOn'] = $now->format('Y-m-d H:i:s');
$studentInfo['FormID'] = $this->post('formID');
$studentInfo['SemesterYear'] = $semDetails['sem'];
$studentInfo['FormType'] = $semDetails['FormType'];
$studentInfo['SessionName'] = $semDetails['SessionName'];
$studentInfo['EnrolmentNo'] = $this->post('enrolmentID');
$studentInfo['CreatedBy'] = $localData['localUserID'];
$studentInfo['BranchCode'] = $localData['localBranchID'];
$studentInfo['ManualEntry'] = 1;
$addEnrolmentDetails=$this->receive_model->addManualEnrolmentDetails($studentInfo);
if($addEnrolmentDetails['status']==true){
$this->response($addEnrolmentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else if($addEnrolmentDetails['status']==false){
$this->response($addEnrolmentDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else{
$this->response(['message' => 'No list were found', 'status' => false], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}