kopia lustrzana https://github.com/magicbug/Cloudlog
Enhanced VUCC award to also see only confirmed or worked gridsquares. The worked gridsquares has the calls in the table.
rodzic
e8b660b775
commit
690ee4dcb4
|
@ -164,7 +164,9 @@ class Awards extends CI_Controller {
|
|||
public function vucc_band(){
|
||||
$this->load->model('vucc');
|
||||
$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
|
||||
$data['page_title'] = "VUCC - band";
|
||||
|
|
|
@ -232,19 +232,10 @@ class Logbook_model extends CI_Model {
|
|||
$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_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. "%'";
|
||||
$sql = "select * from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" and (col_gridsquare like '" . $gridsquare. "%'
|
||||
or col_vucc_grids like '%" . $gridsquare. "%')";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
|
|
@ -164,7 +164,7 @@ class VUCC extends CI_Model
|
|||
$sql = "select col_vucc_grids
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" and (LENGTH(col_vucc_grids) > 0) ";
|
||||
" and col_vucc_grids <> '' ";
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
$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
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" and (LENGTH(col_gridsquare) > 0)";
|
||||
" and col_gridsquare <> ''";
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
$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
|
||||
*/
|
||||
function vucc_details($band) {
|
||||
$col_gridsquare_worked = $this->get_vucc_summary($band, 'none');
|
||||
function vucc_details($band, $type) {
|
||||
|
||||
$workedGridArray = array();
|
||||
foreach ($col_gridsquare_worked as $workedgrid) {
|
||||
array_push($workedGridArray, $workedgrid['gridsquare']);
|
||||
if ($type == 'worked') {
|
||||
$workedGridArray = $this->getWorkedGridsList($band, 'none');
|
||||
$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']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
|
||||
if(!in_array($grid_four, $workedGridArray)){
|
||||
array_push($workedGridArray, $grid_four);
|
||||
if (($key = array_search($grid_four, $workedGridArray)) !== false) {
|
||||
unset($workedGridArray[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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) {
|
||||
$vuccBand[$grid]['qsl'] = '';
|
||||
$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() {
|
||||
|
|
|
@ -9,24 +9,35 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>Gridsquare</td>
|
||||
<td>QSL</td>
|
||||
<td>LoTW</td>
|
||||
</tr>
|
||||
<td>Gridsquare</td>';
|
||||
|
||||
if ($type != 'worked') {
|
||||
echo '<td>QSL</td>
|
||||
<td>LoTW</td>';
|
||||
} else {
|
||||
echo '<td>Call</td>';
|
||||
}
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
foreach ($vucc_array as $vucc => $value) { // Fills the table with the data
|
||||
echo '<tr>
|
||||
foreach ($vucc_array as $vucc => $value) { // Fills the table with the data
|
||||
echo '<tr>
|
||||
<td>'. $i++ .'</td>
|
||||
<td><a href=\'javascript:displayVuccContacts("'. $vucc .'","'. $band . '")\'>'. $vucc .'</td>
|
||||
<td>'. $value['qsl'] . '</td>
|
||||
<td>'. $value['lotw'] .'</td>
|
||||
</tr>';
|
||||
<td><a href=\'javascript:displayVuccContacts("'. $vucc .'","'. $band . '")\'>'. $vucc .'</td>';
|
||||
|
||||
if ($type != 'worked') {
|
||||
echo '<td>'. $value['qsl'] . '</td>
|
||||
<td>'. $value['lotw'] .'</td>';
|
||||
} else {
|
||||
echo '<td>'. $value['call'] .'</td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</tfoot></table></div>';
|
||||
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,8 +13,8 @@
|
|||
<?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 '<td><a href=\'vucc_band?Band="'. $band . '"&Type="worked"\'>'. $vucc['worked'] .'</td>';
|
||||
echo '<td><a href=\'vucc_band?Band="'. $band . '"&Type="confirmed"\'>'. $vucc['confirmed'] .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
|
|
Ładowanie…
Reference in New Issue