diff --git a/Apollo/api/application/controllers/Course_Controller.php b/Apollo/api/application/controllers/Course_Controller.php index 1648d776..9187a8d1 100755 --- a/Apollo/api/application/controllers/Course_Controller.php +++ b/Apollo/api/application/controllers/Course_Controller.php @@ -58,7 +58,10 @@ class Course_Controller extends REST_Controller { if($jsonLateralFeesData['FeesAmount'] != 0 AND $jsonLateralFeesData['FeesAmount'] != '' AND $jsonLateralFeesData['FeesAmount'] != 'undefined'){ 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) + // get subject details + $subjectDetails=$this->post('subjects'); + + $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData,$subjectDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($courseDetails) { $courseDetails['status'] = REST_Controller::HTTP_OK; @@ -104,8 +107,8 @@ class Course_Controller extends REST_Controller { } public function getCourseUnivFeesDetails_post() { - $requestedBy = $this->post('requestedBy'); - $getCourseUnivFee = $this->course_model->getCourseUnivFeesTypes($requestedBy); + $requestedBy = $this->post('requestedBy'); + $getCourseUnivFee = $this->course_model->getCourseUnivFeesTypes($requestedBy); if ($getCourseUnivFee) { @@ -158,7 +161,14 @@ class Course_Controller extends REST_Controller { } - $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData,$existCourseID);// Check if the users data store contains users (in case the database result returns NULL) + // update course subject details + $subjectDetails['UniversityID'] = $this->post('universityID'); + $subjectDetails['CourseID'] = $this->post('courseID'); + $subjectDetails['Subjects'] = $this->post('subjects'); + $subjectDetails['UpdatedBy'] = $this->post('updatedBy'); + $subjectDetails['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + + $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData,$subjectDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/models/Course_model.php b/Apollo/api/application/models/Course_model.php index 89bd4b12..03935f7f 100755 --- a/Apollo/api/application/models/Course_model.php +++ b/Apollo/api/application/models/Course_model.php @@ -15,7 +15,7 @@ class Course_model extends CI_Model { * created by kms * */ - public function addCourse($arrayDetails=null,$jsonSemFeesData=null) + public function addCourse($arrayDetails=null,$jsonSemFeesData=null,$subjectDetails=null) { $this->db->select('CourseCode'); @@ -40,6 +40,10 @@ class Course_model extends CI_Model { $this->db->insert(COURSE_FEES, $insertFeesArray); } + if($subjectDetails){ + $this->insertCourseSubjects($arrayDetails,$insert_id,$subjectDetails); + } + $result['courseStatus'] = true; $result['message'] = "Successfully course details added"; } @@ -95,6 +99,7 @@ class Course_model extends CI_Model { $fetchData['UniversityID']=$row->UniversityID; $fetchData['UniversityName']=$row->UniversityName; $fetchData['feesStructures'] = $this->getCourseFeesDetails($row->CourseID); + $fetchData['existSubjects'] = $this->getExistCourseSubjectDetails($row->CourseID); // print_r($fetchData);exit(); $storeCourseArray[]=$fetchData; } @@ -123,7 +128,7 @@ class Course_model extends CI_Model { * update course details * created by kms * */ - public function updateCourse($arrayDetails=null,$jsonData=null) + public function updateCourse($arrayDetails=null,$jsonData=null,$subjectDetails=null) { $this->db->select('CourseCode'); $this->db->where('CourseCode', $arrayDetails['CourseCode']); @@ -158,6 +163,9 @@ class Course_model extends CI_Model { } } + // update course subject details + $this->updateCourseSubjcetDetails($subjectDetails); + $result['courseStatus'] = true; $result['message'] = "Successfully course details updated"; @@ -261,14 +269,104 @@ class Course_model extends CI_Model { * created by kms * */ public function getSubjectDetails(){ - $this->db->select('UniversityID,UniversityName'); - $this->db->order_by('UniversityID','ASC'); + $this->db->select('SubjectID,SubjectCode,SubjectName'); + $this->db->order_by('SubjectID','DESC'); $this->db->where('IsActive','1'); - $universityDetails = $this->db->get(SUBJE); - return $universityDetails->result(); + $subjectDetails = $this->db->get(SUBJECTMASTER); + return $subjectDetails->result(); } + /* + *Insert course sujects + * created by kms + * */ + public function insertCourseSubjects($details=null,$courseID=null,$subjects=null){ + $insertSubject['UniversityID'] = $details['UniversityID']; + $insertSubject['CourseID'] = $courseID; + if ($subjects){ + foreach ($subjects as $row){ + $insertSubject['SubjectID'] = $row['SubjectID']; + $insertSubject['IsActive'] = true; + $insertSubject['CreatedBy'] = $details['CreatedBy']; + $insertSubject['CreatedOn'] = $details['CreatedOn']; + $this->db->insert(COURSESUBJECT, $insertSubject); + } + } + return true; + } + /* + * get exist Course subject details + * created by kms + * */ + public function getExistCourseSubjectDetails($courseID=null){ + $this->db->select('CSU.SubjectID,SM.SubjectCode,SM.SubjectName'); + $this->db->order_by('CSID','ASC'); + $this->db->where('CSU.CourseID',$courseID); + $this->db->where('CSU.IsActive','1'); + $this->db->where('SM.IsActive','1'); + $this->db->from(COURSESUBJECT.' as CSU'); + $this->db->join(SUBJECTMASTER.' as SM', 'SM.SubjectID = CSU.SubjectID'); + $subDetails = $this->db->get(); + return $subDetails->result(); + } + + /* + * update course subject details + * created by kms + * */ + public function updateCourseSubjcetDetails($sujects=null){ + $deactiveStatus['IsActive']=false; + $deactiveStatus['UpdatedBy']=$sujects['UpdatedBy']; + $deactiveStatus['UpdatedOn']=$sujects['UpdatedOn']; + $this->db->where('CourseID ',$sujects['CourseID']); + $this->db->where('UniversityID ',$sujects['UniversityID']); + $updateCourseSubjectDeactive = $this->db->update(COURSESUBJECT, $deactiveStatus); + + if($updateCourseSubjectDeactive){ + + if($sujects['Subjects']){ + + foreach ($sujects['Subjects'] as $srow){ + $this->db->select('CSID'); + $this->db->where('CourseID',$sujects['CourseID']); + $this->db->where('UniversityID',$sujects['UniversityID']); + $this->db->where('SubjectID',$srow); + if($this->db->get(COURSESUBJECT)->first_row()){ + $existStatusUpdate['IsActive']=true; + $existStatusUpdate['UpdatedBy']=$sujects['UpdatedBy']; + $existStatusUpdate['UpdatedOn']=$sujects['UpdatedOn']; + $this->db->where('CourseID',$sujects['CourseID']); + $this->db->where('UniversityID',$sujects['UniversityID']); + $this->db->where('SubjectID',$srow); + $this->db->update(COURSESUBJECT, $existStatusUpdate); + } + else{ + $update_array["UniversityID"]=$sujects['UniversityID']; + $update_array["CourseID"]=$sujects['CourseID']; + $update_array["SubjectID"]=$srow; + + $update_array["IsActive"]=true; + $update_array["CreatedBy"]=$sujects['UpdatedBy']; + $update_array["CreatedOn"]=$sujects['UpdatedOn']; + $this->db->insert(COURSESUBJECT, $update_array); + + } + + } + } + /* else{ + $activateStatus['IsActive']=true; + $this->db->where('CourseID ',$sujects['CourseID']); + $this->db->where('UniversityID ',$sujects['UniversityID']); + $this->db->update(COURSESUBJECT, $activateStatus); + + }*/ + + } + + return true; + } } \ No newline at end of file diff --git a/Apollo/api/application/models/Subject_model.php b/Apollo/api/application/models/Subject_model.php index 37f3d269..d4e185a9 100644 --- a/Apollo/api/application/models/Subject_model.php +++ b/Apollo/api/application/models/Subject_model.php @@ -15,12 +15,12 @@ class Subject_model extends CI_Model $this->db->select('SubjectCode'); $this->db->where('SubjectCode',$arrayDetails['SubjectCode']); - if($this->db->get('T_SubjectMaster')->first_row()){ + if($this->db->get(SUBJECTMASTER)->first_row()){ $result['SubjectStatus']=false; $result['message']="This subject code already exists"; }else{ - $this->db->insert('T_SubjectMaster',$arrayDetails); + $this->db->insert(SUBJECTMASTER,$arrayDetails); if ($this->db->affected_rows() == '1') { $result['SubjectStatus']=true; @@ -45,12 +45,12 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) $this->db->select('SubjectCode'); $this->db->where('SubjectCode',$arrayDetails['SubjectCode']); $this->db->where('SubjectCode !=', $arrayDetails['SubjectCode']); - if($this->db->get('T_SubjectMaster')->first_row()){ + if($this->db->get(SUBJECTMASTER)->first_row()){ $result['SubjectStatus']=false; $result['message']="This subject code is already exists"; }else{ $this->db->where('SubjectID',$SubjectID); - $upateStatus=$this->db->update('T_SubjectMaster', $arrayDetails); + $upateStatus=$this->db->update(SUBJECTMASTER, $arrayDetails); @@ -82,7 +82,7 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) { $this->db->select('*'); $this->db->order_by('CreatedOn','DESC'); - $subjectDetails = $this->db->get('T_SubjectMaster'); + $subjectDetails = $this->db->get(SUBJECTMASTER); if($subjectDetails->result()){ @@ -99,23 +99,4 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) } - - - - - - - - - - - - - - - - - - - } \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index bb9a7af0..e6df1a77 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -72,7 +72,8 @@ "DAYBOOKMASTER":"INCOME/EXPENSE HEADS", "CENTERMASTER": "CENTER DETAILS", "SUBJECTMASTER":"SUBJECT MASTER", - "SESSIONMASTER":"SESSION DETAILS" + "SESSIONMASTER":"SESSION DETAILS", + "SESSIONSCHEDULE": "SESSION SCHEDULE" }, "student": { "MAIN": "STUDENTS", diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 6c991692..37647774 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -165,7 +165,10 @@ app.constant('JS_REQUIRES', { 'centerCtrl':'assets/js/controllers/centerCtrl.js', //SUBJECT MASTER 'subjectCtrl':'assets/js/controllers/subjectCtrl.js', + // session master 'sessionMasterCtrl':'assets/js/controllers/sessionMasterCtrl.js', + // session sechdule + 'sessionScheduleCtrl':'assets/js/controllers/sessionScheduleCtrl.js', //*** Filters diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index 9662985f..302d1f85 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -228,6 +228,14 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com ncyBreadcrumb: { label: 'Session Master' }, + }).state('app.master.sessionSchedule', { + url: '/session schedule', + templateUrl: "assets/views/sessionSchedule.html", + resolve: loadSequence('ui.select','sessionScheduleCtrl','ngTable', 'ladda', 'angular-ladda','spin'), + title: 'Session Schedule', + ncyBreadcrumb: { + label: 'Session Schedule' + }, }).state('app.student', { url: '/student', template: '