First part of converting visitor map to gridmap
这个提交包含在:
父节点
9e7416afe5
当前提交
aebf53e35b
共有 6 个文件被更改,包括 124 次插入 和 86 次删除
|
|
@ -13,6 +13,7 @@ class Gridmap extends CI_Controller {
|
|||
$this->load->model('gridmap_model');
|
||||
$this->load->model('stations');
|
||||
|
||||
$data['visitor'] = false;
|
||||
$data['homegrid'] = explode(',', $this->stations->find_gridsquare());
|
||||
|
||||
$data['modes'] = $this->gridmap_model->get_worked_modes();
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$this->load->model('gridsquares_model');
|
||||
$this->load->model('gridmap_model');
|
||||
|
||||
$data['page_title'] = "Satellite Gridsquare Map";
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ class Visitor extends CI_Controller {
|
|||
|
||||
|
||||
// Get Confirmed LoTW & Paper Squares (non VUCC)
|
||||
$query = $this->gridsquares_model->get_confirmed_sat_squares($logbooks_locations_array);
|
||||
$query = $this->gridmap_model->get_band_confirmed('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
|
||||
if ($query && $query->num_rows() > 0)
|
||||
|
|
@ -303,10 +303,10 @@ class Visitor extends CI_Controller {
|
|||
foreach ($query->result() as $row)
|
||||
{
|
||||
|
||||
$grid_2char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,2));
|
||||
$grid_4char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,4));
|
||||
$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->SAT_SQUARE,0,6));
|
||||
$grid_6char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,6));
|
||||
}
|
||||
|
||||
// Check if 2 Char is in array
|
||||
|
|
@ -331,17 +331,17 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
|
||||
// Get worked squares
|
||||
$query = $this->gridsquares_model->get_worked_sat_squares($logbooks_locations_array);
|
||||
$query = $this->gridmap_model->get_band('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
if ($query && $query->num_rows() > 0)
|
||||
{
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
|
||||
$grid_two = strtoupper(substr($row->SAT_SQUARE,0,2));
|
||||
$grid_four = strtoupper(substr($row->SAT_SQUARE,0,4));
|
||||
$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->SAT_SQUARE,0,6));
|
||||
$grid_six = strtoupper(substr($row->GRID_SQUARES,0,6));
|
||||
}
|
||||
|
||||
// Check if 2 Char is in array
|
||||
|
|
@ -365,7 +365,7 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$query_vucc = $this->gridsquares_model->get_worked_sat_vucc_squares($logbooks_locations_array);
|
||||
$query_vucc = $this->gridmap_model->get_band_worked_vucc_squares('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
if ($query && $query_vucc->num_rows() > 0)
|
||||
{
|
||||
|
|
@ -392,7 +392,7 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
|
||||
// Confirmed Squares
|
||||
$query_vucc = $this->gridsquares_model->get_confirmed_sat_vucc_squares($logbooks_locations_array);
|
||||
$query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
if ($query && $query_vucc->num_rows() > 0)
|
||||
{
|
||||
|
|
@ -439,9 +439,19 @@ class Visitor extends CI_Controller {
|
|||
$data['grid_4char'] = js_array($array_grid_4char);
|
||||
$data['grid_6char'] = js_array($array_grid_6char);
|
||||
|
||||
$data['homegrid'] = 'JO31OL';
|
||||
$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');
|
||||
|
||||
$data['visitor'] = true;
|
||||
|
||||
$this->load->view('visitor/layout/header', $data);
|
||||
$this->load->view('gridsquares/index');
|
||||
$this->load->view('gridmap/index', $data);
|
||||
$this->load->view('visitor/layout/footer');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
class Gridmap_model extends CI_Model {
|
||||
|
||||
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$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;
|
||||
|
|
@ -40,10 +42,12 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$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;
|
||||
|
|
@ -76,10 +80,12 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$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;
|
||||
|
|
@ -112,10 +118,12 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$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;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<?php if ($visitor == false) { ?>
|
||||
<form class="d-flex align-items-center">
|
||||
<label class="my-1 me-2" for="band"><?php echo lang('gridsquares_band'); ?></label>
|
||||
<select class="form-select my-1 me-sm-2 w-auto" id="band">
|
||||
|
|
@ -111,6 +112,7 @@
|
|||
<button id="plot" type="button" name="plot" class="btn btn-primary me-1 ld-ext-right ld-ext-right-plot" onclick="gridPlot(this.form)"><?php echo lang('gridsquares_button_plot'); ?><div class="ld ld-ring ld-spin"></div></button>
|
||||
<button id="clear" type="button" name="clear" class="btn btn-primary me-1 ld-ext-right ld-ext-right-clear" onclick="clearMarkers()"><?php echo lang('gridsquares_button_clear_markers'); ?><div class="ld ld-ring ld-spin"></div></button>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
|
|
@ -135,16 +137,22 @@
|
|||
<div class="cohidden"><?php echo lang('gen_hamradio_bearing')?>: </div>
|
||||
<div class="cohidden col-auto text-success fw-bold" id="bearing"></div>
|
||||
</div>
|
||||
<script>var gridsquaremap = true;
|
||||
<script>
|
||||
var gridsquaremap = true;
|
||||
var type = "worked";
|
||||
<?php if ($visitor == true) { ?>
|
||||
var visitor = true;
|
||||
<?php } else { ?>
|
||||
var visitor = false;
|
||||
<?php } ?>
|
||||
<?php
|
||||
echo 'var jslayer ="' . $layer .'";';
|
||||
echo "var jslayer = \"" . $layer ."\";\n";
|
||||
echo "var jsattribution ='" . $attribution . "';";
|
||||
echo "var homegrid ='" . strtoupper($homegrid[0]) . "';";
|
||||
echo "var homegrid = \"" . strtoupper($homegrid[0]) . "\";\n";
|
||||
|
||||
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 . '";';
|
||||
echo "var gridsquares_gridsquares = \"" . $gridsquares_gridsquares . "\";\n";
|
||||
echo "var gridsquares_gridsquares_confirmed = \"" . $gridsquares_gridsquares_confirmed . "\";\n";
|
||||
echo "var gridsquares_gridsquares_not_confirmed = \"" . $gridsquares_gridsquares_not_confirmed . "\";\n";
|
||||
echo "var gridsquares_gridsquares_total_worked = \"" . $gridsquares_gridsquares_total_worked . "\";\n";
|
||||
?>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -105,14 +105,14 @@
|
|||
|
||||
if (grid_four_confirmed_count > 0) {
|
||||
var span = document.getElementById('confirmed_grids');
|
||||
span.innerText = span.textContent = '('+grid_four_confirmed_count+' grid squares) ';
|
||||
//span.innerText = span.textContent = '('+grid_four_confirmed_count+' grid squares) ';
|
||||
}
|
||||
if ((grid_four_count-grid_four_confirmed_count) > 0) {
|
||||
var span = document.getElementById('worked_grids');
|
||||
span.innerText = span.textContent = '('+(grid_four_count-grid_four_confirmed_count)+' grid squares) ';
|
||||
//span.innerText = span.textContent = '('+(grid_four_count-grid_four_confirmed_count)+' grid squares) ';
|
||||
}
|
||||
var span = document.getElementById('sum_grids');
|
||||
span.innerText = span.textContent = ' Total Count: '+grid_four_count+' grid squares';
|
||||
//span.innerText = span.textContent = ' Total Count: '+grid_four_count+' grid squares';
|
||||
|
||||
var maidenhead = L.maidenhead().addTo(map);
|
||||
|
||||
|
|
@ -201,6 +201,7 @@
|
|||
<?php } ?>
|
||||
<?php } ?>
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/sections/gridmap.js?"></script>
|
||||
<?php if ($this->CI->public_search_enabled($slug) || $this->session->userdata('user_type') >= 2) { ?>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/datatables.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/dataTables.buttons.min.js"></script>
|
||||
|
|
|
|||
|
|
@ -8,14 +8,16 @@ $('#band').change(function(){
|
|||
});
|
||||
|
||||
var map;
|
||||
var grid_two = '';
|
||||
var grid_four = '';
|
||||
var grid_six = '';
|
||||
var grid_two_confirmed = '';
|
||||
var grid_four_confirmed = '';
|
||||
var grid_six_confirmed = '';
|
||||
if (typeof(visitor) !== 'undefined' && visitor != true) {
|
||||
var grid_two = '';
|
||||
var grid_four = '';
|
||||
var grid_six = '';
|
||||
var grid_two_confirmed = '';
|
||||
var grid_four_confirmed = '';
|
||||
var grid_six_confirmed = '';
|
||||
}
|
||||
|
||||
function gridPlot(form) {
|
||||
function gridPlot(form, visitor) {
|
||||
$(".ld-ext-right-plot").addClass('running');
|
||||
$(".ld-ext-right-plot").prop('disabled', true);
|
||||
$('#plot').prop("disabled", true);
|
||||
|
|
@ -36,6 +38,7 @@ function gridPlot(form) {
|
|||
ajax_url = site_url + '/gridmap/getGridsjs';
|
||||
}
|
||||
|
||||
if (visitor != true) {
|
||||
$.ajax({
|
||||
url: ajax_url,
|
||||
type: 'post',
|
||||
|
|
@ -58,6 +61,18 @@ function gridPlot(form) {
|
|||
grid_two_confirmed = data.grid_2char_confirmed;
|
||||
grid_four_confirmed = data.grid_4char_confirmed;
|
||||
grid_six_confirmed = data.grid_6char_confirmed;
|
||||
plot(grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed);
|
||||
|
||||
},
|
||||
error: function (data) {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
plot(grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed);
|
||||
};
|
||||
}
|
||||
|
||||
function plot(grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed) {
|
||||
var layer = L.tileLayer(jslayer, {
|
||||
maxZoom: 12,
|
||||
attribution: jsattribution,
|
||||
|
|
@ -100,11 +115,6 @@ function gridPlot(form) {
|
|||
var maidenhead = L.maidenhead().addTo(map);
|
||||
map.on('mousemove', onMapMove);
|
||||
map.on('click', onMapClick);
|
||||
|
||||
},
|
||||
error: function (data) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function spawnGridsquareModal(loc_4char) {
|
||||
|
|
@ -174,5 +184,5 @@ function clearMarkers() {
|
|||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
gridPlot(this.form);
|
||||
gridPlot(this.form, visitor);
|
||||
})
|
||||
|
|
|
|||
正在加载…
在新工单中引用