Merge pull request #2220 from AndreasK79/gridmap
[Gridmap] Added gridsquare map with filtering
这个提交包含在:
当前提交
66c3c91900
共有 11 个文件被更改,包括 901 次插入 和 3 次删除
|
|
@ -106,6 +106,7 @@ $autoload['language'] = array(
|
||||||
'notes',
|
'notes',
|
||||||
'qslcard',
|
'qslcard',
|
||||||
'qso',
|
'qso',
|
||||||
|
'gridsquares'
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
178
application/controllers/Gridmap.php
普通文件
178
application/controllers/Gridmap.php
普通文件
|
|
@ -0,0 +1,178 @@
|
||||||
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Gridmap extends CI_Controller {
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$data['page_title'] = lang('gridsquares_gridsquare_map');
|
||||||
|
|
||||||
|
$this->load->model('bands');
|
||||||
|
$this->load->model('gridmap_model');
|
||||||
|
|
||||||
|
$data['modes'] = $this->gridmap_model->get_worked_modes();
|
||||||
|
$data['bands'] = $this->bands->get_worked_bands();
|
||||||
|
$data['sats_available'] = $this->bands->get_worked_sats();
|
||||||
|
|
||||||
|
$data['layer'] = $this->optionslib->get_option('option_map_tile_server');
|
||||||
|
|
||||||
|
$data['attribution'] = $this->optionslib->get_option('option_map_tile_server_copyright');
|
||||||
|
|
||||||
|
$data['gridsquares_gridsquares'] = lang('gridsquares_gridsquares');
|
||||||
|
$data['gridsquares_gridsquares_confirmed'] = lang('gridsquares_gridsquares_confirmed');
|
||||||
|
$data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed');
|
||||||
|
$data['gridsquares_gridsquares_total_worked'] = lang('gridsquares_gridsquares_total_worked');
|
||||||
|
|
||||||
|
$footerData = [];
|
||||||
|
$footerData['scripts'] = [
|
||||||
|
'assets/js/leaflet/L.MaidenheadColouredGridMap.js',
|
||||||
|
'assets/js/sections/gridmap.js?'
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->load->view('interface_assets/header', $data);
|
||||||
|
$this->load->view('gridmap/index');
|
||||||
|
$this->load->view('interface_assets/footer', $footerData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGridsjs() {
|
||||||
|
$band = $this->security->xss_clean($this->input->post('band'));
|
||||||
|
$mode = $this->security->xss_clean($this->input->post('mode'));
|
||||||
|
$qsl = $this->security->xss_clean($this->input->post('qsl'));
|
||||||
|
$lotw = $this->security->xss_clean($this->input->post('lotw'));
|
||||||
|
$eqsl = $this->security->xss_clean($this->input->post('eqsl'));
|
||||||
|
$sat = $this->security->xss_clean($this->input->post('sat'));
|
||||||
|
$this->load->model('gridmap_model');
|
||||||
|
|
||||||
|
$array_grid_2char = array();
|
||||||
|
$array_grid_4char = array();
|
||||||
|
$array_grid_6char = array();
|
||||||
|
|
||||||
|
$array_grid_2char_confirmed = array();
|
||||||
|
$array_grid_4char_confirmed = array();
|
||||||
|
$array_grid_6char_confirmed = array();
|
||||||
|
|
||||||
|
$grid_2char = "";
|
||||||
|
$grid_4char = "";
|
||||||
|
$grid_6char = "";
|
||||||
|
|
||||||
|
$grid_2char_confirmed = "";
|
||||||
|
$grid_4char_confirmed = "";
|
||||||
|
$grid_6char_confirmed = "";
|
||||||
|
|
||||||
|
$query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat);
|
||||||
|
|
||||||
|
if ($query && $query->num_rows() > 0) {
|
||||||
|
foreach ($query->result() as $row) {
|
||||||
|
$grid_2char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,2));
|
||||||
|
$grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,4));
|
||||||
|
if ($this->config->item('map_6digit_grids')) {
|
||||||
|
$grid_6char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,6));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if 2 Char is in array
|
||||||
|
if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){
|
||||||
|
array_push($array_grid_2char_confirmed, $grid_2char_confirmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){
|
||||||
|
array_push($array_grid_4char_confirmed, $grid_4char_confirmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->config->item('map_6digit_grids')) {
|
||||||
|
if(!in_array($grid_6char_confirmed, $array_grid_6char_confirmed)){
|
||||||
|
array_push($array_grid_6char_confirmed, $grid_6char_confirmed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $sat);
|
||||||
|
|
||||||
|
if ($query && $query->num_rows() > 0) {
|
||||||
|
foreach ($query->result() as $row) {
|
||||||
|
|
||||||
|
$grid_two = strtoupper(substr($row->GRID_SQUARES,0,2));
|
||||||
|
$grid_four = strtoupper(substr($row->GRID_SQUARES,0,4));
|
||||||
|
if ($this->config->item('map_6digit_grids')) {
|
||||||
|
$grid_six = strtoupper(substr($row->GRID_SQUARES,0,6));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if 2 Char is in array
|
||||||
|
if(!in_array($grid_two, $array_grid_2char)){
|
||||||
|
array_push($array_grid_2char, $grid_two);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!in_array($grid_four, $array_grid_4char)){
|
||||||
|
array_push($array_grid_4char, $grid_four);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->config->item('map_6digit_grids')) {
|
||||||
|
if(!in_array($grid_six, $array_grid_6char)){
|
||||||
|
array_push($array_grid_6char, $grid_six);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat);
|
||||||
|
|
||||||
|
if ($query_vucc && $query_vucc->num_rows() > 0) {
|
||||||
|
foreach ($query_vucc->result() as $row) {
|
||||||
|
|
||||||
|
$grids = explode(",", $row->COL_VUCC_GRIDS);
|
||||||
|
|
||||||
|
foreach($grids as $key) {
|
||||||
|
$grid_two = strtoupper(substr($key,0,2));
|
||||||
|
$grid_four = strtoupper(substr($key,0,4));
|
||||||
|
|
||||||
|
// Check if 2 Char is in array
|
||||||
|
if(!in_array($grid_two, $array_grid_2char)){
|
||||||
|
array_push($array_grid_2char, $grid_two);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!in_array($grid_four, $array_grid_4char)){
|
||||||
|
array_push($array_grid_4char, $grid_four);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Confirmed Squares
|
||||||
|
$query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat);
|
||||||
|
|
||||||
|
if ($query_vucc && $query_vucc->num_rows() > 0) {
|
||||||
|
foreach ($query_vucc->result() as $row) {
|
||||||
|
|
||||||
|
$grids = explode(",", $row->COL_VUCC_GRIDS);
|
||||||
|
|
||||||
|
foreach($grids as $key) {
|
||||||
|
$grid_2char_confirmed = strtoupper(substr($key,0,2));
|
||||||
|
$grid_4char_confirmed = strtoupper(substr($key,0,4));
|
||||||
|
|
||||||
|
// Check if 2 Char is in array
|
||||||
|
if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){
|
||||||
|
array_push($array_grid_2char_confirmed, $grid_2char_confirmed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){
|
||||||
|
array_push($array_grid_4char_confirmed, $grid_4char_confirmed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['grid_2char_confirmed'] = ($array_grid_2char_confirmed);
|
||||||
|
$data['grid_4char_confirmed'] = ($array_grid_4char_confirmed);
|
||||||
|
$data['grid_6char_confirmed'] = ($array_grid_6char_confirmed);
|
||||||
|
|
||||||
|
$data['grid_2char'] = ($array_grid_2char);
|
||||||
|
$data['grid_4char'] = ($array_grid_4char);
|
||||||
|
$data['grid_6char'] = ($array_grid_6char);
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$lang['gridsquares_gridsquare_map'] = 'Gridsquare map';
|
$lang['gridsquares_gridsquare_map'] = 'Gridsquare map';
|
||||||
|
|
||||||
$lang['gridsquares_confirmed_is_green'] = 'Confirmed is Green';
|
$lang['gridsquares_confirmed_is_green'] = 'Confirmed is Green';
|
||||||
|
|
@ -14,3 +12,15 @@ $lang['gridsquares_this_map_does_not_include_satellite_internet_or_repeater_qsos
|
||||||
|
|
||||||
$lang['gridsquares_grid_squares'] = 'grid square';
|
$lang['gridsquares_grid_squares'] = 'grid square';
|
||||||
$lang['gridsquares_total_count'] = 'Total count';
|
$lang['gridsquares_total_count'] = 'Total count';
|
||||||
|
|
||||||
|
$lang['gridsquares_band'] = 'Band';
|
||||||
|
$lang['gridsquares_mode'] = 'Mode';
|
||||||
|
$lang['gridsquares_sat'] = 'Satellite';
|
||||||
|
$lang['gridsquares_confirmation'] = 'Confirmation';
|
||||||
|
|
||||||
|
$lang['gridsquares_button_plot'] = 'Plot';
|
||||||
|
|
||||||
|
$lang['gridsquares_gridsquares'] = 'Gridsquares';
|
||||||
|
$lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed';
|
||||||
|
$lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed';
|
||||||
|
$lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked';
|
||||||
|
|
@ -21,6 +21,7 @@ $lang['menu_notes'] = 'Notes';
|
||||||
$lang['menu_analytics'] = 'Analytics';
|
$lang['menu_analytics'] = 'Analytics';
|
||||||
$lang['menu_statistics'] = 'Statistics';
|
$lang['menu_statistics'] = 'Statistics';
|
||||||
$lang['menu_gridsquares'] = 'Gridsquares';
|
$lang['menu_gridsquares'] = 'Gridsquares';
|
||||||
|
$lang['menu_gridmap'] = 'Gridmap';
|
||||||
$lang['menu_activated_gridsquares'] = 'Activated Gridsquares';
|
$lang['menu_activated_gridsquares'] = 'Activated Gridsquares';
|
||||||
$lang['menu_gridsquare_activators'] = 'Gridsquare Activators';
|
$lang['menu_gridsquare_activators'] = 'Gridsquare Activators';
|
||||||
$lang['menu_distances_worked'] = 'Distances Worked';
|
$lang['menu_distances_worked'] = 'Distances Worked';
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,15 @@ $lang['gridsquares_this_map_does_not_include_satellite_internet_or_repeater_qsos
|
||||||
|
|
||||||
$lang['gridsquares_grid_squares'] = 'Planquadrate';
|
$lang['gridsquares_grid_squares'] = 'Planquadrate';
|
||||||
$lang['gridsquares_total_count'] = 'Summe';
|
$lang['gridsquares_total_count'] = 'Summe';
|
||||||
|
|
||||||
|
$lang['gridsquares_band'] = 'Band';
|
||||||
|
$lang['gridsquares_mode'] = 'Mode';
|
||||||
|
$lang['gridsquares_sat'] = 'Satellit';
|
||||||
|
$lang['gridsquares_confirmation'] = 'Bestätigung';
|
||||||
|
|
||||||
|
$lang['gridsquares_button_plot'] = 'Kartieren';
|
||||||
|
|
||||||
|
$lang['gridsquares_gridsquares'] = 'Planquadrate';
|
||||||
|
$lang['gridsquares_gridsquares_confirmed'] = 'Planquadrate bestätigt';
|
||||||
|
$lang['gridsquares_gridsquares_not_confirmed'] = 'Planquadrate nicht bestätigt';
|
||||||
|
$lang['gridsquares_gridsquares_total_worked'] = 'Summe gearbeiteter Planquadrate';
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ $lang['menu_notes'] = 'Notizen';
|
||||||
$lang['menu_analytics'] = 'Analysen';
|
$lang['menu_analytics'] = 'Analysen';
|
||||||
$lang['menu_statistics'] = 'Statistik';
|
$lang['menu_statistics'] = 'Statistik';
|
||||||
$lang['menu_gridsquares'] = 'Planquadrate';
|
$lang['menu_gridsquares'] = 'Planquadrate';
|
||||||
|
$lang['menu_gridmap'] = 'Planquadratkarte';
|
||||||
$lang['menu_activated_gridsquares'] = 'Aktivierte Planquadrate';
|
$lang['menu_activated_gridsquares'] = 'Aktivierte Planquadrate';
|
||||||
$lang['menu_gridsquare_activators'] = 'Planquadrat-Aktivierer';
|
$lang['menu_gridsquare_activators'] = 'Planquadrat-Aktivierer';
|
||||||
$lang['menu_distances_worked'] = 'Gearbeitete Entfernungen';
|
$lang['menu_distances_worked'] = 'Gearbeitete Entfernungen';
|
||||||
|
|
|
||||||
226
application/models/Gridmap_model.php
普通文件
226
application/models/Gridmap_model.php
普通文件
|
|
@ -0,0 +1,226 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Gridmap_model extends CI_Model {
|
||||||
|
|
||||||
|
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||||
|
$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)."'";
|
||||||
|
|
||||||
|
$sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM '
|
||||||
|
.$this->config->item('table_name')
|
||||||
|
.' WHERE station_id in ('
|
||||||
|
.$location_list.') AND COL_GRIDSQUARE != ""';
|
||||||
|
|
||||||
|
if ($band != 'All') {
|
||||||
|
if ($band == 'SAT') {
|
||||||
|
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||||
|
if ($sat != 'All') {
|
||||||
|
$sql .= " and col_sat_name ='" . $sat . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= " and col_prop_mode !='SAT'";
|
||||||
|
$sql .= " and col_band ='" . $band . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode != 'All') {
|
||||||
|
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $this->addQslToQuery($qsl, $lotw, $eqsl);
|
||||||
|
|
||||||
|
return $this->db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||||
|
$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)."'";
|
||||||
|
|
||||||
|
$sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM '
|
||||||
|
.$this->config->item('table_name')
|
||||||
|
.' WHERE station_id in ('
|
||||||
|
.$location_list.') AND COL_GRIDSQUARE != ""';
|
||||||
|
|
||||||
|
if ($band != 'All') {
|
||||||
|
if ($band == 'SAT') {
|
||||||
|
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||||
|
if ($sat != 'All') {
|
||||||
|
$sql .= " and col_sat_name ='" . $sat . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= " and col_prop_mode !='SAT'";
|
||||||
|
$sql .= " and col_band ='" . $band . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode != 'All') {
|
||||||
|
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||||
|
$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)."'";
|
||||||
|
|
||||||
|
$sql = 'SELECT distinct COL_VUCC_GRIDS, COL_BAND FROM '
|
||||||
|
.$this->config->item('table_name')
|
||||||
|
.' WHERE station_id in ('
|
||||||
|
.$location_list.') AND COL_VUCC_GRIDS != ""';
|
||||||
|
|
||||||
|
if ($band != 'All') {
|
||||||
|
if ($band == 'SAT') {
|
||||||
|
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||||
|
if ($sat != 'All') {
|
||||||
|
$sql .= " and col_sat_name ='" . $sat . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= " and col_prop_mode !='SAT'";
|
||||||
|
$sql .= " and col_band ='" . $band . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode != 'All') {
|
||||||
|
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||||
|
$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)."'";
|
||||||
|
|
||||||
|
$sql = 'SELECT distinct COL_VUCC_GRIDS, COL_BAND FROM '
|
||||||
|
.$this->config->item('table_name')
|
||||||
|
.' WHERE station_id in ('
|
||||||
|
.$location_list.') AND COL_VUCC_GRIDS != ""';
|
||||||
|
|
||||||
|
if ($band != 'All') {
|
||||||
|
if ($band == 'SAT') {
|
||||||
|
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||||
|
if ($sat != 'All') {
|
||||||
|
$sql .= " and col_sat_name ='" . $sat . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= " and col_prop_mode !='SAT'";
|
||||||
|
$sql .= " and col_band ='" . $band . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode != 'All') {
|
||||||
|
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $this->addQslToQuery($qsl, $lotw, $eqsl);
|
||||||
|
|
||||||
|
return $this->db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adds confirmation to query
|
||||||
|
function addQslToQuery($qsl, $lotw, $eqsl) {
|
||||||
|
$sql = '';
|
||||||
|
if ($lotw == "true" && $qsl == "false" && $eqsl == "false") {
|
||||||
|
$sql .= " and col_lotw_qsl_rcvd = 'Y'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($qsl == "true" && $lotw == "false" && $eqsl == "false") {
|
||||||
|
$sql .= " and col_qsl_rcvd = 'Y'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($eqsl == "true" && $lotw == "false" && $qsl == "false") {
|
||||||
|
$sql .= " and col_eqsl_qsl_rcvd = 'Y'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($lotw == "true" && $qsl == "true" && $eqsl == "false") {
|
||||||
|
$sql .= " and (col_lotw_qsl_rcvd = 'Y' or col_qsl_rcvd = 'Y')";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($qsl == "true" && $lotw == "false" && $eqsl == "true") {
|
||||||
|
$sql .= " and (col_qsl_rcvd = 'Y' or col_eqsl_qsl_rcvd = 'Y')";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($eqsl == "true" && $lotw == "true" && $qsl == "false") {
|
||||||
|
$sql .= " and (col_eqsl_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($qsl == "true" && $lotw == "true" && $eqsl == "true") {
|
||||||
|
$sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y' or col_eqsl_qsl_rcvd = 'Y')";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($qsl == "false" && $lotw == "false" && $eqsl == "false") {
|
||||||
|
$sql .= " and (col_qsl_rcvd != 'Y' and col_lotw_qsl_rcvd != 'Y' and col_eqsl_qsl_rcvd != 'Y')";
|
||||||
|
}
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get's the worked modes from the log
|
||||||
|
*/
|
||||||
|
function get_worked_modes() {
|
||||||
|
$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)."'";
|
||||||
|
|
||||||
|
// get all worked modes from database
|
||||||
|
$data = $this->db->query(
|
||||||
|
"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") order by COL_MODE ASC"
|
||||||
|
);
|
||||||
|
$results = array();
|
||||||
|
foreach ($data->result() as $row) {
|
||||||
|
array_push($results, $row->COL_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->db->query(
|
||||||
|
"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC"
|
||||||
|
);
|
||||||
|
foreach ($data->result() as $row) {
|
||||||
|
if (!in_array($row, $results)) {
|
||||||
|
array_push($results, $row->COL_SUBMODE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
asort($results);
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
application/views/gridmap/index.php
普通文件
107
application/views/gridmap/index.php
普通文件
|
|
@ -0,0 +1,107 @@
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/*Legend specific*/
|
||||||
|
.legend {
|
||||||
|
padding: 6px 8px;
|
||||||
|
font: 14px Arial, Helvetica, sans-serif;
|
||||||
|
background: white;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
line-height: 24px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.legend h4 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 2px 12px 8px;
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
.legend span {
|
||||||
|
position: relative;
|
||||||
|
bottom: 3px;
|
||||||
|
}
|
||||||
|
.legend i {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
float: left;
|
||||||
|
margin: 0 8px 0 0;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h2><?php echo $page_title; ?></h2>
|
||||||
|
|
||||||
|
<form class="form-inline">
|
||||||
|
<label class="my-1 mr-2" for="band"><?php echo lang('gridsquares_band'); ?></label>
|
||||||
|
<select class="custom-select my-1 mr-sm-2" id="band">
|
||||||
|
<option value="All">All</option>
|
||||||
|
<?php foreach($bands as $band) {
|
||||||
|
echo '<option value="' . $band . '"' . '>' . $band . '</option>'."\n";
|
||||||
|
} ?>
|
||||||
|
</select>
|
||||||
|
<?php if (count($sats_available) != 0) { ?>
|
||||||
|
<label class="my-1 mr-2" for="distplot_sats"><?php echo lang('gridsquares_sat'); ?></label>
|
||||||
|
<select class="custom-select my-1 mr-sm-2" id="sats" disabled>
|
||||||
|
<option value="All">All</option>
|
||||||
|
<?php foreach($sats_available as $sat) {
|
||||||
|
echo '<option value="' . $sat . '"' . '>' . $sat . '</option>'."\n";
|
||||||
|
} ?>
|
||||||
|
</select>
|
||||||
|
<?php } else { ?>
|
||||||
|
<input id="sats" type="hidden" value="All"></input>
|
||||||
|
<?php } ?>
|
||||||
|
<label class="my-1 mr-2" for="mode"><?php echo lang('gridsquares_mode'); ?></label>
|
||||||
|
<select class="custom-select my-1 mr-sm-2" id="mode">
|
||||||
|
<option value="All">All</option>
|
||||||
|
<?php
|
||||||
|
foreach($modes as $mode){
|
||||||
|
if ($mode->submode == null) {
|
||||||
|
echo '<option value="' . $mode . '">' . strtoupper($mode) . '</option>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<label class="my-1 mr-2"><?php echo lang('gridsquares_confirmation'); ?></label>
|
||||||
|
<div>
|
||||||
|
<div class="form-check-inline">
|
||||||
|
<input class="form-check-input" type="checkbox" name="qsl" id="qsl" 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" id="lotw" 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" id="eqsl">
|
||||||
|
<label class="form-check-label" for="eqsl">eQSL</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button id="plot" type="button" name="plot" class="btn btn-primary ld-ext-right" onclick="gridPlot(this.form)"><?php echo lang('gridsquares_button_plot'); ?><div class="ld ld-ring ld-spin"></div></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php if($this->session->flashdata('message')) { ?>
|
||||||
|
<!-- Display Message -->
|
||||||
|
<div class="alert-message error">
|
||||||
|
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="gridmapcontainer">
|
||||||
|
<div id="gridsquare_map" style="width: 100%; height: 800px"></div>
|
||||||
|
</div>
|
||||||
|
<script>var gridsquaremap = true;
|
||||||
|
<?php
|
||||||
|
echo 'var jslayer ="' . $layer .'";';
|
||||||
|
echo "var jsattribution ='" . $attribution . "';";
|
||||||
|
|
||||||
|
echo 'var gridsquares_gridsquares = "' . $gridsquares_gridsquares . '";';
|
||||||
|
echo 'var gridsquares_gridsquares_confirmed = "' . $gridsquares_gridsquares_confirmed . '";';
|
||||||
|
echo 'var gridsquares_gridsquares_not_confirmed = "' . $gridsquares_gridsquares_not_confirmed . '";';
|
||||||
|
echo 'var gridsquares_gridsquares_total_worked = "' . $gridsquares_gridsquares_total_worked . '";';
|
||||||
|
?>
|
||||||
|
</script>
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||||
<a class="dropdown-item" href="<?php echo site_url('statistics');?>" title="Statistics"><i class="fas fa-chart-area"></i> <?php echo lang('menu_statistics'); ?></a>
|
<a class="dropdown-item" href="<?php echo site_url('statistics');?>" title="Statistics"><i class="fas fa-chart-area"></i> <?php echo lang('menu_statistics'); ?></a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="<?php echo site_url('gridsquares');?>" title="Gridsquares"><i class="fas fa-globe-europe"></i> <?php echo lang('menu_gridsquares'); ?></a>
|
<a class="dropdown-item" href="<?php echo site_url('gridmap');?>" title="Gridmap"><i class="fas fa-globe-europe"></i> <?php echo lang('menu_gridmap'); ?></a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="<?php echo site_url('activated_grids');?>" title="Activated Gridsquares"><i class="fas fa-globe-europe"></i> <?php echo lang('menu_activated_gridsquares'); ?></a>
|
<a class="dropdown-item" href="<?php echo site_url('activated_grids');?>" title="Activated Gridsquares"><i class="fas fa-globe-europe"></i> <?php echo lang('menu_activated_gridsquares'); ?></a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,217 @@
|
||||||
|
/*
|
||||||
|
* L.Maidenhead displays a Maidenhead Locator of lines on the map.
|
||||||
|
*/
|
||||||
|
|
||||||
|
L.Maidenhead = L.LayerGroup.extend({
|
||||||
|
|
||||||
|
|
||||||
|
options: {
|
||||||
|
// Line and label color
|
||||||
|
color: 'rgba(255, 0, 0, 0.4)',
|
||||||
|
|
||||||
|
// Redraw on move or moveend
|
||||||
|
redraw: 'move'
|
||||||
|
},
|
||||||
|
|
||||||
|
initialize: function (options) {
|
||||||
|
L.LayerGroup.prototype.initialize.call(this);
|
||||||
|
L.Util.setOptions(this, options);
|
||||||
|
},
|
||||||
|
|
||||||
|
onAdd: function (map) {
|
||||||
|
this._map = map;
|
||||||
|
var grid = this.redraw();
|
||||||
|
this._map.on('viewreset '+ this.options.redraw, function () {
|
||||||
|
grid.redraw();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.eachLayer(map.addLayer, map);
|
||||||
|
},
|
||||||
|
|
||||||
|
onRemove: function (map) {
|
||||||
|
// remove layer listeners and elements
|
||||||
|
map.off('viewreset '+ this.options.redraw, this.map);
|
||||||
|
this.eachLayer(this.removeLayer, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
redraw: function () {
|
||||||
|
var d3 = new Array(20, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1 / 24, 1 / 24, 1 / 24, 1 / 24, 1 / 24, 1 / 240, 1 / 240, 1 / 240, 1 / 240, 1 / 240 / 24, 1 / 240 / 24);
|
||||||
|
var lat_cor = new Array(0, 8, 8, 8, 2.5, 2.2, 6, 8, 8, 8, 1.4, 2.5, 3, 3.5, 4, 4, 3.5, 3.5, 3, 1.8, 1.6); // Used for gridsquare text offset
|
||||||
|
var bounds = map.getBounds();
|
||||||
|
var zoom = map.getZoom();
|
||||||
|
console.log(zoom);
|
||||||
|
var unit = d3[zoom];
|
||||||
|
var lcor = lat_cor[zoom];
|
||||||
|
var w = bounds.getWest();
|
||||||
|
var e = bounds.getEast();
|
||||||
|
var n = bounds.getNorth();
|
||||||
|
var s = bounds.getSouth();
|
||||||
|
var field_lat_cor = new Array(0, 8, 8, 9, 8, 7, 6, 8, 8, 8, 1.4, 2.5, 3, 3.5, 4, 4, 3.5, 3.5, 3, 1.8, 1.6); // Used for field text offset
|
||||||
|
var field_cor = field_lat_cor[zoom];
|
||||||
|
if (zoom==1) {var c = 2;} else {var c = 0.2;} // Height offset
|
||||||
|
if (n > 85) n = 85;
|
||||||
|
if (s < -85) s = -85;
|
||||||
|
var left = Math.floor(w/(unit*2))*(unit*2);
|
||||||
|
var right = Math.ceil(e/(unit*2))*(unit*2);
|
||||||
|
var top = Math.ceil(n/unit)*unit;
|
||||||
|
var bottom = Math.floor(s/unit)*unit;
|
||||||
|
this.eachLayer(this.removeLayer, this);
|
||||||
|
|
||||||
|
for (var lon = left; lon < right; lon += (unit*2)) {
|
||||||
|
if (lon > -180 || lon < 180) {
|
||||||
|
for (var lat = bottom; lat < top; lat += unit) {
|
||||||
|
var bounds = [[lat,lon],[lat+unit,lon+(unit*2)]];
|
||||||
|
var locator = this._getLocator(lon,lat);
|
||||||
|
|
||||||
|
if(grid_two.includes(locator) || grid_four.includes(locator) || grid_six.includes(locator)) {
|
||||||
|
|
||||||
|
if(grid_two_confirmed.includes(locator) || grid_four_confirmed.includes(locator) || grid_six_confirmed.includes(locator)) {
|
||||||
|
var rectConfirmed = L.rectangle(bounds, {className: 'grid-rectangle grid-confirmed', color: 'rgba(144,238,144, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false});
|
||||||
|
this.addLayer(rectConfirmed);
|
||||||
|
} else {
|
||||||
|
var rectWorked = L.rectangle(bounds, {className: 'grid-rectangle grid-worked', color: this.options.color, weight: 1, fillOpacity: 1, fill:true, interactive: false})
|
||||||
|
this.addLayer(rectWorked);
|
||||||
|
}
|
||||||
|
// Controls text on grid on various zoom levels
|
||||||
|
if (zoom < 2 || zoom > 2) {
|
||||||
|
this.addLayer(this._getLabel(lon+unit-(unit/lcor),lat+(unit/2)+(unit/lcor*c)));
|
||||||
|
}
|
||||||
|
if (zoom < 3 ) {
|
||||||
|
this.addLayer(L.rectangle(bounds, {className: 'grid-rectangle', color: this.options.color, weight: 1, fill:false, interactive: false}));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (zoom < 3 || zoom > 5) {
|
||||||
|
this.addLayer(L.rectangle(bounds, {className: 'grid-rectangle', color: this.options.color, weight: 1, fill:false, interactive: false}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// This one shows all grids, not just the worked/confirmed
|
||||||
|
if (zoom < 3 || zoom > 5) {
|
||||||
|
this.addLayer(this._getLabel(lon+unit-(unit/lcor),lat+(unit/2)+(unit/lcor*c)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Added this to print fields and field name, while still showing worked/confirmed gridsquares
|
||||||
|
if (zoom < 6 && zoom > 2) {
|
||||||
|
unit = 10;
|
||||||
|
var left = Math.floor(w / (unit * 2)) * (unit * 2);
|
||||||
|
var right = Math.ceil(e / (unit * 2)) * (unit * 2);
|
||||||
|
var top = Math.ceil(n / unit) * unit;
|
||||||
|
var bottom = Math.floor(s / unit) * unit;
|
||||||
|
for (var lon = left; lon < right; lon += (unit * 2)) {
|
||||||
|
for (var lat = bottom; lat < top; lat += unit) {
|
||||||
|
var bounds = [[lat, lon], [lat + unit, lon + (unit * 2)]];
|
||||||
|
|
||||||
|
this.addLayer(L.rectangle(bounds, {
|
||||||
|
className: 'grid-rectangle',
|
||||||
|
color: this.options.color,
|
||||||
|
weight: 1,
|
||||||
|
fill: false,
|
||||||
|
interactive: false
|
||||||
|
}));
|
||||||
|
this.addLayer(this._getLabel2(lon + unit - (unit / field_cor), lat + (unit / 2) + (unit / lcor * c)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
_getLabel: function(lon,lat) {
|
||||||
|
var title_size = new Array(0, 10, 14, 16, 8.5, 13, 14, 16, 24, 36, 12, 14, 20, 36, 60, 12, 20, 36, 60, 12, 24); // Controls text size on labels
|
||||||
|
var zoom = map.getZoom();
|
||||||
|
var size = title_size[zoom]+'px';
|
||||||
|
var title = '';
|
||||||
|
var locator = this._getLocator(lon,lat);
|
||||||
|
if (zoom != 3) {
|
||||||
|
title = '<span class="grid-text" style="cursor: default;"><font style="color:'+this.options.color+'; font-size:'+size+'; font-weight: 900; ">' + locator + '</font></span>';
|
||||||
|
}
|
||||||
|
var myIcon = L.divIcon({className: 'my-div-icon', html: title});
|
||||||
|
var marker = L.marker([lat,lon], {icon: myIcon}, clickable=false);
|
||||||
|
if (zoom == 4 || zoom == 3) {
|
||||||
|
marker.bindTooltip(locator);
|
||||||
|
}
|
||||||
|
if (typeof gridsquaremap !== 'undefined' && gridsquaremap == true) {
|
||||||
|
marker.on('click', function(event) {
|
||||||
|
spawnGridsquareModal(locator);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return marker;
|
||||||
|
},
|
||||||
|
|
||||||
|
_getLocator: function(lon,lat) {
|
||||||
|
var ydiv_arr=new Array(10, 1, 1/24, 1/240, 1/240/24);
|
||||||
|
var d1 = "ABCDEFGHIJKLMNOPQR".split("");
|
||||||
|
var d2 = "ABCDEFGHIJKLMNOPQRSTUVWX".split("");
|
||||||
|
var d4 = new Array(0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5);
|
||||||
|
var locator = "";
|
||||||
|
var x = lon;
|
||||||
|
var y = lat;
|
||||||
|
var precision = d4[map.getZoom()];
|
||||||
|
while (x < -180) {x += 360;}
|
||||||
|
while (x > 180) {x -=360;}
|
||||||
|
x = x + 180;
|
||||||
|
y = y + 90;
|
||||||
|
locator = locator + d1[Math.floor(x/20)] + d1[Math.floor(y/10)];
|
||||||
|
for (var i=0; i<4; i=i+1) {
|
||||||
|
if (precision > i+1) {
|
||||||
|
rlon = x%(ydiv_arr[i]*2);
|
||||||
|
rlat = y%(ydiv_arr[i]);
|
||||||
|
if ((i%2)==0) {
|
||||||
|
locator += Math.floor(rlon/(ydiv_arr[i+1]*2)) +""+ Math.floor(rlat/(ydiv_arr[i+1]));
|
||||||
|
} else {
|
||||||
|
locator += d2[Math.floor(rlon/(ydiv_arr[i+1]*2))] +""+ d2[Math.floor(rlat/(ydiv_arr[i+1]))];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return locator;
|
||||||
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
Need this for the field printing, while showing worked/confirmed grids
|
||||||
|
*/
|
||||||
|
_getLabel2: function(lon,lat) {
|
||||||
|
var title_size = new Array(0, 10, 12, 16, 20, 26, 26, 16, 24, 36, 12, 14, 20, 36, 60, 12, 20, 36, 60, 12, 24);
|
||||||
|
var zoom = map.getZoom();
|
||||||
|
var size = title_size[zoom]+'px';
|
||||||
|
var title = '<span class="grid-text" style="cursor: default;"><font style="color:'+this.options.color+'; font-size:'+size+'; font-weight: 900; ">' + this._getLocator2(lon,lat) + '</font></span>';
|
||||||
|
var myIcon = L.divIcon({className: 'my-div-icon', html: title});
|
||||||
|
var marker = L.marker([lat,lon], {icon: myIcon}, clickable=false);
|
||||||
|
return marker;
|
||||||
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
Need this for the field printing, while showing worked/confirmed grids
|
||||||
|
*/
|
||||||
|
_getLocator2: function(lon,lat) {
|
||||||
|
var ydiv_arr=new Array(10, 1, 1/24, 1/240, 1/240/24);
|
||||||
|
var d1 = "ABCDEFGHIJKLMNOPQR".split("");
|
||||||
|
var d2 = "ABCDEFGHIJKLMNOPQRSTUVWX".split("");
|
||||||
|
var d4 = new Array(0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5);
|
||||||
|
var locator = "";
|
||||||
|
var x = lon;
|
||||||
|
var y = lat;
|
||||||
|
var precision = d4[map.getZoom()];
|
||||||
|
while (x < -180) {x += 360;}
|
||||||
|
while (x > 180) {x -=360;}
|
||||||
|
x = x + 180;
|
||||||
|
y = y + 90;
|
||||||
|
locator = locator + d1[Math.floor(x/20)] + d1[Math.floor(y/10)];
|
||||||
|
for (var i=0; i<4; i=i+1) {
|
||||||
|
if (precision > i+1) {
|
||||||
|
rlon = x%(ydiv_arr[i]*2);
|
||||||
|
rlat = y%(ydiv_arr[i]);
|
||||||
|
if ((i%2)==0) {
|
||||||
|
locator += Math.floor(rlon/(ydiv_arr[i+1]*2)) +""+ Math.floor(rlat/(ydiv_arr[i+1]));
|
||||||
|
} else {
|
||||||
|
locator += d2[Math.floor(rlon/(ydiv_arr[i+1]*2))] +""+ d2[Math.floor(rlat/(ydiv_arr[i+1]))];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return locator;
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
L.maidenhead = function (options) {
|
||||||
|
return new L.Maidenhead(options);
|
||||||
|
};
|
||||||
145
assets/js/sections/gridmap.js
普通文件
145
assets/js/sections/gridmap.js
普通文件
|
|
@ -0,0 +1,145 @@
|
||||||
|
$('#band').change(function(){
|
||||||
|
var band = $("#band option:selected").text();
|
||||||
|
if (band != "SAT") {
|
||||||
|
$("#sats").prop('disabled', true);
|
||||||
|
} else {
|
||||||
|
$("#sats").prop('disabled', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var map;
|
||||||
|
var grid_two = '';
|
||||||
|
var grid_four = '';
|
||||||
|
var grid_six = '';
|
||||||
|
var grid_two_confirmed = '';
|
||||||
|
var grid_four_confirmed = '';
|
||||||
|
var grid_six_confirmed = '';
|
||||||
|
|
||||||
|
function gridPlot(form) {
|
||||||
|
$(".ld-ext-right").addClass('running');
|
||||||
|
$(".ld-ext-right").prop('disabled', true);
|
||||||
|
$('#plot').prop("disabled", true);
|
||||||
|
// If map is already initialized
|
||||||
|
var container = L.DomUtil.get('gridsquare_map');
|
||||||
|
|
||||||
|
if(container != null){
|
||||||
|
container._leaflet_id = null;
|
||||||
|
container.remove();
|
||||||
|
$("#gridmapcontainer").append('<div id="gridsquare_map" style="width: 100%; height: 800px"></div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: site_url + '/gridmap/getGridsjs',
|
||||||
|
type: 'post',
|
||||||
|
data: {
|
||||||
|
band: $("#band").val(),
|
||||||
|
mode: $("#mode").val(),
|
||||||
|
qsl: $("#qsl").is(":checked"),
|
||||||
|
lotw: $("#lotw").is(":checked"),
|
||||||
|
eqsl: $("#eqsl").is(":checked"),
|
||||||
|
sat: $("#sats").val(),
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
$(".ld-ext-right").removeClass('running');
|
||||||
|
$(".ld-ext-right").prop('disabled', false);
|
||||||
|
$('#plot').prop("disabled", false);
|
||||||
|
grid_two = data.grid_2char;
|
||||||
|
grid_four = data.grid_4char;
|
||||||
|
grid_six = data.grid_6char;
|
||||||
|
grid_two_confirmed = data.grid_2char_confirmed;
|
||||||
|
grid_four_confirmed = data.grid_4char_confirmed;
|
||||||
|
grid_six_confirmed = data.grid_6char_confirmed;
|
||||||
|
var layer = L.tileLayer(jslayer, {
|
||||||
|
maxZoom: 9,
|
||||||
|
attribution: jsattribution,
|
||||||
|
id: 'mapbox.streets'
|
||||||
|
});
|
||||||
|
|
||||||
|
map = L.map('gridsquare_map', {
|
||||||
|
layers: [layer],
|
||||||
|
center: [19, 0],
|
||||||
|
zoom: 3,
|
||||||
|
minZoom: 2,
|
||||||
|
fullscreenControl: true,
|
||||||
|
fullscreenControlOptions: {
|
||||||
|
position: 'topleft'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
var printer = L.easyPrint({
|
||||||
|
tileLayer: layer,
|
||||||
|
sizeModes: ['Current'],
|
||||||
|
filename: 'myMap',
|
||||||
|
exportOnly: true,
|
||||||
|
hideControlContainer: true
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
|
/*Legend specific*/
|
||||||
|
var legend = L.control({ position: "topright" });
|
||||||
|
|
||||||
|
legend.onAdd = function(map) {
|
||||||
|
var div = L.DomUtil.create("div", "legend");
|
||||||
|
div.innerHTML += "<h4>" + gridsquares_gridsquares + "</h4>";
|
||||||
|
div.innerHTML += '<i style="background: green"></i><span>' + gridsquares_gridsquares_confirmed + ' ('+grid_four_confirmed.length+')</span><br>';
|
||||||
|
div.innerHTML += '<i style="background: red"></i><span>' + gridsquares_gridsquares_not_confirmed + ' ('+(grid_four.length - grid_four_confirmed.length)+')</span><br>';
|
||||||
|
div.innerHTML += '<i></i><span>' + gridsquares_gridsquares_total_worked + ' ('+grid_four.length+')</span><br>';
|
||||||
|
return div;
|
||||||
|
};
|
||||||
|
|
||||||
|
legend.addTo(map);
|
||||||
|
|
||||||
|
var maidenhead = L.maidenhead().addTo(map);
|
||||||
|
},
|
||||||
|
error: function (data) {
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function spawnGridsquareModal(loc_4char) {
|
||||||
|
$.ajax({
|
||||||
|
url: base_url + 'index.php/awards/qso_details_ajax',
|
||||||
|
type: 'post',
|
||||||
|
data: {
|
||||||
|
'Searchphrase': loc_4char,
|
||||||
|
'Band': $("#band").val(),
|
||||||
|
'Mode': $("#mode").val(),
|
||||||
|
'Type': 'VUCC'
|
||||||
|
},
|
||||||
|
success: function (html) {
|
||||||
|
BootstrapDialog.show({
|
||||||
|
title: 'QSO Data',
|
||||||
|
cssClass: 'qso-dialog',
|
||||||
|
size: BootstrapDialog.SIZE_WIDE,
|
||||||
|
nl2br: false,
|
||||||
|
message: html,
|
||||||
|
onshown: function(dialog) {
|
||||||
|
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
$('.contacttable').DataTable({
|
||||||
|
"pageLength": 25,
|
||||||
|
responsive: false,
|
||||||
|
ordering: false,
|
||||||
|
"scrollY": "550px",
|
||||||
|
"scrollCollapse": true,
|
||||||
|
"paging": false,
|
||||||
|
"scrollX": true,
|
||||||
|
dom: 'Bfrtip',
|
||||||
|
buttons: [
|
||||||
|
'csv'
|
||||||
|
]
|
||||||
|
});
|
||||||
|
// change color of csv-button if dark mode is chosen
|
||||||
|
if (isDarkModeTheme()) {
|
||||||
|
$(".buttons-csv").css("color", "white");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
buttons: [{
|
||||||
|
label: 'Close',
|
||||||
|
action: function(dialogItself) {
|
||||||
|
dialogItself.close();
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
正在加载…
在新工单中引用