Skip to content

Commit aa93510

Browse files
authored
Merge pull request wavelog#249 from phl0/orbitTypeToMaps
[WIP] Add option to filter map to orbit type
2 parents 51a51fe + 2f4f707 commit aa93510

File tree

8 files changed

+261
-172
lines changed

8 files changed

+261
-172
lines changed

application/controllers/Awards.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,12 @@ public function qso_details_ajax(){
373373
$searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase")));
374374
$band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band")));
375375
$mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode")));
376+
$sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat")));
377+
$orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit")));
376378
$type = $this->security->xss_clean($this->input->post('Type'));
377379
$qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL'));
378380
$searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode'));
379-
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $searchmode);
381+
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode);
380382

381383
// This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC.
382384
// We replace the values to make it look a bit nicer
@@ -402,7 +404,18 @@ public function qso_details_ajax(){
402404

403405
// Render Page
404406
$data['page_title'] = "Log View - " . $type;
405-
$data['filter'] = $type . " " . $searchphrase . " and band ".$band . " and mode ".$mode;
407+
$data['filter'] = $type." ".$searchphrase." and band ".$band;
408+
if ($band == 'SAT') {
409+
if ($sat != 'All' && $sat != null) {
410+
$data['filter'] .= " and sat ".$sat;
411+
}
412+
if ($orbit != 'All' && $orbit != null) {
413+
$data['filter'] .= " and orbit type ".$orbit;
414+
}
415+
}
416+
if ($mode != null && strtolower($mode) != 'all') {
417+
$data['filter'] .= " and mode ".$mode;
418+
}
406419
if (!empty($qsltype)) {
407420
$data['filter'] .= " and ".implode('/', $qsltype);
408421
}

application/controllers/Gridmap.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ public function index() {
1616
$data['visitor'] = false;
1717
$data['homegrid'] = explode(',', $this->stations->find_gridsquare());
1818

19-
$data['modes'] = $this->gridmap_model->get_worked_modes();
19+
$data['modes'] = $this->gridmap_model->get_worked_modes();
2020
$data['bands'] = $this->bands->get_worked_bands();
21+
$data['orbits'] = $this->bands->get_worked_orbits();
2122
$data['sats_available'] = $this->bands->get_worked_sats();
2223

2324
$data['user_default_band'] = $this->session->userdata('user_default_band');
@@ -45,13 +46,14 @@ public function index() {
4546
}
4647

4748
public function getGridsjs() {
48-
$band = $this->security->xss_clean($this->input->post('band'));
49-
$mode = $this->security->xss_clean($this->input->post('mode'));
50-
$qsl = $this->security->xss_clean($this->input->post('qsl'));
51-
$lotw = $this->security->xss_clean($this->input->post('lotw'));
52-
$eqsl = $this->security->xss_clean($this->input->post('eqsl'));
53-
$qrz = $this->security->xss_clean($this->input->post('qrz'));
49+
$band = $this->security->xss_clean($this->input->post('band'));
50+
$mode = $this->security->xss_clean($this->input->post('mode'));
51+
$qsl = $this->security->xss_clean($this->input->post('qsl'));
52+
$lotw = $this->security->xss_clean($this->input->post('lotw'));
53+
$eqsl = $this->security->xss_clean($this->input->post('eqsl'));
54+
$qrz = $this->security->xss_clean($this->input->post('qrz'));
5455
$sat = $this->security->xss_clean($this->input->post('sat'));
56+
$orbit = $this->security->xss_clean($this->input->post('orbit'));
5557
$this->load->model('gridmap_model');
5658

5759
$array_grid_2char = array();
@@ -70,7 +72,7 @@ public function getGridsjs() {
7072
$grid_4char_confirmed = "";
7173
$grid_6char_confirmed = "";
7274

73-
$query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
75+
$query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
7476

7577
if ($query && $query->num_rows() > 0) {
7678
foreach ($query->result() as $row) {
@@ -97,7 +99,7 @@ public function getGridsjs() {
9799
}
98100
}
99101

100-
$query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
102+
$query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
101103

102104
if ($query && $query->num_rows() > 0) {
103105
foreach ($query->result() as $row) {
@@ -124,7 +126,7 @@ public function getGridsjs() {
124126
}
125127
}
126128
}
127-
$query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
129+
$query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
128130

129131
if ($query_vucc && $query_vucc->num_rows() > 0) {
130132
foreach ($query_vucc->result() as $row) {
@@ -149,7 +151,7 @@ public function getGridsjs() {
149151
}
150152

151153
// // Confirmed Squares
152-
$query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat);
154+
$query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit);
153155

154156
if ($query_vucc && $query_vucc->num_rows() > 0) {
155157
foreach ($query_vucc->result() as $row) {

application/language/english/gridsquares_lang.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
$lang['gridsquares_show_map'] = "Show Map";
2121
$lang['gridsquares_band'] = 'Band';
2222
$lang['gridsquares_mode'] = 'Mode';
23+
$lang['gridsquares_orbit'] = 'Orbit';
2324
$lang['gridsquares_sat'] = 'Satellite';
2425
$lang['gridsquares_confirmation'] = 'Confirmation';
2526

application/models/Bands.php

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,42 @@ function get_worked_sats() {
179179

180180
$location_list = "'".implode("','",$logbooks_locations_array)."'";
181181

182-
// get all worked sats from database
183-
$sql = "SELECT distinct col_sat_name FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name";
182+
// get all worked sats from database
183+
$sql = "SELECT distinct col_sat_name FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name";
184184

185-
$data = $this->db->query($sql);
185+
$data = $this->db->query($sql);
186186

187-
$worked_sats = array();
188-
foreach($data->result() as $row){
189-
array_push($worked_sats, $row->col_sat_name);
190-
}
187+
$worked_sats = array();
188+
foreach($data->result() as $row){
189+
array_push($worked_sats, $row->col_sat_name);
190+
}
191191

192-
return $worked_sats;
193-
}
192+
return $worked_sats;
193+
}
194+
195+
function get_worked_orbits() {
196+
$CI =& get_instance();
197+
$CI->load->model('logbooks_model');
198+
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
199+
200+
if (!$logbooks_locations_array) {
201+
return array();
202+
}
203+
204+
$location_list = "'".implode("','",$logbooks_locations_array)."'";
205+
206+
// get all worked orbit types from database
207+
$sql = "SELECT DISTINCT satellite.orbit AS orbit FROM ".$this->config->item('table_name')." LEFT JOIN satellite ON COL_SAT_NAME = satellite.name WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = 'SAT' AND satellite.orbit IS NOT NULL ORDER BY orbit ASC";
208+
209+
$data = $this->db->query($sql);
210+
211+
$worked_orbits = array();
212+
foreach($data->result() as $row){
213+
array_push($worked_orbits, $row->orbit);
214+
}
215+
216+
return $worked_orbits;
217+
}
194218

195219
function get_worked_bands_dok() {
196220
$CI =& get_instance();

0 commit comments

Comments
 (0)