diff --git a/Apollo/api/application/config/constants.php b/Apollo/api/application/config/constants.php index ab3fa057..04c7ea41 100755 --- a/Apollo/api/application/config/constants.php +++ b/Apollo/api/application/config/constants.php @@ -120,6 +120,7 @@ defined('BRANCH') OR define('BRANCH','T_BranchMaster'); defined('STAFF') OR define('STAFF','T_StaffDetails'); defined('STAFF_BRANCH') OR define('STAFF_BRANCH','T_Staff_BranchAccess'); defined('UNIVERSITY') OR define('UNIVERSITY','T_UniversityMaster'); +defined('UNIVERSITYFILE') OR define('UNIVERSITYFILE','T_University_File_List'); defined('COURSE') OR define('COURSE','T_CourseMaster'); defined('COURSE_FEES') OR define('COURSE_FEES','T_Course_Fees_Details'); defined('LEAD_DETAILS') OR define('LEAD_DETAILS','T_Lead_Details'); diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index d757c011..af1cf416 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -319,4 +319,5 @@ $route['report_wav_ref'] = 'Report/wav_ref'; $route['report_examfee'] = 'Report/examfee'; $route['report_balfee'] = 'Report/balfee'; $route['report_lead'] = 'Report/lead'; +$route['insertUniversityfile'] = 'UniversityFile_Controller/insertUniversityfile'; diff --git a/Apollo/api/application/controllers/UniversityFile_Controller.php b/Apollo/api/application/controllers/UniversityFile_Controller.php new file mode 100644 index 00000000..93b35b04 --- /dev/null +++ b/Apollo/api/application/controllers/UniversityFile_Controller.php @@ -0,0 +1,350 @@ +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('Universityfile_model', 'universityfile_model'); + } + + // get university details + public function getUniversity_post() { + $reqData = $this->post('data'); + $loginUserId = $reqData['localUserID']; + $loginUserBranchId = $reqData['localBranchID']; + $loginUserType = $reqData['localType']; + $getUniversityListDetails = $this->universityfile_model->get_university_list($loginUserBranchId);// Check if the employee exist + if ($getUniversityListDetails) + { + $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + + //update university details + public function updateUniversityDetail_post() { + + + //s print_r($_FILES); + $imagename=''; + $size=''; + $imageSource=''; + + if(!empty($_FILES)) + { + $imagename = $_FILES['idProof']['name']; + $size = $_FILES['idProof']['size']; + $imageSource = $_FILES['idProof']['tmp_name']; + } + + + // echo $imagename; + // echo $size; + // echo $imageSource; + // die(); + + + $reqData = $this->post('data'); + $data = json_decode($reqData, true); + $req['UpdatedBy'] = $this->post('updatedBy'); + $date = date('Y-m-d H:i:s'); + $req['UpdatedOn'] = $date; + $req['UniversityName']= $data['UniversityName']; + $req['UniversityShortName']= $data['UniversityShortName']; + $req['MobileNumber']= $data['MobileNumber']; + $req['EmailID']= $data['EmailID']; + $req['Address']= $data['Address']; + $req['IsActive']= $data['IsActive']; + $req['BranchCode'] = $this->post('branchCode'); + $req['ID']= $data['ID']; + + $updateFor = $data['UniversityID']; + + + $updateUniversityDetail = $this->university_model->update_university_details($updateFor, $req,$imagename,$imageSource,$size);// Check if the employee exist + if ($updateUniversityDetail) + { + $updateUniversityDetail['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateUniversityDetail, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + + // check university details exist + public function chkUnivIdExistDetail_post() { + + $data = $this->post('data'); + $check = $this->post('check'); + $branchCode = $this->post('branchCode'); + + $checkUnivExist = $this->university_model->check_Univ_Exist($data, $check,$branchCode);// Check if the employee exist + if ($checkUnivExist) + { + $checkUnivExist['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkUnivExist, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + + // insert university details + public function insertUniversityfile_post() { + + + + $imagename=''; + $size=''; + $imageSource=''; + + + if(!empty($_FILES)) + { + $imagename = $_FILES['idProof']['name']; + $size = $_FILES['idProof']['size']; + $imageSource = $_FILES['idProof']['tmp_name']; + } + // echo $imagename; + // echo $size; + // echo $imageSource; + + + $reqData = $this->post('data'); + $temp = json_decode($reqData, true); + + //print_r($reqData); + //die(); + // $req['CreatedBy'] = $this->post('createdBy'); + $date = date('Y-m-d H:i:s'); + //$req['CreatedOn'] = $date; + $req['UniversityName']= $temp['UniversityName']; + + + + // $insertUniv = $this->universityfile_model->insert_Univfile($req,$imagename,$imageSource,$size); + $insertUniv = $this->universityfile_model->insert_Univfile($req,$imagename); + print_r($insertUniv); + // Check if the employee exist + if ($insertUniv) + { + + $insertUniv['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($insertUniv, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + + /* + * add activity details + * created Surendiran + * */ + + public function addActivityDetails_post() { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['ActivityID'] = $this->post('activityID'); + $details['ActivityName'] = $this->post('activityName'); + $details['Description'] = $this->post('description'); + $details['CreatedBy'] = $this->post('createdBy'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); + $details['IsActive'] = $this->post('status'); + $details['BranchCode'] = $this->post('branchCode'); + $jsonData=$this->post('activityStatus'); + $activityDetails = $this->university_model->addActivity($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 + } + } + + /* + * get activity details + * created by Surendiran + * */ + public function getActivityDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $requestedBranch = $this->post('branchCode'); + $getActivity = $this->university_model->getActivity($requestedBy,$requestedBranch); + if ($getActivity) + { + $getActivity['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getActivity, 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 activity details + * created by Surendiran + * */ + public function updateActivityDetails_post() + { + + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['ActivityID'] = $this->post('activityID'); + $details['ActivityName'] = $this->post('activityName'); + $details['Description'] = $this->post('description'); + $details['IsActive'] = $this->post('status'); + $details['UpdatedBy'] = $this->post('updatedBy'); + $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $details['BranchCode'] = $this->post('branchCode'); + $jsonData=$this->post('activityStatus'); + $activityDetails = $this->university_model->updateActivity($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 + } + + + } + /* + * get default activity details + * created by kms + * */ + public function getDefaultActivityDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $requestedBranch = $this->post('requestedBranch'); + $getDefaultActivity = $this->university_model->getDefaultActivity($requestedBy, $requestedBranch); + 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['BranchCode'] = $this->post('reqBranch'); + $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 + } + + + } + + +} diff --git a/Apollo/api/application/controllers/University_Controller.php b/Apollo/api/application/controllers/University_Controller.php index be738955..84be2013 100755 --- a/Apollo/api/application/controllers/University_Controller.php +++ b/Apollo/api/application/controllers/University_Controller.php @@ -34,7 +34,7 @@ class University_Controller extends REST_Controller { $this->methods['updateDefaultActivityDetails_post']['limit'] = 100; // load the university model - $this->load->model('University_model', 'university_model'); + $this->load->model('Universityfile_model', 'universityfile_model'); } // get university details @@ -43,7 +43,7 @@ class University_Controller extends REST_Controller { $loginUserId = $reqData['localUserID']; $loginUserBranchId = $reqData['localBranchID']; $loginUserType = $reqData['localType']; - $getUniversityListDetails = $this->university_model->get_university_list($loginUserBranchId);// Check if the employee exist + $getUniversityListDetails = $this->universityfile_model->get_university_list($loginUserBranchId);// Check if the employee exist if ($getUniversityListDetails) { $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/models/Universityfile_model.php b/Apollo/api/application/models/Universityfile_model.php new file mode 100644 index 00000000..d3bee638 --- /dev/null +++ b/Apollo/api/application/models/Universityfile_model.php @@ -0,0 +1,462 @@ +db->select('*'); + $this->db->where('BranchCode',$loginUserBranchId); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(UNIVERSITY); + $univDetails = $this->db->get(); + $universityDetails = $univDetails->result(); + if (count($universityDetails) > 0) { + $results['univList'] = true; + $results['university_details'] = $universityDetails; + } else { + $results['univList'] = false; + $results['message'] = 'No record found'; + } + return $results; + + print_r($results); + } + + // update univesity details + public function update_university_details($updateFor, $Arr,$imageName, $imageSource, $imageSize) { + + if($imageSource == '') + { + //echo "if"; + $imageNameDb = 'default.jpeg'; + // $Arr['ProfilePicPath'] = "university/".$imageNameDb; + } + + else + { + //echo "else"; + $target = "../images/university/"; + $getUploadStatus = $this->upload_image($imageSource, $imageSize, $target); + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + // echo $imageNameDb; + $Arr['ProfilePicPath'] = "university/".$imageNameDb; + } + + + // print_r($Arr); + // die(); + + + $this->db->where('UniversityID', $updateFor); + $this->db->where('BranchCode', $Arr['BranchCode']); + $this->db->where('ID', $Arr['ID']); + $this->db->update(UNIVERSITY, $Arr); + if ($this->db->affected_rows() == '1') { + $result['updateUniversityStatus'] = true; + $result['message'] = "Successfully University details Updated"; + } else { + $result['updateUniversityStatus'] = false; + $result['message'] = "University details not Updated"; + } + return $result; + } + + // check exist details + public function check_Univ_Exist($data, $check,$branchCode) { + // check univ with branch code + $this->db->select('*'); + $this->db->from(UNIVERSITY); + $this->db->where('UniversityID', $data); + $this->db->where('BranchCode', $branchCode); + if ($this->db->get()->first_row()) { + $result['existUniv'] = true; + $result['message'] = "This University Id is already exist!"; + } else { + $result['existUniv'] = false; + } + return $result; + } + + // add university details + public function insert_Univfile($arr,$imageName, $imageSource, $imageSize) { + + + + if($imageSource == '') + { + //echo "if"; + $imageNameDb = 'default.jpeg'; + $arr['ProfilePicPath'] = "university/".$imageNameDb; + } + + else + { + //echo "else"; + $target = "../images/university/"; + $getUploadStatus = $this->upload_image($imageSource, $imageSize, $target); + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + // echo $imageNameDb; + $arr['ProfilePicPath'] = "university/".$imageNameDb; + } + + + // // echo $imageName; + // // echo $imageSource; + // // echo $imageSize; + // echo $imageSource; + //die(); + $this->db->select('*'); + $this->db->from(UNIVERSITYFILE); + $this->db->where('UniversityID', $arr['UniversityID']); + $this->db->where('BranchCode', $arr['BranchCode']); + if ($this->db->get()->first_row()) { + $result['addUniv'] = false; + $result['message'] = "This University Id is already exist!"; + } else { + $this->db->insert(UNIVERSITYFILE, $arr); + if ($this->db->affected_rows() == '1') { + $result['addUniv'] = true; + $result['message'] = "Successfully University file added"; + } else { + $result['addUniv'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + + } + + public function addActivity($arrayDetails=null,$jsonData=null) + { + $this->db->select('ActivityID,ActivityName'); + $this->db->where('ActivityName', $arrayDetails['ActivityName']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); + if($this->db->get(ACTIVITY)->first_row()){ + $result['activityStatus'] = false; + $result['message'] = "Activity name is already exist!"; + } + else{ + $this->db->insert(ACTIVITY, $arrayDetails); + if($this->db->affected_rows() == '1'){ + $last = $this->db->order_by('ActivityID',"desc")->limit(1)->get(ACTIVITY)->row(); + $lastActivityID=$last->ActivityID; + + if($jsonData){ + + foreach ($jsonData as $srow){ + $status_array["StatusName"]=$srow['id']; + $status_array["ActivityID"]=$lastActivityID; + $status_array["IsActive"]=$arrayDetails['IsActive']; + $status_array["CreatedBy"]=$arrayDetails['CreatedBy']; + $status_array["CreatedOn"]=$arrayDetails['CreatedOn']; + $this->db->insert(ACTIVITY_STATUS, $status_array); + } + } + $result['activityStatus'] = true; + $result['message'] = "Successfully activity details added"; + + } + else { + $result['activityStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + + + + return $result; + + } + + /* + * get Activity details + * parama id + * created by Surendiran + * */ + + public function getActivity($requestedBy=null,$requestedBranch=null) + { + $this->db->distinct(); + $this->db->where('BranchCode',$requestedBranch); + $this->db->order_by('ActivityID','DESC'); + $this->db->select('ActivityID,ActivityName,Description,IsActive'); + $activityDetails=$this->db->get(ACTIVITY); + if($activityDetails->result()){ + + $activity_result['activityStatus'] = true; + foreach ($activityDetails->result() as $row){ + $result_array['ActivityID'] = $row->ActivityID; + $result_array['ActivityName'] = $row->ActivityName; + $result_array['IsActive'] = $row->IsActive; + $result_array['Description'] = $row->Description; + $this->db->select('AVS.StatusID,PLD.ListCode,PLD.ListName'); + $this->db->from(ACTIVITY_STATUS .' as AVS'); + $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AVS.StatusName'); + $this->db->where('AVS.ActivityID',$row->ActivityID); + $this->db->where('AVS.IsActive','1'); + $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',$requestedBranch); + return $activity_result; + + } + /* + * get status details + * created by kms + * */ + + public function getAllStatusList($groupName=null, $branch = null) + { + $this->db->select('ListCode,ListName'); + $this->db->where('ListGroup',$groupName); + $this->db->where('IsActive','1'); + $this->db->where('BranchCode', $branch); + $this->db->order_by('ListCode','ASC'); + $status = $this->db->get(PICK_LIST_DETAILS); + return $status->result(); + } + + + /* + * update activity details details + * created by Surendiran + * */ + public function updateActivity($arrayDetails=null,$jsonData=null) { + + $this->db->select('ActivityName'); + $this->db->where('ActivityName',$arrayDetails['ActivityName']); + $this->db->where('ActivityID !=',$arrayDetails['ActivityID']); + $this->db->where('BranchCode',$arrayDetails['BranchCode']); + if($this->db->get(ACTIVITY)->first_row()){ + $result['activityStatus'] = false; + $result['message'] = "Activity name is already exist!"; + } + else{ + + $this->db->where('ActivityID ',$arrayDetails['ActivityID']); + $updateStatus=$this->db->update(ACTIVITY, $arrayDetails); + if($updateStatus){ + $deactiveStatus['IsActive']=false; + $deactiveStatus['UpdatedBy']=$arrayDetails['UpdatedBy']; + $deactiveStatus['UpdatedOn']=$arrayDetails['UpdatedOn']; + $this->db->where('ActivityID ',$arrayDetails['ActivityID']); + $updateActivityStatusDeactive = $this->db->update(ACTIVITY_STATUS, $deactiveStatus); + if($updateActivityStatusDeactive){ + + if($jsonData){ + + foreach ($jsonData as $urow){ + + $this->db->select('StatusName'); + $this->db->where('StatusName',$urow); + $this->db->where('ActivityID',$arrayDetails['ActivityID']); + if($this->db->get(ACTIVITY_STATUS)->first_row()){ + $existStatusUpdate['IsActive']=true; + $existStatusUpdate['UpdatedBy']=$arrayDetails['UpdatedBy']; + $existStatusUpdate['UpdatedOn']=$arrayDetails['UpdatedOn']; + $this->db->where('StatusName',$urow); + $this->db->where('ActivityID',$arrayDetails['ActivityID']); + $this->db->update(ACTIVITY_STATUS, $existStatusUpdate); + } + else{ + $update_array["StatusName"]=$urow; + $update_array["ActivityID"]=$arrayDetails['ActivityID']; + $update_array["IsActive"]=true; + $update_array["CreatedBy"]=$arrayDetails['UpdatedBy']; + $update_array["CreatedOn"]=$arrayDetails['UpdatedOn']; + $this->db->insert(ACTIVITY_STATUS, $update_array); + + } + + } + } + else{ + $activateStatus['IsActive']=true; + $this->db->where('ActivityID ',$arrayDetails['ActivityID']); + $this->db->update(ACTIVITY_STATUS, $activateStatus); + + } + + + + $result['activityStatus'] = true; + $result['message'] = "Successfully activity details updated"; + } + + + } + else { + $result['activityStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + + } + + return $result; + } + + /* + * get default activity details + * created by kms + * */ + public function getDefaultActivity($reqBy, $reqBranch) + { + $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.BranchCode', $reqBranch); + // $this->db->where('PLD.BranchCode', $reqBranch); + $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', $reqBranch); + return $activity_result; + + } + /* + * update default activity status + * created by kms + * */ + public function updateDefaultActivity($arrayDetails=null,$jsonData=null) { + + $branchCode = $arrayDetails['BranchCode']; + $deactiveStatus['IsActive']=false; + $deactiveStatus['UpdatedBy']=$arrayDetails['UpdatedBy']; + $deactiveStatus['UpdatedOn']=$arrayDetails['UpdatedOn']; + $this->db->where('BranchCode',$branchCode); + $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('BranchCode',$branchCode); + $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']; + $update_array["BranchCode"]= $branchCode; + $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; + } + + + // image upload in taget path + public function upload_image( $imageSource, $size, $target ) { + + //echo "fn"; + $key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 12); + $new_regNo = "Dri_" . $key2 . "." . 'jpeg'; + $targetPlace = $target . $new_regNo; + // echo $imageSource; + // exit(); + if(!move_uploaded_file($imageSource , $targetPlace)) + {//echo "if"; + return $result['status'] = false; + + $result['imageName'] = $new_regNo; + } + else + { + // echo "else"; + $result['status'] = true; + $result['imageName'] = $new_regNo; + + return $result; + } + } + +} \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index 6898b6e5..d4c1260e 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -81,6 +81,7 @@ "report": { "TITLE": "REPORTS", "studmatstatus": "STUDY MATERIAL STATUS ", + "unidataupload":"UNIVERSITY DATA UPLOAD", "mstatus": "MARK CARD STATUS ", "certificate_status": "CERTIFICATE STATUS ", "certificate_mark_status": "MARKCARD/CERTIFICATE ISSUED STATUS ", diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 165e47e5..1b45104a 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -205,6 +205,7 @@ app.constant('JS_REQUIRES', { 'htmlToPlaintext': 'assets/js/filters/htmlToPlaintext.js', // reports 'reportCtrl':'assets/js/controllers/reportCtrl.js', + 'report_university_file_uploadCtrl':'assets/js/controllers/report_university_file_uploadCtrl.js', 'report_study_material_statusCtrl':'assets/js/controllers/report_study_material_statusCtrl.js', 'report_markcard_statusCtrl':'assets/js/controllers/report_markcard_statusCtrl.js', 'report_certificateCtrl':'assets/js/controllers/report_certificateCtrl.js', diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index 053d2cf3..923c5d1f 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -585,6 +585,12 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com ncyBreadcrumb: { label: 'Reports' } + }).state('app.reports.universityfileupload', { + url: '/report_university_file_uploadCtrl', + templateUrl: "assets/views/report_universityfileupload.html", + resolve: loadSequence('ui.select','report_university_file_uploadCtrl','ngTable', 'ladda', 'angular-ladda'), + title: 'university file upload', + }).state('app.reports.studymaterial', { url: '/report_study_material_statusCtrl', templateUrl: "assets/views/report_studymaterialstatus.html", diff --git a/Apollo/assets/js/controllers/report_university_file_uploadCtrl.js b/Apollo/assets/js/controllers/report_university_file_uploadCtrl.js new file mode 100644 index 00000000..66bc086b --- /dev/null +++ b/Apollo/assets/js/controllers/report_university_file_uploadCtrl.js @@ -0,0 +1,358 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ + +app.controller('report_university-file-uploadCtrl.js', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window) { + /** + * university details capture + * by : kdk + */ + // get local cliend details + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + //alert(JSON.stringify(localDetail)); + + $scope.myModel = { + + 'UniversityName': '', + // 'UniversityID': '', + // 'UniversityShortName': '', + // 'MobileNumber': '', + // 'EmailID': '', + // 'Address': '', + // 'switchsetting': true, + + + + }; + + + $scope.init = function() { + // alert(); + const LOCALTYPE = localDetail.localType; + if (localDetail != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' )) { + $scope.getUniversityList(); + }else { + if(localDetail != null && LOCALTYPE != 'R001') { + $state.go('app.dashboard'); + } else { + ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + } + + // 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.getUniversityList = function () { + $scope.loader = true; + var empListreq = { + method: 'POST', + url: apiPoint.url + 'getUniversity/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(empListreq).then(function (response) { + if (response.data.univList) { + $scope.loader = false; + $scope.emptyUniversity = true; + $scope.univ = response.data.university_details; + } else { + $scope.loader = false; + $scope.emptyUniversity = false; + } + }); + + } + + // check employee Id existing + $scope.checkUnivIdExist = function () { + var checkReq = { + method: 'POST', + url: apiPoint.url + 'chkUnivIdExistDetail/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.myModel.UniversityID, + check: 'univId', + branchCode: localDetails.localBranchID, + } + }; + $http(checkReq).then(function (response) { + if (response.data.existUniv === true) { + swal("", "University Id already exists", "warning"); + $scope.myModel.UniversityID = ''; + } else { + } + }); + } + + + + + //--------------------------------------------------------------> + // getting for image to show + //--------------------------------------------------------------> + + $scope.stepsModel = []; + $scope.imageUpload = function (event) { + var files = event.target.files; //FileList object + + for (var i = 0; i < files.length; i++) { + var file = files[i]; + var reader = new FileReader(); + reader.onload = $scope.imageIsLoaded; + reader.readAsDataURL(file); + } + } + + $scope.imageIsLoaded = function (e) { + $scope.$apply(function () { + // $scope.stepsModel.push(e.target.result); + $scope.stepsModel[0] = e.target.result; + }); + } + + + //an array of files selected + $scope.filesimage = []; + + //listen for the file selected event + $scope.$on("fileSelected", function (event, args) { + $scope.$apply(function () { + //add the file object to the scope's files collection + $scope.filesimage[0] = args.file; + + + }); + }); + + + // reset image + $scope.resetImage = function () { + $scope.filesimage.length = 0; + $scope.filesimage[0]=''; + $scope.stepsModel.length = 0; + } + + + //------------------image functions over ----------> + + $scope.setEditId = function (id) { + // alert(id); + $scope.editId = id; + } + + $scope.cancel = function () { + $scope.getUniversityList(); + $scope.editId = -1; + } + + $scope.updateUniversityDetails = function (form, p) { + //alert() + 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 { + p.IsActive = p.IsActive === true ? 1 : 0; + var idProof = $scope.filesimage[0]; + + + if(idProof === undefined) + { + + //alert('if') + // alert(JSON.stringify(p)) + var req = { + method: 'POST', + url: apiPoint.url + 'updateUniversityDetail/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: JSON.stringify(p), + updatedBy: localDetails.localUserID, + branchCode: localDetails.localBranchID + } + }; + $http(req).then(function (response) { + if (response.data.updateUniversityStatus = true) { + swal(" ", "Updated successfully.", "success"); + $scope.getUniversityList(); + $scope.editId = -1; + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal(" ", "Something went wrong, please try again.", "error"); + } + }); + } + + + else + { + +//alert('else') + var formData = new FormData(); + var idProof = $scope.filesimage[0]; + //alert(idProof) + + formData.append("data", JSON.stringify(p)); + formData.append("updatedBy", localDetails.localUserID); + formData.append("branchCode", localDetails.localBranchID); + formData.append('idProof', idProof); + + $http.post(apiPoint.url + 'updateUniversityDetail/', formData, { + transformRequest: angular.identity, + headers: { 'Content-Type': undefined, 'Process-Data': false }, + }).success(function (data) { + + if (data.updateUniversityStatus == true) { + swal("Success!", data.message, "success"); + $state.go($state.current, {}, { reload: true }); + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", data.message, "error"); + } + }); + } + } + } + + // add university + $scope.universityForm = { + submit: function (form, myModel) { + 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.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0; + + var idProof = $scope.filesimage[0]; + var formData = new FormData(); + //var idProof = $scope.filesimage[0]; + + //alert(idProof); + // var req = { + // method: 'POST', + // url: apiPoint.url + 'insertUniversity/', + // headers: { + // 'Content-Type': 'application/json' + // }, + // data: { + // data: $scope.myModel, + // branchCode: localDetails.localBranchID, + // createdBy: localDetails.localUserID, + // } + // }; + formData.append("data", JSON.stringify($scope.myModel)); + formData.append("branchCode", localDetails.localBranchID); + formData.append("createdBy", localDetails.localUserID); + formData.append('idProof', idProof); + + + $http.post(apiPoint.url + 'insertUniversityfile/', formData, { + transformRequest: angular.identity, + headers: { 'Content-Type': undefined, 'Process-Data': false }, + }).success(function (data) { + if (data.addUniv == true) { + // swal("Success!", data.message, "success"); + // $state.go($state.current, {}, { reload: true }); + swal("Success!", data.message, "success"); + $state.go($state.current, {}, { reload: true }); + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", data.message, "error"); + } + }); + + + + + // $http(req).then(function (response) { + // if (response.data.addUniv == true) { + // swal("", "University details added successfully.", "success"); + // $state.go($state.current, {}, { reload: true }); + // } + // else if(response.data.addUniv == false){ + // swal("","This University Id is already exist!", "error"); + + // } + // else { + // // $scope.ldloading1[loading.replace('-', '_')] = false; + // swal("","Something went wrong, please try again.", "error"); + // } + // }); + } + }, + reset: function (form) { + + // $scope.myModel = angular.copy($scope.master); + form.$setPristine(true); + $scope.myModel = { + 'UniversityID': '', + 'UniversityName': '', + 'UniversityShortName': '', + 'MobileNumber': '', + 'EmailID': '', + 'Address': '', + }; + } + } + +}]); + + + +// file upload directive +app.directive('fileUpload', function () { + return { + scope: true, //create a new scope + link: function (scope, el, attrs) { + el.bind('change', function (event) { + var files = event.target.files; + //iterate files since 'multiple' may be specified on the element + for (var i = 0; i < files.length; i++) { + //emit event upward + scope.$emit("fileSelected", { file: files[i] }); + } + }); + } + }; +}); diff --git a/Apollo/assets/views/branchDetails.html b/Apollo/assets/views/branchDetails.html index ec0fa475..51790219 100755 --- a/Apollo/assets/views/branchDetails.html +++ b/Apollo/assets/views/branchDetails.html @@ -95,8 +95,7 @@ Status - - + Action diff --git a/Apollo/assets/views/certificate/certificate.html b/Apollo/assets/views/certificate/certificate.html index 37e55789..29766c2a 100755 --- a/Apollo/assets/views/certificate/certificate.html +++ b/Apollo/assets/views/certificate/certificate.html @@ -67,7 +67,7 @@ -->
- @@ -87,15 +87,13 @@
-
+
-
+
+
+
- -
-
- -
+
-
@@ -68,7 +68,7 @@ Status - + Action diff --git a/Apollo/images/university/Dri_4RrL5J6loCa0.jpeg b/Apollo/images/university/Dri_4RrL5J6loCa0.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_4RrL5J6loCa0.jpeg differ diff --git a/Apollo/images/university/Dri_52lVFNuxP0ej.jpeg b/Apollo/images/university/Dri_52lVFNuxP0ej.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_52lVFNuxP0ej.jpeg differ diff --git a/Apollo/images/university/Dri_9EKICn5ra3QW.jpeg b/Apollo/images/university/Dri_9EKICn5ra3QW.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_9EKICn5ra3QW.jpeg differ diff --git a/Apollo/images/university/Dri_DKyJlY6UAkqp.jpeg b/Apollo/images/university/Dri_DKyJlY6UAkqp.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_DKyJlY6UAkqp.jpeg differ diff --git a/Apollo/images/university/Dri_DVenzmR0Bu39.jpeg b/Apollo/images/university/Dri_DVenzmR0Bu39.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_DVenzmR0Bu39.jpeg differ diff --git a/Apollo/images/university/Dri_Fj7Z3spXUlY1.jpeg b/Apollo/images/university/Dri_Fj7Z3spXUlY1.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_Fj7Z3spXUlY1.jpeg differ diff --git a/Apollo/images/university/Dri_GOJ5UlXys1MR.jpeg b/Apollo/images/university/Dri_GOJ5UlXys1MR.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_GOJ5UlXys1MR.jpeg differ diff --git a/Apollo/images/university/Dri_IQ5n3uW7EXPb.jpeg b/Apollo/images/university/Dri_IQ5n3uW7EXPb.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_IQ5n3uW7EXPb.jpeg differ diff --git a/Apollo/images/university/Dri_TE1jqOPDa3bc.jpeg b/Apollo/images/university/Dri_TE1jqOPDa3bc.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_TE1jqOPDa3bc.jpeg differ diff --git a/Apollo/images/university/Dri_VvBHCXrgP2ui.jpeg b/Apollo/images/university/Dri_VvBHCXrgP2ui.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_VvBHCXrgP2ui.jpeg differ diff --git a/Apollo/images/university/Dri_WrsjdxESP8Jl.jpeg b/Apollo/images/university/Dri_WrsjdxESP8Jl.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_WrsjdxESP8Jl.jpeg differ diff --git a/Apollo/images/university/Dri_bqG7hiQU3ntx.jpeg b/Apollo/images/university/Dri_bqG7hiQU3ntx.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_bqG7hiQU3ntx.jpeg differ diff --git a/Apollo/images/university/Dri_eWixpUOwF7hE.jpeg b/Apollo/images/university/Dri_eWixpUOwF7hE.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_eWixpUOwF7hE.jpeg differ diff --git a/Apollo/images/university/Dri_gjPxOA7Y8Rs0.jpeg b/Apollo/images/university/Dri_gjPxOA7Y8Rs0.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_gjPxOA7Y8Rs0.jpeg differ diff --git a/Apollo/images/university/Dri_hOVMvRE3Y2ay.jpeg b/Apollo/images/university/Dri_hOVMvRE3Y2ay.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_hOVMvRE3Y2ay.jpeg differ diff --git a/Apollo/images/university/Dri_kOKnqvAupcBP.jpeg b/Apollo/images/university/Dri_kOKnqvAupcBP.jpeg new file mode 100644 index 00000000..600b2565 Binary files /dev/null and b/Apollo/images/university/Dri_kOKnqvAupcBP.jpeg differ diff --git a/Apollo/images/university/Dri_uGIvpDTUaV7b.jpeg b/Apollo/images/university/Dri_uGIvpDTUaV7b.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_uGIvpDTUaV7b.jpeg differ diff --git a/Apollo/images/university/Dri_z8BCkrhf2KGX.jpeg b/Apollo/images/university/Dri_z8BCkrhf2KGX.jpeg new file mode 100644 index 00000000..33908da5 Binary files /dev/null and b/Apollo/images/university/Dri_z8BCkrhf2KGX.jpeg differ