[QSLCard] PR #677 from AndreasK79 this adds QSL Card management features for uploading QSL card images

This adds basic document management for QSL cards into Cloudlog which can be used when viewing QSO record.

You might need to make sure /assets/qslcard is writeable and deletable by PHP
这个提交包含在:
Peter Goodhall 2020-11-01 15:52:04 +00:00 提交者 GitHub
当前提交 356296c953
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 11 个文件被更改,包括 798 次插入249 次删除

1
.gitignore vendored
查看文件

@ -10,6 +10,7 @@
/updates/*.html /updates/*.html
/images/eqsl_card_images/*.jpg /images/eqsl_card_images/*.jpg
/updates/clublog_scp.txt /updates/clublog_scp.txt
/assets/qslcard/*
.idea/* .idea/*
.DS_Store .DS_Store
sync.sh sync.sh

查看文件

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 53; $config['migration_version'] = 54;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

查看文件

@ -411,6 +411,9 @@ class Logbook extends CI_Controller {
$data['measurement_base'] = $this->session->userdata('user_measurement_base'); $data['measurement_base'] = $this->session->userdata('user_measurement_base');
} }
$this->load->model('Qsl_model');
$data['qslimages'] = $this->Qsl_model->getQslForQsoId($id);
$this->load->view('interface_assets/mini_header', $data); $this->load->view('interface_assets/mini_header', $data);
$this->load->view('view_log/qso'); $this->load->view('view_log/qso');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');

查看文件

@ -0,0 +1,140 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
Controller for QSL Cards
*/
class Qsl extends CI_Controller {
function __construct() {
parent::__construct();
$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() {
// Render Page
$data['page_title'] = "QSL Cards";
$this->load->model('qsl_model');
$data['qslarray'] = $this->qsl_model->getQsoWithQslList();
$this->load->view('interface_assets/header', $data);
$this->load->view('qslcard/index');
$this->load->view('interface_assets/footer');
}
public function upload() {
// Render Page
$data['page_title'] = "Upload QSL Cards";
$this->load->view('interface_assets/header', $data);
$this->load->view('qslcard/upload');
$this->load->view('interface_assets/footer');
}
public function delete() {
$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'); }
$id = $this->input->post('id');
$this->load->model('Qsl_model');
$path = './assets/qslcard/';
$file = $this->Qsl_model->getFilename($id)->row();
$filename = $file->filename;
unlink($path.$filename);
$this->Qsl_model->deleteQsl($id);
}
public function uploadqsl() {
$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'); }
if (!file_exists('./assets/qslcard')) {
mkdir('./assets/qslcard', 0755, true);
}
$qsoid = $this->input->post('qsoid');
if (isset($_FILES['qslcardfront']) && $_FILES['qslcardfront']['name'] != "" && $_FILES['qslcardfront']['error'] == 0)
{
$result['front'] = $this->uploadQslCardFront($qsoid);
}
if (isset($_FILES['qslcardback']) && $_FILES['qslcardback']['name'] != "" && $_FILES['qslcardback']['error'] == 0)
{
$result['back'] = $this->uploadQslCardBack($qsoid);
}
header("Content-type: application/json");
echo json_encode(['status' => $result]);
}
function uploadQslCardFront($qsoid) {
$config['upload_path'] = './assets/qslcard';
$config['allowed_types'] = 'jpg|gif|png';
$array = explode(".", $_FILES['qslcardfront']['name']);
$ext = end($array);
$config['file_name'] = $qsoid . '_' . time() . '.' . $ext;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('qslcardfront')) {
// Upload of QSL card Failed
$error = array('error' => $this->upload->display_errors());
return $error;
}
else {
// Load database queries
$this->load->model('Qsl_model');
//Upload of QSL card was successful
$data = $this->upload->data();
// Now we need to insert info into database about file
$filename = $data['file_name'];
$insertid = $this->Qsl_model->saveQsl($qsoid, $filename);
$result['status'] = 'Success';
$result['insertid'] = $insertid;
$result['filename'] = $filename;
return $result;
}
}
function uploadQslCardBack($qsoid) {
$config['upload_path'] = './assets/qslcard';
$config['allowed_types'] = 'jpg|gif|png';
$array = explode(".", $_FILES['qslcardback']['name']);
$ext = end($array);
$config['file_name'] = $qsoid . '_' . time() . '.' . $ext;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('qslcardback')) {
// Upload of QSL card Failed
$error = array('error' => $this->upload->display_errors());
return $error;
}
else {
// Load database queries
$this->load->model('Qsl_model');
//Upload of QSL card was successful
$data = $this->upload->data();
// Now we need to insert info into database about file
$filename = $data['file_name'];
$insertid = $this->Qsl_model->saveQsl($qsoid, $filename);
$result['status'] = 'Success';
$result['insertid'] = $insertid;
$result['filename'] = $filename;
return $result;
}
}
}

