From f9448bddb216d617167e2ad185ddd70d7c4d5d50 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 22 Aug 2020 22:26:04 +0100 Subject: [PATCH] Started code to read station profiles and find matching certs --- application/controllers/Lotw.php | 43 +++++++++++++++++++ application/models/LotwCert.php | 8 ++++ application/views/interface_assets/header.php | 2 +- application/views/lotw_views/index.php | 4 +- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index ebd7aeb23..d7a096437 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -136,6 +136,49 @@ class Lotw extends CI_Controller { } } + /* + |-------------------------------------------------------------------------- + | Function: lotw_upload + |-------------------------------------------------------------------------- + | + | This function Uploads to LOTW + | + */ + public function lotw_upload() { + // Get Station Profile Data + $this->load->model('Stations'); + + $station_profiles = $this->Stations->all(); + + if ($station_profiles->num_rows() >= 1) { + foreach ($station_profiles->result() as $station_profile) + { + print_r($station_profile); + + // Get Certificate Data + $this->load->model('LotwCert'); + + $lotw_cert_info = $this->LotwCert->lotw_cert_details($station_profile->station_callsign, $this->session->userdata('user_id')); + + print_r($lotw_cert_info); + } + } else { + echo "No Station Profiles"; + } + + // Get Certificate Data + $this->load->model('LotwCert'); + // Set QSOs for Station Profile that havent been uploaded + + // Build ADIF file + + // Save TQ8 + + // Upload TQ8 + + // Destory TQ8 + } + /* |-------------------------------------------------------------------------- | Function: delete_cert diff --git a/application/models/LotwCert.php b/application/models/LotwCert.php index c567121c0..15dfb4784 100644 --- a/application/models/LotwCert.php +++ b/application/models/LotwCert.php @@ -25,6 +25,14 @@ class LotwCert extends CI_Model { return $query; } + function lotw_cert_details($callsign, $user_id) { + $this->db->where('user_id', $user_id); + $this->db->where('callsign', $callsign); + $query = $this->db->get('lotw_certs'); + + return $query->row(); + } + function find_cert($callsign, $user_id) { $this->db->where('user_id', $user_id); $this->db->where('callsign', $callsign); diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index db6366865..beac329fa 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -106,7 +106,7 @@ - LoTW Import + LoTW diff --git a/application/views/lotw_views/index.php b/application/views/lotw_views/index.php index daae6a214..f292f49a7 100644 --- a/application/views/lotw_views/index.php +++ b/application/views/lotw_views/index.php @@ -1,6 +1,6 @@
- -

+
+ LoTW Import