kopia lustrzana https://github.com/magicbug/Cloudlog
[Awards][US Counties] Added US Counties Award. Only totals so far.
rodzic
89d579489a
commit
e558abf890
|
@ -438,4 +438,15 @@ class Awards extends CI_Controller {
|
|||
$data['filter'] = "iota ".$iota. " and ".$band;
|
||||
$this->load->view('awards/details', $data);
|
||||
}
|
||||
|
||||
public function counties() {
|
||||
$this->load->model('counties');
|
||||
$data['counties_array'] = $this->counties->get_counties_array();
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Awards - US Counties";
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/counties/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
class Counties extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetches worked and confirmed counties
|
||||
*/
|
||||
function get_counties_array() {
|
||||
$countiesArray = $this->get_counties_summary();
|
||||
|
||||
if (isset($countiesArray)) {
|
||||
return $countiesArray;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a result of worked/confirmed US Counties, grouped by STATE
|
||||
* QSL card and EQSL is valid for award. Satellite does not count.
|
||||
* No band split, as it only count the number of counties in the award.
|
||||
*/
|
||||
function get_counties_summary() {
|
||||
$station_id = $this->get_station_id();
|
||||
|
||||
$sql = "select count(distinct COL_CNTY) countycountworked, coalesce(x.countycountconfirmed, 0) countycountconfirmed, thcv.COL_STATE
|
||||
from " . $this->config->item('table_name') . " thcv
|
||||
left outer join (
|
||||
select count(distinct COL_CNTY) countycountconfirmed, COL_STATE
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" and COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'
|
||||
and (col_qsl_rcvd='Y' or col_eqsl_qsl_rcvd='Y')
|
||||
group by COL_STATE
|
||||
order by COL_STATE
|
||||
) x on thcv.COL_STATE = x.COL_STATE
|
||||
where station_id =" . $station_id .
|
||||
" and COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'
|
||||
group by thcv.COL_STATE
|
||||
order by thcv.COL_STATE";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
function get_station_id() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
return $CI->Stations->find_active();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<div class="container">
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
<?php if ($counties_array) { ?>
|
||||
<table style="width:100%" class="countiestable table table-sm table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>State</td>
|
||||
<td>Counties Worked</td>
|
||||
<td>Counties Confirmed</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$worked = 0;
|
||||
$confirmed = 0;
|
||||
foreach($counties_array as $band => $counties) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . $counties['COL_STATE'] .'</td>';
|
||||
echo '<td><a href=\'counties?Type="worked"\'>'. $counties['countycountworked'] .'</td>';
|
||||
echo '<td><a href=\'counties?Type="confirmed"\'>'. $counties['countycountconfirmed'] .'</td>';
|
||||
echo '</tr>';
|
||||
$worked += $counties['countycountworked'];
|
||||
$confirmed += $counties['countycountconfirmed'];
|
||||
}
|
||||
?><tfoot><tr>
|
||||
<td>Total</td>
|
||||
<td><?php echo $worked ?></td>
|
||||
<td><?php echo $confirmed ?></td>
|
||||
</tr></tfoot>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</div>
|
|
@ -2929,6 +2929,30 @@ function deleteQsl(id) {
|
|||
});
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(2) == "counties") { ?>
|
||||
<script>
|
||||
$('.countiestable').DataTable({
|
||||
"pageLength": 25,
|
||||
responsive: false,
|
||||
ordering: false,
|
||||
"scrollY": "390px",
|
||||
"scrollCollapse": true,
|
||||
"paging": false,
|
||||
"scrollX": true,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'csv'
|
||||
]
|
||||
});
|
||||
// using this to change color of csv-button if dark mode is chosen
|
||||
var background = $('body').css( "background-color");
|
||||
|
||||
if (background != ('rgb(255, 255, 255)')) {
|
||||
$(".buttons-csv").css("color", "white");
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -111,6 +111,8 @@
|
|||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('awards/sota');?>">SOTA</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('awards/counties');?>">US Counties</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('awards/vucc');?>">VUCC</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="<?php echo site_url('awards/wab');?>">WAB</a>
|
||||
|
|
Ładowanie…
Reference in New Issue