apollodec/Apollo/api/application/controllers/University_Controller.php
2017-11-23 18:16:44 +05:30

93 lines
3.3 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;
// load the employee model
$this->load->model('University_model', 'university_model');
}
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
}
}
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
}
}
}