diff --git a/application/controllers/Gridmap.php b/application/controllers/Gridmap.php index 702f0a8cb..075906269 100644 --- a/application/controllers/Gridmap.php +++ b/application/controllers/Gridmap.php @@ -50,6 +50,7 @@ class Gridmap extends CI_Controller { $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')); + $qrz = $this->security->xss_clean($this->input->post('qrz')); $sat = $this->security->xss_clean($this->input->post('sat')); $this->load->model('gridmap_model'); @@ -69,7 +70,7 @@ class Gridmap extends CI_Controller { $grid_4char_confirmed = ""; $grid_6char_confirmed = ""; - $query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat); + $query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { @@ -96,7 +97,7 @@ class Gridmap extends CI_Controller { } } - $query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $sat); + $query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { @@ -123,7 +124,7 @@ class Gridmap extends CI_Controller { } } } - $query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat); + $query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); if ($query_vucc && $query_vucc->num_rows() > 0) { foreach ($query_vucc->result() as $row) { @@ -148,7 +149,7 @@ class Gridmap extends CI_Controller { } // // Confirmed Squares - $query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat); + $query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); if ($query_vucc && $query_vucc->num_rows() > 0) { foreach ($query_vucc->result() as $row) { diff --git a/application/models/Gridmap_model.php b/application/models/Gridmap_model.php index d51b3b86b..067545c3a 100644 --- a/application/models/Gridmap_model.php +++ b/application/models/Gridmap_model.php @@ -2,7 +2,7 @@ class Gridmap_model extends CI_Model { - function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $logbooks_locations_array = NULL) { if ($logbooks_locations_array == NULL) { $CI =& get_instance(); $CI->load->model('logbooks_model'); @@ -37,12 +37,12 @@ class Gridmap_model extends CI_Model { $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl); + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz); return $this->db->query($sql); } - function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + function get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $logbooks_locations_array = NULL) { if ($logbooks_locations_array == NULL) { $CI =& get_instance(); $CI->load->model('logbooks_model'); @@ -80,7 +80,7 @@ class Gridmap_model extends CI_Model { return $this->db->query($sql); } - function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $logbooks_locations_array = NULL) { if ($logbooks_locations_array == NULL) { $CI =& get_instance(); $CI->load->model('logbooks_model'); @@ -118,7 +118,7 @@ class Gridmap_model extends CI_Model { return $this->db->query($sql); } - function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $logbooks_locations_array = NULL) { if ($logbooks_locations_array == NULL) { $CI =& get_instance(); $CI->load->model('logbooks_model'); @@ -153,47 +153,34 @@ class Gridmap_model extends CI_Model { $sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')"; } - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl); + $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz); 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'"; - } + function addQslToQuery($qsl, $lotw, $eqsl, $qrz) { + $sql = ''; + if ($lotw == "true") { + $sql .= " or col_lotw_qsl_rcvd = 'Y'"; + } - if ($qsl == "true" && $lotw == "false" && $eqsl == "false") { - $sql .= " and col_qsl_rcvd = 'Y'"; - } + if ($qsl == "true") { + $sql .= " or col_qsl_rcvd = 'Y'"; + } - if ($eqsl == "true" && $lotw == "false" && $qsl == "false") { - $sql .= " and col_eqsl_qsl_rcvd = 'Y'"; - } + if ($eqsl == "true") { + $sql .= " or 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; - } + if ($qrz == "true") { + $sql .= " or col_qrzcom_qso_download_status = 'Y'"; + } + if ($sql != '') { + $sql='and (1=0 '.$sql.')'; + } + return $sql; + } /* * Get's the worked modes from the log diff --git a/assets/js/sections/gridmap.js b/assets/js/sections/gridmap.js index bce542cc7..f4b1d3867 100644 --- a/assets/js/sections/gridmap.js +++ b/assets/js/sections/gridmap.js @@ -49,6 +49,7 @@ function gridPlot(form, visitor=true) { qsl: $("#qsl").is(":checked"), lotw: $("#lotw").is(":checked"), eqsl: $("#eqsl").is(":checked"), + qrz: $("#qrz").is(":checked"), sat: $("#sats").val(), }, success: function (data) {