Enhanced VUCC award to also see only confirmed or worked gridsquares. The worked gridsquares has the calls in the table.

这个提交包含在:
Andreas 2020-10-25 14:59:03 +01:00
父节点 e8b660b775
当前提交 690ee4dcb4
共有 5 个文件被更改,包括 123 次插入45 次删除

查看文件

@ -164,7 +164,9 @@ class Awards extends CI_Controller {
public function vucc_band(){ public function vucc_band(){
$this->load->model('vucc'); $this->load->model('vucc');
$band = str_replace('"', "", $this->input->get("Band")); $band = str_replace('"', "", $this->input->get("Band"));
$data['vucc_array'] = $this->vucc->vucc_details($band); $type = str_replace('"', "", $this->input->get("Type"));
$data['vucc_array'] = $this->vucc->vucc_details($band, $type);
$data['type'] = $type;
// Render Page // Render Page
$data['page_title'] = "VUCC - band"; $data['page_title'] = "VUCC - band";

查看文件

@ -232,19 +232,10 @@ class Logbook_model extends CI_Model {
$CI =& get_instance(); $CI =& get_instance();
$CI->load->model('Stations'); $CI->load->model('Stations');
$station_id = $CI->Stations->find_active(); $station_id = $CI->Stations->find_active();
$sql = "select * from " . $this->config->item('table_name') . " where station_id =" . $station_id . " and col_gridsquare like '" . $gridsquare. "%'"; $sql = "select * from " . $this->config->item('table_name') .
" where station_id =" . $station_id .
if ($band != 'All') { " and (col_gridsquare like '" . $gridsquare. "%'
if ($band == 'SAT') { or col_vucc_grids like '%" . $gridsquare. "%')";
$sql .= " and col_prop_mode ='" . $band . "'";
} else {
$sql .= " and col_prop_mode !='SAT'";
$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 != 'All') {
if ($band == 'SAT') { if ($band == 'SAT') {

查看文件

@ -164,7 +164,7 @@ class VUCC extends CI_Model
$sql = "select col_vucc_grids $sql = "select col_vucc_grids
from " . $this->config->item('table_name') . from " . $this->config->item('table_name') .
" where station_id =" . $station_id . " where station_id =" . $station_id .
" and (LENGTH(col_vucc_grids) > 0) "; " and col_vucc_grids <> '' ";
if ($confirmationMethod == 'both') { if ($confirmationMethod == 'both') {
$sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')"; $sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')";
@ -199,7 +199,7 @@ class VUCC extends CI_Model
$sql = "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare $sql = "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare
from " . $this->config->item('table_name') . from " . $this->config->item('table_name') .
" where station_id =" . $station_id . " where station_id =" . $station_id .
" and (LENGTH(col_gridsquare) > 0)"; " and col_gridsquare <> ''";
if ($confirmationMethod == 'both') { if ($confirmationMethod == 'both') {
$sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')"; $sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')";
@ -228,27 +228,81 @@ class VUCC extends CI_Model
/* /*
* Makes a list of all gridsquares on chosen band with info about lotw and qsl * Makes a list of all gridsquares on chosen band with info about lotw and qsl
*/ */
function vucc_details($band) { function vucc_details($band, $type) {
$col_gridsquare_worked = $this->get_vucc_summary($band, 'none');
$workedGridArray = array(); if ($type == 'worked') {
foreach ($col_gridsquare_worked as $workedgrid) { $workedGridArray = $this->getWorkedGridsList($band, 'none');
array_push($workedGridArray, $workedgrid['gridsquare']); $vuccBand = $this->removeConfirmedGrids($band, $workedGridArray);
} else if ($type == 'confirmed') {
$workedGridArray = $this->getWorkedGridsList($band, 'both');
$vuccBand = $this->markConfirmedGrids($band, $workedGridArray);
} else {
$workedGridArray = $this->getWorkedGridsList($band, 'none');
$vuccBand = $this->markConfirmedGrids($band, $workedGridArray);
} }
$col_vucc_grids_worked = $this->get_vucc_summary_col_vucc($band, 'none'); if (count($vuccBand) == 0) {
return 0;
} else {
ksort($vuccBand);
return $vuccBand;
}
}
foreach ($col_vucc_grids_worked as $gridSplit) { function removeConfirmedGrids($band, $workedGridArray) {
$vuccDataQsl = $this->get_vucc_summary($band, 'qsl');
foreach ($vuccDataQsl as $grid) {
if (($key = array_search($grid['gridsquare'], $workedGridArray)) !== false) {
unset($workedGridArray[$key]);
}
}
$vuccDataLotw = $this->get_vucc_summary($band, 'lotw');
foreach ($vuccDataLotw as $grid) {
if (($key = array_search($grid['gridsquare'], $workedGridArray)) !== false) {
unset($workedGridArray[$key]);
}
}
$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']); $grids = explode(",", $gridSplit['col_vucc_grids']);
foreach($grids as $key) { foreach($grids as $key) {
$grid_four = strtoupper(substr(trim($key),0,4)); $grid_four = strtoupper(substr(trim($key),0,4));
if (($key = array_search($grid_four, $workedGridArray)) !== false) {
if(!in_array($grid_four, $workedGridArray)){ unset($workedGridArray[$key]);
array_push($workedGridArray, $grid_four);
} }
} }
} }
$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));
if (($key = array_search($grid_four, $workedGridArray)) !== false) {
unset($workedGridArray[$key]);
}
}
}
foreach ($workedGridArray as $grid) {
$this->load->model('logbook_model');
$result = $this->logbook_model->vucc_qso_details($grid, $band);
$callsignlist = '';
foreach($result->result() as $call) {
$callsignlist .= $call->COL_CALL . ' ';
}
$vuccBand[$grid]['call'] = $callsignlist;
}
return $vuccBand;
}
function markConfirmedGrids($band, $workedGridArray) {
foreach ($workedGridArray as $grid) { foreach ($workedGridArray as $grid) {
$vuccBand[$grid]['qsl'] = ''; $vuccBand[$grid]['qsl'] = '';
$vuccBand[$grid]['lotw'] = ''; $vuccBand[$grid]['lotw'] = '';
@ -286,12 +340,32 @@ class VUCC extends CI_Model
} }
} }
if (count($vuccBand) == 0) {
return 0;
} else {
ksort($vuccBand);
return $vuccBand; return $vuccBand;
} }
function getWorkedGridsList($band, $confirmationMethod) {
$col_gridsquare_worked = $this->get_vucc_summary($band, $confirmationMethod);
$workedGridArray = array();
foreach ($col_gridsquare_worked as $workedgrid) {
array_push($workedGridArray, $workedgrid['gridsquare']);
}
$col_vucc_grids_worked = $this->get_vucc_summary_col_vucc($band, $confirmationMethod);
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);
}
}
}
return $workedGridArray;
} }
function get_station_id() { function get_station_id() {

查看文件

@ -9,21 +9,32 @@
<thead> <thead>
<tr> <tr>
<td>#</td> <td>#</td>
<td>Gridsquare</td> <td>Gridsquare</td>';
<td>QSL</td>
<td>LoTW</td> if ($type != 'worked') {
</tr> echo '<td>QSL</td>
<td>LoTW</td>';
} else {
echo '<td>Call</td>';
}
echo '</tr>
</thead> </thead>
<tbody>'; <tbody>';
foreach ($vucc_array as $vucc => $value) { // Fills the table with the data foreach ($vucc_array as $vucc => $value) { // Fills the table with the data
echo '<tr> echo '<tr>
<td>'. $i++ .'</td> <td>'. $i++ .'</td>
<td><a href=\'javascript:displayVuccContacts("'. $vucc .'","'. $band . '")\'>'. $vucc .'</td> <td><a href=\'javascript:displayVuccContacts("'. $vucc .'","'. $band . '")\'>'. $vucc .'</td>';
<td>'. $value['qsl'] . '</td>
<td>'. $value['lotw'] .'</td> if ($type != 'worked') {
</tr>'; echo '<td>'. $value['qsl'] . '</td>
<td>'. $value['lotw'] .'</td>';
} else {
echo '<td>'. $value['call'] .'</td>';
} }
echo '</tfoot></table></div>';
echo '</tr>';
}
echo '</tbody></table></div>';
} }
else { else {

查看文件

@ -13,8 +13,8 @@
<?php foreach($vucc_array as $band => $vucc) { <?php foreach($vucc_array as $band => $vucc) {
echo '<tr>'; echo '<tr>';
echo '<td><a href=\'vucc_band?Band="'. $band . '"\'>'. $band .'</td>'; echo '<td><a href=\'vucc_band?Band="'. $band . '"\'>'. $band .'</td>';
echo '<td>' . $vucc['worked'] . '</td>'; echo '<td><a href=\'vucc_band?Band="'. $band . '"&Type="worked"\'>'. $vucc['worked'] .'</td>';
echo '<td>' . $vucc['confirmed'] . '</td>'; echo '<td><a href=\'vucc_band?Band="'. $band . '"&Type="confirmed"\'>'. $vucc['confirmed'] .'</td>';
echo '</tr>'; echo '</tr>';
} }
?> ?>