kopia lustrzana https://github.com/magicbug/Cloudlog
[Gridmap] Added sat selection
rodzic
3d1b35b068
commit
db590c969b
|
@ -13,9 +13,8 @@ class Gridmap extends CI_Controller {
|
|||
$this->load->model('gridmap_model');
|
||||
|
||||
$data['modes'] = $this->gridmap_model->get_worked_modes();
|
||||
|
||||
|
||||
$data['bands'] = $this->bands->get_worked_bands();
|
||||
$data['bands'] = $this->bands->get_worked_bands();
|
||||
$data['sats_available'] = $this->bands->get_worked_sats();
|
||||
|
||||
$footerData = [];
|
||||
$footerData['scripts'] = [
|
||||
|
@ -28,151 +27,13 @@ class Gridmap extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer', $footerData);
|
||||
}
|
||||
|
||||
public function getGrids() {
|
||||
$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'));
|
||||
$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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
if ($query && $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);
|
||||
|
||||
if ($query && $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);
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -191,7 +52,7 @@ class Gridmap extends CI_Controller {
|
|||
$grid_4char_confirmed = "";
|
||||
$grid_6char_confirmed = "";
|
||||
|
||||
$query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl);
|
||||
$query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat);
|
||||
|
||||
if ($query && $query->num_rows() > 0) {
|
||||
foreach ($query->result() as $row) {
|
||||
|
@ -218,7 +79,7 @@ class Gridmap extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl);
|
||||
$query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $sat);
|
||||
|
||||
if ($query && $query->num_rows() > 0) {
|
||||
foreach ($query->result() as $row) {
|
||||
|
@ -245,7 +106,7 @@ class Gridmap extends CI_Controller {
|
|||
}
|
||||
}
|
||||
}
|
||||
$query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl);
|
||||
$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) {
|
||||
|
@ -270,7 +131,7 @@ class Gridmap extends CI_Controller {
|
|||
}
|
||||
|
||||
// // Confirmed Squares
|
||||
$query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl);
|
||||
$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) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Gridmap_model extends CI_Model {
|
||||
|
||||
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl) {
|
||||
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'));
|
||||
|
@ -21,6 +21,9 @@ class Gridmap_model extends CI_Model {
|
|||
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'";
|
||||
|
@ -37,7 +40,7 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band($band, $mode, $qsl, $lotw, $eqsl) {
|
||||
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'));
|
||||
|
@ -56,6 +59,9 @@ class Gridmap_model extends CI_Model {
|
|||
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'";
|
||||
|
@ -70,7 +76,7 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl) {
|
||||
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'));
|
||||
|
@ -89,6 +95,9 @@ class Gridmap_model extends CI_Model {
|
|||
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'";
|
||||
|
@ -103,7 +112,7 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl) {
|
||||
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'));
|
||||
|
@ -119,9 +128,12 @@ class Gridmap_model extends CI_Model {
|
|||
.' WHERE station_id in ('
|
||||
.$location_list.') AND COL_VUCC_GRIDS != ""';
|
||||
|
||||
if ($band != 'All') {
|
||||
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'";
|
||||
|
|
|
@ -40,16 +40,27 @@
|
|||
echo '<option value="' . $band . '"' . '>' . $band . '</option>'."\n";
|
||||
} ?>
|
||||
</select>
|
||||
<?php if (count($sats_available) != 0) { ?>
|
||||
<label class="my-1 mr-2" for="distplot_sats">Satellite</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">Mode selection</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";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
foreach($modes as $mode){
|
||||
if ($mode->submode == null) {
|
||||
echo '<option value="' . $mode . '">' . strtoupper($mode) . '</option>'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<label class="my-1 mr-2">Confirmation</label>
|
||||
<div>
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
$('#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 = '';
|
||||
|
@ -25,7 +34,8 @@ function gridPlot(form) {
|
|||
mode: $("#mode").val(),
|
||||
qsl: $("#qsl").is(":checked"),
|
||||
lotw: $("#lotw").is(":checked"),
|
||||
eqsl: $("#eqsl").is(":checked")
|
||||
eqsl: $("#eqsl").is(":checked"),
|
||||
sat: $("#sats").val(),
|
||||
},
|
||||
success: function (data) {
|
||||
$('#plot').prop("disabled", false);
|
||||
|
|
Ładowanie…
Reference in New Issue