[DX Atlas Gridsquare Export] Added station location select.

这个提交包含在:
Andreas 2021-09-05 10:43:36 +02:00
父节点 9c236a935c
当前提交 54c4943798
共有 3 个文件被更改,包括 43 次插入35 次删除

查看文件

@ -2,15 +2,17 @@
class Dxatlas extends CI_Controller { class Dxatlas extends CI_Controller {
public function index() public function index() {
{
$this->load->model('user_model'); $this->load->model('user_model');
$this->load->model('modes');
$this->load->model('dxcc');
$this->load->model('logbook_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$this->load->model('modes');
$this->load->model('dxcc');
$this->load->model('logbook_model');
$this->load->model('stations');
$data['station_profile'] = $this->stations->all(); // Used in the view for station location select
$data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select $data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
$data['modes'] = $this->modes->active(); // Used in the view for mode select $data['modes'] = $this->modes->active(); // Used in the view for mode select
$data['dxcc'] = $this->logbook_model->fetchDxcc(); // Used in the view for dxcc select $data['dxcc'] = $this->logbook_model->fetchDxcc(); // Used in the view for dxcc select
@ -23,21 +25,21 @@ class Dxatlas extends CI_Controller {
} }
public function export() public function export() {
{
$this->load->model('dxatlas_model'); $this->load->model('dxatlas_model');
// Parameters // Parameters
$band = $this->input->post('band'); $station_id = $this->security->xss_clean($this->input->post('station_profile'));
$mode = $this->input->post('mode'); $band = $this->security->xss_clean($this->input->post('band'));
$dxcc = $this->input->post('dxcc_id'); $mode = $this->security->xss_clean($this->input->post('mode'));
$cqz = $this->input->post('cqz'); $dxcc = $this->security->xss_clean($this->input->post('dxcc_id'));
$propagation = $this->input->post('prop_mode'); $cqz = $this->security->xss_clean($this->input->post('cqz'));
$fromdate = $this->input->post('fromdate'); $propagation = $this->security->xss_clean($this->input->post('prop_mode'));
$todate = $this->input->post('todate'); $fromdate = $this->security->xss_clean($this->input->post('fromdate'));
$todate = $this->security->xss_clean($this->input->post('todate'));
// Get QSOs with Valid QRAs // Get QSOs with Valid QRAs
$grids = $this->dxatlas_model->get_gridsquares($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate); $grids = $this->dxatlas_model->get_gridsquares($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
$this->generateFiles($grids['worked'], $grids['confirmed'], $band); $this->generateFiles($grids['worked'], $grids['confirmed'], $band);
} }

查看文件

@ -12,8 +12,8 @@ class Dxatlas_model extends CI_Model
/* /*
* Fetches worked and confirmed gridsquare from the logbook * Fetches worked and confirmed gridsquare from the logbook
*/ */
function get_gridsquares($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) { function get_gridsquares($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
$gridArray = $this->fetchGrids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate); $gridArray = $this->fetchGrids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
if (isset($gridArray)) { if (isset($gridArray)) {
return $gridArray; return $gridArray;
@ -25,17 +25,17 @@ class Dxatlas_model extends CI_Model
/* /*
* Builds the array for worked and confirmed gridsquares * Builds the array for worked and confirmed gridsquares
*/ */
function fetchGrids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) { function fetchGrids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
// Getting all the worked grids // Getting all the worked grids
$col_gridsquare_worked = $this->get_grids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'none', 'single'); $col_gridsquare_worked = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'none', 'single');
$workedGridArray = array(); $workedGridArray = array();
foreach ($col_gridsquare_worked as $workedgrid) { foreach ($col_gridsquare_worked as $workedgrid) {
array_push($workedGridArray, $workedgrid['gridsquare']); array_push($workedGridArray, $workedgrid['gridsquare']);
} }
$col_vucc_grids_worked = $this->get_grids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'none', 'multi'); $col_vucc_grids_worked = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'none', 'multi');
foreach ($col_vucc_grids_worked as $gridSplit) { foreach ($col_vucc_grids_worked as $gridSplit) {
$grids = explode(",", $gridSplit['col_vucc_grids']); $grids = explode(",", $gridSplit['col_vucc_grids']);
@ -49,7 +49,7 @@ class Dxatlas_model extends CI_Model
} }
// Getting all the confirmed grids // Getting all the confirmed grids
$col_gridsquare_confirmed = $this->get_grids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'both', 'single'); $col_gridsquare_confirmed = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'both', 'single');
$confirmedGridArray = array(); $confirmedGridArray = array();
foreach ($col_gridsquare_confirmed as $confirmedgrid) { foreach ($col_gridsquare_confirmed as $confirmedgrid) {
@ -60,7 +60,7 @@ class Dxatlas_model extends CI_Model
} }
} }
$col_vucc_grids_confirmed = $this->get_grids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'both', 'multi'); $col_vucc_grids_confirmed = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'both', 'multi');
foreach ($col_vucc_grids_confirmed as $gridSplit) { foreach ($col_vucc_grids_confirmed as $gridSplit) {
$grids = explode(",", $gridSplit['col_vucc_grids']); $grids = explode(",", $gridSplit['col_vucc_grids']);
@ -99,22 +99,22 @@ class Dxatlas_model extends CI_Model
* $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed * $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed
* *
*/ */
function get_grids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, $confirmationMethod, $column) { function get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, $confirmationMethod, $column) {
$station_id = $this->get_station_id();
$sql = ""; $sql = "";
if ($column == 'single') { if ($column == 'single') {
$sql .= "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare $sql .= "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare
from " . $this->config->item('table_name') . from " . $this->config->item('table_name') .
" where station_id =" . $station_id . " where col_gridsquare <> ''";
" and col_gridsquare <> ''";
} }
else if ($column == 'multi') { else if ($column == 'multi') {
$sql .= "select col_vucc_grids $sql .= "select col_vucc_grids
from " . $this->config->item('table_name') . from " . $this->config->item('table_name') .
" where station_id =" . $station_id . " where col_vucc_grids <> '' ";
" and col_vucc_grids <> '' "; }
if ($station_id != "All") {
$sql .= ' and station_id = ' . $station_id;
} }
if ($confirmationMethod == 'both') { if ($confirmationMethod == 'both') {
@ -168,11 +168,5 @@ class Dxatlas_model extends CI_Model
return $query->result_array(); return $query->result_array();
} }
function get_station_id() {
$CI =& get_instance();
$CI->load->model('Stations');
return $CI->Stations->find_active();
}
} }
?> ?>

查看文件

@ -14,6 +14,18 @@
<div class="card-body"> <div class="card-body">
<form class="form" action="<?php echo site_url('dxatlas/export'); ?>" method="post" enctype="multipart/form-data"> <form class="form" action="<?php echo site_url('dxatlas/export'); ?>" method="post" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group col-md-3">
<label for="station_profile"><?php echo $this->lang->line('cloudlog_station_profile'); ?></label>
<select name="station_profile" class="station_id custom-select">
<option value="All">All</option>
<?php foreach ($station_profile->result() as $station) { ?>
<option value="<?php echo $station->station_id; ?>">Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
<?php } ?>
</select>
</div>
</div>
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="band">Band</label> <label for="band">Band</label>