session schedule changes done
This commit is contained in:
parent
734fe7dda0
commit
8fad392bb2
@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: karthi
|
||||
* Date: 2/7/18
|
||||
* Time: 10:37 AM
|
||||
*/
|
||||
class SessionSchedule_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['addSessionScheduleDetails_post']['limit'] = 100; // 50 requests per hour per user/key
|
||||
$this->methods['getSessionScheduleDetails_post']['limit'] = 500; // 50 requests per hour per user/key
|
||||
$this->methods['updateSessionMaterDetails_post']['limit'] = 500;// 500 requests per hour per user/key
|
||||
// load the model
|
||||
$this->load->model('SeesionSchedule_model', 'sessionSC_model');
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* This method used to add session Schedule details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function addSessionScheduleDetails_post()
|
||||
{
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details['SessionID'] = $this->post('sessionID');
|
||||
$details['SCDate'] = $this->post('date');
|
||||
$details['CreatedBy'] = $this->post('createdBy');
|
||||
$details['IsActive'] = $this->post('status');
|
||||
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
||||
$Timings['Timings'] = $this->post('timings');
|
||||
$sessionDetails = $this->sessionSC_model->addSessionScheduel($details,$Timings);// Check if the users data store contains users (in case the database result returns NULL)
|
||||
if ($sessionDetails)
|
||||
{
|
||||
$sessionDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($sessionDetails, 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 session Schedule details
|
||||
* created by kms
|
||||
* */
|
||||
public function getSessionScheduleDetails_post()
|
||||
{
|
||||
$requestedBy = $this->post('requestedBy');
|
||||
$getSession = $this->sessionSC_model->getSessionSchedule($requestedBy);
|
||||
if ($getSession)
|
||||
{
|
||||
$getSession['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getSession, 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 the session Schedule details
|
||||
* created by kms
|
||||
* */
|
||||
public function updateSessionScheduleDetails_post()
|
||||
{
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details['SCID'] = $this->post('scheduleID');
|
||||
$details['SessionID'] = $this->post('sessionID');
|
||||
$details['SCDate'] = $this->post('date');
|
||||
$details['IsActive'] = $this->post('status');
|
||||
$details['UpdatedBy'] = $this->post('updatedBy');
|
||||
$details['UpdatedOn'] = $now->format("Y-m-d H:i:s");
|
||||
$Timings['Timings'] = $this->post('timings');
|
||||
$updateDetails = $this->sessionSC_model->updateSessionSchedule($details,$Timings);// Check if the users data store contains users (in case the database result returns NULL)
|
||||
|
||||
if ($updateDetails)
|
||||
{
|
||||
$updateDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($updateDetails, 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
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user