Merge pull request #927 from AndreasK79/adif_choose_station_profile

[Adif Export] Added possibility to choose station profile when export…
pull/928/head
Peter Goodhall 2021-03-09 11:58:40 +00:00 zatwierdzone przez GitHub
commit 22b1accdd8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 47 dodań i 39 usunięć

Wyświetl plik

@ -81,14 +81,16 @@ class adif extends CI_Controller {
$this->load->model('adif_data');
$station_id = $this->security->xss_clean($this->input->post('station_profile'));
// Used for exporting QSOs not previously exported to LoTW
if ($this->input->post('exportLotw') == 1) {
$exportLotw = true;
} else {
$exportLotw = false;
}
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $exportLotw);
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id, $exportLotw);
$this->load->view('adif/data/exportall', $data);
@ -106,9 +108,10 @@ class adif extends CI_Controller {
// Set memory limit to unlimited to allow heavy usage
ini_set('memory_limit', '-1');
$station_id = $this->security->xss_clean($this->input->post('station_profile'));
$this->load->model('adif_data');
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'));
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id);
foreach ($data['qsos']->result() as $qso)
{
@ -122,9 +125,11 @@ class adif extends CI_Controller {
// Set memory limit to unlimited to allow heavy usage
ini_set('memory_limit', '-1');
$station_id = $this->security->xss_clean($this->input->post('station_profile'));
$this->load->model('adif_data');
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'));
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $station_id);
$this->load->model('logbook_model');
@ -225,7 +230,7 @@ class adif extends CI_Controller {
};
$data['adif_errors'] = $custom_errors;
$data['adif_errors'] = $custom_errors;
unlink('./uploads/'.$data['upload_data']['file_name']);

Wyświetl plik

@ -67,14 +67,11 @@ class adif_data extends CI_Model {
return $this->db->get();
}
function export_custom($from, $to, $exportLotw = false) {
$this->load->model('stations');
$active_station_id = $this->stations->find_active();
function export_custom($from, $to, $station_id, $exportLotw = false) {
$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').'.station_id', $station_id);
// If date is set, we format the date and add it to the where-statement
if ($from != 0) {
@ -97,12 +94,12 @@ class adif_data extends CI_Model {
return $this->db->get();
}
function export_lotw() {
$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);
@ -114,15 +111,15 @@ class adif_data extends CI_Model {
return $this->db->get();
}
function mark_lotw_sent($id) {
$data = array(
'COL_LOTW_QSL_SENT' => 'Y'
);
$this->db->set('COL_LOTW_QSLSDATE', 'now()', FALSE);
$this->db->where('COL_PRIMARY_KEY', $id);
$this->db->update($this->config->item('table_name'), $data);
$this->db->update($this->config->item('table_name'), $data);
}
}

Wyświetl plik

@ -82,20 +82,21 @@
</div>
</div>
<button type="submit" class="btn btn-primary mb-2" value="Upload">Upload</button>
<button type="submit" class="btn-sm btn-primary mb-2" value="Upload">Upload</button>
</form>
</div>
<div class="tab-pane fade" id="export" role="tabpanel" aria-labelledby="home-tab">
<div class="alert alert-warning" role="alert">
Exporting QSOs from the active station profile <span class="badge badge-danger"><?php echo $active_station_info->station_profile_name;?></span> with the station callsign <span class="badge badge-danger"><?php echo $active_station_info->station_callsign;?></span>
</div>
<form class="form" action="<?php echo site_url('adif/export_custom'); ?>" method="post" enctype="multipart/form-data">
<form class="form" action="<?php echo site_url('adif/export_custom'); ?>" method="post" enctype="multipart/form-data">
<h5 class="card-title">Take your logbook file anywhere!</h5>
<p class="card-text">Exporting ADIFs allows you to import contacts into third party applications like LoTW, Awards or just for keeping a backup.</p>
<select name="station_profile" class="custom-select mb-2 mr-sm-2" style="width: 20%;">
<option value="0">Select Station Profile</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>
<p class="card-text">From date:</p>
<div class="row">
<div class="input-group date col-md-3" id="datetimepicker1" data-target-input="nearest">
@ -133,26 +134,27 @@
</div>
</div>
<button type="submit" class="btn btn-primary" value="Export">Export QSOs</button>
</form>
<button type="submit" class="btn-sm btn-primary" value="Export">Export QSOs</button>
</form>
<br><br>
<h5>Export Satellite-Only QSOs</h5>
<p><a href="<?php echo site_url('adif/exportsat'); ?>" title="Export All Satellite Contacts" target="_blank" class="btn btn-primary">Export All Satellite QSOs</a></p>
<p><a href="<?php echo site_url('adif/exportsat'); ?>" title="Export All Satellite Contacts" target="_blank" class="btn-sm btn-primary">Export All Satellite QSOs</a></p>
<p><a href="<?php echo site_url('adif/exportsatlotw'); ?>" title="Export All Satellite QSOS Confirmed on LoTW" target="_blank" class="btn btn-primary">Export All Satellite QSOs Confirmed on LoTW</a></p>
<p><a href="<?php echo site_url('adif/exportsatlotw'); ?>" title="Export All Satellite QSOS Confirmed on LoTW" target="_blank" class="btn-sm btn-primary">Export All Satellite QSOs Confirmed on LoTW</a></p>
</div>
<div class="tab-pane fade" id="lotw" role="tabpanel" aria-labelledby="home-tab">
<div class="alert alert-warning" role="alert">
Marking QSOs in the active station profile <span class="badge badge-danger"><?php echo $active_station_info->station_profile_name;?></span> with the station callsign <span class="badge badge-danger"><?php echo $active_station_info->station_callsign;?></span>
</div>
<p><span class="badge badge-warning">Warning</span> If a date range is not selected then all QSOs will be marked!</p>
<form class="form" action="<?php echo site_url('adif/mark_lotw'); ?>" method="post" enctype="multipart/form-data">
<select name="station_profile" class="custom-select mb-2 mr-sm-2" style="width: 20%;">
<option value="0">Select Station Profile</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>
<p><span class="badge badge-warning">Warning</span> If a date range is not selected then all QSOs will be marked!</p>
<p class="card-text">From date:</p>
<div class="row">
<div class="input-group date col-md-3" id="datetimepicker3" data-target-input="nearest">
@ -172,17 +174,21 @@
</div>
</div>
<br>
<button type="submit" class="btn btn-primary" value="Export">Mark QSOs as exported to LoTW</button>
<button type="submit" class="btn-sm btn-primary" value="Export">Mark QSOs as exported to LoTW</button>
</form>
</div>
<div class="tab-pane fade" id="qrz" role="tabpanel" aria-labelledby="home-tab">
<div class="alert alert-warning" role="alert">
Marking QSOs in the active station profile <span class="badge badge-danger"><?php echo $active_station_info->station_profile_name;?></span> with the station callsign <span class="badge badge-danger"><?php echo $active_station_info->station_callsign;?></span>
</div>
<p><span class="badge badge-warning">Warning</span> If a date range is not selected then all QSOs will be marked!</p>
<form class="form" action="<?php echo site_url('adif/mark_qrz'); ?>" method="post" enctype="multipart/form-data">
<select name="station_profile" class="custom-select mb-2 mr-sm-2" style="width: 20%;">
<option value="0">Select Station Profile</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>
<p><span class="badge badge-warning">Warning</span> If a date range is not selected then all QSOs will be marked!</p>
<p class="card-text">From date:</p>
<div class="row">
<div class="input-group date col-md-3" id="datetimepicker5" data-target-input="nearest">
@ -202,9 +208,9 @@
</div>
</div>
<br>
<button type="submit" class="btn btn-primary" value="Export">Mark QSOs as exported to QRZ Logbook</button>
<button type="submit" class="btn-sm btn-primary" value="Export">Mark QSOs as exported to QRZ Logbook</button>
</form>
</div>
</div>
</div>
</div>
</div>