From ebc4ac0c4bd8a18a0b4a9b0c41930039d8412d64 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Sat, 20 Mar 2021 11:24:13 +0100
Subject: [PATCH 1/2] [Award] SIG added to awards. Based on the work by
@daccle.
---
application/controllers/Awards.php | 80 +++++++++++++++----
application/models/Adif_data.php | 16 ++++
application/models/Sig.php | 40 ++++++++++
application/views/awards/sig/index.php | 35 ++++++++
application/views/awards/sig/qso_list.php | 32 ++++++++
application/views/interface_assets/header.php | 4 +-
6 files changed, 191 insertions(+), 16 deletions(-)
create mode 100644 application/models/Sig.php
create mode 100644 application/views/awards/sig/index.php
create mode 100644 application/views/awards/sig/qso_list.php
diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php
index 529e667c..90835ead 100644
--- a/application/controllers/Awards.php
+++ b/application/controllers/Awards.php
@@ -2,12 +2,12 @@
/*
Handles Displaying of information for awards.
-
- These are taken from comments fields or ADIF fields
+
+ These are taken from comments fields or ADIF fields
*/
class Awards extends CI_Controller {
-
+
function __construct()
{
parent::__construct();
@@ -24,7 +24,7 @@ class Awards extends CI_Controller {
$this->load->view('awards/index');
$this->load->view('interface_assets/footer');
}
-
+
public function dok ()
{
//echo "Needs Developed";
@@ -39,7 +39,7 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
-
+
public function dok_details_ajax(){
$a = $this->input->post();
$q = "";
@@ -72,7 +72,7 @@ class Awards extends CI_Controller {
$data['filter'] = str_replace("(and)", ", ", $q);//implode(", ", array_keys($a));
$this->load->view('awards/details', $data);
}
-
+
public function dxcc () {
$this->load->model('dxcc');
$this->load->model('modes');
@@ -200,52 +200,52 @@ class Awards extends CI_Controller {
Comment field - WAB:#
*/
public function wab() {
-
+
// Grab all worked WABs
$this->load->model('wab');
$data['wab_all'] = $this->wab->get_all();
-
+
// Render Page
$data['page_title'] = "Awards - WAB";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/wab/index');
$this->load->view('interface_assets/footer');
}
-
+
/*
Handles showing worked SOTAs
Comment field - SOTA:#
*/
public function sota() {
-
+
// Grab all worked sota stations
$this->load->model('sota');
$data['sota_all'] = $this->sota->get_all();
-
+
// Render page
$data['page_title'] = "Awards - SOTA";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/sota/index');
$this->load->view('interface_assets/footer');
}
-
+
/*
Handles showing worked WACRAL members (wacral.org)
Comment field - WACRAL:#
*/
public function wacral() {
-
+
// Grab all worked wacral members
$this->load->model('wacral');
$data['wacral_all'] = $this->wacral->get_all();
-
+
// Render page
$data['page_title'] = "Awards - WACRAL Members";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/wacral/index');
$this->load->view('interface_assets/footer');
}
-
+
public function cq(){
$this->load->model('cq');
$zones = array();
@@ -477,4 +477,54 @@ class Awards extends CI_Controller {
$data['filter'] = "county " . $state;
$this->load->view('awards/details', $data);
}
+
+ /*
+ Handles showing worked Sigs
+ Adif fields: my_sig
+ */
+ public function sig() {
+ // Grab all worked sig stations
+ $this->load->model('sig');
+
+ $data['sig_types'] = $this->sig->get_all_sig_types();
+
+ // Render page
+ $data['page_title'] = "Awards - SIG";
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('awards/sig/index');
+ $this->load->view('interface_assets/footer');
+ }
+
+ /*
+ Handles showing worked Sigs
+ */
+ public function sig_details() {
+
+ // Grab all worked sig stations
+ $this->load->model('sig');
+ $type = str_replace('"', "", $this->input->get("type"));
+ $data['sig_all'] = $this->sig->get_all($type);
+ $data['type'] = $type;
+
+ // Render page
+ $data['page_title'] = "Awards - SIG - " . $type;
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('awards/sig/qso_list');
+ $this->load->view('interface_assets/footer');
+ }
+
+ /*
+ Handles exporting SIGS to ADIF
+ */
+ public function sigexportadif() {
+ // Set memory limit to unlimited to allow heavy usage
+ ini_set('memory_limit', '-1');
+
+ $this->load->model('adif_data');
+ //$type = str_replace('"', "", $this->input->get("type"));
+ $type = $this->uri->segment(3);
+ $data['qsos'] = $this->adif_data->sig_all($type);
+
+ $this->load->view('adif/data/exportsat', $data);
+ }
}
diff --git a/application/models/Adif_data.php b/application/models/Adif_data.php
index da774e72..9d765c09 100644
--- a/application/models/Adif_data.php
+++ b/application/models/Adif_data.php
@@ -121,6 +121,22 @@ class adif_data extends CI_Model {
$this->db->where('COL_PRIMARY_KEY', $id);
$this->db->update($this->config->item('table_name'), $data);
}
+
+ function sig_all($type) {
+ $this->load->model('stations');
+ $active_station_id = $this->stations->find_active();
+
+ $this->db->select(''.$this->config->item('table_name').'.*, station_profile.*');
+ $this->db->from($this->config->item('table_name'));
+ $this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
+ $this->db->where($this->config->item('table_name').'.COL_SIG', $type);
+
+ $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
+
+ $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
+
+ return $this->db->get();
+ }
}
?>
diff --git a/application/models/Sig.php b/application/models/Sig.php
new file mode 100644
index 00000000..50fc7c7b
--- /dev/null
+++ b/application/models/Sig.php
@@ -0,0 +1,40 @@
+load->model('Stations');
+ $station_id = $CI->Stations->find_active();
+
+ $this->db->where("station_id", $station_id);
+ $this->db->order_by("COL_SIG_INFO", "ASC");
+ $this->db->where('COL_SIG =', $type);
+
+ return $this->db->get($this->config->item('table_name'));
+ }
+
+ function get_all_sig_types() {
+ $CI =& get_instance();
+ $CI->load->model('Stations');
+ $station_id = $CI->Stations->find_active();
+
+ $sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') .
+ " where col_sig <> ''" .
+ " and station_id = " . $station_id .
+ " group by col_sig";
+
+ $query = $this->db->query($sql);
+
+ return $query->result();
+ }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/application/views/awards/sig/index.php b/application/views/awards/sig/index.php
new file mode 100644
index 00000000..dbc97518
--- /dev/null
+++ b/application/views/awards/sig/index.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+ Award Type |
+ # QSOs |
+ # Refs |
+
+
+
+
+
+
+ col_sig; ?>
+ |
+
+ qsos; ?>
+ |
+
+ refs; ?>
+ |
+
+
+
+
×Nothing found!
';
+}
+?>
+
\ No newline at end of file
diff --git a/application/views/awards/sig/qso_list.php b/application/views/awards/sig/qso_list.php
new file mode 100644
index 00000000..aeae61e7
--- /dev/null
+++ b/application/views/awards/sig/qso_list.php
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+ Reference |
+ Date/Time |
+ Callsign |
+ Band |
+ RST Sent |
+ RST Received |
+
+ result() as $row) { ?>
+
+
+ COL_SIG_INFO; ?>
+ |
+ COL_TIME_ON); echo date('d/m/y', $timestamp); ?> - COL_TIME_ON); echo date('H:i', $timestamp); ?> |
+ COL_CALL; ?> |
+ COL_BAND; ?> |
+ COL_RST_SENT; ?> |
+ COL_RST_RCVD; ?> |
+
+
+
+
+
+
Export QSOs to ADIF
+
\ No newline at end of file
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php
index 1dd21117..9f6d8de9 100644
--- a/application/views/interface_assets/header.php
+++ b/application/views/interface_assets/header.php
@@ -106,7 +106,9 @@
DXCC
IOTA
-
+
+ SIG
+
SOTA
US Counties
From 94980ec285613bbb9319ad9b68e76353125b3904 Mon Sep 17 00:00:00 2001
From: Andreas <6977712+AndreasK79@users.noreply.github.com>
Date: Sat, 20 Mar 2021 11:43:32 +0100
Subject: [PATCH 2/2] [Award] Changed to correct view when exporting (not that
it does matter, they are equal).
---
application/controllers/Awards.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php
index 90835ead..224539b0 100644
--- a/application/controllers/Awards.php
+++ b/application/controllers/Awards.php
@@ -525,6 +525,6 @@ class Awards extends CI_Controller {
$type = $this->uri->segment(3);
$data['qsos'] = $this->adif_data->sig_all($type);
- $this->load->view('adif/data/exportsat', $data);
+ $this->load->view('adif/data/exportall', $data);
}
}