diff --git a/application/controllers/Activated_gridmap.php b/application/controllers/Activated_gridmap.php
index ba41858f93..8b8c2d4b07 100644
--- a/application/controllers/Activated_gridmap.php
+++ b/application/controllers/Activated_gridmap.php
@@ -6,11 +6,11 @@ function __construct() {
parent::__construct();
}
- public function index() {
+ public function index() {
$data['page_title'] = "Activated Gridsquare Map";
- $this->load->model('bands');
- $this->load->model('activated_gridmap_model');
+ $this->load->model('bands');
+ $this->load->model('activated_gridmap_model');
$this->load->model('stations');
$data['visitor'] = false;
@@ -18,6 +18,7 @@ public function index() {
$data['modes'] = $this->activated_gridmap_model->get_worked_modes();
$data['bands'] = $this->bands->get_worked_bands();
+ $data['orbits'] = $this->bands->get_worked_orbits();
$data['sats_available'] = $this->bands->get_worked_sats();
$data['user_default_band'] = $this->session->userdata('user_default_band');
@@ -32,7 +33,7 @@ public function index() {
$data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed');
$data['gridsquares_gridsquares_total_activated'] = lang('gridsquares_gridsquares_total_activated');
- $footerData = [];
+ $footerData = [];
$footerData['scripts'] = [
'assets/js/leaflet/geocoding.js',
'assets/js/leaflet/L.MaidenheadColouredGridMap.js',
@@ -45,13 +46,14 @@ public function index() {
}
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'));
- $qrz = $this->security->xss_clean($this->input->post('qrz'));
+ $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'));
+ $qrz = $this->security->xss_clean($this->input->post('qrz'));
$sat = $this->security->xss_clean($this->input->post('sat'));
+ $orbit = $this->security->xss_clean($this->input->post('orbit'));
$this->load->model('activated_gridmap_model');
$array_grid_2char = array();
@@ -70,7 +72,7 @@ public function getGridsjs() {
$grid_4char_confirmed = "";
$grid_6char_confirmed = "";
- $query = $this->activated_gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
+ $query = $this->activated_gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
if ($query && $query->num_rows() > 0) {
foreach ($query->result() as $row) {
@@ -100,7 +102,7 @@ public function getGridsjs() {
}
}
- $query = $this->activated_gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
+ $query = $this->activated_gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
if ($query && $query->num_rows() > 0) {
foreach ($query->result() as $row) {
@@ -130,7 +132,7 @@ public function getGridsjs() {
}
}
}
- $query_vucc = $this->activated_gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
+ $query_vucc = $this->activated_gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
if ($query_vucc && $query_vucc->num_rows() > 0) {
foreach ($query_vucc->result() as $row) {
@@ -155,7 +157,7 @@ public function getGridsjs() {
}
// // Confirmed Squares
- $query_vucc = $this->activated_gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
+ $query_vucc = $this->activated_gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
if ($query_vucc && $query_vucc->num_rows() > 0) {
foreach ($query_vucc->result() as $row) {
@@ -179,7 +181,7 @@ public function getGridsjs() {
}
}
- $data['grid_2char_confirmed'] = ($array_grid_2char_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);
@@ -187,7 +189,7 @@ public function getGridsjs() {
$data['grid_4char'] = ($array_grid_4char);
$data['grid_6char'] = ($array_grid_6char);
- header('Content-Type: application/json');
- echo json_encode($data);
- }
+ header('Content-Type: application/json');
+ echo json_encode($data);
+ }
}
diff --git a/application/models/Activated_gridmap_model.php b/application/models/Activated_gridmap_model.php
index d757723c2a..c24c788df5 100644
--- a/application/models/Activated_gridmap_model.php
+++ b/application/models/Activated_gridmap_model.php
@@ -2,191 +2,208 @@
class Activated_gridmap_model extends CI_Model {
- function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat) {
- $CI =& get_instance();
- $CI->load->model('logbooks_model');
- $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+ function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) {
+ $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;
- }
+ if (!$logbooks_locations_array) {
+ return null;
+ }
$location_list = "'".implode("','",$logbooks_locations_array)."'";
- $sql = 'SELECT DISTINCT station_gridsquare AS GRID_SQUARES, COL_BAND FROM '
- . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id '
- . 'WHERE station_profile.station_gridsquare != "" '
- . 'AND station_profile.station_id in ('.$location_list.')';
-
- 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 = 'SELECT DISTINCT station_gridsquare AS GRID_SQUARES, COL_BAND FROM '
+ . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id '
+ .' LEFT JOIN `satellite` on '.$this->config->item('table_name').'.COL_SAT_NAME = satellite.name '
+ . 'WHERE station_profile.station_gridsquare != "" '
+ . 'AND station_profile.station_id in ('.$location_list.')';
+
+ 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->addOrbitToQuery($orbit);
- $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz);
+ $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz);
return $this->db->query($sql);
}
- function get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $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 station_gridsquare AS GRID_SQUARES, COL_BAND FROM '
- . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id '
- . 'WHERE station_profile.station_gridsquare != "" '
- . 'AND station_profile.station_id in ('.$location_list.')';
-
- 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') {
+ function get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) {
+ $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 station_gridsquare AS GRID_SQUARES, COL_BAND FROM '
+ . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id '
+ .' LEFT JOIN `satellite` on '.$this->config->item('table_name').'.COL_SAT_NAME = satellite.name '
+ . 'WHERE station_profile.station_gridsquare != "" '
+ . 'AND station_profile.station_id in ('.$location_list.')';
+
+ 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);
- }
+ $sql .= $this->addOrbitToQuery($orbit);
- function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat) {
- $CI =& get_instance();
- $CI->load->model('logbooks_model');
- $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+ return $this->db->query($sql);
+ }
- if (!$logbooks_locations_array) {
- return null;
- }
+ function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) {
+ $CI =& get_instance();
+ $CI->load->model('logbooks_model');
+ $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
- $location_list = "'".implode("','",$logbooks_locations_array)."'";
+ 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')
+ .' LEFT JOIN `satellite` on '.$this->config->item('table_name').'.COL_SAT_NAME = satellite.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') {
+ 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->addOrbitToQuery($orbit);
- return null;
- return $this->db->query($sql);
- }
+ return null;
+ return $this->db->query($sql);
+ }
- function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $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;
- }
+ function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) {
+ $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')
+ .' LEFT JOIN `satellite` on '.$this->config->item('table_name').'.COL_SAT_NAME = satellite.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') {
+
+ 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->addOrbitToQuery($orbit);
$sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz);
- return null;
+ return null;
return $this->db->query($sql);
}
// Adds confirmation to query
- function addQslToQuery($qsl, $lotw, $eqsl, $qrz) {
- $sql = '';
- if ($lotw == "true") {
- $sql .= " or col_lotw_qsl_sent = 'Y'";
- }
-
- if ($qsl == "true") {
- $sql .= " or col_qsl_sent = 'Y'";
- }
-
- if ($eqsl == "true") {
- $sql .= " or col_eqsl_qsl_sent = 'Y'";
- }
-
- if ($qrz == "true") {
- $sql .= " or col_qrzcom_qso_upload_status = 'Y'";
- }
- if ($sql != '') {
- $sql='and (1=0 '.$sql.')';
- }
- return $sql;
- }
-
-
- /*
- * Get's the worked modes from the log
- */
+ function addQslToQuery($qsl, $lotw, $eqsl, $qrz) {
+ $sql = '';
+ if ($lotw == "true") {
+ $sql .= " or col_lotw_qsl_sent = 'Y'";
+ }
+
+ if ($qsl == "true") {
+ $sql .= " or col_qsl_sent = 'Y'";
+ }
+
+ if ($eqsl == "true") {
+ $sql .= " or col_eqsl_qsl_sent = 'Y'";
+ }
+
+ if ($qrz == "true") {
+ $sql .= " or col_qrzcom_qso_upload_status = 'Y'";
+ }
+ if ($sql != '') {
+ $sql='and (1=0 '.$sql.')';
+ }
+ return $sql;
+ }
+
+ // Adds orbit type to query
+ function addOrbitToQuery($orbit) {
+ $sql = '';
+ if ($orbit != 'All') {
+ $sql .= ' AND satellite.orbit = \''.$orbit.'\'';
+ }
+
+ 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;
- }
+ $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)."'";
@@ -208,7 +225,7 @@ function get_worked_modes() {
}
}
- asort($results);
+ asort($results);
return $results;
}
diff --git a/application/models/Gridmap_model.php b/application/models/Gridmap_model.php
index 582f161b12..310754f83f 100644
--- a/application/models/Gridmap_model.php
+++ b/application/models/Gridmap_model.php
@@ -197,7 +197,7 @@ function addQslToQuery($qsl, $lotw, $eqsl, $qrz) {
return $sql;
}
- // Adds confirmation to query
+ // Adds orbit type to query
function addOrbitToQuery($orbit) {
$sql = '';
if ($orbit != 'All') {
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 2a8bcc6de4..482297b01e 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -412,6 +412,14 @@ public function qso_details($searchphrase, $band, $mode, $type, $qsl, $sat = nul
case 'VUCC':
if ($searchmode == 'activated') {
$this->db->where("station_gridsquare like '%" . $searchphrase . "%'");
+ if ($band == 'SAT' && $type == 'VUCC') {
+ if ($sat != 'All' && $sat != null) {
+ $this->db->where("COL_SAT_NAME = '$sat'");
+ }
+ if ($orbit != 'All' && $orbit != null) {
+ $this->db->where("satellite.orbit = '$orbit'");
+ }
+ }
} else {
$this->db->where("(COL_GRIDSQUARE like '" . $searchphrase . "%' OR COL_VUCC_GRIDS like '%" . $searchphrase ."%')");
if ($band == 'SAT' && $type == 'VUCC') {
diff --git a/application/views/activated_gridmap/index.php b/application/views/activated_gridmap/index.php
index a9fa6f027e..1b9c28335b 100644
--- a/application/views/activated_gridmap/index.php
+++ b/application/views/activated_gridmap/index.php
@@ -17,8 +17,8 @@
} ?>
-
-