Added POTA to awards section

Signed-off-by: phl0 <github@florian-wolters.de>
pull/1826/head
phl0 2022-10-05 22:13:12 +02:00
rodzic 8de14376ba
commit f556e6319f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 48EA1E640798CA9A
9 zmienionych plików z 113 dodań i 5 usunięć

Wyświetl plik

@ -257,6 +257,23 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
/*
Handles showing worked POTAs
Comment field - POTA:#
*/
public function pota() {
// Grab all worked pota stations
$this->load->model('pota');
$data['pota_all'] = $this->pota->get_all();
// Render page
$data['page_title'] = "Awards - POTA";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/pota/index');
$this->load->view('interface_assets/footer');
}
public function cq() {
$CI =& get_instance();
$CI->load->model('logbooks_model');

Wyświetl plik

@ -37,6 +37,17 @@ class Migration_add_pota_columns extends CI_Migration {
);
$this->dbforge->add_column('station_profile', $fields);
}
if (!$this->db->field_exists('pota', 'bandxuser')) {
$fields = array(
'pota' => array(
'type' => 'INT',
'constraint' => 20,
'unsigned' => TRUE,
),
);
$this->dbforge->add_column('bandxuser', $fields);
$this->db->query("update bandxuser set pota = 1");
}
}
public function down()
@ -50,5 +61,8 @@ class Migration_add_pota_columns extends CI_Migration {
if ($this->db->field_exists('station_pota', 'station_profile')) {
$this->dbforge->drop_column('station_profile', 'station_pota');
}
if ($this->db->field_exists('pota', 'bandxuser')) {
$this->dbforge->drop_column('bandxuser', 'pota');
}
}
}

Wyświetl plik

@ -247,6 +247,7 @@ class Bands extends CI_Model {
'dok' => $band['dok'] == "true" ? '1' : '0',
'dxcc' => $band['dxcc'] == "true" ? '1' : '0',
'iota' => $band['iota'] == "true" ? '1' : '0',
'pota' => $band['pota'] == "true" ? '1' : '0',
'sig' => $band['sig'] == "true" ? '1' : '0',
'sota' => $band['sota'] == "true" ? '1' : '0',
'uscounties' => $band['uscounties'] == "true" ? '1' : '0',
@ -279,8 +280,8 @@ class Bands extends CI_Model {
$this->db->insert('bands', $data);
}
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc)
select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);");
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc)
select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);");
}
function getband($id) {
@ -305,4 +306,4 @@ class Bands extends CI_Model {
}
}
?>
?>

Wyświetl plik

@ -0,0 +1,27 @@
<?php
class Pota extends CI_Model {
function get_all() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
}
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('pota');
$this->db->where_in("station_id", $logbooks_locations_array);
$this->db->where_in("col_band", $bandslots);
$this->db->order_by("COL_POTA_REF", "ASC");
$this->db->where('COL_POTA_REF !=', '');
return $this->db->get($this->config->item('table_name'));
}
}
?>

Wyświetl plik

@ -152,7 +152,7 @@ class User_Model extends CI_Model {
// Add user and insert bandsettings for user
$this->db->insert($this->config->item('auth_table'), $data);
$insert_id = $this->db->insert_id();
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;");
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;");
return OK;
} else {
return EUSERNAMEEXISTS;

Wyświetl plik

@ -0,0 +1,44 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<?php
if ($pota_all) {
?>
<table class="table table-sm table-striped table-hover">
<tr>
<td>Reference</td>
<td>Date/Time</td>
<td>Callsign</td>
<td>Band</td>
<td>RST Sent</td>
<td>RST Received</td>
</tr>
<?php
if ($pota_all->num_rows() > 0) {
foreach ($pota_all->result() as $row) {
?>
<tr>
<td>
<?php echo $row->COL_POTA_REF; ?>
</td>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?> - <?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
<td><?php echo $row->COL_CALL; ?></td>
<td><?php echo $row->COL_BAND; ?></td>
<td><?php echo $row->COL_RST_SENT; ?></td>
<td><?php echo $row->COL_RST_RCVD; ?></td>
</tr>
<?php
}
}
?>
</table>
<?php } else {
echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>Nothing found!</div>';
}?>
</div>

Wyświetl plik

@ -32,6 +32,7 @@
<th>DOK</th>
<th>DXCC</th>
<th>IOTA</th>
<th>POTA</th>
<th>SIG</th>
<th>SOTA</th>
<th>US Counties</th>
@ -55,6 +56,7 @@
<td class='dok_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->dok == 1) {echo 'checked';}?>></td>
<td class='dxcc_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->dxcc == 1) {echo 'checked';}?>></td>
<td class='iota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->iota == 1) {echo 'checked';}?>></td>
<td class='pota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->pota == 1) {echo 'checked';}?>></td>
<td class='sig_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sig == 1) {echo 'checked';}?>></td>
<td class='sota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sota == 1) {echo 'checked';}?>></td>
<td class='uscounties_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->uscounties == 1) {echo 'checked';}?>></td>

Wyświetl plik

@ -116,6 +116,8 @@
<a class="dropdown-item" href="<?php echo site_url('awards/dxcc');?>"><i class="fas fa-trophy"></i> DXCC</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/iota');?>"><i class="fas fa-trophy"></i> IOTA</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/pota');?>"><i class="fas fa-trophy"></i> POTA</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/sig');?>"><i class="fas fa-trophy"></i> SIG</a>
<div class="dropdown-divider"></div>

Wyświetl plik

@ -186,6 +186,7 @@ function saveBand(id) {
'dok': $(".dok_"+id+" input[type='checkbox']").is(":checked"),
'dxcc': $(".dxcc_"+id+" input[type='checkbox']").is(":checked"),
'iota': $(".iota_"+id+" input[type='checkbox']").is(":checked"),
'pota': $(".pota_"+id+" input[type='checkbox']").is(":checked"),
'sig': $(".sig_"+id+" input[type='checkbox']").is(":checked"),
'sota': $(".sota_"+id+" input[type='checkbox']").is(":checked"),
'uscounties': $(".uscounties_"+id+" input[type='checkbox']").is(":checked"),
@ -196,4 +197,4 @@ function saveBand(id) {
success: function (html) {
}
});
}
}