mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
Add Dutch VRZA WAP Worked All Provinces award
This commit is contained in:
@@ -1235,6 +1235,123 @@ class Awards extends CI_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($states);
|
||||
}
|
||||
|
||||
public function wap() {
|
||||
$footerData = [];
|
||||
$footerData['scripts'] = [
|
||||
'assets/js/sections/wapmap_geojson.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wapmap_geojson.js")),
|
||||
'assets/js/sections/wapmap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wapmap.js")),
|
||||
'assets/js/leaflet/L.Maidenhead.js',
|
||||
];
|
||||
|
||||
$this->load->model('wap');
|
||||
$this->load->model('modes');
|
||||
$this->load->model('bands');
|
||||
|
||||
$data['worked_bands'] = $this->bands->get_worked_bands('wap');
|
||||
$data['modes'] = $this->modes->active(); // Used in the view for mode select
|
||||
|
||||
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
|
||||
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
|
||||
$bands = $data['worked_bands'];
|
||||
}
|
||||
else {
|
||||
$bands[] = $this->security->xss_clean($this->input->post('band'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$bands = $data['worked_bands'];
|
||||
}
|
||||
|
||||
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
|
||||
|
||||
if($this->input->method() === 'post') {
|
||||
$postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl'));
|
||||
$postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw'));
|
||||
$postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl'));
|
||||
$postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz'));
|
||||
$postdata['worked'] = $this->security->xss_clean($this->input->post('worked'));
|
||||
$postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed'));
|
||||
$postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked'));
|
||||
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
|
||||
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
|
||||
}
|
||||
else { // Setting default values at first load of page
|
||||
$postdata['qsl'] = 1;
|
||||
$postdata['lotw'] = 1;
|
||||
$postdata['eqsl'] = 0;
|
||||
$postdata['qrz'] = 0;
|
||||
$postdata['worked'] = 1;
|
||||
$postdata['confirmed'] = 1;
|
||||
$postdata['notworked'] = 1;
|
||||
$postdata['band'] = 'All';
|
||||
$postdata['mode'] = 'All';
|
||||
}
|
||||
|
||||
$data['wap_array'] = $this->wap->get_wap_array($bands, $postdata);
|
||||
$data['wap_summary'] = $this->wap->get_wap_summary($bands, $postdata);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = sprintf(__("Awards - %s"), __("WAP"));
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('awards/wap/index');
|
||||
$this->load->view('interface_assets/footer', $footerData);
|
||||
}
|
||||
|
||||
/*
|
||||
function WAP_map
|
||||
|
||||
This displays the WAP Worked All The Netherlands Provinces map and requires the $band_type and $mode_type
|
||||
*/
|
||||
public function wap_map() {
|
||||
$stateString = 'DR,FL,FR,GD,GR,LB,NB,NH,OV,UT,ZH,ZL';
|
||||
$wapArray = explode(',', $stateString);
|
||||
|
||||
$this->load->model('wap');
|
||||
|
||||
$bands[] = $this->security->xss_clean($this->input->post('band'));
|
||||
|
||||
$postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1;
|
||||
$postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1;
|
||||
$postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1;
|
||||
$postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1;
|
||||
$postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1;
|
||||
$postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1;
|
||||
$postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1;
|
||||
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
|
||||
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
|
||||
|
||||
$wap_array = $this->wap->get_wap_array($bands, $postdata);
|
||||
|
||||
$states = array();
|
||||
|
||||
foreach ($wapArray as $state) { // Generating array for use in the table
|
||||
$states[$state] = '-'; // Inits each state's count
|
||||
}
|
||||
|
||||
|
||||
foreach ($wap_array as $was => $value) {
|
||||
foreach ($value as $key) {
|
||||
if($key != "") {
|
||||
if (strpos($key, '>W<') !== false) {
|
||||
$states[$was] = 'W';
|
||||
break;
|
||||
}
|
||||
if (strpos($key, '>C<') !== false) {
|
||||
$states[$was] = 'C';
|
||||
break;
|
||||
}
|
||||
if (strpos($key, '-') !== false) {
|
||||
$states[$was] = '-';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($states);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ class Band extends CI_Controller {
|
||||
$band['sig'] = $this->security->xss_clean($this->input->post('sig'));
|
||||
$band['sota'] = $this->security->xss_clean($this->input->post('sota'));
|
||||
$band['uscounties'] = $this->security->xss_clean($this->input->post('uscounties'));
|
||||
$band['wap'] = $this->security->xss_clean($this->input->post('wap'));
|
||||
$band['was'] = $this->security->xss_clean($this->input->post('was'));
|
||||
$band['wwff'] = $this->security->xss_clean($this->input->post('wwff'));
|
||||
$band['vucc'] = $this->security->xss_clean($this->input->post('vucc'));
|
||||
|
||||
23
application/migrations/245_add_wap_bandxuser.php
Normal file
23
application/migrations/245_add_wap_bandxuser.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Migration_add_wap_bandxuser extends CI_Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'wap TINYINT NOT NULL DEFAULT 1',
|
||||
);
|
||||
|
||||
if (!$this->db->field_exists('wap', 'bandxuser')) {
|
||||
$this->dbforge->add_column('bandxuser', $fields);
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->field_exists('wap', 'bandxuser')) {
|
||||
$this->dbforge->drop_column('bandxuser', 'wap');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,6 +279,7 @@ class Bands extends CI_Model {
|
||||
'sig' => $band['sig'] == "true" ? '1' : '0',
|
||||
'sota' => $band['sota'] == "true" ? '1' : '0',
|
||||
'uscounties' => $band['uscounties'] == "true" ? '1' : '0',
|
||||
'wap' => $band['wap'] == "true" ? '1' : '0',
|
||||
'waja' => $band['waja'] == "true" ? '1' : '0',
|
||||
'was' => $band['was'] == "true" ? '1' : '0',
|
||||
'wwff' => $band['wwff'] == "true" ? '1' : '0',
|
||||
@@ -306,7 +307,7 @@ class Bands extends CI_Model {
|
||||
}
|
||||
|
||||
function add($band_data) {
|
||||
|
||||
|
||||
$this->db->where('band', $band_data['band']);
|
||||
$result = $this->db->get('bands');
|
||||
|
||||
@@ -315,10 +316,10 @@ class Bands extends CI_Model {
|
||||
}
|
||||
|
||||
$binding = [];
|
||||
$sql = "insert into bandxuser (bandid, userid) select bands.id, "
|
||||
. $this->session->userdata('user_id')
|
||||
. " from bands where band = ?
|
||||
and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . "
|
||||
$sql = "insert into bandxuser (bandid, userid) select bands.id, "
|
||||
. $this->session->userdata('user_id')
|
||||
. " from bands where band = ?
|
||||
and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . "
|
||||
and bandid = bands.id);";
|
||||
$binding[] = $band_data['band'];
|
||||
|
||||
|
||||
@@ -582,6 +582,10 @@ class Logbook_model extends CI_Model {
|
||||
$this->db->where('COL_STATE', $searchphrase);
|
||||
$this->db->where_in('COL_DXCC', ['291', '6', '110']);
|
||||
break;
|
||||
case 'WAP':
|
||||
$this->db->where('COL_STATE', $searchphrase);
|
||||
$this->db->where_in('COL_DXCC', ['263']);
|
||||
break;
|
||||
case 'RAC':
|
||||
$this->db->where('COL_STATE', $searchphrase);
|
||||
$this->db->where_in('COL_DXCC', ['1']);
|
||||
@@ -1463,8 +1467,8 @@ class Logbook_model extends CI_Model {
|
||||
} else {
|
||||
$retvals['detail']=__("DXCC has to be Numeric");
|
||||
return $retvals;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'COL_TIME_ON' => $time_on,
|
||||
'COL_TIME_OFF' => $time_off,
|
||||
|
||||
268
application/models/Wap.php
Normal file
268
application/models/Wap.php
Normal file
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
|
||||
class wap extends CI_Model {
|
||||
|
||||
function __construct() {
|
||||
$this->load->library('Genfunctions');
|
||||
}
|
||||
|
||||
public $stateString = 'DR,FL,FR,GD,GR,LB,NB,NH,OV,UT,ZH,ZL';
|
||||
|
||||
|
||||
function get_wap_array($bands, $postdata) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$stateArray = explode(',', $this->stateString);
|
||||
|
||||
$states = array(); // Used for keeping track of which states that are not worked
|
||||
|
||||
$qsl = $this->genfunctions->gen_qsl_from_postdata($postdata);
|
||||
|
||||
foreach ($stateArray as $state) { // Generating array for use in the table
|
||||
$states[$state]['count'] = 0; // Inits each state's count
|
||||
}
|
||||
|
||||
|
||||
foreach ($bands as $band) {
|
||||
foreach ($stateArray as $state) { // Generating array for use in the table
|
||||
$bandwap[$state][$band] = '-'; // Sets all to dash to indicate no result
|
||||
}
|
||||
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$wapBand = $this->getwapWorked($location_list, $band, $postdata);
|
||||
foreach ($wapBand as $line) {
|
||||
$bandwap[$line->col_state][$band] = '<div class="bg-danger awardsBgDanger"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","All","All","'. $postdata['mode'] . '","WAP", "")\'>W</a></div>';
|
||||
$states[$line->col_state]['count']++;
|
||||
}
|
||||
}
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$wapBand = $this->getwapConfirmed($location_list, $band, $postdata);
|
||||
foreach ($wapBand as $line) {
|
||||
$bandwap[$line->col_state][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","All","All","'. $postdata['mode'] . '","WAP", "'.$qsl.'")\'>C</a></div>';
|
||||
$states[$line->col_state]['count']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We want to remove the worked states in the list, since we do not want to display them
|
||||
if ($postdata['worked'] == NULL) {
|
||||
$wapBand = $this->getwapWorked($location_list, $postdata['band'], $postdata);
|
||||
foreach ($wapBand as $line) {
|
||||
unset($bandwap[$line->col_state]);
|
||||
}
|
||||
}
|
||||
|
||||
// We want to remove the confirmed states in the list, since we do not want to display them
|
||||
if ($postdata['confirmed'] == NULL) {
|
||||
$wapBand = $this->getwapConfirmed($location_list, $postdata['band'], $postdata);
|
||||
foreach ($wapBand as $line) {
|
||||
unset($bandwap[$line->col_state]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($postdata['notworked'] == NULL) {
|
||||
foreach ($stateArray as $state) {
|
||||
if ($states[$state]['count'] == 0) {
|
||||
unset($bandwap[$state]);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($bandwap)) {
|
||||
return $bandwap;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function gets worked and confirmed summary on each band on the active stationprofile
|
||||
*/
|
||||
function get_wap_summary($bands, $postdata) {
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
foreach ($bands as $band) {
|
||||
$worked = $this->getSummaryByBand($band, $postdata, $location_list);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list);
|
||||
$wapSummary['worked'][$band] = $worked[0]->count;
|
||||
$wapSummary['confirmed'][$band] = $confirmed[0]->count;
|
||||
}
|
||||
|
||||
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
|
||||
|
||||
$wapSummary['worked']['Total'] = $workedTotal[0]->count;
|
||||
$wapSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
||||
|
||||
return $wapSummary;
|
||||
}
|
||||
|
||||
function getSummaryByBand($band, $postdata, $location_list) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode = ?";
|
||||
$bindings[]=$band;
|
||||
} else if ($band == 'All') {
|
||||
$this->load->model('bands');
|
||||
|
||||
$bandslots = $this->bands->get_worked_bands('wap');
|
||||
|
||||
$bandslots_list = "'".implode("','",$bandslots)."'";
|
||||
|
||||
$sql .= " and thcv.col_band in (" . $bandslots_list . ")" .
|
||||
" and thcv.col_prop_mode !='SAT'";
|
||||
} else {
|
||||
$sql .= " and thcv.col_prop_mode !='SAT'";
|
||||
$sql .= " and thcv.col_band = ?";
|
||||
$bindings[]=$band;
|
||||
}
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->addStateToQuery();
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function getSummaryByBandConfirmed($band, $postdata, $location_list) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode = ?";
|
||||
$bindings[]=$band;
|
||||
} else if ($band == 'All') {
|
||||
$this->load->model('bands');
|
||||
|
||||
$bandslots = $this->bands->get_worked_bands('wap');
|
||||
|
||||
$bandslots_list = "'".implode("','",$bandslots)."'";
|
||||
|
||||
$sql .= " and thcv.col_band in (" . $bandslots_list . ")" .
|
||||
" and thcv.col_prop_mode !='SAT'";
|
||||
} else {
|
||||
$sql .= " and thcv.col_prop_mode !='SAT'";
|
||||
$sql .= " and thcv.col_band = ?";
|
||||
$bindings[]=$band;
|
||||
}
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->genfunctions->addQslToQuery($postdata);
|
||||
|
||||
$sql .= $this->addStateToQuery();
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function returns all worked, but not confirmed states
|
||||
* $postdata contains data from the form, in this case Lotw or QSL are used
|
||||
*/
|
||||
function getwapWorked($location_list, $band, $postdata) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->addStateToQuery();
|
||||
|
||||
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
|
||||
|
||||
$sql .= " and not exists (select 1 from ". $this->config->item('table_name') .
|
||||
" where station_id in (". $location_list . ")" .
|
||||
" and col_state = thcv.col_state";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
|
||||
|
||||
$sql .= $this->genfunctions->addQslToQuery($postdata);
|
||||
|
||||
$sql .= $this->addStateToQuery();
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function returns all confirmed states on given band and on LoTW or QSL
|
||||
* $postdata contains data from the form, in this case Lotw or QSL are used
|
||||
*/
|
||||
function getwapConfirmed($location_list, $band, $postdata) {
|
||||
$bindings=[];
|
||||
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = ? or col_submode = ?)";
|
||||
$bindings[]=$postdata['mode'];
|
||||
$bindings[]=$postdata['mode'];
|
||||
}
|
||||
|
||||
$sql .= $this->addStateToQuery();
|
||||
|
||||
$sql .= $this->genfunctions->addBandToQuery($band,$bindings);
|
||||
|
||||
$sql .= $this->genfunctions->addQslToQuery($postdata);
|
||||
|
||||
$query = $this->db->query($sql,$bindings);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function addStateToQuery() {
|
||||
$sql = '';
|
||||
$sql .= " and COL_DXCC = 263";
|
||||
$sql .= " and COL_STATE in ('DR','FL','FR','GD','GR','LB','NB','NH','OV','UT','ZH','ZL')";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
?>
|
||||
205
application/views/awards/wap/index.php
Normal file
205
application/views/awards/wap/index.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<script>
|
||||
var tileUrl="<?php echo $this->optionslib->get_option('option_map_tile_server');?>";
|
||||
var lang_netherlands_province = "<?= _pgettext("The Netherlands Province", "Province"); ?>";
|
||||
var lang_hover_over_a_province = "<?= __("Hover over a province"); ?>";
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#wapmap {
|
||||
height: calc(100vh - 500px) !important;
|
||||
max-height: 900px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<!-- Award Info Box -->
|
||||
<br>
|
||||
<div id="awardInfoButton">
|
||||
<script>
|
||||
var lang_awards_info_button = "<?= __("Award Info"); ?>";
|
||||
var lang_award_info_ln1 = "<?= __("VRZA WAP Award"); ?>";
|
||||
var lang_award_info_ln2 = "<?= __("The Netherlands spans approximately 300 km from North to South and about 200 km from East to West. Of the country's 18 million inhabitants, around 11,500 are licensed amateur radio operators. The largest amateur radio organizations in the Netherlands are VERON (Vereniging voor Experimenteel Radio Onderzoek in Nederland) and VRZA (Vereniging voor Radio Zend Amateurs). Both organizations are active in organizing events, contests, and training, and they represent Dutch amateurs nationally and internationally."); ?>";
|
||||
var lang_award_info_ln3 = "<?= __("The VRZA (Vereniging voor Radio Zend Amateurs) offers the Worked All Provinces (WAP) award to amateur radio operators who have confirmed contacts with stations in each of the twelve provinces of The Netherlands. This award encourages operators to engage with a diverse range of stations across the country, promoting both national connectivity and operational skill."); ?>";
|
||||
var lang_award_info_ln4 = "<?= sprintf(_pgettext("uses 'here'", "Information about the WAP Awards and its rules can be found %s."), "<a href='https://www.vrza.nl/files/awards/VRZA_Awards_eng.pdf' target='_blank'>" . __("here") . "</a>"); ?>";
|
||||
</script>
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
<button type="button" class="btn btn-sm btn-primary me-1" id="displayAwardInfo"><?= __("Award Info"); ?></button>
|
||||
</div>
|
||||
<!-- End of Award Info Box -->
|
||||
<form class="form" action="<?php echo site_url('awards/wap'); ?>" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-2" for="checkboxes"><?= __("Worked / Confirmed"); ?></div>
|
||||
<div class="col-md-10">
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="worked" id="worked" value="1" <?php if ($this->input->post('worked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="worked"><?= __("Show worked"); ?></label>
|
||||
</div>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="confirmed" id="confirmed" value="1" <?php if ($this->input->post('confirmed') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="confirmed"><?= __("Show confirmed"); ?></label>
|
||||
</div>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="notworked" id="notworked" value="1" <?php if ($this->input->post('notworked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="notworked"><?= __("Show not worked"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-2"><?= __("Show QSO with QSL Type"); ?></div>
|
||||
<div class="col-md-10">
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="qsl" value="1" id="qsl" <?php if ($this->input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="qsl"><?= __("QSL"); ?></label>
|
||||
</div>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="lotw" value="1" id="lotw" <?php if ($this->input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="lotw"><?= __("LoTW"); ?></label>
|
||||
</div>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="eqsl" value="1" id="eqsl" <?php if ($this->input->post('eqsl')) echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="eqsl"><?= __("eQSL"); ?></label>
|
||||
</div>
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="qrz" value="1" id="qrz" <?php if ($this->input->post('qrz')) echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="qrz"><?= __("QRZ.com"); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label class="col-md-2 control-label" for="band2"><?= __("Band"); ?></label>
|
||||
<div class="col-md-2">
|
||||
<select id="band2" name="band" class="form-select form-select-sm">
|
||||
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> ><?= __("Every band"); ?></option>
|
||||
<?php foreach($worked_bands as $band) {
|
||||
echo '<option value="' . $band . '"';
|
||||
if ($this->input->post('band') == $band) echo ' selected';
|
||||
echo '>' . $band . '</option>'."\n";
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label class="col-md-2 control-label" for="mode"><?= __("Mode"); ?></label>
|
||||
<div class="col-md-2">
|
||||
<select id="mode" name="mode" class="form-select form-select-sm">
|
||||
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>><?= __("All"); ?></option>
|
||||
<?php
|
||||
foreach($modes->result() as $mode){
|
||||
if ($mode->submode == null) {
|
||||
echo '<option value="' . $mode->mode . '"';
|
||||
if ($this->input->post('mode') == $mode->mode) echo ' selected';
|
||||
echo '>'. $mode->mode . '</option>'."\n";
|
||||
} else {
|
||||
echo '<option value="' . $mode->submode . '"';
|
||||
if ($this->input->post('mode') == $mode->submode) echo ' selected';
|
||||
echo '>' . $mode->submode . '</option>'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<label class="col-md-2 control-label" for="button1id"></label>
|
||||
<div class="col-md-10">
|
||||
<button id="button2id" type="reset" name="button2id" class="btn btn-sm btn-warning"><?= __("Reset"); ?></button>
|
||||
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary"><?= __("Show"); ?></button>
|
||||
<?php if ($wap_array) {
|
||||
?><button type="button" onclick="load_wap_map();" class="btn btn-info btn-sm"><i class="fas fa-globe-americas"></i> <?= __("Show WAP Map"); ?></button>
|
||||
<?php }?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="table-tab" data-bs-toggle="tab" href="#table" role="tab" aria-controls="table" aria-selected="true"><?= __("Table"); ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="map-tab" onclick="load_wap_map();" data-bs-toggle="tab" href="#wapmaptab" role="tab" aria-controls="home" aria-selected="false"><?= __("Map"); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<br />
|
||||
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade" id="wapmaptab" role="tabpanel" aria-labelledby="home-tab">
|
||||
<br />
|
||||
|
||||
<div id="wapmap" class="map-leaflet" ></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade show active" id="table" role="tabpanel" aria-labelledby="table-tab">
|
||||
|
||||
|
||||
<?php
|
||||
if ($wap_array) {
|
||||
$i = 1;
|
||||
echo '
|
||||
<table style="width:100%" class="table table-sm tablewap table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>#</td>
|
||||
<td>' . __("Province") . '</td>';
|
||||
foreach($bands as $band) {
|
||||
echo '<td>' . $band . '</td>';
|
||||
}
|
||||
echo '</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
foreach ($wap_array as $wap => $value) { // Fills the table with the data
|
||||
echo '<tr>
|
||||
<td>' . $i++ . '</td>
|
||||
<td>'. $wap .'</td>';
|
||||
foreach ($value as $key) {
|
||||
echo '<td style="text-align: center">' . $key . '</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>
|
||||
|
||||
<h2>' . __("Summary") . '</h2>
|
||||
|
||||
<table class="table tablesummary table-sm table-bordered table-hover table-striped table-condensed text-center">
|
||||
<thead>
|
||||
<tr><td></td>';
|
||||
|
||||
foreach($bands as $band) {
|
||||
echo '<td>' . $band . '</td>';
|
||||
}
|
||||
echo '<td>' . __("Total") . '</td></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr><td>' . __("Total worked") . '</td>';
|
||||
|
||||
foreach ($wap_summary['worked'] as $wap) { // Fills the table with the data
|
||||
echo '<td style="text-align: center">' . $wap . '</td>';
|
||||
}
|
||||
|
||||
echo '</tr><tr>
|
||||
<td>' . __("Total confirmed") . '</td>';
|
||||
foreach ($wap_summary['confirmed'] as $wap) { // Fills the table with the data
|
||||
echo '<td style="text-align: center">' . $wap . '</td>';
|
||||
}
|
||||
|
||||
echo '</tr>
|
||||
</table>
|
||||
</div>';
|
||||
}
|
||||
else {
|
||||
echo '<div class="alert alert-danger" role="alert">' . __("Nothing found!") . '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -11,6 +11,7 @@ $sig = 0;
|
||||
$sota = 0;
|
||||
$uscounties = 0;
|
||||
$vucc = 0;
|
||||
$wap = 0;
|
||||
$waja = 0;
|
||||
$was = 0;
|
||||
$wwff = 0;
|
||||
@@ -56,6 +57,7 @@ $wwff = 0;
|
||||
<th><?= __("USA County"); ?></th>
|
||||
<th><?= __("VUCC"); ?></th>
|
||||
<th><?= __("WAJA"); ?></th>
|
||||
<th><?= __("WAP"); ?></th>
|
||||
<th><?= __("WAS"); ?></th>
|
||||
<th><?= __("WWFF"); ?></th>
|
||||
<th><?= __("Bandgroup"); ?></th>
|
||||
@@ -86,6 +88,7 @@ $wwff = 0;
|
||||
<td style="text-align: center; vertical-align: middle;" class='sota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sota == 1) {echo 'checked'; $sota++;}?>></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='uscounties_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->uscounties == 1) {echo 'checked'; $uscounties++;}?>></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='vucc_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->vucc == 1) {echo 'checked'; $vucc++;}?>></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='wap_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->wap == 1) {echo 'checked'; $wap++;}?>></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='waja_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->waja == 1) {echo 'checked'; $waja++;}?>></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='was_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->was == 1) {echo 'checked'; $was++;}?>></td>
|
||||
<td style="text-align: center; vertical-align: middle;" class='wwff_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->wwff == 1) {echo 'checked'; $wwff++;}?>></td>
|
||||
@@ -122,6 +125,7 @@ $wwff = 0;
|
||||
<th class="master_helvetia"><input type="checkbox" <?php if ($helvetia > 0) echo 'checked';?>></th>
|
||||
<th class="master_iota"><input type="checkbox" <?php if ($iota > 0) echo 'checked';?>></th>
|
||||
<th class="master_jcc"><input type="checkbox" <?php if ($jcc > 0) echo 'checked';?>></th>
|
||||
<th class="master_pawap"><input type="checkbox" <?php if ($pawap > 0) echo 'checked';?>></th>
|
||||
<th class="master_pota"><input type="checkbox" <?php if ($pota > 0) echo 'checked';?>></th>
|
||||
<th class="master_rac"><input type="checkbox" <?php if ($rac > 0) echo 'checked';?>></th>
|
||||
<th class="master_sig"><input type="checkbox" <?php if ($sig > 0) echo 'checked';?>></th>
|
||||
|
||||
@@ -246,6 +246,12 @@
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('awards/helvetia'); ?>"><i class="fas fa-trophy"></i> H26</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li><a class="dropdown-item dropdown-toggle dropdown-toggle-submenu" data-bs-toggle="dropdown" href="#">🇳🇱️ <?= __("The Netherlands"); ?></a>
|
||||
<ul class="submenu dropdown-menu">
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('awards/wap'); ?>"><i class="fas fa-trophy"></i> <?= __("WAP Worked All Provinces"); ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="dropdown-divider"></div>
|
||||
<li><a class="dropdown-item dropdown-toggle dropdown-toggle-submenu" data-bs-toggle="dropdown" href="#">🇺🇸 <?= __("USA"); ?></a>
|
||||
<ul class="submenu dropdown-menu">
|
||||
|
||||
@@ -228,6 +228,7 @@ function saveBand(id) {
|
||||
'sota': $(".sota_"+id+" input[type='checkbox']").is(":checked"),
|
||||
'uscounties': $(".uscounties_"+id+" input[type='checkbox']").is(":checked"),
|
||||
'waja': $(".waja_"+id+" input[type='checkbox']").is(":checked"),
|
||||
'wap': $(".wap_"+id+" input[type='checkbox']").is(":checked"),
|
||||
'was': $(".was_"+id+" input[type='checkbox']").is(":checked"),
|
||||
'wwff': $(".wwff_"+id+" input[type='checkbox']").is(":checked"),
|
||||
'vucc': $(".vucc_"+id+" input[type='checkbox']").is(":checked")
|
||||
|
||||
229
assets/js/sections/wapmap.js
Normal file
229
assets/js/sections/wapmap.js
Normal file
@@ -0,0 +1,229 @@
|
||||
var osmUrl = tileUrl;
|
||||
var province;
|
||||
var geojson;
|
||||
var map;
|
||||
var info;
|
||||
var clickmarkers = [];
|
||||
|
||||
const states = 'DR,FL,FR,GD,GR,LB,NB,NH,OV,UT,ZH,ZL';
|
||||
|
||||
const wapmarkers = [
|
||||
[ "52.9", "6.6" ], // DR Drenthe
|
||||
[ "52.5", "5.5" ], // FL Flevoland
|
||||
[ "53.2", "7.7" ], // FR Friesland
|
||||
[ "52.0", "6.0" ], // GD Gelderland
|
||||
[ "53.3", "6.8" ], // GR Groningen
|
||||
[ "51.3", "5.9" ], // LB Limburg
|
||||
[ "51.6", "5.4" ], // NB Noord-Brabant
|
||||
[ "52.6", "4.8" ], // NH Noord-Holland
|
||||
[ "52.4", "6.5" ], // OV Overijssel
|
||||
[ "52.1", "5.1" ], // UT Utrecht
|
||||
[ "52.0", "4.3" ], // ZH Zuid-Holland
|
||||
[ "51.5", "3.8" ] // ZL Zeeland
|
||||
];
|
||||
|
||||
var statearray = states.split(",");
|
||||
|
||||
|
||||
function load_wap_map() {
|
||||
$('.nav-tabs a[href="#wapmaptab"]').tab('show');
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/awards/wap_map',
|
||||
type: 'post',
|
||||
data: {
|
||||
band: $('#band2').val(),
|
||||
mode: $('#mode').val(),
|
||||
worked: +$('#worked').prop('checked'),
|
||||
confirmed: +$('#confirmed').prop('checked'),
|
||||
notworked: +$('#notworked').prop('checked'),
|
||||
qsl: +$('#qsl').prop('checked'),
|
||||
eqsl: +$('#eqsl').prop('checked'),
|
||||
lotw: +$('#lotw').prop('checked'),
|
||||
qrz: +$('#qrz').prop('checked'),
|
||||
},
|
||||
success: function(data) {
|
||||
province = data;
|
||||
load_wap_map2(data);
|
||||
},
|
||||
error: function() {
|
||||
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function load_wap_map2(data) {
|
||||
|
||||
// If map is already initialized
|
||||
var container = L.DomUtil.get('wapmap');
|
||||
|
||||
if(container != null){
|
||||
container._leaflet_id = null;
|
||||
container.remove();
|
||||
$("#wapmaptab").append('<div id="wapmap"></div>');
|
||||
}
|
||||
|
||||
map = new L.Map('wapmap', {
|
||||
fullscreenControl: true,
|
||||
fullscreenControlOptions: {
|
||||
position: 'topleft'
|
||||
},
|
||||
});
|
||||
|
||||
L.tileLayer(
|
||||
osmUrl,
|
||||
{
|
||||
attribution: option_map_tile_server_copyright,
|
||||
maxZoom: 18
|
||||
}
|
||||
).addTo(map);
|
||||
|
||||
var notworked = mapcoordinates.features.length;
|
||||
var confirmed = 0;
|
||||
var workednotconfirmed = 0;
|
||||
|
||||
for(var k in data) {
|
||||
var mapColor = 'red';
|
||||
|
||||
if (data[k] == 'C') {
|
||||
mapColor = 'green';
|
||||
confirmed++;
|
||||
notworked--;
|
||||
}
|
||||
if (data[k] == 'W') {
|
||||
mapColor = 'orange';
|
||||
workednotconfirmed++;
|
||||
notworked--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*Legend specific*/
|
||||
var legend = L.control({ position: "topright" });
|
||||
|
||||
legend.onAdd = function(map) {
|
||||
var div = L.DomUtil.create("div", "legend");
|
||||
div.innerHTML += "<h4>" + lang_general_word_colors + "</h4>";
|
||||
div.innerHTML += "<i style='background: green'></i><span>" + lang_general_word_confirmed + " (" + confirmed + ")</span><br>";
|
||||
div.innerHTML += "<i style='background: orange'></i><span>" + lang_general_word_worked_not_confirmed + " (" + workednotconfirmed + ")</span><br>";
|
||||
div.innerHTML += "<i style='background: red'></i><span>" + lang_general_word_not_worked + " (" + notworked + ")</span><br>";
|
||||
return div;
|
||||
};
|
||||
|
||||
legend.addTo(map);
|
||||
|
||||
info = L.control();
|
||||
|
||||
info.onAdd = function (map) {
|
||||
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
|
||||
this.update();
|
||||
return this._div;
|
||||
};
|
||||
|
||||
// method that we will use to update the control based on feature properties passed
|
||||
info.update = function (props) {
|
||||
this._div.innerHTML = '<h4>' + lang_netherlands_province + '</h4>' + (props ?
|
||||
'<b>' + props.id.substring(3,5) + ' - ' + props.name + '</b><br />' : lang_hover_over_a_province);
|
||||
};
|
||||
|
||||
info.addTo(map);
|
||||
|
||||
geojson = L.geoJson(mapcoordinates, {style: style, onEachFeature: onEachFeature}).addTo(map);
|
||||
|
||||
map.setView([52, 5], 6);
|
||||
|
||||
addMarkers();
|
||||
|
||||
map.on('zoomed', function() {
|
||||
clearMarkers();
|
||||
addMarkers();
|
||||
});
|
||||
|
||||
var layerControl = new L.Control.Layers(null, { [lang_general_gridsquares]: maidenhead = L.maidenhead() }).addTo(map);
|
||||
maidenhead.addTo(map);
|
||||
}
|
||||
|
||||
function clearMarkers() {
|
||||
clickmarkers.forEach(function (item) {
|
||||
map.removeLayer(item)
|
||||
});
|
||||
}
|
||||
|
||||
function addMarkers() {
|
||||
var zoom = map.getZoom();
|
||||
|
||||
for (var i = 0; i < statearray.length; i++) {
|
||||
createMarker(i);
|
||||
}
|
||||
}
|
||||
|
||||
function createMarker(i) {
|
||||
var title = '<span class="grid-text" style="cursor: default"><font style="color: \'white\'; font-size: 1em; font-weight: 900;">' + (statearray[i]) + '</font></span>';
|
||||
var myIcon = L.divIcon({className: 'my-div-icon', html: title});
|
||||
var marker = L.marker(
|
||||
[wapmarkers[i][0], wapmarkers[i][1]], {
|
||||
icon: myIcon,
|
||||
title: (statearray[i]),
|
||||
zIndex: 1000,
|
||||
}
|
||||
).addTo(map).on('click', onClick2);
|
||||
clickmarkers.push(marker);
|
||||
}
|
||||
|
||||
function getColor(d) {
|
||||
return province[d] == 'C' ? 'green' :
|
||||
province[d] == 'W' ? 'orange' :
|
||||
'red';
|
||||
}
|
||||
|
||||
function highlightFeature(e) {
|
||||
var layer = e.target;
|
||||
|
||||
layer.setStyle({
|
||||
weight: 3,
|
||||
color: 'white',
|
||||
dashArray: '',
|
||||
fillOpacity: 0.8
|
||||
});
|
||||
|
||||
layer.bringToFront();
|
||||
info.update(layer.feature.properties);
|
||||
}
|
||||
|
||||
function onEachFeature(feature, layer) {
|
||||
layer.on({
|
||||
mouseover: highlightFeature,
|
||||
mouseout: resetHighlight,
|
||||
click: onClick
|
||||
});
|
||||
}
|
||||
|
||||
function zoomToFeature(e) {
|
||||
map.fitBounds(e.target.getBounds());
|
||||
}
|
||||
|
||||
function resetHighlight(e) {
|
||||
geojson.resetStyle(e.target);
|
||||
info.update();
|
||||
}
|
||||
|
||||
function style(feature) {
|
||||
return {
|
||||
fillColor: getColor(feature.id),
|
||||
weight: 1,
|
||||
opacity: 1,
|
||||
color: 'white',
|
||||
// dashArray: '3',
|
||||
fillOpacity: 0.6
|
||||
};
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
zoomToFeature(e);
|
||||
var marker = e.target;
|
||||
displayContactsOnMap($("#wapmap"),marker.feature.id, $('#band2').val(), 'All', 'All', $('#mode').val(), 'wap');
|
||||
}
|
||||
|
||||
function onClick2(e) {
|
||||
var marker = e.target;
|
||||
displayContactsOnMap($("#wapmap"), marker.options.title, $('#band2').val(), 'All', 'All', $('#mode').val(), 'wap');
|
||||
}
|
||||
15
assets/js/sections/wapmap_geojson.js
Normal file
15
assets/js/sections/wapmap_geojson.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user