mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
Make QSO widget better looking and more configurable
This commit is contained in:
@@ -53,6 +53,9 @@ define('QSO_PAGE_QSOS_COUNT_LIMIT', 20);
|
||||
|
||||
define('USER_SLUG_LENGTH', 10);
|
||||
|
||||
define('QSO_WIDGET_DEFAULT_QSO_LIMIT', 15);
|
||||
define('QSO_WIDGET_MAX_QSO_LIMIT', 50);
|
||||
|
||||
|
||||
/* End of file constants.php */
|
||||
/* Location: ./application/config/constants.php */
|
||||
|
||||
@@ -14,14 +14,47 @@ class Widgets extends CI_Controller {
|
||||
}
|
||||
|
||||
|
||||
// Can be used to embed last 11 QSOs in a iframe or javascript include.
|
||||
// Can be used to embed last few QSOs
|
||||
public function qsos($logbook_slug = null) {
|
||||
|
||||
if($logbook_slug == null) {
|
||||
show_error(__("Unknown Public Page, please make sure the public slug is correct."));
|
||||
}
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
// determine theme
|
||||
$this->load->model('themes_model');
|
||||
$theme = $this->input->get('theme', TRUE);
|
||||
if ($theme != null) {
|
||||
if (($this->themes_model->get_theme_mode($theme) ?? '') != '') {
|
||||
$data['theme'] = $theme;
|
||||
} else {
|
||||
$data['theme'] = $this->config->item('option_theme');
|
||||
}
|
||||
} else {
|
||||
$data['theme'] = "default";
|
||||
}
|
||||
|
||||
// should we show time?
|
||||
// TODO
|
||||
$data['show_time'] = (($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time')));
|
||||
$data['show_time'] = true;
|
||||
|
||||
// determine text size
|
||||
$text_size = $this->input->get('text_size', true) ?? 1;
|
||||
$data['text_size_class'] = $this->prepare_text_size_css_class($text_size);
|
||||
|
||||
// number of QSOs shown
|
||||
$qso_count_param = $this->input->get('qso_count', TRUE);
|
||||
if ($qso_count_param != null) {
|
||||
$qso_count = min($qso_count_param, QSO_WIDGET_MAX_QSO_LIMIT);
|
||||
} else {
|
||||
$qso_count = QSO_WIDGET_DEFAULT_QSO_LIMIT;
|
||||
}
|
||||
|
||||
// date format
|
||||
$data['date_format'] = $this->config->item('qso_date_format'); // date format from /config/wavelog.php
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('logbooks_model');
|
||||
if($this->logbooks_model->public_slug_exists($logbook_slug)) {
|
||||
// Load the public view
|
||||
@@ -40,7 +73,7 @@ class Widgets extends CI_Controller {
|
||||
show_404(__("Unknown Public Page."));
|
||||
}
|
||||
|
||||
$data['last_qsos_list'] = $this->logbook_model->get_last_qsos(15, $logbooks_locations_array);
|
||||
$data['last_qsos_list'] = $this->logbook_model->get_last_qsos($qso_count, $logbooks_locations_array);
|
||||
|
||||
$this->load->view('widgets/qsos', $data);
|
||||
}
|
||||
|
||||
@@ -1,64 +1,45 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title><?= __("QSOs"); ?></title>
|
||||
<style type="text/css" media="screen">
|
||||
body {
|
||||
font-family: Arial, "MS Trebuchet", sans-serif;
|
||||
}
|
||||
.titles th {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $theme; ?>/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $theme; ?>/overrides.css">
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css">
|
||||
|
||||
<title><?= "QSOs"; ?></title>
|
||||
</head>
|
||||
|
||||
<?php if (($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) {
|
||||
$show_time = true;
|
||||
} else {
|
||||
$show_time = false;
|
||||
} ?>
|
||||
|
||||
|
||||
<body>
|
||||
<table width="100%" class="zebra-striped">
|
||||
<table width="100%" class="table table-striped">
|
||||
<tr class="titles">
|
||||
<th><?= __("Date"); ?></th>
|
||||
<?php if ($show_time) { ?>
|
||||
<th><?= __("Time"); ?></th>
|
||||
<?php } ?>
|
||||
<th><?= __("Call"); ?></th>
|
||||
<th><?= __("Mode"); ?></th>
|
||||
<th><?= __("Sent"); ?></th>
|
||||
<th><?= __("Rcvd"); ?></th>
|
||||
<th><?= __("Band"); ?></th>
|
||||
<th class="<?= $text_size_class ?>"><?= __("Date"); ?></th>
|
||||
<th class="<?= $text_size_class ?>"><?= __("Call"); ?></th>
|
||||
<th class="<?= $text_size_class ?>"><?= __("Mode"); ?></th>
|
||||
<th class="<?= $text_size_class ?>"><?= __("Sent"); ?></th>
|
||||
<th class="<?= $text_size_class ?>"><?= __("Rcvd"); ?></th>
|
||||
<th class="<?= $text_size_class ?>"><?= __("Band"); ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
// 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/wavelog.php
|
||||
$custom_date_format = $this->config->item('qso_date_format');
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($last_qsos_list->result() as $row) { ?>
|
||||
<?php echo '<tr class="tr'.($i & 1).'">'; ?>
|
||||
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td>
|
||||
<?php if ($show_time) { ?>
|
||||
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?></td>
|
||||
<td><?php echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?></td>
|
||||
<td><?php echo $row->COL_RST_SENT; ?> <?php if ($row->COL_STX_STRING) { ?>(<?php echo $row->COL_STX_STRING;?>)<?php } ?></td>
|
||||
<td><?php echo $row->COL_RST_RCVD; ?> <?php if ($row->COL_SRX_STRING) { ?>(<?php echo $row->COL_SRX_STRING;?>)<?php } ?></td>
|
||||
<td class="<?= $text_size_class ?>">
|
||||
<?php $timestamp = strtotime($row->COL_TIME_ON); echo date($date_format, $timestamp); ?>
|
||||
<?php if ($show_time) { ?>
|
||||
<?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td class="<?= $text_size_class ?>"><?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?></td>
|
||||
<td class="<?= $text_size_class ?>"><?php echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?></td>
|
||||
<td class="<?= $text_size_class ?>"><?php echo $row->COL_RST_SENT; ?> <?php if ($row->COL_STX_STRING) { ?>(<?php echo $row->COL_STX_STRING;?>)<?php } ?></td>
|
||||
<td class="<?= $text_size_class ?>"><?php echo $row->COL_RST_RCVD; ?> <?php if ($row->COL_SRX_STRING) { ?>(<?php echo $row->COL_SRX_STRING;?>)<?php } ?></td>
|
||||
<?php if($row->COL_SAT_NAME != null) { ?>
|
||||
<td><?php echo $row->COL_SAT_NAME; ?></td>
|
||||
<td class="<?= $text_size_class ?>"><?php echo $row->COL_SAT_NAME; ?></td>
|
||||
<?php } else { ?>
|
||||
<td><?php echo $row->COL_BAND; ?></td>
|
||||
<td class="<?= $text_size_class ?>"><?php echo $row->COL_BAND; ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php $i++; } ?>
|
||||
|
||||
Reference in New Issue
Block a user