查看文件

@ -0,0 +1,19 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_add_qsl_images extends CI_Migration {
public function up()
{
// create qsl images table
$this->db->query("CREATE TABLE IF NOT EXISTS `qsl_images`
(`id` integer NOT NULL auto_increment, `qsoid` int, `filename` text, primary key (id))
ENGINE=myisam DEFAULT CHARSET=utf8;");
}
public function down()
{
$this->db->query("");
}
}

查看文件

@ -0,0 +1,63 @@
<?php
class Qsl_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function getQsoWithQslList() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$this->db->select('*');
$this->db->from($this->config->item('table_name'));
$this->db->join('qsl_images', 'qsl_images.qsoid = ' . $this->config->item('table_name') . '.col_primary_key');
$this->db->where('station_id', $station_id);
return $this->db->get();
}
function getQslForQsoId($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$this->db->select('*');
$this->db->from('qsl_images');
$this->db->where('qsoid', $clean_id);
return $this->db->get()->result();
}
function saveQsl($qsoid, $filename) {
$data = array(
'qsoid' => $qsoid,
'filename' => $filename
);
$this->db->insert('qsl_images', $data);
return $this->db->insert_id();
}
function deleteQsl($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
// Delete Mode
$this->db->delete('qsl_images', array('id' => $clean_id));
}
function getFilename($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$this->db->select('filename');
$this->db->from('qsl_images');
$this->db->where('id', $clean_id);
return $this->db->get();
}
}

查看文件

