From ac98ea44f6f412bde7f8c932aef666c206c9beae Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Thu, 14 Dec 2017 11:23:38 +0530 Subject: [PATCH] certificate new files added --- .../controllers/Certificate_Controller.php | 138 ++++++++++++ .../controllers/Fees_Status_Controller.php | 0 .../controllers/Status_Controller.php | 0 .../application/models/Certificate_model.php | 107 ++++++++++ .../application/models/Fees_status_model.php | 0 .../api/application/models/Status_model.php | 0 .../assets/js/controllers/certificateCtrl.js | 197 ++++++++++++++++++ .../assets/js/controllers/feesStatusCtrl.js | 0 Apollo/assets/js/controllers/myProfileCtrl.js | 0 Apollo/assets/js/controllers/statusCtrl.js | 0 .../js/controllers/studyMaterialStatusCtrl.js | 0 .../assets/views/certificate/certificate.html | 140 +++++++++++++ .../certificate/editCertificationDetails.html | 70 +++++++ Apollo/assets/views/myProfile/myProfile.html | 0 .../views/status-update/fees_status.html | 0 .../status-update/study_material_status.html | 0 Apollo/images/employee/Dri_9jwuh7dZD2na.jpeg | Bin Apollo/images/student/default.jpeg | Bin 18 files changed, 652 insertions(+) create mode 100644 Apollo/api/application/controllers/Certificate_Controller.php mode change 100644 => 100755 Apollo/api/application/controllers/Fees_Status_Controller.php mode change 100644 => 100755 Apollo/api/application/controllers/Status_Controller.php create mode 100644 Apollo/api/application/models/Certificate_model.php mode change 100644 => 100755 Apollo/api/application/models/Fees_status_model.php mode change 100644 => 100755 Apollo/api/application/models/Status_model.php create mode 100644 Apollo/assets/js/controllers/certificateCtrl.js mode change 100644 => 100755 Apollo/assets/js/controllers/feesStatusCtrl.js mode change 100644 => 100755 Apollo/assets/js/controllers/myProfileCtrl.js mode change 100644 => 100755 Apollo/assets/js/controllers/statusCtrl.js mode change 100644 => 100755 Apollo/assets/js/controllers/studyMaterialStatusCtrl.js create mode 100644 Apollo/assets/views/certificate/certificate.html create mode 100644 Apollo/assets/views/certificate/editCertificationDetails.html mode change 100644 => 100755 Apollo/assets/views/myProfile/myProfile.html mode change 100644 => 100755 Apollo/assets/views/status-update/fees_status.html mode change 100644 => 100755 Apollo/assets/views/status-update/study_material_status.html mode change 100644 => 100755 Apollo/images/employee/Dri_9jwuh7dZD2na.jpeg mode change 100644 => 100755 Apollo/images/student/default.jpeg diff --git a/Apollo/api/application/controllers/Certificate_Controller.php b/Apollo/api/application/controllers/Certificate_Controller.php new file mode 100644 index 00000000..fc65c979 --- /dev/null +++ b/Apollo/api/application/controllers/Certificate_Controller.php @@ -0,0 +1,138 @@ +methods['addCertificateDetails_get']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['addCertificateDetails_post']['limit'] = 100; // 100 requests per hour per user/key + $this->methods['addCertificateDetails_delete']['limit'] = 50; // 50 requests per hour per user/key + $this->methods['getCertificateDetails_post']['limit'] = 500; // 50 requests per hour per user/key + $this->methods['updateCertificateDetails_post']['limit'] = 500; + // load the model + $this->load->model('Certificate_model', 'certificate_model'); + + } + + /* + * This method used to add Certificate details + * created by Surendiran + * */ + + public function addCertificateDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['CertificateName'] = $this->post('certificateName'); + $details['CreatedBy'] = $this->post('createdBy'); + $details['IsActive'] = $this->post('status'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); + $certificateDetails = $this->certificate_model->addcertificate($details);// Check if the users data store contains users (in case the database result returns NULL) + if ($certificateDetails) + { + $certificateDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($certificateDetails, 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 Certificate details + * created by Surendiran + * */ + public function getCertificateDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $getCertificate = $this->certificate_model->getCertificate($requestedBy); + + if ($getCertificate) + { + $getCertificate['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getCertificate, 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 Certificate details + * created by Surendiran + * */ + public function updateCertificateDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $updateID = $this->post('updateID'); + $details['CertificateName'] = $this->post('certificateName'); + $details['IsActive'] = $this->post('status'); + $details['UpdatedBy'] = $this->post('updatedBy'); + $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); + $certificateDetails = $this->certificate_model->update($details,$updateID);// Check if the users data store contains users (in case the database result returns NULL) + + if ($certificateDetails) + + { + $certificateDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($certificateDetails, 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/controllers/Fees_Status_Controller.php b/Apollo/api/application/controllers/Fees_Status_Controller.php old mode 100644 new mode 100755 diff --git a/Apollo/api/application/controllers/Status_Controller.php b/Apollo/api/application/controllers/Status_Controller.php old mode 100644 new mode 100755 diff --git a/Apollo/api/application/models/Certificate_model.php b/Apollo/api/application/models/Certificate_model.php new file mode 100644 index 00000000..807e15ca --- /dev/null +++ b/Apollo/api/application/models/Certificate_model.php @@ -0,0 +1,107 @@ +db->select('CertificateName'); + $this->db->where('CertificateName', $arrayDetails['CertificateName']); + if($this->db->get(CERTIFICATION_MASTER)->first_row()){ + $result['certificateStatus'] = false; + $result['message'] = "Certificate name is already exist!"; + } else { + $this->db->insert(CERTIFICATION_MASTER, $arrayDetails); + if($this->db->affected_rows() == '1'){ + $result['certificateStatus'] = true; + $result['message'] = "Successfully Certificate name is added"; + } + else { + $result['certificateStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + + } + + + + + + return $result; + + } + /* + * get Certificate details + * parama id + * created by Surendiran + * */ + public function getCertificate() + { + $this->db->select('CertificationID,CertificateName,CreatedOn,IsActive'); + $this->db->order_by('CertificationID','DESC'); + $certificateDetails = $this->db->get(CERTIFICATION_MASTER); + if($certificateDetails->result()){ + + $result['certificateStatus'] = true; + $result['details'] = $certificateDetails->result(); + } + else { + $result['certificateStatus'] = false; + $result['message'] = "No records found!"; + } + + return $result; + + } + + + /* + * update Certificate details + * created by Surendiran + * */ + + public function update($arrayDetails=null,$CertificationID=null) + { + $this->db->select('CertificateName'); + + $this->db->where('CertificateName', $arrayDetails['CertificateName']); + $this->db->where_not_in('CertificationID', $CertificationID); + if($this->db->get(CERTIFICATION_MASTER)->first_row()){ + $result['certificateStatus'] = false; + $result['message'] = "Certificate name is already exist!"; + } else { + $this->db->where('CertificationID',$CertificationID); + $this->db->update(CERTIFICATION_MASTER, $arrayDetails); + if($this->db->affected_rows() == '1'){ + $result['certificateStatus'] = true; + $result['message'] = "Successfully Certificate name is updated"; + } + else { + $result['certificateStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + + } + + + + return $result; + + } + +} + + + diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php old mode 100644 new mode 100755 diff --git a/Apollo/api/application/models/Status_model.php b/Apollo/api/application/models/Status_model.php old mode 100644 new mode 100755 diff --git a/Apollo/assets/js/controllers/certificateCtrl.js b/Apollo/assets/js/controllers/certificateCtrl.js new file mode 100644 index 00000000..6835087c --- /dev/null +++ b/Apollo/assets/js/controllers/certificateCtrl.js @@ -0,0 +1,197 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ +// var helloApp = angular.module("helloApp", []); +app.controller("certificateCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state) { + + $scope.myModel = { + "CertificateName": "", + "switchsetting": true + + }; + /* + * edit Certificate details + * created by Surendiran + * */ + $scope.editId = -1; + $scope.setEditId = function (pid) { + $scope.editId = pid; + $scope.viewId = -1; + }; + + /* + * cancel edit div + * created by Surendiran + * */ + $scope.cancel = function () { + $scope.init(); + $scope.editId = -1; + + }; + + // sorting function for table params + $scope.sort = function(keyname){ + $scope.sortKey = keyname; //set the sortKey to the param passed + $scope.reverse = !$scope.reverse; //if true make it false and vice versa + } + + +$scope.certificateForm = { + + submit: function (form, myModel,loading) { + + var firstError = null; + if (form.$invalid) { + var field = null, firstError = null; + for (field in form) { + if (field[0] != '$') { + if (firstError === null && !form[field].$valid) { + firstError = form[field].$name; + } + if (form[field].$pristine) { + form[field].$dirty = true; + } + } + } + angular.element('.ng-invalid[name=' + firstError + ']').focus(); + // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); + } else { + + $scope.ldloading1 = {}; + + $scope.ldloading1[loading.replace('-', '_')] = true; + + + var addcertificate = { + method: 'POST', + url: apiPoint.url + 'addCertificateDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + certificateName: myModel.CertificateName, + status: myModel.switchsetting, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(addcertificate).then(function (response) { + if (response.data.status == 200 && response.data.certificateStatus) { + $scope.ldloading1[loading.replace('-', '_')] = false; + $scope.init(); + swal("Success!", response.data.message, "success"); + $state.go($state.current, {}, { reload: true }); + } else { + $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + + +} + }, + + +}; + + +/* + *get Certificate details when page loading called from view file + * + * created by Surendiran + * */ + + $scope.loader=''; + + $scope.emptyData=''; + + + $scope.init = function () { + + var getCertificate = { + method: 'POST', + url: apiPoint.url + 'getCertificateDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(getCertificate).then(function (response) { + if (response.data.status==200 && response.data.certificateStatus) { + $scope.emptyData=true; + $scope.loader=true; + + $scope.statusInfo = response.data.details; + + } else { + $scope.emptyData=false; + $scope.loader=true; + + $scope.statusInfo=''; + + } + }); + }; + + + /* + * update the Certificate details + * created by Surendiran + * */ + $scope.updateCertificate = function (myModel, form, loading) { + + var firstError = null; + if (form.$invalid) { + var field = null, firstError = null; + for (field in form) { + if (field[0] != '$') { + if (firstError === null && !form[field].$valid) { + firstError = form[field].$stop_name; + } + + if (form[field].$pristine) { + form[field].$dirty = true; + } + } + } + angular.element('.ng-invalid[name=' + firstError + ']').focus(); + } else { + $scope.ldloading = {}; + + $scope.ldloading[loading.replace('-', '_')] = true; + + + var update = { + method: 'POST', + url: apiPoint.url + 'updateCertificateDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + updateID: myModel.CertificationID, + certificateName: myModel.CertificateName, + status: myModel.IsActive, + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(update).then(function (response) { + if (response.data.status==200 && response.data.certificateStatus) { + $scope.ldloading[loading.replace('-', '_')] = false; + swal("Success!", response.data.message, "success"); + $scope.editId = -1; + $scope.init(); + + } else { + $scope.ldloading[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + + } + }; +}]); \ No newline at end of file diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js old mode 100644 new mode 100755 diff --git a/Apollo/assets/js/controllers/myProfileCtrl.js b/Apollo/assets/js/controllers/myProfileCtrl.js old mode 100644 new mode 100755 diff --git a/Apollo/assets/js/controllers/statusCtrl.js b/Apollo/assets/js/controllers/statusCtrl.js old mode 100644 new mode 100755 diff --git a/Apollo/assets/js/controllers/studyMaterialStatusCtrl.js b/Apollo/assets/js/controllers/studyMaterialStatusCtrl.js old mode 100644 new mode 100755 diff --git a/Apollo/assets/views/certificate/certificate.html b/Apollo/assets/views/certificate/certificate.html new file mode 100644 index 00000000..a3677cf2 --- /dev/null +++ b/Apollo/assets/views/certificate/certificate.html @@ -0,0 +1,140 @@ + +
+
+
+

