methods['addAnnouncementDetails_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['addAnnouncementDetails_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['addAnnouncementDetails_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getAnnouncementDetails_post']['limit'] = 500; // 50 requests per hour per user/key $this->methods['updateAnnouncementDetails_post']['limit'] = 500; // load the model $this->load->model('Announcement_model', 'announcement_model'); } /* * This method used to add Announcement Details * created by Surendiran * */ public function addAnnouncementDetails_post() { $details['Heading'] = $this->post('Heading'); $details['Description'] = $this->post('description'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); $announcementDetails = $this->announcement_model->addAnnouncement($details);// Check if the users data store contains users (in case the database result returns NULL) if ($announcementDetails) { $announcementDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($announcementDetails, 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 Announcement Details * created by Surendiran * */ public function getAnnouncementDetails_post() { $requestedBy = $this->post('requestedBy'); $getAnnouncement = $this->announcement_model->getAnnouncement(); if ($getAnnouncement) { $getAnnouncement['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getAnnouncement, 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 updateAnnouncementDetails_post() { $updateID = $this->post('updateID'); // $details['ID'] = $this->post('ID'); $details['Heading'] = $this->post('Heading'); $details['Description'] = $this->post('description'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('createdBy'); $date = date('Y-m-d H:i:s'); $details['UpdatedOn'] = $date; $announcementDetails = $this->announcement_model->updateAnnouncement($details,$updateID);// Check if the users data store contains users (in case the database result returns NULL) if ($announcementDetails) { $announcementDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($announcementDetails, 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 } } }