From 3f3817b4ef39d2697fa3003c4e8209bf6e53166b Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 16:46:35 +0530 Subject: [PATCH 1/8] course details changes done --- .../application/models/University_model.php | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/Apollo/api/application/models/University_model.php b/Apollo/api/application/models/University_model.php index 80a602a3..12d59dbe 100755 --- a/Apollo/api/application/models/University_model.php +++ b/Apollo/api/application/models/University_model.php @@ -254,4 +254,115 @@ class University_model extends CI_Model return $result; } + + /* + * get default activity details + * created by kms + * */ + public function getDefaultActivity() + { + $arr = array('ListGroup'=>2,'ListGroup'=>6); + $this->db->distinct(); + $this->db->select('ListName,ListCode,IsActive'); + $this->db->order_by('ListName','ASC'); + $this->db->or_where('ListGroup','2'); + $this->db->or_where('ListGroup','6'); + $this->db->or_where('ListGroup','7'); + $this->db->or_where('ListGroup','8'); + $this->db->or_where('ListGroup','9'); + $defaultActivityDetails=$this->db->get(PICK_LIST_DETAILS); + if($defaultActivityDetails->result()){ + $activity_result['activityStatus'] = true; + foreach ($defaultActivityDetails->result() as $row){ + $result_array['ActivityID'] = $row->ListCode; + $result_array['ActivityName'] = $row->ListName; + $result_array['IsActive'] = $row->IsActive; + $this->db->select('DA.StudentActivityCode,PLD.ListCode,PLD.ListName'); + $this->db->from(DEFAULTACTIVITY .' as DA'); + $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = DA.StatusCode'); + $this->db->where('PLD.IsActive','1'); + $this->db->where('DA.IsActive','1'); + $this->db->where('DA.StudentActivityCode',$row->ListCode); + $result_array['statusDetails']=$this->db->get()->result(); + $result[]=$result_array; + } + + $activity_result['details'] = $result; + + + } + else { + $activity_result['activityStatus'] = false; + $activity_result['details'] = "No records found!"; + } + $activity_result['masterStatusList']=$this->getAllStatusList('1'); + return $activity_result; + + } + /* + * update default activity status + * created by kms + * */ + public function updateDefaultActivity($arrayDetails=null,$jsonData=null) { + + + $deactiveStatus['IsActive']=false; + $deactiveStatus['UpdatedBy']=$arrayDetails['UpdatedBy']; + $deactiveStatus['UpdatedOn']=$arrayDetails['UpdatedOn']; + $this->db->where('StudentActivityCode ',$arrayDetails['StudentActivityCode']); + $updateActivityStatusDeactive = $this->db->update(DEFAULTACTIVITY, $deactiveStatus); + if($updateActivityStatusDeactive){ + + if($jsonData){ + + foreach ($jsonData as $urow){ + + $this->db->select('StatusCode'); + $this->db->where('StatusCode',$urow); + $this->db->where('StudentActivityCode',$arrayDetails['StudentActivityCode']); + if($this->db->get(DEFAULTACTIVITY)->first_row()){ + $existStatusUpdate['IsActive']=true; + $existStatusUpdate['UpdatedBy']=$arrayDetails['UpdatedBy']; + $existStatusUpdate['UpdatedOn']=$arrayDetails['UpdatedOn']; + $this->db->where('StatusCode',$urow); + $this->db->where('StudentActivityCode',$arrayDetails['StudentActivityCode']); + $this->db->update(DEFAULTACTIVITY, $existStatusUpdate); + } + else{ + $update_array["StatusCode"]=$urow; + $update_array["StudentActivityCode"]=$arrayDetails['StudentActivityCode']; + $update_array["IsActive"]=true; + $update_array["CreatedBy"]=$arrayDetails['UpdatedBy']; + $update_array["CreatedOn"]=$arrayDetails['UpdatedOn']; + $this->db->insert(DEFAULTACTIVITY, $update_array); + + } + + } + } + /*else{ + $activateStatus['IsActive']=true; + $this->db->where('StudentActivityCode ',$arrayDetails['StudentActivityCode']); + $this->db->update(DEFAULTACTIVITY, $activateStatus); + + }*/ + + + + $result['activityStatus'] = true; + $result['message'] = "Successfully status updated"; + } + + + + else { + $result['activityStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + + + + return $result; + } + } \ No newline at end of file From 7c7ef348bae8f0e03a5d5239d295cfd020c17beb Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 16:47:41 +0530 Subject: [PATCH 2/8] course details changes done --- .../controllers/University_Controller.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) 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 + } + + + } } From 65e4e9bf0cab248e7f408179bd9a4e64b679aea3 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 16:47:52 +0530 Subject: [PATCH 3/8] course details changes done --- .../js/controllers/studentStatusUpdateCtrl.js | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 Apollo/assets/js/controllers/studentStatusUpdateCtrl.js diff --git a/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js b/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js new file mode 100644 index 00000000..d4ab92f7 --- /dev/null +++ b/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js @@ -0,0 +1,155 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ +// var helloApp = angular.module("helloApp", []); +app.controller("studentStatusUpdateCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state) { + + $scope.companies = { + "ActivityID": "", + "ActivityName": "", + "switchsetting": true, + + }; + /* + * cancel edit div + * created by kms + * */ + $scope.cancel = function () { + $scope.init(); + $scope.editId = -1; + + }; + + /* + * update the default Activity details + * created by kms + * */ + $scope.updateActivity = function (myModel,listStatus, 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.ldloading3 = {}; + + $scope.ldloading3[loading.replace('-', '_')] = true; + + + var update = { + method: 'POST', + url: apiPoint.url + 'updateDefaultActivityDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + activityID: myModel.ActivityID, + activityName: myModel.ActivityName, + activityStatus:listStatus.list, + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(update).then(function (response) { + if (response.data.status==200 && response.data.activityStatus) { + + $scope.ldloading3[loading.replace('-', '_')] = false; + swal("Success!", response.data.message, "success"); + $scope.init(); + $scope.editId = -1; + + + } else { + $scope.ldloading3[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + } + }; + + // 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.editId = -1; + $scope.setEditId = function (p) { + $scope.editId = p.ActivityID; + $scope.editStatusList = []; + angular.forEach(p.statusDetails, function (values, keys) { + + $scope.editStatusList.push(values.ListCode); + }) + $scope.viewEditStatus = { + list: $scope.editStatusList, + } + + }; + + /* +*get Activity details when page loading called from view file +* +* created by karthi +* */ + $scope.statusList = []; + $scope.loader = ''; + $scope.emptyData = ''; + $scope.init = function () { + var getActivity = { + method: 'POST', + url: apiPoint.url + 'getDefaultActivityDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(getActivity).then(function (response) { + if (response.data.status == 200 && response.data.activityStatus) { + $scope.statusList = []; + $scope.emptyData = true; + $scope.loader = true; + $scope.activityInfo = response.data.details; + $scope.masterActivityStatus=response.data.masterStatusList; + angular.forEach($scope.masterActivityStatus, function (values, keys) { + $scope.statusData = { + name: values.ListName, + id: values.ListCode + }; + $scope.statusList.push($scope.statusData); + }) + } else { + $scope.statusList = []; + $scope.emptyData = false; + $scope.loader = false; + $scope.activityInfo = ""; + $scope.masterActivityStatus=response.data.masterStatusList; + angular.forEach($scope.masterActivityStatus, function (values, keys) { + $scope.statusData = { + name: values.ListName, + id: values.ListCode + }; + $scope.statusList.push($scope.statusData); + }) + } + }); + }; + + + +}]); \ No newline at end of file From 9d235bc1221ed9acfcd5f134593a9938373a6278 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 16:48:06 +0530 Subject: [PATCH 4/8] course details changes done --- Apollo/assets/views/studentStatusUpdate.html | 80 ++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Apollo/assets/views/studentStatusUpdate.html diff --git a/Apollo/assets/views/studentStatusUpdate.html b/Apollo/assets/views/studentStatusUpdate.html new file mode 100644 index 00000000..c594222f --- /dev/null +++ b/Apollo/assets/views/studentStatusUpdate.html @@ -0,0 +1,80 @@ + +
+
+
+