@ -1449,7 +1449,6 @@ $(document).ready(function(){
L.marker([lat,long], {icon: redIcon}).addTo(mymap) L.marker([lat,long], {icon: redIcon}).addTo(mymap)
.bindPopup(callsign); .bindPopup(callsign);
mymap.on('click', onMapClick);
}, },
}); });
@ -2267,5 +2266,160 @@ $(document).ready(function(){
</script> </script>
<?php } ?> <?php } ?>
<?php if ($this->uri->segment(1) == "qsl") { ?>
<script>
$('.qsltable').DataTable({
"pageLength": 25,
responsive: false,
ordering: false,
"scrollY": "500px",
"scrollCollapse": true,
"paging": false,
"scrollX": true
});
function viewQsl(picture, callsign) {
var baseURL= "<?php echo base_url();?>";
var $textAndPic = $('<div></div>');
$textAndPic.append('<img class="img-fluid" style="height:auto;width:auto;"src="'+baseURL+'/assets/qslcard/'+picture+'" />');
BootstrapDialog.show({
title: 'QSL Card for ' + callsign,
size: BootstrapDialog.SIZE_WIDE,
message: $textAndPic,
buttons: [{
label: 'Close',
action: function(dialogRef){
dialogRef.close();
}
}]
});
}
</script>
<?php } ?>
<script>
function deleteQsl(id) {
BootstrapDialog.confirm({
title: 'DANGER',
message: 'Warning! Are you sure you want to delete this QSL card?' ,
type: BootstrapDialog.TYPE_DANGER,
closable: true,
draggable: true,
btnOKClass: 'btn-danger',
callback: function(result) {
if(result) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/qsl/delete',
type: 'post',
data: {'id': id
},
success: function(data) {
$("#" + id).parent("tr:first").remove(); // removes qsl from table
// remove qsl from carousel
$(".carousel-indicators li:last-child").remove();
$(".carouselimageid_"+id).remove();
$('#carouselExampleIndicators').find('.carousel-item').first().addClass('active');
// remove table and hide tab if all qsls are deleted
if ($('.qsltable tr').length == 1) {
$('.qsltable').remove();
$('.qslcardtab').attr('hidden','');
}
}
});
}
}
});
}
</script>
<script>
function uploadQsl() {
var baseURL= "<?php echo base_url();?>";
var formdata = new FormData(document.getElementById("fileinfo"));
$.ajax({
url: baseURL + 'index.php/qsl/uploadqsl',
type: 'post',
data: formdata,
enctype: 'multipart/form-data',
processData: false,
contentType: false,
success: function(data) {
if (data.status.front.status == 'Success') {
if ($('.qsltable').length > 0) {
$('.qsltable tr:last').after('<tr><td style="text-align: center">'+data.status.front.filename+'</td>' +
'<td id="'+data.status.front.insertid+'"style="text-align: center"><button onclick="deleteQsl('+data.status.front.insertid+');" class="btn btn-sm btn-danger">Delete</button></td></tr>');
var quantity = $(".carousel-indicators li").length;
$(".carousel-indicators").append('<li data-target="#carouselExampleIndicators" data-slide-to="'+quantity+'"></li>');
$(".carousel-inner").append('<div class="carousel-item carouselimageid_'+data.status.front.insertid+'"><img class="d-block w-100" src="'+baseURL+'/assets/qslcard/'+data.status.front.filename+'" alt="QSL picture #'+(quantity+1)+'"></div>');
$("#qslcardfront").val(null);
}
else {
$("#qslupload").prepend('<table style="width:100%" class="qsltable table table-sm table-bordered table-hover table-striped table-condensed">'+
'<thead>'+
'<tr>'+
'<th style="text-align: center">QSL image file</th>'+
'<th style="text-align: center"></th>'+
'</tr>'+
'</thead><tbody>'+
'<tr><td style="text-align: center">'+data.status.front.filename+'</td>' +
'<td id="'+data.status.front.insertid+'"style="text-align: center"><button onclick="deleteQsl('+data.status.front.insertid+');" class="btn btn-sm btn-danger">Delete</button></td>' +
'</tr>'+
'</tbody></table>');
$('.qslcardtab').removeAttr('hidden');
var quantity = $(".carousel-indicators li").length;
$(".carousel-indicators").append('<li class="active" data-target="#carouselExampleIndicators" data-slide-to="'+quantity+'"></li>');
$(".carousel-inner").append('<div class="active carousel-item carouselimageid_'+data.status.front.insertid+'"><img class="d-block w-100" src="'+baseURL+'/assets/qslcard/'+data.status.front.filename+'" alt="QSL picture #'+(quantity+1)+'"></div>');
$(".carouselExampleIndicators").carousel();
$("#qslcardfront").val(null);
}
} else {
$("#qslupload").append('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>\n' +
data.status.front +
'</div>');
}
if (data.status.back.status == 'Success') {
var qsoid = $("#qsoid").text();
if ($('.qsltable').length > 0) {
$('.qsltable tr:last').after('<tr><td style="text-align: center">'+data.status.back.filename+'</td>' +
'<td id="'+data.status.back.insertid+'"style="text-align: center"><button onclick="deleteQsl('+data.status.back.insertid+');" class="btn btn-sm btn-danger">Delete</button></td></tr>');
var quantity = $(".carousel-indicators li").length;
$(".carousel-indicators").append('<li data-target="#carouselExampleIndicators" data-slide-to="'+quantity+'"></li>');
$(".carousel-inner").append('<div class="carousel-item carouselimageid_'+data.status.back.insertid+'"><img class="d-block w-100" src="'+baseURL+'/assets/qslcard/'+data.status.back.filename+'" alt="QSL picture #'+(quantity+1)+'"></div>');
$("#qslcardback").val(null);
}
else {
$("#qslupload").prepend('<table style="width:100%" class="qsltable table table-sm table-bordered table-hover table-striped table-condensed">'+
'<thead>'+
'<tr>'+
'<th style="text-align: center">QSL image file</th>'+
'<th style="text-align: center"></th>'+
'</tr>'+
'</thead><tbody>'+
'<tr><td style="text-align: center">'+data.status.back.filename+'</td>' +
'<td id="'+data.status.back.insertid+'"style="text-align: center"><button onclick="deleteQsl('+data.status.back.insertid+');" class="btn btn-sm btn-danger">Delete</button></td>' +
'</tr>'+
'</tbody></table>');
$('.qslcardtab').removeAttr('hidden');
var quantity = $(".carousel-indicators li").length;
$(".carousel-indicators").append('<li class="active" data-target="#carouselExampleIndicators" data-slide-to="'+quantity+'"></li>');
$(".carousel-inner").append('<div class="active carousel-item carouselimageid_'+data.status.back.insertid+'"><img class="d-block w-100" src="'+baseURL+'/assets/qslcard/'+data.status.back.filename+'" alt="QSL picture #'+(quantity+1)+'"></div>');
$(".carouselExampleIndicators").carousel();
$("#qslcardback").val(null);
}
} else {
$("#qslupload").append('<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>\n' +
data.status.back +
'</div>');
}
}
});
}
</script>
</body> </body>
</html> </html>

