From ffa1e12048d6e0bf8c02cb1b2fc8b3172c6e369e Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sat, 12 Oct 2019 23:10:22 +0100 Subject: [PATCH] started the barebones to add realtime clublog uploading --- application/controllers/Clublog.php | 25 +++++++++++++++++++++++++ application/models/Clublog_model.php | 11 +++++++++++ 2 files changed, 36 insertions(+) diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index 02bf8425..cb7d64f8 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -137,6 +137,31 @@ class Clublog extends CI_Controller { $this->clublog_model->mark_all_qsos_notsent($clean_station_id); } + + function realtime() { + $this->load->model('stations'); + $this->load->model('clublog_model'); + + $station_profiles = $this->stations->all_with_count(); + + // if station profiles exist + if($station_profiles->num_rows()){ + // Loop through station profiles + foreach ($station_profiles->result() as $station_row) + { + // if the station profile has more than 1 qso + if($station_row->qso_total > 0) { + $qsos = $this->clublog_model->get_last_five($station_row->station_id); + + foreach ($qsos->result() as $qso) + { + print_r($qso); + } + } + } + } + } + // Find DXCC function find_dxcc($callsign) { $clean_callsign = $this->security->xss_clean($callsign); diff --git a/application/models/Clublog_model.php b/application/models/Clublog_model.php index a05c7a39..e573590e 100644 --- a/application/models/Clublog_model.php +++ b/application/models/Clublog_model.php @@ -27,6 +27,17 @@ class Clublog_model extends CI_Model { $this->db->update($this->config->item('table_name'), $data); } + function get_last_five($station_id) { + $this->db->where('station_id', $station_id); + $this->db->where("COL_CLUBLOG_QSO_UPLOAD_STATUS", null); + $this->db->or_where("COL_CLUBLOG_QSO_UPLOAD_STATUS", ""); + $this->db->or_where("COL_CLUBLOG_QSO_UPLOAD_STATUS", "N"); + $this->db->limit(5); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + function mark_all_qsos_notsent($station_id) { $data = array( 'COL_CLUBLOG_QSO_UPLOAD_DATE' => null,