diff --git a/Apollo/api/application/controllers/SessionMater_Controller.php b/Apollo/api/application/controllers/SessionMater_Controller.php new file mode 100644 index 00000000..b8f00721 --- /dev/null +++ b/Apollo/api/application/controllers/SessionMater_Controller.php @@ -0,0 +1,118 @@ +methods['addSessionMaterDetails_post']['limit'] = 100; // 50 requests per hour per user/key + $this->methods['getSessionMaterDetails_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('SeesionMaster_model', 'sessionM_model'); + + } + + /* + * This method used to add session master details + * created by kms + * */ + + public function addSessionMaterDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['SessionName'] = $this->post('sessionName'); + $details['UniversityID'] = $this->post('universityName'); + $details['CreatedBy'] = $this->post('createdBy'); + $details['IsActive'] = $this->post('status'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); + + $sessionDetails = $this->sessionM_model->addSession($details);// 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 master details + * created by kms + * */ + public function getSessionMaterDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $getSession = $this->sessionM_model->getSession($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 master details + * created by kms + * */ + public function updateSessionMaterDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['SessionID'] = $this->post('sessionID'); + $details['SessionName'] = $this->post('sessionName'); + $details['IsActive'] = $this->post('status'); + $universityDetails['University'] = $this->post('university'); + $details['UpdatedBy'] = $this->post('updatedBy'); + $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); + $updateDetails = $this->sessionM_model->updateSession($details,$universityDetails);// 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 + } + + + } + + +} \ No newline at end of file