查看文件

@ -67,6 +67,8 @@
<a class="dropdown-item" href="<?php echo site_url('qso?manual=0');?>" title="Log Live QSOs">Live QSO</a> <a class="dropdown-item" href="<?php echo site_url('qso?manual=0');?>" title="Log Live QSOs">Live QSO</a>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('qso?manual=1');?>" title="Log QSO made in the past">Post QSO</a> <a class="dropdown-item" href="<?php echo site_url('qso?manual=1');?>" title="Log QSO made in the past">Post QSO</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('qsl');?>" title="QSL"> View QSL</a>
</div> </div>
</li> </li>

查看文件

@ -0,0 +1,28 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<?php
if (is_array($qslarray->result())) {
echo '<table style="width:100%" class="qsltable table table-sm table-bordered table-hover table-striped table-condensed">
<thead>
<tr>
<th style=\'text-align: center\'>Callsign</th>
<th style=\'text-align: center\'>QSL</th>
<th style=\'text-align: center\'></th>
<th style=\'text-align: center\'></th>
</tr>
</thead><tbody>';
foreach ($qslarray->result() as $qsl) {
echo '<tr>';
echo '<td style=\'text-align: center\'>' . $qsl->COL_CALL . '</td>';
echo '<td style=\'text-align: center\'>' . $qsl->filename . '</td>';
echo '<td id="'.$qsl->id.'" style=\'text-align: center\'><button onclick="deleteQsl(\''.$qsl->id.'\')" class="btn btn-sm btn-danger">Delete</button></td>';
echo '<td style=\'text-align: center\'><button onclick="viewQsl(\''.$qsl->filename.'\', \''. $qsl->COL_CALL . '\')" class="btn btn-sm btn-success">View</button></td>';
echo '</tr>';
}
echo '</tbody></table>';
}
?>
</div>

查看文件

@ -0,0 +1,25 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<div class="card-body">
<?php if($front != 'Success') { ?>
<div class="alert alert-danger" role="alert">
<?php echo $front; ?>
</div>
<?php } else { ?>
<div class="alert alert-success" role="alert">
Front QSL Card image has been uploaded!
</div>
<?php } ?>
<?php if($back != 'Success') { ?>
<div class="alert alert-danger" role="alert">
<?php echo $back; ?>
</div>
<?php } else { ?>
<div class="alert alert-success" role="alert">
Back QSL Card image has been uploaded!
</div>
<?php } ?>
</div>
</div>

查看文件

