mirror of
https://github.com/magicbug/Cloudlog
synced 2024-11-22 00:07:14 +00:00
Exporting QSO-Data for printing QSLs
This commit is contained in:
parent
87bc0a66e3
commit
0f81c3f6a8
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@
|
||||
/updates/*.html
|
||||
.idea/*
|
||||
.DS_Store
|
||||
sync.sh
|
||||
|
@ -32,7 +32,7 @@ $config['show_time'] = FALSE;
|
||||
| Default is: M
|
||||
|
|
||||
*/
|
||||
$config['measurement_base'] = 'M';
|
||||
$config['measurement_base'] = 'K';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -59,4 +59,4 @@ $config['map_gridsquares'] = FALSE;
|
||||
|
|
||||
*/
|
||||
|
||||
$config['cat_timeout_interval'] = 300;
|
||||
$config['cat_timeout_interval'] = 300;
|
||||
|
67
application/controllers/Qslprint.php
Normal file
67
application/controllers/Qslprint.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class QSLPrint extends CI_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
$data['page_title'] = "Export requested QSLs for printing";
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('qslprint/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
|
||||
}
|
||||
|
||||
public function exportadif()
|
||||
{
|
||||
// Set memory limit to unlimited to allow heavy usage
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->load->model('adif_data');
|
||||
|
||||
$data['qsos'] = $this->adif_data->export_printrequested();
|
||||
|
||||
$this->load->view('adif/data/exportall', $data);
|
||||
}
|
||||
|
||||
public function exportcsv()
|
||||
{
|
||||
// Set memory limit to unlimited to allow heavy usage
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$data['qsos'] = $this->logbook_model->get_qsos_for_printing();
|
||||
|
||||
$this->load->view('qslprint/data/csv', $data);
|
||||
}
|
||||
|
||||
function qsl_printed() {
|
||||
$this->load->model('qslprint_model');
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
// Update Logbook to Mark Paper Card Received
|
||||
|
||||
$this->qslprint_model->mark_qsos_printed();
|
||||
|
||||
$this->session->set_flashdata('notice', 'QSOs are marked as sent via buro');
|
||||
|
||||
redirect('logbook');
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
@ -16,6 +16,14 @@ class adif_data extends CI_Model {
|
||||
return $query;
|
||||
}
|
||||
|
||||
function export_printrequested() {
|
||||
$this->db->where('COL_QSL_SENT', 'R');
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function sat_all() {
|
||||
$this->db->where('COL_PROP_MODE', 'SAT');
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
|
@ -495,6 +495,11 @@ class Logbook_model extends CI_Model {
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
}
|
||||
|
||||
function get_qsos_for_printing() {
|
||||
$query = $this->db->query('SELECT COL_PRIMARY_KEY, COL_CALL, COL_QSL_VIA, COL_TIME_ON, COL_MODE, COL_FREQ, UPPER(COL_BAND) as COL_BAND, COL_RST_SENT, COL_SAT_NAME, COL_SAT_MODE, COL_QSL_RCVD, (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) AS COL_ROUTING, ADIF, ENTITY FROM '.$this->config->item('table_name').', dxcc_prefixes WHERE COL_QSL_SENT LIKE \'R\' and (CASE WHEN COL_QSL_VIA != \'\' THEN COL_QSL_VIA ELSE COL_CALL END) like CONCAT(dxcc_prefixes.call,\'%\') and (end is null or end > now()) ORDER BY adif, col_routing');
|
||||
//$query = $this->db->query('SELECT * FROM '.$this->config->item('table_name').' WHERE COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function get_qsos($num, $offset) {
|
||||
$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE, COL_QSL_RCVD, COL_EQSL_QSL_RCVD, COL_EQSL_QSL_SENT, COL_QSL_SENT, COL_STX, COL_STX_STRING, COL_SRX, COL_SRX_STRING, COL_OPERATOR, COL_STATION_CALLSIGN, COL_LOTW_QSL_SENT, COL_LOTW_QSL_RCVD, COL_VUCC_GRIDS');
|
||||
|
22
application/models/Qslprint_model.php
Normal file
22
application/models/Qslprint_model.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class Qslprint_model extends CI_Model {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function mark_qsos_printed() {
|
||||
$data = array(
|
||||
'COL_QSLSDATE' => date('Y-m-d'),
|
||||
'COL_QSL_SENT' => "Y",
|
||||
'COL_QSL_SENT_VIA' => "B",
|
||||
);
|
||||
|
||||
$this->db->where("COL_QSL_SENT", "R");
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -83,6 +83,8 @@
|
||||
<a class="dropdown-item" href="<?php echo site_url('lotw/import');?>" title="LoTW Import/Export"><i class="fas fa-sync"></i> LoTW Import/Export</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('eqsl/import');?>" title="eQSL Import/Export"><i class="fas fa-sync"></i> eQSL Import/Export</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('qslprint');?>" title="Print Requested QSLs"><i class="fas fa-print"></i> Print Requested QSLs</a>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('backup');?>" title="Backup Cloudlog"><i class="fas fa-save"></i> Backup</a>
|
||||
|
4
application/views/qslprint/data/csv.php
Normal file
4
application/views/qslprint/data/csv.php
Normal file
@ -0,0 +1,4 @@
|
||||
COL_CALL;COL_QSL_VIA;COL_TIME_ON;COL_MODE;COL_FREQ;COL_BAND;COL_RST_SENT;COL_SAT_NAME;COL_SAT_MODE;COL_QSL_RCVD;COL_ROUTING;ADIF;ENTITY;
|
||||
<?php foreach ($qsos->result() as $qso) { ?>
|
||||
<?php echo $qso->COL_CALL; ?>;<?php echo $qso->COL_QSL_VIA; ?>;<?php echo $qso->COL_TIME_ON; ?>;<?php echo $qso->COL_MODE; ?>;<?php echo $qso->COL_FREQ; ?>;<?php echo $qso->COL_BAND; ?>;<?php echo $qso->COL_RST_SENT; ?>;<?php echo $qso->COL_SAT_NAME; ?>;<?php echo $qso->COL_SAT_MODE; ?>;<?php echo $qso->COL_QSL_RCVD; ?>;<?php echo $qso->COL_ROUTING; ?>;<?php echo $qso->ADIF; ?>;<?php echo $qso->ENTITY; ?>;
|
||||
<?php } ?>
|
42
application/views/qslprint/index.php
Normal file
42
application/views/qslprint/index.php
Normal file
@ -0,0 +1,42 @@
|
||||
<div class="container">
|
||||
|
||||
<br>
|
||||
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<?php echo $page_title; ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"></h5>
|
||||
<p class="card-text">
|
||||
Here you can export requested QSLs as CSV-file or ADIF and mark them as sent via buro in a mass transaction if you like.
|
||||
</p>
|
||||
|
||||
|
||||
<a href="<?php echo site_url('qslprint/exportcsv'); ?>" title="Export CSV-file" target="_blank" class="btn btn-outline-secondary btn-sm">Export requested QSLs to CSV-file</a>
|
||||
|
||||
<a href="<?php echo site_url('qslprint/exportadif'); ?>" title="Export ADIF" target="_blank" class="btn btn-outline-secondary btn-sm">Export requested QSLs to ADIF-file</a>
|
||||
|
||||
<a href="<?php echo site_url('qslprint/qsl_printed'); ?>" title="Mark QSLs as printed" target="_blank" class="btn btn-outline-secondary btn-sm">Mark requested QSLs as sent</a>
|
||||
|
||||
<!--
|
||||
<div class="table-responsive">
|
||||
<! -- Display Radio Statuses -- >
|
||||
<table class="table table-striped status"></table>
|
||||
</div>
|
||||
|
||||
<p class="card-text">
|
||||
<span class="badge badge-info">Info</span> You can find out how to use the <a href="https://github.com/magicbug/Cloudlog/wiki/Radio-Interface" target="_blank">radio functons</a> in the wiki.</a>
|
||||
</p>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user