[Awards][Sigs] Creation of the Sig area within the Awards dropdown with data grids and ADIF export

Creation of the Sig area within the Awards dropdown that shows each unique SIG option in the database and the ability to see the references along with exporting them as ADIF.
这个提交包含在:
Peter Goodhall 2021-03-20 15:38:34 +00:00 提交者 GitHub
当前提交 023766063e
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 6 个文件被更改,包括 191 次插入16 次删除

查看文件

@ -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/exportall', $data);
}
}

查看文件

@ -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();
}
}
?>

40
application/models/Sig.php 普通文件
查看文件

@ -0,0 +1,40 @@
<?php
class Sig extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_all($type) {
$CI =& get_instance();
$CI->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();
}
}
?>

查看文件

@ -0,0 +1,35 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<?php if ($sig_types) { ?>
<table style="width:100%" class="table-sm table tabledxcc table-bordered table-hover table-striped table-condensed text-center">
<tr>
<td>Award Type</td>
<td># QSOs</td>
<td># Refs</td>
</tr>
<?php
foreach ($sig_types as $row) {
?>
<tr>
<td>
<?php echo $row->col_sig; ?>
</td>
<td>
<a href='sig_details?type="<?php echo $row->col_sig; ?>"'><?php echo $row->qsos; ?></a>
</td>
<td>
<a href='sig_details?type="<?php echo $row->col_sig; ?>"'><?php echo $row->refs; ?></a>
</td>
</tr>
<?php } ?>
</table>
<?php }
else {
echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>Nothing found!</div>';
}
?>
</div>

查看文件

@ -0,0 +1,32 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<?php if ($sig_all) { ?>
<table class="table table-sm table-striped table-hover">
<tr>
<td>Reference</td>
<td>Date/Time</td>
<td>Callsign</td>
<td>Band</td>
<td>RST Sent</td>
<td>RST Received</td>
</tr>
<?php foreach ($sig_all->result() as $row) { ?>
<tr>
<td>
<?php echo $row->COL_SIG_INFO; ?>
</td>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?> - <?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
<td><?php echo $row->COL_CALL; ?></td>
<td><?php echo $row->COL_BAND; ?></td>
<td><?php echo $row->COL_RST_SENT; ?></td>
<td><?php echo $row->COL_RST_RCVD; ?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<p><a href="<?php echo site_url('/awards/sigexportadif/' . $type); ?>" title="Export QSOs to ADIF" target="_blank" class="btn btn-primary">Export QSOs to ADIF</a></p>
</div>

查看文件

@ -106,7 +106,9 @@
<a class="dropdown-item" href="<?php echo site_url('awards/dxcc');?>">DXCC</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/iota');?>">IOTA</a>
<div class="dropdown-divider"></div>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/sig');?>">SIG</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/sota');?>">SOTA</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/counties');?>">US Counties</a>