[Awards][US Counties] Can see list of counties now, and QSOs when clicked on county.
这个提交包含在:
父节点
e558abf890
当前提交
7642ab874f
共有 6 个文件被更改,包括 151 次插入 和 12 次删除
|
|
@ -449,4 +449,32 @@ class Awards extends CI_Controller {
|
|||
$this->load->view('awards/counties/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function counties_details() {
|
||||
$this->load->model('counties');
|
||||
$state = str_replace('"', "", $this->input->get("State"));
|
||||
$type = str_replace('"', "", $this->input->get("Type"));
|
||||
$data['counties_array'] = $this->counties->counties_details($state, $type);
|
||||
$data['type'] = $type;
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "US Counties";
|
||||
$data['filter'] = $type . " counties in state ".$state;
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/counties/details');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function counties_details_ajax(){
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$state = str_replace('"', "", $this->input->post("State"));
|
||||
$county = str_replace('"', "", $this->input->post("County"));
|
||||
$data['results'] = $this->logbook_model->county_qso_details($state, $county);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Log View - Counties";
|
||||
$data['filter'] = "county " . $state;
|
||||
$this->load->view('awards/details', $data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
class Counties extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
function __construct() {
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
@ -36,8 +35,8 @@ class Counties extends CI_Model
|
|||
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')
|
||||
" 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')
|
||||
|
|
@ -45,7 +44,7 @@ class Counties extends CI_Model
|
|||
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 COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'
|
||||
group by thcv.COL_STATE
|
||||
|
|
@ -60,4 +59,46 @@ class Counties extends CI_Model
|
|||
$CI->load->model('Stations');
|
||||
return $CI->Stations->find_active();
|
||||
}
|
||||
|
||||
/*
|
||||
* Makes a list of all counties in given state
|
||||
*/
|
||||
function counties_details($state, $type) {
|
||||
if ($type == 'worked') {
|
||||
$counties = $this->get_counties($state, 'none');
|
||||
} else if ($type == 'confirmed') {
|
||||
$counties = $this->get_counties($state, 'confirmed');
|
||||
}
|
||||
if (!isset($counties)) {
|
||||
return 0;
|
||||
} else {
|
||||
ksort($counties);
|
||||
return $counties;
|
||||
}
|
||||
}
|
||||
|
||||
function get_counties($state, $confirmationtype) {
|
||||
$station_id = $this->get_station_id();
|
||||
|
||||
$sql = "select distinct COL_CNTY, COL_STATE
|
||||
from " . $this->config->item('table_name') . " thcv
|
||||
where station_id =" . $station_id .
|
||||
" and COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'";
|
||||
|
||||
if ($state != 'All') {
|
||||
$sql .= " and COL_STATE = '" . $state . "'";
|
||||
}
|
||||
|
||||
if ($confirmationtype != 'none') {
|
||||
$sql .= " and (col_qsl_rcvd='Y' or col_eqsl_qsl_rcvd='Y')";
|
||||
}
|
||||
|
||||
$sql .= " order by thcv.COL_STATE";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2257,6 +2257,20 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
return "Updated";
|
||||
}
|
||||
|
||||
function county_qso_details($state, $county) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
$this->db->where('station_id', $station_id);
|
||||
$this->db->where('COL_STATE', $state);
|
||||
$this->db->where('COL_CNTY', $county);
|
||||
$this->db->where('COL_PROP_MODE !=', 'SAT');
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function validateADIFDate($date, $format = 'Ymd')
|
||||
|
|
@ -2264,4 +2278,8 @@ function validateADIFDate($date, $format = 'Ymd')
|
|||
$d = DateTime::createFromFormat($format, $date);
|
||||
return $d && $d->format($format) == $date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<div class="container">
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<h3>Filtering on <?php echo $filter ?></h3>
|
||||
<?php
|
||||
$i = 1;
|
||||
if ($counties_array) {
|
||||
echo '<table style="width:100%" class="countiestable table table-sm table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>County</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($counties_array as $county) {
|
||||
echo '<tr>
|
||||
<td>'. $i++ .'</td>
|
||||
<td><a href=\'javascript:displayCountyContacts("'. $county['COL_STATE'] .'","'. $county['COL_CNTY'] .'")\'>'. $county['COL_CNTY'] .'</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tbody></table></div>';
|
||||
}
|
||||
else {
|
||||
echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>';
|
||||
}
|
||||
?>
|
||||
|
|
@ -13,19 +13,19 @@
|
|||
<?php
|
||||
$worked = 0;
|
||||
$confirmed = 0;
|
||||
foreach($counties_array as $band => $counties) {
|
||||
foreach($counties_array as $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 '<td><a href=\'counties_details?State="'.$counties['COL_STATE'].'"&Type="worked"\'>'. $counties['countycountworked'] .'</a></td>';
|
||||
echo '<td><a href=\'counties_details?State="'.$counties['COL_STATE'].'"&Type="confirmed"\'>'. $counties['countycountconfirmed'] .'</a></td>';
|
||||
echo '</tr>';
|
||||
$worked += $counties['countycountworked'];
|
||||
$confirmed += $counties['countycountconfirmed'];
|
||||
}
|
||||
?><tfoot><tr>
|
||||
<td>Total</td>
|
||||
<td><?php echo $worked ?></td>
|
||||
<td><?php echo $confirmed ?></td>
|
||||
<td>Total</td>
|
||||
<td><a href=counties_details?State="All"&Type="worked"><?php echo $worked ?></a></td>
|
||||
<td><a href=counties_details?State="All"&Type="confirmed"><?php echo $confirmed ?></a></td>
|
||||
</tr></tfoot>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -2931,7 +2931,7 @@ function deleteQsl(id) {
|
|||
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(2) == "counties") { ?>
|
||||
<?php if ($this->uri->segment(2) == "counties" || $this->uri->segment(2) == "counties_details") { ?>
|
||||
<script>
|
||||
$('.countiestable').DataTable({
|
||||
"pageLength": 25,
|
||||
|
|
@ -2952,6 +2952,31 @@ function deleteQsl(id) {
|
|||
if (background != ('rgb(255, 255, 255)')) {
|
||||
$(".buttons-csv").css("color", "white");
|
||||
}
|
||||
|
||||
function displayCountyContacts(state, county) {
|
||||
var baseURL= "<?php echo base_url();?>";
|
||||
$.ajax({
|
||||
url: baseURL + 'index.php/awards/counties_details_ajax',
|
||||
type: 'post',
|
||||
data: {'State': state, 'County': county
|
||||
},
|
||||
success: function(html) {
|
||||
BootstrapDialog.show({
|
||||
title: 'QSO Data',
|
||||
size: BootstrapDialog.SIZE_WIDE,
|
||||
cssClass: 'qso-counties-dialog',
|
||||
nl2br: false,
|
||||
message: html,
|
||||
buttons: [{
|
||||
label: 'Close',
|
||||
action: function (dialogItself) {
|
||||
dialogItself.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
</body>
|
||||
|
|
|
|||
正在加载…
在新工单中引用