Add 73on73 SAT award

This commit is contained in:
phl0
2025-02-27 09:25:58 +01:00
parent 404544ce0f
commit 6c2b109ea6
4 changed files with 123 additions and 1 deletions

View File

@@ -1917,7 +1917,7 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function wae () {
public function wae () {
$this->load->model('wae');
$this->load->model('modes');
$this->load->model('bands');
@@ -1995,4 +1995,15 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function seven3on73 () {
// Grab all worked stations on AO-73
$this->load->model('Seven3on73');
$data['seven3on73_array'] = $this->Seven3on73->get_all();
$data['page_title'] = sprintf(__("Awards - %s"), __("73 on 73"));
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/73on73/index');
$this->load->view('interface_assets/footer');
}
}

View File

@@ -0,0 +1,38 @@
<?php
class Seven3on73 extends CI_Model {
function get_all() {
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
}
$sql = "SELECT MIN(COL_TIME_ON) as time, COL_CALL as callsign FROM ".$this->config->item('table_name')." WHERE station_id IN (".implode(', ', $logbooks_locations_array).") AND COL_SAT_NAME = 'AO-73' AND COL_TIME_ON > '2014-09-01 00:00:00' GROUP BY callsign ORDER BY time DESC;";
$query = $this->db->query($sql);
$result = array();
foreach($query->result() as $row) {
$bindings=[];
$subsql = "SELECT COL_PRIMARY_KEY AS pkey, COL_MODE AS mode, COL_RST_RCVD AS rst_r, COL_RST_SENT AS rst_s
FROM ".$this->config->item('table_name')."
WHERE ".$this->config->item('table_name').".station_id IN (".implode(', ', $logbooks_locations_array).")
AND COL_CALL = ?
AND COL_TIME_ON = ?
ORDER BY COL_TIME_ON ASC LIMIT 1;";
$bindings[] = $row->callsign;
$bindings[] = $row->time;
$subquery = $this->db->query($subsql, $bindings);
$subrow = $subquery->row();
array_push($result, (object) ["time" => $row->time, "callsign" => $row->callsign, "pkey" => $subrow->pkey, "mode" => $subrow->mode, "rst_r" => $subrow->rst_r, "rst_s" => $subrow->rst_s]);
}
return $result;
}
}
?>

View File

@@ -0,0 +1,67 @@
<div class="container">
<!-- Award Info Box -->
<br>
<div id="awardInfoButton">
<script>
var lang_awards_info_button = "<?= __("Award Info"); ?>";
var lang_award_info_ln1 = "<?= __("73 on 73 Award"); ?>";
var lang_award_info_ln2 = "<?= __("Paul Stoetzer N8HM is sponsoring an award for contacts made via the AO-73 (FUNcube-1) amateur radio satellite."); ?>";
var lang_award_info_ln3 = "<?= sprintf(__("For more information, please visit: %s."), "<a href='https://amsat-uk.org/funcube/73-on-73-award/' target='_blank'>https://amsat-uk.org/funcube/73-on-73-award/</a>"); ?>";
var lang_award_info_ln4 = "";
</script>
<h2><?php echo $page_title; ?></h2>
<button type="button" class="btn btn-sm btn-primary me-1" id="displayAwardInfo"><?= __("Award Info"); ?></button>
</div>
<!-- End of Award Info Box -->
<?php
if ($seven3on73_array) {
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');
}
?>
<table style="width: 100%" id="wwfftable" class="wwfftable table table-sm table-striped table-hover">
<thead>
<tr>
<th style="text-align: center"><?= __("Number") ?></th>
<th style="text-align: center"><?= __("Date") ?></th>
<th style="text-align: center"><?= __("Time") ?></th>
<th style="text-align: center"><?= __("Callsign") ?></th>
<th style="text-align: center"><?= __("Mode") ?></th>
<th style="text-align: center"><?= __("RST (R)") ?></th>
<th style="text-align: center"><?= __("RST (S)") ?></th>
</tr>
</thead>
<tbody>
<?php
$i = count($seven3on73_array);
if ($i > 0) {
foreach ($seven3on73_array as $row) {
?>
<tr>
<td style="text-align: center"><?php echo $i--; ?></td>
<td style="text-align: center"><?php $timestamp = strtotime($row->time); echo date($custom_date_format, $timestamp); ?></td>
<td style="text-align: center"><?php $timestamp = strtotime($row->time); echo date('H:i', $timestamp); ?></td>
<td style="text-align: center"><a href="javascript:displayQso(<?= $row->pkey; ?>)"><?php echo $row->callsign; ?></a></td>
<td style="text-align: center"><?php echo $row->mode; ?></td>
<td style="text-align: center"><?php echo $row->rst_r; ?></td>
<td style="text-align: center"><?php echo $row->rst_s; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php } else {
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';
}?>
</div>

View File

@@ -189,6 +189,12 @@
</ul>
</li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item dropdown-toggle dropdown-toggle-submenu" data-bs-toggle="dropdown" href="#"><i class="fas fa-satellite"></i> <?= __("Satellite"); ?></a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="<?php echo site_url('awards/seven3on73'); ?>"><i class="fas fa-trophy"></i> <?= __("73 on 73"); ?></a></li>
</ul>
</li>
<div class="dropdown-divider"></div>
<li><a class="dropdown-item dropdown-toggle dropdown-toggle-submenu" data-bs-toggle="dropdown" href="#"><i class="fas fa-trophy"></i> xOTA</a>
<ul class="submenu dropdown-menu">
<li><a class="dropdown-item" href="<?php echo site_url('awards/sota'); ?>"><i class="fas fa-trophy"></i> <?= __("SOTA"); ?></a></li>