VUCC award added.
这个提交包含在:
父节点
0ecbef6d9f
当前提交
992eb62a8b
共有 7 个文件被更改,包括 437 次插入 和 0 次删除
|
|
@ -152,6 +152,48 @@ class Awards extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function vucc() {
|
||||
$this->load->model('vucc');
|
||||
$data['worked_bands'] = $this->vucc->get_worked_bands();
|
||||
|
||||
$data['vucc_array'] = $this->vucc->get_vucc_array($data);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Awards - VUCC";
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/vucc/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function vucc_band(){
|
||||
$this->load->model('vucc');
|
||||
$band = str_replace('"', "", $this->input->get("Band"));
|
||||
$data['vucc_array'] = $this->vucc->vucc_details($band);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "VUCC - band";
|
||||
$data['filter'] = "band ".$band;
|
||||
$data['band'] = $band;
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/vucc/band');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function vucc_details(){
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$gridsquare = str_replace('"', "", $this->input->get("Gridsquare"));
|
||||
$band = str_replace('"', "", $this->input->get("Band"));
|
||||
$data['results'] = $this->logbook_model->vucc_qso_details($gridsquare, $band);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Log View - VUCC";
|
||||
$data['filter'] = "vucc " . $gridsquare . " and band ".$band;
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/vucc/details');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
/*
|
||||
Handles Displaying of WAB Squares worked.
|
||||
Comment field - WAB:#
|
||||
|
|
|
|||
|
|
@ -190,6 +190,34 @@ class Logbook_model extends CI_Model {
|
|||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
public function vucc_qso_details($gridsquare, $band) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$sql = "select * from " . $this->config->item('table_name') . " where station_id =" . $station_id . " and col_gridsquare like '" . $gridsquare. "%'";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
} else {
|
||||
$sql .= " and col_band ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " union ";
|
||||
$sql .= "select * from " . $this->config->item('table_name') . " where station_id =" . $station_id . " and col_vucc_grids like '%" . $gridsquare. "%'";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
} else {
|
||||
$sql .= " and col_band ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
|
||||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
public function cq_qso_details($cqzone){
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
|
|
|
|||
301
application/models/Vucc.php
普通文件
301
application/models/Vucc.php
普通文件
|
|
@ -0,0 +1,301 @@
|
|||
<?php
|
||||
|
||||
class VUCC extends CI_Model
|
||||
{
|
||||
|
||||
public $bandslots = array("160m" => 0,
|
||||
"80m" => 0,
|
||||
"60m" => 0,
|
||||
"40m" => 0,
|
||||
"30m" => 0,
|
||||
"20m" => 0,
|
||||
"17m" => 0,
|
||||
"15m" => 0,
|
||||
"12m" => 0,
|
||||
"10m" => 0,
|
||||
"6m" => 0,
|
||||
"4m" => 0,
|
||||
"2m" => 0,
|
||||
"70cm" => 0,
|
||||
"23cm" => 0,
|
||||
"13cm" => 0,
|
||||
"9cm" => 0,
|
||||
"6cm" => 0,
|
||||
"3cm" => 0,
|
||||
"1.25cm" => 0,
|
||||
"SAT" => 0,
|
||||
);
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function get_worked_bands()
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
array_push($worked_slots, $row->COL_BAND);
|
||||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
|
||||
}
|
||||
|
||||
// bring worked-slots in order of defined $bandslots
|
||||
$results = array();
|
||||
foreach (array_keys($this->bandslots) as $slot) {
|
||||
if (in_array($slot, $worked_slots)) {
|
||||
array_push($results, $slot);
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
/*
|
||||
* Fetches worked and confirmed gridsquare on each band and total
|
||||
*/
|
||||
function get_vucc_array($data) {
|
||||
$vuccArray = $this->fetchVucc($data);
|
||||
|
||||
if (isset($vuccArray)) {
|
||||
return $vuccArray;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Builds the array to display worked/confirmed vucc on awward page
|
||||
*/
|
||||
function fetchVucc($data) {
|
||||
$totalGridConfirmed = array();
|
||||
$totalGridWorked = array();
|
||||
|
||||
foreach($data['worked_bands'] as $band) {
|
||||
|
||||
// Getting all the worked grids
|
||||
$col_gridsquare_worked = $this->get_vucc_summary($band, 'none');
|
||||
|
||||
$workedGridArray = array();
|
||||
foreach ($col_gridsquare_worked as $workedgrid) {
|
||||
array_push($workedGridArray, $workedgrid['gridsquare']);
|
||||
if(!in_array($workedgrid['gridsquare'], $totalGridWorked)){
|
||||
array_push($totalGridWorked, $workedgrid['gridsquare']);
|
||||
}
|
||||
}
|
||||
|
||||
$col_vucc_grids_worked = $this->get_vucc_summary_col_vucc($band, 'none');
|
||||
|
||||
foreach ($col_vucc_grids_worked as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
|
||||
if(!in_array($grid_four, $workedGridArray)){
|
||||
array_push($workedGridArray, $grid_four);
|
||||
}
|
||||
|
||||
if(!in_array($grid_four, $totalGridWorked)){
|
||||
array_push($totalGridWorked, $grid_four);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Getting all the confirmed grids
|
||||
$col_gridsquare_confirmed = $this->get_vucc_summary($band, 'both');
|
||||
|
||||
$confirmedGridArray = array();
|
||||
foreach ($col_gridsquare_confirmed as $confirmedgrid) {
|
||||
array_push($confirmedGridArray, $confirmedgrid['gridsquare']);
|
||||
if(!in_array($confirmedgrid['gridsquare'], $totalGridConfirmed)){
|
||||
array_push($totalGridConfirmed, $confirmedgrid['gridsquare']);
|
||||
}
|
||||
}
|
||||
|
||||
$col_vucc_grids_confirmed = $this->get_vucc_summary_col_vucc($band, 'both');
|
||||
|
||||
foreach ($col_vucc_grids_confirmed as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
|
||||
if(!in_array($grid_four, $confirmedGridArray)){
|
||||
array_push($confirmedGridArray, $grid_four);
|
||||
}
|
||||
|
||||
if(!in_array($grid_four, $totalGridConfirmed)){
|
||||
array_push($totalGridConfirmed, $grid_four);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$vuccArray[$band]['worked'] = count($workedGridArray);
|
||||
$vuccArray[$band]['confirmed'] = count($confirmedGridArray);
|
||||
}
|
||||
|
||||
$vuccArray['All']['worked'] = count($totalGridWorked);
|
||||
$vuccArray['All']['confirmed'] = count($totalGridConfirmed);
|
||||
|
||||
return $vuccArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the grid from col_vucc_grids
|
||||
* $band = the band chosen
|
||||
* $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed
|
||||
*/
|
||||
function get_vucc_summary_col_vucc($band, $confirmationMethod) {
|
||||
$station_id = $this->get_station_id();
|
||||
|
||||
$sql = "select col_vucc_grids
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" and (LENGTH(col_vucc_grids) > 0) ";
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
$sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')";
|
||||
}
|
||||
else if ($confirmationMethod == 'qsl') {
|
||||
$sql .= " and col_qsl_rcvd='Y'";
|
||||
}
|
||||
else if ($confirmationMethod == 'lotw') {
|
||||
$sql .= " and col_lotw_qsl_rcvd='Y'";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
} else {
|
||||
$sql .= " and col_band ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the grid from col_gridsquare
|
||||
* $band = the band chosen
|
||||
* $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed
|
||||
*/
|
||||
function get_vucc_summary($band, $confirmationMethod) {
|
||||
$station_id = $this->get_station_id();
|
||||
$sql = "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" and (LENGTH(col_gridsquare) > 0)";
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
$sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')";
|
||||
}
|
||||
else if ($confirmationMethod == 'qsl') {
|
||||
$sql .= " and col_qsl_rcvd='Y'";
|
||||
}
|
||||
else if ($confirmationMethod == 'lotw') {
|
||||
$sql .= " and col_lotw_qsl_rcvd='Y'";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
} else {
|
||||
$sql .= " and col_band ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
/*
|
||||
* Makes a list of all gridsquares on chosen band with info about lotw and qsl
|
||||
*/
|
||||
function vucc_details($band) {
|
||||
$col_gridsquare_worked = $this->get_vucc_summary($band, 'none');
|
||||
|
||||
$workedGridArray = array();
|
||||
foreach ($col_gridsquare_worked as $workedgrid) {
|
||||
array_push($workedGridArray, $workedgrid['gridsquare']);
|
||||
}
|
||||
|
||||
$col_vucc_grids_worked = $this->get_vucc_summary_col_vucc($band, 'none');
|
||||
|
||||
foreach ($col_vucc_grids_worked as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
|
||||
if(!in_array($grid_four, $workedGridArray)){
|
||||
array_push($workedGridArray, $grid_four);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($workedGridArray as $grid) {
|
||||
$vuccBand[$grid]['qsl'] = '';
|
||||
$vuccBand[$grid]['lotw'] = '';
|
||||
}
|
||||
|
||||
$vuccDataQsl = $this->get_vucc_summary($band, 'qsl');
|
||||
|
||||
foreach ($vuccDataQsl as $grid) {
|
||||
$vuccBand[$grid['gridsquare']]['qsl'] = 'Y';
|
||||
}
|
||||
|
||||
$vuccDataLotw = $this->get_vucc_summary($band, 'lotw');
|
||||
|
||||
foreach ($vuccDataLotw as $grid) {
|
||||
$vuccBand[$grid['gridsquare']]['lotw'] = 'Y';
|
||||
}
|
||||
|
||||
$col_vucc_grids_confirmed_qsl = $this->get_vucc_summary_col_vucc($band, 'lotw');
|
||||
|
||||
foreach ($col_vucc_grids_confirmed_qsl as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
$vuccBand[$grid_four]['lotw'] = 'Y';
|
||||
}
|
||||
}
|
||||
|
||||
$col_vucc_grids_confirmed_lotw = $this->get_vucc_summary_col_vucc($band, 'qsl');
|
||||
|
||||
foreach ($col_vucc_grids_confirmed_lotw as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
$vuccBand[$grid_four]['qsl'] = 'Y';
|
||||
}
|
||||
}
|
||||
|
||||
if (count($vuccBand) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
ksort($vuccBand);
|
||||
return $vuccBand;
|
||||
}
|
||||
}
|
||||
|
||||
function get_station_id() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
return $CI->Stations->find_active();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -6,4 +6,5 @@
|
|||
<a class="nav-link" href="<?php echo site_url('awards/sota'); ?>">SOTA</a>
|
||||
<a class="nav-link" href="<?php echo site_url('awards/cq'); ?>">CQ</a>
|
||||
<a class="nav-link" href="<?php echo site_url('awards/dok'); ?>">DOK</a>
|
||||
<a class="nav-link" href="<?php echo site_url('awards/vucc'); ?>">VUCC</a>
|
||||
</nav>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<div class="container">
|
||||
<h1><?php echo $page_title; ?></h1>
|
||||
|
||||
<h3>Filtering on <?php echo $filter ?></h3>
|
||||
<?php
|
||||
$i = 1;
|
||||
if ($vucc_array) {
|
||||
echo '<table class="table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>Gridsquare</td>
|
||||
<td>QSL</td>
|
||||
<td>LoTW</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($vucc_array as $vucc => $value) { // Fills the table with the data
|
||||
echo '<tr>
|
||||
<td>'. $i++ .'</td>
|
||||
<td><a href=\'vucc_details?Gridsquare="'. $vucc .'"&Band="'. $band . '"\'>'. $vucc .'</td>
|
||||
<td>'. $value['qsl'] . '</td>
|
||||
<td>'. $value['lotw'] .'</td>
|
||||
</tr>';
|
||||
}
|
||||
echo '</tfoot></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>';
|
||||
}
|
||||
?>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<div class="container">
|
||||
|
||||
<h2>Logbook</h2>
|
||||
|
||||
<h3>Filtering on <?php echo $filter ?></h3>
|
||||
|
||||
<?php $this->load->view('view_log/partial/log') ?>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<div class="container">
|
||||
<h1><?php echo $page_title; ?></h1>
|
||||
|
||||
<!-- Sub Nav for Awards -->
|
||||
|
||||
<?php $this->load->view("awards/nav_bar")?>
|
||||
<table class="table table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Band</td>
|
||||
<td>Grids worked</td>
|
||||
<td>Grids confirmed</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($vucc_array as $band => $vucc) {
|
||||
echo '<tr>';
|
||||
echo '<td><a href=\'vucc_band?Band="'. $band . '"\'>'. $band .'</td>';
|
||||
echo '<td>' . $vucc['worked'] . '</td>';
|
||||
echo '<td>' . $vucc['confirmed'] . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
正在加载…
在新工单中引用