methods['addCourseDetails_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['addCourseDetails_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['addCourseDetails_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getCourseDetails_post']['limit'] = 500; // 50 requests per hour per user/key $this->methods['updateCourseDetails_post']['limit'] = 500; // load the model $this->load->model('Course_model', 'course_model'); } /* * This method used to add Course details * created by kms * */ public function addCourseDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['CourseID'] = $this->post('courseID'); $details['CourseName'] = $this->post('courseName'); $details['UniversityID'] = $this->post('universityName'); //$details['FeesType'] = $this->post('feesType'); $details['PC'] = $this->post('provFess'); $details['DC'] = $this->post('degreeAmount'); $details['TC'] = $this->post('transferAmount'); $details['MC'] = $this->post('migrationAmount'); $details['OtherFees'] = $this->post('otherAmount'); $details['CreatedBy'] = $this->post('createdBy'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $details['IsActive'] = $this->post('status'); $jsonRegularFeesData=$this->post('regularFeesAmounts'); $jsonLateralFeesData=$this->post('lateralFeesAmounts'); $jsonSemFeesData=$this->post('semFeesAmounts'); // push regular,lateral fees into same array array_push($jsonSemFeesData,$jsonRegularFeesData); array_push($jsonSemFeesData,$jsonLateralFeesData); $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData);// Check if the users data store contains users (in case the database result returns NULL) if ($courseDetails) { $courseDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($courseDetails, 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 course details * created by kms * */ public function getCourseDetails_post() { $requestedBy = $this->post('requestedBy'); $getCourse = $this->course_model->getCourse($requestedBy); if ($getCourse) { $getCourse['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getCourse, 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 course details * created by kms * */ public function updateCourseDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['CourseID'] = $this->post('courseCode'); $details['CourseName'] = $this->post('courseName'); $details['IsActive'] = $this->post('status'); $details['PC'] = $this->post('provFess'); $details['DC'] = $this->post('degreeAmount'); $details['TC'] = $this->post('transferAmount'); $details['MC'] = $this->post('migrationAmount'); $details['OtherFees'] = $this->post('otherAmount'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); $jsonRegularFeesData=$this->post('regularFeesAmounts'); $jsonLateralFeesData=$this->post('lateralFeesAmounts'); $jsonSemFeesData=$this->post('semFeesAmounts'); // push regular,lateral fees into same array array_push($jsonSemFeesData,$jsonRegularFeesData); array_push($jsonSemFeesData,$jsonLateralFeesData); $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData);// 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 } } }