@ -1,274 +1,388 @@
<?php if ($query->num_rows() > 0) { foreach ($query->result() as $row) { ?> <?php if ($query->num_rows() > 0) { foreach ($query->result() as $row) { ?>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <ul class="nav nav-tabs" id="myTab" role="tablist">
<div class="col"> <li class="nav-item">
<h3>QSO Details</h3> <a class="nav-link active" id="table-tab" data-toggle="tab" href="#qsodetails" role="tab" aria-controls="table" aria-selected="true">QSO Details</a>
</div> </li>
</div> <?php
if (($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) {
<div class="row"> echo '<li ';
<div class="col"> if (count($qslimages) == 0) {
echo 'hidden ';
}
echo 'class="qslcardtab nav-item">
<a class="nav-link" id="qsltab" data-toggle="tab" href="#qslcard" role="tab" aria-controls="home" aria-selected="false">QSL Card</a>
</li>';
<table width="100%"> echo '<li class="nav-item">
<tr> <a class="nav-link" id="qslmanagementtab" data-toggle="tab" href="#qslupload" role="tab" aria-controls="home" aria-selected="false">QSL Card Management</a>
<?php </li>';
}
// Get Date format ?>
if($this->session->userdata('user_date_format')) {
// If Logged in and session exists
$custom_date_format = $this->session->userdata('user_date_format');
} else {
// Get Default date format from /config/cloudlog.php
$custom_date_format = $this->config->item('qso_date_format');
}
?> </ul>
<td>Date/Time:</td> <div class="tab-content" id="myTabContent">
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?> <div class="tab-pane active" id="qsodetails" role="tabpanel" aria-labelledby="home-tab">
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); $timestamp = strtotime($row->COL_TIME_ON); echo " at ".date('H:i', $timestamp); ?></td>
<?php } else { ?>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td>
<?php } ?>
</tr>
<tr> <div class="row">
<td>Callsign:</td> <div class="col">
<td><b><?php echo str_replace("0","&Oslash;",strtoupper($row->COL_CALL)); ?></b></td>
</tr>
<tr> <table width="100%">
<td>Band:</td> <tr>
<td><?php echo $row->COL_BAND; ?></td> <?php
</tr>
<?php if($this->config->item('display_freq') == true) { ?> // Get Date format
<tr> if($this->session->userdata('user_date_format')) {
<td>Freq:</td> // If Logged in and session exists
<td><?php echo frequency_display_string($row->COL_FREQ); ?></td> $custom_date_format = $this->session->userdata('user_date_format');
</tr> } else {
<?php if($row->COL_FREQ_RX != 0) { ?> // Get Default date format from /config/cloudlog.php
<tr> $custom_date_format = $this->config->item('qso_date_format');
<td>Freq (RX):</td> }
<td><?php echo frequency_display_string($row->COL_FREQ_RX); ?></td>
</tr>
<?php }} ?>
<tr> ?>
<td>Mode:</td>
<td><?php echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?></td>
</tr>
<tr> <td>Date/Time:</td>
<td>RST Sent:</td> <?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>
<td><?php echo $row->COL_RST_SENT; ?> <?php if ($row->COL_STX) { ?>(<?php echo $row->COL_STX;?>)<?php } ?> <?php if ($row->COL_STX_STRING) { ?>(<?php echo $row->COL_STX_STRING;?>)<?php } ?></td> <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); $timestamp = strtotime($row->COL_TIME_ON); echo " at ".date('H:i', $timestamp); ?></td>
</tr> <?php } else { ?>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td>
<?php } ?>
</tr>
<tr> <tr>
<td>RST Recv:</td> <td>Callsign:</td>
<td><?php echo $row->COL_RST_RCVD; ?> <?php if ($row->COL_SRX) { ?>(<?php echo $row->COL_SRX;?>)<?php } ?> <?php if ($row->COL_SRX_STRING) { ?>(<?php echo $row->COL_SRX_STRING;?>)<?php } ?></td> <td><b><?php echo str_replace("0","&Oslash;",strtoupper($row->COL_CALL)); ?></b></td>
</tr> </tr>
<?php if($row->COL_GRIDSQUARE != null) { ?> <tr>
<tr> <td>Band:</td>
<td>Gridsquare:</td> <td><?php echo $row->COL_BAND; ?></td>
<td><?php echo $row->COL_GRIDSQUARE; ?></td> </tr>
</tr>
<?php } ?>
<?php if($row->COL_GRIDSQUARE != null) { ?> <?php if($this->config->item('display_freq') == true) { ?>
<!-- Total Distance Between the Station Profile Gridsquare and Logged Square --> <tr>
<tr> <td>Freq:</td>
<td>Total Distance</td> <td><?php echo frequency_display_string($row->COL_FREQ); ?></td>
<td> </tr>
<?php <?php if($row->COL_FREQ_RX != 0) { ?>
// Load the QRA Library <tr>
$CI =& get_instance(); <td>Freq (RX):</td>
$CI->load->library('qra'); <td><?php echo frequency_display_string($row->COL_FREQ_RX); ?></td>
</tr>
<?php }} ?>
// Cacluate Distance <tr>
echo $CI->qra->distance($row->station_gridsquare, $row->COL_GRIDSQUARE, $measurement_base); <td>Mode:</td>
<td><?php echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?></td>
</tr>
switch ($measurement_base) { <tr>
case 'M': <td>RST Sent:</td>
echo "mi"; <td><?php echo $row->COL_RST_SENT; ?> <?php if ($row->COL_STX) { ?>(<?php echo $row->COL_STX;?>)<?php } ?> <?php if ($row->COL_STX_STRING) { ?>(<?php echo $row->COL_STX_STRING;?>)<?php } ?></td>
break; </tr>
case 'K':
echo "km";
break;
case 'N':
echo "nmi";
break;
}
?>
</td>
</tr>
<?php } ?>
<?php if($row->COL_VUCC_GRIDS != null) { ?> <tr>
<tr> <td>RST Recv:</td>
<td>Gridsquare (Multi):</td> <td><?php echo $row->COL_RST_RCVD; ?> <?php if ($row->COL_SRX) { ?>(<?php echo $row->COL_SRX;?>)<?php } ?> <?php if ($row->COL_SRX_STRING) { ?>(<?php echo $row->COL_SRX_STRING;?>)<?php } ?></td>
<td><?php echo $row->COL_VUCC_GRIDS; ?></td> </tr>
</tr>
<?php } ?>
<?php if($row->COL_STATE != null) { ?> <?php if($row->COL_GRIDSQUARE != null) { ?>
<tr> <tr>
<td>USA State:</td> <td>Gridsquare:</td>
<td><?php echo $row->COL_STATE; ?></td> <td><?php echo $row->COL_GRIDSQUARE; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_GRIDSQUARE != null) { ?>
<!-- Total Distance Between the Station Profile Gridsquare and Logged Square -->
<tr>
<td>Total Distance</td>
<td>
<?php
// Load the QRA Library
$CI =& get_instance();
$CI->load->library('qra');
// Cacluate Distance
echo $CI->qra->distance($row->station_gridsquare, $row->COL_GRIDSQUARE, $measurement_base);
switch ($measurement_base) {
case 'M':
echo "mi";
break;
case 'K':
echo "km";
break;
case 'N':
echo "nmi";
break;
}
?>
</td>
</tr>
<?php } ?>
<?php if($row->COL_VUCC_GRIDS != null) { ?>
<tr>
<td>Gridsquare (Multi):</td>
<td><?php echo $row->COL_VUCC_GRIDS; ?></td>
</tr>
<?php } ?>
<?php if($row->COL_STATE != null) { ?>
<tr>
<td>USA State:</td>
<td><?php echo $row->COL_STATE; ?></td>
</tr>
<?php } ?>
<?php if($row->COL_NAME != null) { ?> <?php if($row->COL_NAME != null) { ?>
<tr> <tr>
<td>Name:</td> <td>Name:</td>
<td><?php echo $row->COL_NAME; ?></td> <td><?php echo $row->COL_NAME; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?> <?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?>
<?php if($row->COL_COMMENT != null) { ?> <?php if($row->COL_COMMENT != null) { ?>
<tr> <tr>
<td>Comment:</td> <td>Comment:</td>
<td><?php echo $row->COL_COMMENT; ?></td> <td><?php echo $row->COL_COMMENT; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php if($row->COL_SAT_NAME != null) { ?> <?php if($row->COL_SAT_NAME != null) { ?>
<tr> <tr>
<td>Sat Name:</td> <td>Sat Name:</td>
<td><?php echo $row->COL_SAT_NAME; ?></td> <td><?php echo $row->COL_SAT_NAME; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_SAT_MODE != null) { ?> <?php if($row->COL_SAT_MODE != null) { ?>
<tr> <tr>
<td>Sat Mode:</td> <td>Sat Mode:</td>
<td><?php echo $row->COL_SAT_MODE; ?></td> <td><?php echo $row->COL_SAT_MODE; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_COUNTRY != null) { ?> <?php if($row->COL_COUNTRY != null) { ?>
<tr> <tr>
<td>Country:</td> <td>Country:</td>
<td><?php echo ucwords(strtolower(($row->COL_COUNTRY))); ?></td> <td><?php echo ucwords(strtolower(($row->COL_COUNTRY))); ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_IOTA != null) { ?> <?php if($row->COL_IOTA != null) { ?>
<tr> <tr>
<td>IOTA Ref:</td> <td>IOTA Ref:</td>
<td><?php echo $row->COL_IOTA; ?></td> <td><?php echo $row->COL_IOTA; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_SOTA_REF != null) { ?> <?php if($row->COL_SOTA_REF != null) { ?>
<tr> <tr>
<td>SOTA Ref:</td> <td>SOTA Ref:</td>
<td><?php echo $row->COL_SOTA_REF; ?></td> <td><?php echo $row->COL_SOTA_REF; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_DARC_DOK != null) { ?> <?php if($row->COL_DARC_DOK != null) { ?>
<tr> <tr>
<td>DOK:</td> <td>DOK:</td>
<td><a href="https://www.darc.de/<?php echo $row->COL_DARC_DOK; ?>" target="_new"><?php echo $row->COL_DARC_DOK; ?></a></td> <td><a href="https://www.darc.de/<?php echo $row->COL_DARC_DOK; ?>" target="_new"><?php echo $row->COL_DARC_DOK; ?></a></td>
</tr> </tr>
<?php } ?> <?php } ?>
</table> </table>
<?php if($row->COL_QSL_SENT == "Y" || $row->COL_QSL_RCVD == "Y") { ?> <?php if($row->COL_QSL_SENT == "Y" || $row->COL_QSL_RCVD == "Y") { ?>
<h3>QSL Info:</h3> <h3>QSL Info:</h3>
<?php if($row->COL_QSL_SENT == "Y" && $row->COL_QSL_SENT_VIA == "B") { ?> <?php if($row->COL_QSL_SENT == "Y" && $row->COL_QSL_SENT_VIA == "B") { ?>
<p>QSL Card has been sent via the bureau</p> <p>QSL Card has been sent via the bureau</p>
<?php } ?> <?php } ?>
<?php if($row->COL_QSL_SENT == "Y" && $row->COL_QSL_SENT_VIA == "D") { ?> <?php if($row->COL_QSL_SENT == "Y" && $row->COL_QSL_SENT_VIA == "D") { ?>
<p>QSL Card has been sent direct</p> <p>QSL Card has been sent direct</p>
<?php } ?> <?php } ?>
<?php if($row->COL_QSL_RCVD == "Y" && $row->COL_QSL_RCVD_VIA == "B") { ?> <?php if($row->COL_QSL_RCVD == "Y" && $row->COL_QSL_RCVD_VIA == "B") { ?>
<p>QSL Card has been received via the bureau</p> <p>QSL Card has been received via the bureau</p>
<?php } ?> <?php } ?>
<?php if($row->COL_QSL_RCVD == "Y" && $row->COL_QSL_RCVD_VIA == "D") { ?> <?php if($row->COL_QSL_RCVD == "Y" && $row->COL_QSL_RCVD_VIA == "D") { ?>
<p>QSL Card has been received direct</p> <p>QSL Card has been received direct</p>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php if($row->COL_LOTW_QSL_RCVD == "Y") { ?> <?php if($row->COL_LOTW_QSL_RCVD == "Y") { ?>
<h3>LoTW:</h3> <h3>LoTW:</h3>
<p>This QSO is confirmed on Lotw</p> <p>This QSO is confirmed on Lotw</p>
<?php } ?> <?php } ?>
<h2 style="font-size: 22px;">Station Information</h2> <h2 style="font-size: 22px;">Station Information</h2>
<table width="100%"> <table width="100%">
<tr> <tr>
<td>Station Callsign</td> <td>Station Callsign</td>
<td><?php echo $row->station_callsign; ?></td> <td><?php echo $row->station_callsign; ?></td>
</tr> </tr>
<tr> <tr>
<td>Station Gridsquare</td> <td>Station Gridsquare</td>
<td><?php echo $row->station_gridsquare; ?></td> <td><?php echo $row->station_gridsquare; ?></td>
</tr> </tr>
<?php if($row->station_city) { ?> <?php if($row->station_city) { ?>
<tr> <tr>
<td>Station City:</td> <td>Station City:</td>
<td><?php echo $row->station_city; ?></td> <td><?php echo $row->station_city; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->station_country) { ?> <?php if($row->station_country) { ?>
<tr> <tr>
<td>Station Country:</td> <td>Station Country:</td>
<td><?php echo ucwords(strtolower(($row->station_country))); ?></td> <td><?php echo ucwords(strtolower(($row->station_country))); ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_OPERATOR) { ?> <?php if($row->COL_OPERATOR) { ?>
<tr> <tr>
<td>Station Operator</td> <td>Station Operator</td>
<td><?php echo $row->COL_OPERATOR; ?></td> <td><?php echo $row->COL_OPERATOR; ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<?php if($row->COL_TX_PWR) { ?> <?php if($row->COL_TX_PWR) { ?>
<tr> <tr>
<td>Station Transmit Power</td> <td>Station Transmit Power</td>
<td><?php echo $row->COL_TX_PWR; ?>w</td> <td><?php echo $row->COL_TX_PWR; ?>w</td>
</tr> </tr>
<?php } ?> <?php } ?>
</table> </table>
</div> </div>
<div class="col">
<div id="mapqso" style="width: 340px; height: 250px"></div> <div class="col">
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?> <div id="mapqso" style="width: 340px; height: 250px"></div>
<br>
<p class="editButton"><a class="btn btn-primary" href="<?php echo site_url('qso/edit'); ?>/<?php echo $row->COL_PRIMARY_KEY; ?>" href="javascript:;"><i class="fas fa-edit"></i> Edit QSO</a></p>
<?php } ?>
<?php <?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?>
<br>
<p class="editButton"><a class="btn btn-primary" href="<?php echo site_url('qso/edit'); ?>/<?php echo $row->COL_PRIMARY_KEY; ?>" href="javascript:;"><i class="fas fa-edit"></i> Edit QSO</a></p>
<?php } ?>
if($row->COL_SAT_NAME != null) { <?php
$twitter_band_sat = $row->COL_SAT_NAME;
$hashtags = "#hamr #cloudlog #amsat";
} else {
$twitter_band_sat = $row->COL_BAND;
$hashtags = "#hamr #cloudlog";
}
$twitter_string = urlencode("Just worked ".$row->COL_CALL." in ".ucwords(strtolower(($row->COL_COUNTRY)))." (Gridsquare: ".$row->COL_GRIDSQUARE.") on ".$twitter_band_sat." using ".$row->COL_MODE." ".$hashtags); if($row->COL_SAT_NAME != null) {
?> $twitter_band_sat = $row->COL_SAT_NAME;
$hashtags = "#hamr #cloudlog #amsat";
} else {
$twitter_band_sat = $row->COL_BAND;
$hashtags = "#hamr #cloudlog";
}
<div class="text-right"><a class="btn btn-sm btn-primary twitter-share-button" target="_blank" href="https://twitter.com/intent/tweet?text=<?php echo $twitter_string; ?>"><i class="fab fa-twitter"></i> Tweet</a></div> $twitter_string = urlencode("Just worked ".$row->COL_CALL." in ".ucwords(strtolower(($row->COL_COUNTRY)))." (Gridsquare: ".$row->COL_GRIDSQUARE.") on ".$twitter_band_sat." using ".$row->COL_MODE." ".$hashtags);
?>
</div> <div class="text-right"><a class="btn btn-sm btn-primary twitter-share-button" target="_blank" href="https://twitter.com/intent/tweet?text=<?php echo $twitter_string; ?>"><i class="fab fa-twitter"></i> Tweet</a></div>
</div>
</div>
</div>
</div>
<?php
if (($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) {
?>
<div class="tab-pane fade" id="qslupload" role="tabpanel" aria-labelledby="table-tab">
<?php
if (count($qslimages) > 0) {
echo '<table style="width:100%" class="qsltable table table-sm table-bordered table-hover table-striped table-condensed">
<thead>
<tr>
<th style=\'text-align: center\'>QSL image file</th>
<th style=\'text-align: center\'></th>
</tr>
</thead><tbody>';
foreach ($qslimages as $qsl) {
echo '<tr>';
echo '<td style=\'text-align: center\'>' . $qsl->filename . '</td>';
echo '<td id="'.$qsl->id.'" style=\'text-align: center\'><button onclick="deleteQsl('.$qsl->id.')" class="btn btn-sm btn-danger">Delete</button></td>';
echo '</tr>';
}
echo '</tbody></table>';
}
?>
<form class="form" id="fileinfo" name="fileinfo" enctype="multipart/form-data">
<fieldset>
<div class="form-group">
<label for="qslcardfront">Upload QSL Card front image</label>
<input class="form-control-file" type="file" id="qslcardfront" name="qslcardfront" accept="image/*" capture="environment">
</div>
<div class="form-group">
<label for="qslcardback">Upload QSL card back image</label>
<input class="form-control-file" type="file" id="qslcardback" name="qslcardback" accept="image/*" capture="environment">
</div>
<input type="hidden" class="form-control" id="qsoinputid" name="qsoid" value="<?php echo $row->COL_PRIMARY_KEY; ?>">
<button type="button" onclick="uploadQsl();" id="button1id" name="button1id" class="btn btn-primary">Upload QSL card image</button>
</fieldset>
</form>
</div>
<div class="tab-pane fade" id="qslcard" role="tabpanel" aria-labelledby="table-tab">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php
$i = 0;
foreach ($qslimages as $image) {
echo '<li data-target="#carouselExampleIndicators" data-slide-to="' . $i . '"';
if ($i == 0) {
echo 'class="active"';
}
$i++;
echo '></li>';
}
?>
</ol>
<div class="carousel-inner">
<?php
$i = 1;
foreach ($qslimages as $image) {
echo '<div class="carousel-item carouselimageid_' . $image->id;
if ($i == 1) {
echo ' active';
}
echo '">';
echo '<img class="d-block w-100" src="' . base_url() . '/assets/qslcard/' . $image->filename .'" alt="QSL picture #'. $i++.'">';
echo '</div>';
}
?>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<?php
}
?>
</div>
</div> </div>
<?php <?php