Add eQSL card list/view

这个提交包含在:
phl0 2023-05-10 16:03:30 +02:00
父节点 c61bb81e30
当前提交 21562bffc4
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 5 个文件被更改,包括 157 次插入3 次删除

查看文件

@ -8,6 +8,23 @@ class eqsl extends CI_Controller {
$this->load->helper(array('form', 'url'));
}
// Default view when loading controller.
public function index() {
$this->lang->load('qslcard');
$folder_name = "assets/qslcard";
$data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name));
// Render Page
$data['page_title'] = "eQSL Cards";
$this->load->model('eqsl_images');
$data['qslarray'] = $this->eqsl_images->eqsl_qso_list();
$this->load->view('interface_assets/header', $data);
$this->load->view('eqslcard/index');
$this->load->view('interface_assets/footer');
}
public function import() {
$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'); }
@ -599,5 +616,49 @@ class eqsl extends CI_Controller {
$status = $this->uploadQso($adif, $qsl);
}
}
// Functions for storage, these need shifted to a libary to use across Cloudlog
function folderSize($dir){
$count_size = 0;
$count = 0;
$dir_array = scandir($dir);
foreach($dir_array as $key=>$filename){
if($filename!=".." && $filename!="."){
if(is_dir($dir."/".$filename)){
$new_foldersize = foldersize($dir."/".$filename);
$count_size = $count_size+ $new_foldersize;
}else if(is_file($dir."/".$filename)){
$count_size = $count_size + filesize($dir."/".$filename);
$count++;
}
}
}
return $count_size;
}
function sizeFormat($bytes){
$kb = 1024;
$mb = $kb * 1024;
$gb = $mb * 1024;
$tb = $gb * 1024;
if (($bytes >= 0) && ($bytes < $kb)) {
return $bytes . ' B';
} elseif (($bytes >= $kb) && ($bytes < $mb)) {
return ceil($bytes / $kb) . ' KB';
} elseif (($bytes >= $mb) && ($bytes < $gb)) {
return ceil($bytes / $mb) . ' MB';
} elseif (($bytes >= $gb) && ($bytes < $tb)) {
return ceil($bytes / $gb) . ' GB';
} elseif ($bytes >= $tb) {
return ceil($bytes / $tb) . ' TB';
} else {
return $bytes . ' B';
}
}
} // end class

查看文件

@ -24,6 +24,13 @@ class Eqsl_images extends CI_Model {
$this->db->insert('eQSL_images', $data);
}
function eqsl_qso_list() {
$this->db->select('qso_id, COL_CALL, COL_MODE, , COL_SUBMODE, COL_TIME_ON, COL_BAND, COL_SAT_NAME, image_file');
$this->db->join($this->config->item('table_name'), 'qso_id = COL_PRIMARY_KEY', 'left outer');
$this->db->order_by('COL_TIME_ON', 'DESC');
return $this->db->get('eQSL_images');
}
}
?>
?>

查看文件

@ -0,0 +1,59 @@
<div class="container">
<br>
<h2><?php echo $this->lang->line('general_word_eqslcards'); ?></h2>
<div class="alert alert-info" role="alert">
<?php echo $this->lang->line('qslcard_string_your_are_using'); ?> <?php echo $storage_used; ?> <?php echo $this->lang->line('qslcard_string_disk_space'); ?>
</div>
<?php
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');
}
if (is_array($qslarray->result())) {
echo '<table style="width:100%" class="eqsltable table table-sm table-bordered table-hover table-striped table-condensed">
<thead>
<tr>
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_callsign').'</th>
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_mode').'</th>
<th style=\'text-align: center\'>'.$this->lang->line('general_word_date').'</th>
<th style=\'text-align: center\'>'.$this->lang->line('general_word_time').'</th>
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_band').'</th>
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_qsl').'</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\'>';
echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE;
echo '</td>';
echo '<td style=\'text-align: center\'>';
$timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp);
echo '</td>';
echo '<td style=\'text-align: center\'>';
$timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp);
echo '</td>';
echo '<td style=\'text-align: center\'>';
if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); };
echo '</td>';
echo '<td style=\'text-align: center\'>' . $qsl->image_file . '</td>';
echo '<td style=\'text-align: center\'><button onclick="viewEqsl(\''.$qsl->image_file.'\', \''. $qsl->COL_CALL . '\')" class="btn btn-sm btn-success">View</button></td>';
echo '</tr>';
}
echo '</tbody></table>';
}
?>
</div>

查看文件

@ -2123,7 +2123,7 @@ $(document).ready(function(){
<script src="<?php echo base_url(); ?>assets/js/sections/timeplot.js"></script>
<?php } ?>
<?php if ($this->uri->segment(1) == "qsl") {
<?php if ($this->uri->segment(1) == "qsl" || $this->uri->segment(1) == "eqsl") {
// Get Date format
if($this->session->userdata('user_date_format')) {
// If Logged in and session exists
@ -2244,6 +2244,31 @@ function deleteQsl(id) {
});
}
</script>
<script>
function viewEqsl(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+'images/eqsl_card_images/'+picture+'" />');
var title = '';
if (callsign == null) {
title = 'eQSL Card';
} else {
title = 'eQSL Card for ' + callsign;
}
BootstrapDialog.show({
title: title,
size: BootstrapDialog.SIZE_WIDE,
message: $textAndPic,
buttons: [{
label: 'Close',
action: function(dialogRef){
dialogRef.close();
}
}]
});
}
</script>
<script>
/*

查看文件

@ -82,6 +82,8 @@
<a class="dropdown-item" href="<?php echo site_url('contesting?manual=1');?>" title="Post contest QSOs"><i class="fas fa-list"></i> Post Contest Logging</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('qsl');?>" title="QSL"><i class="fa fa-id-card"></i> View QSL</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('eqsl');?>" title="eQSL"><i class="fa fa-id-card"></i> View eQSL</a>
</div>
</li>