diff --git a/Apollo/api/application/controllers/University_Controller.php b/Apollo/api/application/controllers/University_Controller.php index fb5ad1f8..a2ec4380 100755 --- a/Apollo/api/application/controllers/University_Controller.php +++ b/Apollo/api/application/controllers/University_Controller.php @@ -30,6 +30,9 @@ class University_Controller extends REST_Controller { parent::__construct(); $this->methods['getUniversity_post']['limit'] = 100; $this->methods['chkUnivIdExistDetail_post']['limit'] = 100; + $this->methods['getDefaultActivityDetails_post']['limit'] = 100; + $this->methods['updateDefaultActivityDetails_post']['limit'] = 100; + // load the university model $this->load->model('University_model', 'university_model'); } @@ -233,6 +236,63 @@ class University_Controller extends REST_Controller { } + /* + * get default activity details + * created by kms + * */ + public function getDefaultActivityDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $getDefaultActivity = $this->university_model->getDefaultActivity($requestedBy); + if ($getDefaultActivity) + { + $getDefaultActivity['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getDefaultActivity, 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 default activity status + * created by kms + * */ + + public function updateDefaultActivityDetails_post() + { + + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['StudentActivityCode'] = $this->post('activityID'); + $details['StatusCode'] = $this->post('activityName'); + //$details['IsActive'] = $this->post('status'); + $details['UpdatedBy'] = $this->post('updatedBy'); + $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $jsonData=$this->post('activityStatus'); + $activityDetails = $this->university_model->updateDefaultActivity($details,$jsonData);// Check if the users data store contains users (in case the database result returns NULL) + + if ($activityDetails) + { + $activityDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($activityDetails, 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 + } + + + } }