From 322085d2f62824d05b3fb9c13b86aa5a45a1796b Mon Sep 17 00:00:00 2001 From: phl0 Date: Thu, 11 May 2023 15:25:35 +0200 Subject: [PATCH] Refactor table and add View/Download button --- application/controllers/Eqsl.php | 32 +------------- application/models/Eqslmethods_model.php | 7 +--- application/views/eqsl/download.php | 53 +++++++++++++++--------- 3 files changed, 37 insertions(+), 55 deletions(-) diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 3e2dd369..5f9715cb 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -558,39 +558,11 @@ class eqsl extends CI_Controller { if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } $data['page_title'] = "eQSL Card Image Download"; - $custom_date_format = $this->session->userdata('user_date_format'); $this->load->model('eqslmethods_model'); - $rows = ''; - $qslsnotdownloaded = $this->eqslmethods_model->eqsl_not_yet_downloaded(); + $data['custom_date_format'] = $this->session->userdata('user_date_format'); + $data['qslsnotdownloaded'] = $this->eqslmethods_model->eqsl_not_yet_downloaded(); - foreach ($qslsnotdownloaded->result_array() as $qsl) { - $rows .= ""; - // eQSL username changes for linked account. - // i.e. when operating /P it must be callsign/p - // the password, however, is always the same as the main account - $data['user_eqsl_name'] = $qsl['station_callsign']; - //$adif = $this->generateAdif($qsl, $data); - - //$status = $this->uploadQso($adif, $qsl); - $status = "none"; - - $timestamp = strtotime($qsl['COL_TIME_ON']); - $rows .= "".date($custom_date_format, $timestamp).""; - $rows .= "".date('H:i', $timestamp).""; - $rows .= "".str_replace("0","Ø",$qsl['COL_CALL']).""; - $rows .= "".$qsl['COL_MODE'].""; - if(isset($qsl['COL_SUBMODE'])) { - $rows .= "".$qsl['COL_SUBMODE'].""; - } else { - $rows .= ""; - } - $rows .= "".$qsl['COL_BAND'].""; - $rows .= "".$status.""; - } - $rows .= ""; - $data['eqsl_table'] = $this->generateResultTable($custom_date_format, $rows); - // Load frontend $this->load->view('interface_assets/header', $data); $this->load->view('eqsl/download'); $this->load->view('interface_assets/footer'); diff --git a/application/models/Eqslmethods_model.php b/application/models/Eqslmethods_model.php index 49f49dee..ff83f5bd 100644 --- a/application/models/Eqslmethods_model.php +++ b/application/models/Eqslmethods_model.php @@ -81,7 +81,7 @@ class Eqslmethods_model extends CI_Model { } } - $this->db->select('station_profile.*, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_COMMENT, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_PROP_MODE, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_SAT_MODE, '.$this->config->item('table_name').'.COL_QSLMSG, eQSL_images.*'); + $this->db->select('station_profile.station_id, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_PROP_MODE, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_SAT_MODE, '.$this->config->item('table_name').'.COL_QSLMSG, eQSL_images.qso_id'); $this->db->from('station_profile'); $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); $this->db->join('eQSL_images','eQSL_images.qso_id = '.$this->config->item('table_name').'.COL_PRIMARY_KEY','left outer'); @@ -91,10 +91,7 @@ class Eqslmethods_model extends CI_Model { $this->db->where('qso_id', NULL); $this->db->where_in('station_profile.station_id', $logbooks_locations_array); - $result = $this->db->get(); - log_message('info','SQL: '.$this->db->last_query()); - return $result; - //return $this->db->get(); + return $this->db->get(); } // Mark the QSO as sent to eQSL diff --git a/application/views/eqsl/download.php b/application/views/eqsl/download.php index c8dd5dd4..6da35457 100644 --- a/application/views/eqsl/download.php +++ b/application/views/eqsl/download.php @@ -24,31 +24,44 @@ load->view('layout/messages'); ?> result())) { ?>

Below is a table of QSOs that have been confirmed on eQSL but QSL images have not been downloaded yet.

- - Clicking \"Upload QSOs\" will send QSO information to eQSL.cc.

"; - echo form_open('eqsl/export'); - echo ""; - echo ""; + + + + + + + + + + +result_array() as $qsl) { + echo ""; + $timestamp = strtotime($qsl['COL_TIME_ON']); + echo ""; + echo ""; + echo ""; + echo ""; + if(isset($qsl['COL_SUBMODE'])) { + echo ""; + } else { + echo ""; } - else - { - if (isset($eqsl_results_table)) - { - echo "

The following QSOs were sent to eQSL.

"; - echo $eqsl_results_table; - } - else - { - echo "

There are no QSOs whose eQSL card images have not yet been downloaded. Go log some more QSOs!

"; - } + echo ""; + echo ""; +} + echo ""; +?> +
DateTimeCallModeSubmodeBandAction
".date($custom_date_format, $timestamp)."".date('H:i', $timestamp)."".str_replace("0","Ø",$qsl['COL_CALL'])."".$qsl['COL_MODE']."".$qsl['COL_SUBMODE']."".$qsl['COL_BAND']."View/Download
+ +There are no QSOs whose eQSL card images have not yet been downloaded. Go log some more QSOs!

"; } ?>