diff --git a/Apollo/api/application/config/constants.php b/Apollo/api/application/config/constants.php index 940ae6c4..af611e46 100644 --- a/Apollo/api/application/config/constants.php +++ b/Apollo/api/application/config/constants.php @@ -103,6 +103,7 @@ defined('PICK_LIST_DETAILS') OR define('PICK_LIST_DETAILS','T_PickListDetails'); defined('BATCH') OR define('BATCH','T_BatchMaster'); defined('STUDENTCOURSE') OR define('STUDENTCOURSE','T_Student_CourseDetails'); defined('STUDENTS') OR define('STUDENTS','T_StudentDetails'); +defined('ANNOUNCEMENT') OR define('ANNOUNCEMENT','T_AnnouncementDetails'); //end of database table name diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 8dc8a7a7..e5099bd2 100644 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -115,6 +115,14 @@ $route['addBatchDetails'] = 'Batch_Controller/addBatchDetails'; $route['updateBatchDetails'] = 'Batch_Controller/updateBatchDetails'; $route['getBatchDetails'] = 'Batch_Controller/getBatchDetails'; +/*Announcement*/ +$route['addAnnouncementDetails'] = 'Announcement_Controller/addAnnouncementDetails'; +$route['getAnnouncementDetails'] = 'Announcement_Controller/getAnnouncementDetails'; +$route['updateAnnouncementDetails'] = 'Announcement_Controller/updateAnnouncementDetails'; + +// dash board +$route['getDashboardCallTrack'] = 'Call_Tracking_Controller/getDashboardCallTrack'; + diff --git a/Apollo/api/application/controllers/Announcement_Controller.php b/Apollo/api/application/controllers/Announcement_Controller.php new file mode 100644 index 00000000..d919d4b9 --- /dev/null +++ b/Apollo/api/application/controllers/Announcement_Controller.php @@ -0,0 +1,135 @@ +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('updatedBy'); + $details['UpdatedOn'] = date("Y-m-d", time()); + $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 + } + + + } +} \ No newline at end of file diff --git a/Apollo/api/application/models/Announcement_model.php b/Apollo/api/application/models/Announcement_model.php new file mode 100644 index 00000000..a2e7ce2b --- /dev/null +++ b/Apollo/api/application/models/Announcement_model.php @@ -0,0 +1,103 @@ +db->select('Heading'); + $this->db->where('Heading', $arrayDetails['Heading']); + if($this->db->get(ANNOUNCEMENT)->first_row()){ + $result['AnnouncementStatus'] = false; + $result['message'] = "This Announcement is already exist!"; + } else { + $this->db->select('Description'); + $this->db->where('Description', $arrayDetails['Description']); + if($this->db->get(ANNOUNCEMENT)->first_row()){ + $result['AnnouncementStatus'] = false; + $result['message'] = "This Announcement name is already exist!"; + } else{ + $this->db->insert(ANNOUNCEMENT, $arrayDetails); + if($this->db->affected_rows() == '1'){ + + $result['AnnouncementStatus'] = true; + $result['message'] = "Successfully Announcement details added"; + } + + else { + $result['AnnouncementStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + + } + + + + return $result; + + } + public function getAnnouncement() + { + $this->db->select('Heading,description,CreatedOn,IsActive,ID'); + $this->db->order_by('CreatedOn','DESC'); + $announcementDetails = $this->db->get(ANNOUNCEMENT); + + if($announcementDetails->result()){ + + $result['AnnouncementStatus'] = true; + $result['details'] = $announcementDetails->result(); + } + else { + $result['AnnouncementStatus'] = false; + $result['message'] = "No records found!"; + } + + return $result; + + } + + /* + * update announcement details + * created by Surendiran + * */ + + public function updateAnnouncement($arrayDetails=null,$updateID=null) + { + $this->db->where('ID',$updateID); + $updateStatus=$this->db->update(ANNOUNCEMENT, $arrayDetails); + + if($updateStatus){ + + $result['AnnouncementStatus'] = true; + $result['message'] = "Successfully Announcement details updated"; + } + + else { + $result['AnnouncementStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + + } + + + return $result; + + } + +} \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index f1e96bde..683dd34b 100644 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -64,7 +64,8 @@ "UNIVERSITY": "UNIVERSITY DETAILS", "COURSE": "COURSE DETAILS", "ACTIVITY": "ACTIVITY DETAILS", - "EMPLOYEE": "EMPLOYEE DETAILS" + "EMPLOYEE": "EMPLOYEE DETAILS", + "ANNOUNCEMENT": "ANNOUNCEMENT DETAILS" }, "student": { "MAIN": "STUDENTS DETAILS", diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index ce06c3a3..0c34372e 100644 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -99,7 +99,10 @@ app.constant('JS_REQUIRES', { * batch * */ 'batchCtrl': 'assets/js/controllers/batchCtrl.js', - + /* * + announcementCtrl + * */ + 'announcementCtrl': 'assets/js/controllers/announcementCtrl.js', /* * call track diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index dc1ce976..8d1485c0 100644 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -141,6 +141,14 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com label: 'Activity' }, // resolve: loadSequence('iconsCtrl') + }).state('app.master.announcement', { + url: '/announcement', + templateUrl: "assets/views/announcement/Announcement.html", + resolve: loadSequence('ckeditor-plugin', 'ckeditor', 'announcementCtrl','ladda', 'angular-ladda','ngTable'), + title: 'Announcement', + ncyBreadcrumb: { + label: 'Announcement' + }, }).state('app.student', { url: '/student', template: '
oops! No
+ records found...