@@ -33,15 +33,6 @@ function info($callsign) {
3333 }
3434 }
3535
36- function search (){
37- print_r ($ this ->input ->get ());
38- return ;
39- }
40-
41- function empty_table ($ table ) {
42- $ this ->db ->empty_table ($ table );
43- }
44-
4536 /*
4637 * Fetches a list of all dxcc's, both current and deleted
4738 */
@@ -89,15 +80,15 @@ function get_dxcc_array($dxccArray, $bands, $postdata) {
8980 if ($ postdata ['worked ' ] != NULL ) {
9081 $ workedDXCC = $ this ->getDxccBandWorked ($ location_list , $ band , $ postdata );
9182 foreach ($ workedDXCC as $ wdxcc ) {
92- $ dxccMatrix [$ wdxcc ->dxcc ][$ band ] = '<div class="bg-danger awardsBgDanger" ><a href= \'javascript:displayContacts(" ' .str_replace ("& " , "%26 " , $ wdxcc ->name ).'"," ' . $ band . '"," ' . $ postdata ['mode ' ] . '","DXCC", "") \'>W</a></div> ' ;
83+ $ dxccMatrix [$ wdxcc ->dxcc ][$ band ] = '<div class="bg-danger awardsBgDanger" ><a href= \'javascript:displayContacts(" ' .str_replace ("& " , "%26 " , $ wdxcc ->name ).'"," ' . $ band . '"," ' . $ postdata ['sat ' ] . ' "," ' . $ postdata [ ' orbit ' ] . ' "," ' . $ postdata [ ' mode ' ] . '","DXCC", "") \'>W</a></div> ' ;
9384 }
9485 }
9586
9687 // If confirmed is checked, we add confirmed entities to the array
9788 if ($ postdata ['confirmed ' ] != NULL ) {
9889 $ confirmedDXCC = $ this ->getDxccBandConfirmed ($ location_list , $ band , $ postdata );
9990 foreach ($ confirmedDXCC as $ cdxcc ) {
100- $ dxccMatrix [$ cdxcc ->dxcc ][$ band ] = '<div class="bg-success awardsBgSuccess"><a href= \'javascript:displayContacts(" ' .str_replace ("& " , "%26 " , $ cdxcc ->name ).'"," ' . $ band . '"," ' . $ postdata ['mode ' ] . '","DXCC"," ' .$ qsl .'") \'>C</a></div> ' ;
91+ $ dxccMatrix [$ cdxcc ->dxcc ][$ band ] = '<div class="bg-success awardsBgSuccess"><a href= \'javascript:displayContacts(" ' .str_replace ("& " , "%26 " , $ cdxcc ->name ).'"," ' . $ band . '"," ' . $ postdata [ ' sat ' ] . ' "," ' . $ postdata [ ' orbit ' ] . ' "," ' . $ postdata ['mode ' ] . '","DXCC"," ' .$ qsl .'") \'>C</a></div> ' ;
10192 }
10293 }
10394 }
@@ -133,15 +124,23 @@ function getDxccBandConfirmed($location_list, $band, $postdata) {
133124 $ sql = "select adif as dxcc, name from dxcc_entities
134125 join (
135126 select col_dxcc from " .$ this ->config ->item ('table_name ' )." thcv
127+ LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
136128 where station_id in ( " . $ location_list .
137129 ") and col_dxcc > 0 " ;
138130
139131 $ sql .= $ this ->genfunctions ->addBandToQuery ($ band );
132+ if ($ band == 'SAT ' ) {
133+ if ($ postdata ['sat ' ] != 'All ' ) {
134+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
135+ }
136+ }
140137
141138 if ($ postdata ['mode ' ] != 'All ' ) {
142139 $ sql .= " and (col_mode = ' " . $ postdata ['mode ' ] . "' or col_submode = ' " . $ postdata ['mode ' ] . "') " ;
143140 }
144141
142+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
143+
145144 $ sql .= $ this ->genfunctions ->addQslToQuery ($ postdata );
146145
147146 $ sql .= " group by col_dxcc
@@ -162,18 +161,27 @@ function getDxccBandWorked($location_list, $band, $postdata) {
162161 $ sql = "select adif as dxcc, name from dxcc_entities
163162 join (
164163 select col_dxcc from " .$ this ->config ->item ('table_name ' )." thcv
164+ LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
165165 where station_id in ( " . $ location_list .
166166 ") and col_dxcc > 0 " ;
167167 $ sql .= $ this ->genfunctions ->addBandToQuery ($ band );
168+ if ($ band == 'SAT ' ) {
169+ if ($ postdata ['sat ' ] != 'All ' ) {
170+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
171+ }
172+ }
168173 if ($ postdata ['mode ' ] != 'All ' ) {
169174 $ sql .= " and (col_mode = ' " . $ postdata ['mode ' ] . "' or col_submode = ' " . $ postdata ['mode ' ] . "') " ;
170175 }
176+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
177+
171178 $ sql .= " group by col_dxcc
172179 ) x on dxcc_entities.adif = x.col_dxcc " ;;
173180 if ($ postdata ['includedeleted ' ] == NULL ) {
174181 $ sql .= " and dxcc_entities.end is null " ;
175182 }
176183 $ sql .= $ this ->addContinentsToQuery ($ postdata );
184+
177185 $ query = $ this ->db ->query ($ sql );
178186 return $ query ->result ();
179187 }
@@ -193,11 +201,16 @@ function fetchDxcc($postdata) {
193201 from dxcc_entities " ;
194202
195203 if ($ postdata ['notworked ' ] == NULL ) {
196- $ sql .= " join (select col_dxcc from " . $ this ->config ->item ('table_name ' ) . " where station_id in ( " . $ location_list . ") and col_dxcc > 0 " ;
204+ $ sql .= " join (select col_dxcc from " . $ this ->config ->item ('table_name ' ) . " thcv
205+ LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
206+ where station_id in ( " . $ location_list . ") and col_dxcc > 0 " ;
197207
198208 if ($ postdata ['band ' ] != 'All ' ) {
199209 if ($ postdata ['band ' ] == 'SAT ' ) {
200210 $ sql .= " and col_prop_mode =' " . $ postdata ['band ' ] . "' " ;
211+ if ($ postdata ['sat ' ] != 'All ' ) {
212+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
213+ }
201214 } else {
202215 $ sql .= " and col_prop_mode !='SAT' " ;
203216 $ sql .= " and col_band =' " . $ postdata ['band ' ] . "' " ;
@@ -208,6 +221,8 @@ function fetchDxcc($postdata) {
208221 $ sql .= " and (col_mode = ' " . $ postdata ['mode ' ] . "' or col_submode = ' " . $ postdata ['mode ' ] . "') " ;
209222 }
210223
224+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
225+
211226 $ sql .= ' group by col_dxcc) x on dxcc_entities.adif = x.col_dxcc ' ;
212227 }
213228
@@ -230,16 +245,30 @@ function getDxccWorked($location_list, $postdata) {
230245 join (
231246 select col_dxcc
232247 from " .$ this ->config ->item ('table_name ' )." thcv
248+ LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
233249 where station_id in ( " . $ location_list .
234250 ") and col_dxcc > 0 " ;
235251 $ sql .= $ this ->genfunctions ->addBandToQuery ($ postdata ['band ' ]);
252+ if ($ postdata ['band ' ] == 'SAT ' ) {
253+ if ($ postdata ['sat ' ] != 'All ' ) {
254+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
255+ }
256+ }
257+
258+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
236259
237260 if ($ postdata ['mode ' ] != 'All ' ) {
238261 $ sql .= " and (col_mode = ' " . $ postdata ['mode ' ] . "' or col_submode = ' " . $ postdata ['mode ' ] . "') " ;
239262 }
240263
241264 $ sql .= " and not exists (select 1 from " .$ this ->config ->item ('table_name ' )." where station_id in ( " . $ location_list .") and col_dxcc = thcv.col_dxcc and col_dxcc > 0 " ;
242265 $ sql .= $ this ->genfunctions ->addBandToQuery ($ postdata ['band ' ]);
266+ if ($ postdata ['band ' ] == 'SAT ' ) {
267+ if ($ postdata ['sat ' ] != 'All ' ) {
268+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
269+ }
270+ }
271+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
243272
244273 if ($ postdata ['mode ' ] != 'All ' ) {
245274 $ sql .= " and (col_mode = ' " . $ postdata ['mode ' ] . "' or col_submode = ' " . $ postdata ['mode ' ] . "') " ;
@@ -256,6 +285,7 @@ function getDxccWorked($location_list, $postdata) {
256285 }
257286
258287 $ sql .= $ this ->addContinentsToQuery ($ postdata );
288+
259289 $ query = $ this ->db ->query ($ sql );
260290 return $ query ->result ();
261291 }
@@ -265,15 +295,23 @@ function getDxccConfirmed($location_list, $postdata) {
265295 join (
266296 select col_dxcc
267297 from " .$ this ->config ->item ('table_name ' )." thcv
298+ LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name
268299 where station_id in ( " . $ location_list .
269300 ") and col_dxcc > 0 " ;
270301
271302 $ sql .= $ this ->genfunctions ->addBandToQuery ($ postdata ['band ' ]);
303+ if ($ postdata ['band ' ] == 'SAT ' ) {
304+ if ($ postdata ['sat ' ] != 'All ' ) {
305+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
306+ }
307+ }
272308
273309 if ($ postdata ['mode ' ] != 'All ' ) {
274310 $ sql .= " and (col_mode = ' " . $ postdata ['mode ' ] . "' or col_submode = ' " . $ postdata ['mode ' ] . "') " ;
275311 }
276312
313+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
314+
277315 $ sql .= $ this ->genfunctions ->addQslToQuery ($ postdata );
278316
279317 $ sql .= " group by col_dxcc
@@ -286,6 +324,7 @@ function getDxccConfirmed($location_list, $postdata) {
286324
287325 $ sql .= $ this ->addContinentsToQuery ($ postdata );
288326
327+
289328 $ query = $ this ->db ->query ($ sql );
290329
291330 return $ query ->result ();
@@ -356,12 +395,16 @@ function get_dxcc_summary($bands, $postdata) {
356395
357396 function getSummaryByBand ($ band , $ postdata , $ location_list ) {
358397 $ sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $ this ->config ->item ('table_name ' ) . " thcv " ;
398+ $ sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name " ;
359399 $ sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif " ;
360400
361401 $ sql .= " where station_id in ( " . $ location_list . ") and col_dxcc > 0 " ;
362402
363403 if ($ band == 'SAT ' ) {
364404 $ sql .= " and thcv.col_prop_mode =' " . $ band . "' " ;
405+ if ($ band != 'All ' ) {
406+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
407+ }
365408 } else if ($ band == 'All ' ) {
366409 $ this ->load ->model ('bands ' );
367410
@@ -386,19 +429,35 @@ function getSummaryByBand($band, $postdata, $location_list) {
386429
387430 $ sql .= $ this ->addContinentsToQuery ($ postdata );
388431
432+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
433+
389434 $ query = $ this ->db ->query ($ sql );
390435
391436 return $ query ->result ();
392437 }
393438
439+ // Adds orbit type to query
440+ function addOrbitToQuery ($ postdata ) {
441+ $ sql = '' ;
442+ if ($ postdata ['orbit ' ] != 'All ' ) {
443+ $ sql .= ' AND satellite.orbit = \'' .$ postdata ['orbit ' ].'\'' ;
444+ }
445+
446+ return $ sql ;
447+ }
448+
394449 function getSummaryByBandConfirmed ($ band , $ postdata , $ location_list ) {
395450 $ sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $ this ->config ->item ('table_name ' ) . " thcv " ;
451+ $ sql .= " LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name " ;
396452 $ sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif " ;
397453
398454 $ sql .= " where station_id in ( " . $ location_list . ") " ;
399455
400456 if ($ band == 'SAT ' ) {
401457 $ sql .= " and thcv.col_prop_mode =' " . $ band . "' " ;
458+ if ($ postdata ['sat ' ] != 'All ' ) {
459+ $ sql .= " and col_sat_name =' " . $ postdata ['sat ' ] . "' " ;
460+ }
402461 } else if ($ band == 'All ' ) {
403462 $ this ->load ->model ('bands ' );
404463
@@ -419,6 +478,8 @@ function getSummaryByBandConfirmed($band, $postdata, $location_list) {
419478
420479 $ sql .= $ this ->genfunctions ->addQslToQuery ($ postdata );
421480
481+ $ sql .= $ this ->addOrbitToQuery ($ postdata );
482+
422483
423484 if ($ postdata ['includedeleted ' ] == NULL ) {
424485 $ sql .= " and d.end is null " ;
0 commit comments