+ +
+
+
+
+
+
+
+
+ Add Certificate Details +
+ +
+ +
+ +
+ + + + Certificate Name is required + Invalid Certificate name + +
+ +
+
+ + + +
+
+ +
+ + +
+
+
+ +
+
+ +
+ +

+
+ + +
+ + + + + + + + + + + + + + + + + + + + + +
Certification ID + + Certificate Nmae + +
{{p.CertificationID}}{{p.CertificateName}} + + +
+ + + +
+
\ No newline at end of file diff --git a/Apollo/assets/views/certificate/editCertificationDetails.html b/Apollo/assets/views/certificate/editCertificationDetails.html new file mode 100644 index 00000000..64270ade --- /dev/null +++ b/Apollo/assets/views/certificate/editCertificationDetails.html @@ -0,0 +1,70 @@ +
+
+
+
+
+ + Update Certificate Details + + +
+
+ + + + Certificate ID is required + +
+ + +
+ + + + Certificate Name is required + Invalid Certificate Name + +
+
+ +
+ + + +
+
+ + +
+ +
+ +
+ +
+
+
+
+ + + + + +
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/Apollo/assets/views/myProfile/myProfile.html b/Apollo/assets/views/myProfile/myProfile.html old mode 100644 new mode 100755 diff --git a/Apollo/assets/views/status-update/fees_status.html b/Apollo/assets/views/status-update/fees_status.html old mode 100644 new mode 100755 diff --git a/Apollo/assets/views/status-update/study_material_status.html b/Apollo/assets/views/status-update/study_material_status.html old mode 100644 new mode 100755 diff --git a/Apollo/images/employee/Dri_9jwuh7dZD2na.jpeg b/Apollo/images/employee/Dri_9jwuh7dZD2na.jpeg old mode 100644 new mode 100755 diff --git a/Apollo/images/student/default.jpeg b/Apollo/images/student/default.jpeg old mode 100644 new mode 100755