+ +
+
+
+
+
+
+
+ +
+
+ +
+ +

+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Activity ID + + Activity Name + + +
{{p.ActivityID}}{{p.ActivityName}} + + + +
+
+ + +
+ \ No newline at end of file From 445ea0b8a8d131aac4e744e9872ac86002dd2c86 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 16:48:17 +0530 Subject: [PATCH 5/8] course details changes done --- .../views/editDefaultActivityStatus.html | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 Apollo/assets/views/editDefaultActivityStatus.html diff --git a/Apollo/assets/views/editDefaultActivityStatus.html b/Apollo/assets/views/editDefaultActivityStatus.html new file mode 100644 index 00000000..eafffcc7 --- /dev/null +++ b/Apollo/assets/views/editDefaultActivityStatus.html @@ -0,0 +1,103 @@ +
+
+
+
+
+ + Update Status + + +
+
+ + + + Activity ID is required + +
+ + +
+ + + + Activity name is required + Invalid activity name + +
+
+
+ + + + + {{$item.name}} + + + {{d.name}} + + + + + Status is required. + + +
+ +
+ +
+
+ + + + +
+ +
+
+
+
+ + + + + +
+
+
+ +
+
+
+ \ No newline at end of file From e96c52ed47595929830d1fce1dfc69b418b550de Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 17:15:29 +0530 Subject: [PATCH 6/8] course details changes done --- Apollo/assets/views/studentStatusUpdate.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/Apollo/assets/views/studentStatusUpdate.html b/Apollo/assets/views/studentStatusUpdate.html index c594222f..beab8b2c 100644 --- a/Apollo/assets/views/studentStatusUpdate.html +++ b/Apollo/assets/views/studentStatusUpdate.html @@ -21,9 +21,6 @@
-
- -
From 09244dafe281c11cb72775051b2c8cf04fef7205 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 17:27:51 +0530 Subject: [PATCH 7/8] course details changes done --- .../js/controllers/studentStatusUpdateCtrl.js | 146 +++++++++--------- 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js b/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js index d4ab92f7..a7bf5910 100644 --- a/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js +++ b/Apollo/assets/js/controllers/studentStatusUpdateCtrl.js @@ -22,10 +22,81 @@ app.controller("studentStatusUpdateCtrl", ["$scope", "toaster", "$filter", "API_ }; + /* - * update the default Activity details - * created by kms - * */ +*get Activity details when page loading called from view file +* +* created by karthi +* */ + $scope.statusList = []; + $scope.loader = ''; + $scope.emptyData = ''; + $scope.init = function () { + var getActivity = { + method: 'POST', + url: apiPoint.url + 'getDefaultActivityDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(getActivity).then(function (response) { + if (response.data.status == 200 && response.data.activityStatus) { + $scope.statusList = []; + $scope.emptyData = true; + $scope.loader = true; + $scope.activityInfo = response.data.details; + $scope.masterActivityStatus=response.data.masterStatusList; + angular.forEach($scope.masterActivityStatus, function (values, keys) { + $scope.statusData = { + name: values.ListName, + id: values.ListCode + }; + $scope.statusList.push($scope.statusData); + }) + } else { + $scope.statusList = []; + $scope.emptyData = false; + $scope.loader = false; + $scope.activityInfo = ""; + $scope.masterActivityStatus=response.data.masterStatusList; + angular.forEach($scope.masterActivityStatus, function (values, keys) { + $scope.statusData = { + name: values.ListName, + id: values.ListCode + }; + $scope.statusList.push($scope.statusData); + }) + } + }); + }; + + // 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.editId = -1; + $scope.setEditId = function (p) { + $scope.editId = p.ActivityID; + $scope.editStatusList = []; + angular.forEach(p.statusDetails, function (values, keys) { + + $scope.editStatusList.push(values.ListCode); + }) + $scope.viewEditStatus = { + list: $scope.editStatusList, + } + + }; + /* + * update the default Activity details + * created by kms + * */ $scope.updateActivity = function (myModel,listStatus, form, loading) { var firstError = null; @@ -79,77 +150,8 @@ app.controller("studentStatusUpdateCtrl", ["$scope", "toaster", "$filter", "API_ } }; - // 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.editId = -1; - $scope.setEditId = function (p) { - $scope.editId = p.ActivityID; - $scope.editStatusList = []; - angular.forEach(p.statusDetails, function (values, keys) { - - $scope.editStatusList.push(values.ListCode); - }) - $scope.viewEditStatus = { - list: $scope.editStatusList, - } - - }; - - /* -*get Activity details when page loading called from view file -* -* created by karthi -* */ - $scope.statusList = []; - $scope.loader = ''; - $scope.emptyData = ''; - $scope.init = function () { - var getActivity = { - method: 'POST', - url: apiPoint.url + 'getDefaultActivityDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID - } - }; - $http(getActivity).then(function (response) { - if (response.data.status == 200 && response.data.activityStatus) { - $scope.statusList = []; - $scope.emptyData = true; - $scope.loader = true; - $scope.activityInfo = response.data.details; - $scope.masterActivityStatus=response.data.masterStatusList; - angular.forEach($scope.masterActivityStatus, function (values, keys) { - $scope.statusData = { - name: values.ListName, - id: values.ListCode - }; - $scope.statusList.push($scope.statusData); - }) - } else { - $scope.statusList = []; - $scope.emptyData = false; - $scope.loader = false; - $scope.activityInfo = ""; - $scope.masterActivityStatus=response.data.masterStatusList; - angular.forEach($scope.masterActivityStatus, function (values, keys) { - $scope.statusData = { - name: values.ListName, - id: values.ListCode - }; - $scope.statusList.push($scope.statusData); - }) - } - }); - }; - }]); \ No newline at end of file From b50453b82ad8dbb98a18204d41d41c61ebda300c Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Dec 2017 17:28:15 +0530 Subject: [PATCH 8/8] course details changes done --- Apollo/assets/views/editDefaultActivityStatus.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Apollo/assets/views/editDefaultActivityStatus.html b/Apollo/assets/views/editDefaultActivityStatus.html index eafffcc7..f7cbb5b1 100644 --- a/Apollo/assets/views/editDefaultActivityStatus.html +++ b/Apollo/assets/views/editDefaultActivityStatus.html @@ -33,7 +33,7 @@
+ ng-class="{'has-error':Form.status.$dirty && Form.status.$invalid && viewEditStatus.list.length==0, 'has-success':Form.status.$valid}">