diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php
index fa7a69e6..f9004658 100644
--- a/application/controllers/Eqsl.php
+++ b/application/controllers/Eqsl.php
@@ -552,6 +552,48 @@ class eqsl extends CI_Controller {
$this->load->view('interface_assets/footer');
}
+ public function download() {
+ // Check logged in
+ $this->load->model('user_model');
+ 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";
+ $this->load->model('eqslmethods_model');
+
+ $rows = '';
+ $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);
+
+ $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');
+ }
+
public function mark_all_sent() {
// Check logged in
$this->load->model('user_model');
diff --git a/application/models/Eqslmethods_model.php b/application/models/Eqslmethods_model.php
index eb7546f5..d676bcc0 100644
--- a/application/models/Eqslmethods_model.php
+++ b/application/models/Eqslmethods_model.php
@@ -49,7 +49,7 @@ class Eqslmethods_model extends CI_Model {
array_push($logbooks_locations_array, $row->station_id);
}
}
-
+
$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');
$this->db->from('station_profile');
$this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
@@ -63,7 +63,38 @@ class Eqslmethods_model extends CI_Model {
$this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'N');
$this->db->group_end();
$this->db->where_in('station_profile.station_id', $logbooks_locations_array);
-
+
+ return $this->db->get();
+ }
+
+ // Show all QSOs whose eQSL card images we did not download yet
+ function eqsl_not_yet_downloaded($userid = null) {
+ $CI =& get_instance();
+ if ($userid == null) {
+ $CI->load->model('logbooks_model');
+ $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+ } else {
+ $stations = $this->get_all_user_locations($userid);
+ $logbooks_locations_array = array();
+ foreach ($stations->result() as $row) {
+ array_push($logbooks_locations_array, $row->station_id);
+ }
+ }
+
+ $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');
+ $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->where("coalesce(station_profile.eqslqthnickname, '') <> ''");
+ $this->db->where($this->config->item('table_name').'.COL_CALL !=', '');
+ $this->db->group_start();
+ $this->db->where($this->config->item('table_name').'.COL_EQSL_QSL_SENT is null');
+ $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', '');
+ $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'R');
+ $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'Q');
+ $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'N');
+ $this->db->group_end();
+ $this->db->where_in('station_profile.station_id', $logbooks_locations_array);
+
return $this->db->get();
}
@@ -165,4 +196,4 @@ class Eqslmethods_model extends CI_Model {
}
-?>
\ No newline at end of file
+?>
diff --git a/application/views/eqsl/analysis.php b/application/views/eqsl/analysis.php
index c2230d3e..ab3246e4 100644
--- a/application/views/eqsl/analysis.php
+++ b/application/views/eqsl/analysis.php
@@ -16,6 +16,9 @@ $custom_date_format = $this->session->userdata('user_date_format');
diff --git a/application/views/eqsl/tools.php b/application/views/eqsl/tools.php
index fa6e0948..d099525c 100644
--- a/application/views/eqsl/tools.php
+++ b/application/views/eqsl/tools.php
@@ -15,6 +15,10 @@
Tools
+
+
+ Download eQSL Images
+