224 lines
8.8 KiB
PHP
224 lines
8.8 KiB
PHP
<?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 University_Controller extends REST_Controller {
|
|
|
|
/*
|
|
* get university details
|
|
* params:
|
|
* created by kdk
|
|
* */
|
|
function __construct()
|
|
{
|
|
// Construct the parent class
|
|
parent::__construct();
|
|
$this->methods['getUniversity_post']['limit'] = 100;
|
|
$this->methods['chkUnivIdExistDetail_post']['limit'] = 100;
|
|
// load the university model
|
|
$this->load->model('University_model', 'university_model');
|
|
}
|
|
|
|
// get university details
|
|
public function getUniversity_post() {
|
|
$reqData = $this->post('data');
|
|
$loginUserId = $reqData['localUserID'];
|
|
$loginUserBranchId = $reqData['localBranchID'];
|
|
$loginUserType = $reqData['localType'];
|
|
$getUniversityListDetails = $this->university_model->get_university_list();// Check if the employee exist
|
|
if ($getUniversityListDetails)
|
|
{
|
|
$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
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No list were found',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
}
|
|
|
|
//update university details
|
|
public function updateUniversityDetail_post() {
|
|
|
|
$reqData = $this->post('data');
|
|
$req['UpdatedBy'] = $this->post('updatedBy');
|
|
$date = date('Y-m-d H:i:s');
|
|
$req['UpdatedOn'] = $date;
|
|
$req['UniversityName']= $reqData['UniversityName'];
|
|
$req['UniversityShortName']= $reqData['UniversityShortName'];
|
|
$req['MobileNumber']= $reqData['MobileNumber'];
|
|
$req['EmailID']= $reqData['EmailID'];
|
|
$req['Address']= $reqData['Address'];
|
|
$req['IsActive']= $reqData['IsActive'];
|
|
|
|
$updateFor = $reqData['UniversityID'];
|
|
|
|
$updateUniversityDetail = $this->university_model->update_university_details($updateFor, $req);// Check if the employee exist
|
|
if ($updateUniversityDetail)
|
|
{
|
|
$updateUniversityDetail['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($updateUniversityDetail, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No list were found',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
}
|
|
|
|
// check university details exist
|
|
public function chkUnivIdExistDetail_post() {
|
|
|
|
$data = $this->post('data');
|
|
$check = $this->post('check');
|
|
|
|
$checkUnivExist = $this->university_model->check_Univ_Exist($data, $check);// Check if the employee exist
|
|
if ($checkUnivExist)
|
|
{
|
|
$checkUnivExist['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($checkUnivExist, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No list were found',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
}
|
|
|
|
// insert university details
|
|
public function insertUniversity_post() {
|
|
$reqData = $this->post('data');
|
|
$req['CreatedBy'] = $this->post('createdBy');
|
|
$date = date('Y-m-d H:i:s');
|
|
$req['CreatedOn'] = $date;
|
|
$req['UniversityName']= $reqData['UniversityName'];
|
|
$req['UniversityShortName']= $reqData['UniversityShortName'];
|
|
$req['MobileNumber']= $reqData['MobileNumber'];
|
|
$req['EmailID']= $reqData['EmailID'];
|
|
$req['Address']= $reqData['Address'];
|
|
$req['IsActive']= $reqData['switchsetting'];
|
|
$req['UniversityID']= $reqData['UniversityID'];
|
|
|
|
$insertUniv = $this->university_model->insert_Univ($req);// Check if the employee exist
|
|
if ($insertUniv)
|
|
{
|
|
$insertUniv['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($insertUniv, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No list were found',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
}
|
|
|
|
public function addActivityDetails_post() {
|
|
$details['ListCode'] = $this->post('activityID');
|
|
$details['ListName'] = $this->post('activityName');
|
|
$details['ListGroup'] = "2";
|
|
$details['Description'] = $this->post('description');
|
|
$details['CreatedBy'] = $this->post('createdBy');
|
|
$details['IsActive'] = $this->post('status');
|
|
$activityDetails = $this->university_model->addactivity($details);// Check if the users data store contains users (in case the database result returns NULL)
|
|
if ($activityDetails) {
|
|
$activityDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($activityDetails, 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 getActivityDetails_post()
|
|
{
|
|
$requestedBy = $this->post('requestedBy');
|
|
$getActivity = $this->university_model->getActivity($requestedBy);
|
|
if ($getActivity)
|
|
{
|
|
$getActivity['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getActivity, 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
|
|
}
|
|
}
|
|
|
|
/*
|
|
* update Announcement Details
|
|
* created by Surendiran
|
|
* */
|
|
public function updateActivityDetails_post()
|
|
{
|
|
$ListCode = $this->post('ListCode');
|
|
// $details['ID'] = $this->post('ID');
|
|
$details['ListName'] = $this->post('ListName');
|
|
$details['Description'] = $this->post('description');
|
|
$details['IsActive'] = $this->post('status');
|
|
$details['UpdatedBy'] = $this->post('updatedBy');
|
|
$details['UpdatedOn'] = date("Y-m-d", time());
|
|
$activityDetails = $this->university_model->updateActivity($details,$ListCode);// Check if the users data store contains users (in case the database result returns NULL)
|
|
|
|
if ($activityDetails)
|
|
{
|
|
$activityDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($activityDetails, 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
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|