[DX Atlas Gridsquare Export] Added station location select.

pull/1150/head
Andreas 2021-09-05 10:43:36 +02:00
rodzic 9c236a935c
commit 54c4943798
3 zmienionych plików z 43 dodań i 35 usunięć

Wyświetl plik

@ -2,15 +2,17 @@
class Dxatlas extends CI_Controller {
public function index()
{
public function index() {
$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'); }
$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['modes'] = $this->modes->active(); // Used in the view for mode 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');
// Parameters
$band = $this->input->post('band');
$mode = $this->input->post('mode');
$dxcc = $this->input->post('dxcc_id');
$cqz = $this->input->post('cqz');
$propagation = $this->input->post('prop_mode');
$fromdate = $this->input->post('fromdate');
$todate = $this->input->post('todate');
$station_id = $this->security->xss_clean($this->input->post('station_profile'));
$band = $this->security->xss_clean($this->input->post('band'));
$mode = $this->security->xss_clean($this->input->post('mode'));
$dxcc = $this->security->xss_clean($this->input->post('dxcc_id'));
$cqz = $this->security->xss_clean($this->input->post('cqz'));
$propagation = $this->security->xss_clean($this->input->post('prop_mode'));
$fromdate = $this->security->xss_clean($this->input->post('fromdate'));
$todate = $this->security->xss_clean($this->input->post('todate'));
// 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);
}

Wyświetl plik

@ -12,8 +12,8 @@ class Dxatlas_model extends CI_Model
/*
* Fetches worked and confirmed gridsquare from the logbook
*/
function get_gridsquares($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
$gridArray = $this->fetchGrids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
function get_gridsquares($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
$gridArray = $this->fetchGrids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
if (isset($gridArray)) {
return $gridArray;
@ -25,17 +25,17 @@ class Dxatlas_model extends CI_Model
/*
* 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
$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();
foreach ($col_gridsquare_worked as $workedgrid) {
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) {
$grids = explode(",", $gridSplit['col_vucc_grids']);
@ -49,7 +49,7 @@ class Dxatlas_model extends CI_Model
}
// 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();
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) {
$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
*
*/
function get_grids($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, $confirmationMethod, $column) {
$station_id = $this->get_station_id();
function get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, $confirmationMethod, $column) {
$sql = "";
if ($column == 'single') {
$sql .= "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare
from " . $this->config->item('table_name') .
" where station_id =" . $station_id .
" and col_gridsquare <> ''";
" where col_gridsquare <> ''";
}
else if ($column == 'multi') {
$sql .= "select col_vucc_grids
from " . $this->config->item('table_name') .
" where station_id =" . $station_id .
" and col_vucc_grids <> '' ";
" where col_vucc_grids <> '' ";
}
if ($station_id != "All") {
$sql .= ' and station_id = ' . $station_id;
}
if ($confirmationMethod == 'both') {
@ -168,11 +168,5 @@ class Dxatlas_model extends CI_Model
return $query->result_array();
}
function get_station_id() {
$CI =& get_instance();
$CI->load->model('Stations');
return $CI->Stations->find_active();
}
}
?>

Wyświetl plik

@ -14,6 +14,18 @@
<div class="card-body">
<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-group col-md-3">
<label for="band">Band</label>