@@ -40,6 +40,7 @@ public function generate_report($logbooks_locations_array, $year, $month) {
4040 'bands ' => $ this ->get_bands_breakdown ($ logbooks_locations_array , $ start_date , $ end_date ),
4141 'continents ' => $ this ->get_continents_breakdown ($ logbooks_locations_array , $ start_date , $ end_date ),
4242 'satellite_qsos ' => $ this ->get_satellite_qsos ($ logbooks_locations_array , $ start_date , $ end_date ),
43+ 'satellite_breakdown ' => $ this ->get_satellite_breakdown ($ logbooks_locations_array , $ start_date , $ end_date ),
4344 'eme_qsos ' => $ this ->get_eme_qsos ($ logbooks_locations_array , $ start_date , $ end_date ),
4445 'top_band ' => '' ,
4546 'top_mode ' => ''
@@ -288,8 +289,8 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
288289
289290 // If not worked before on this band, it's new
290291 if ($ prev_row ->count == 0 ) {
291- // Get the callsign from the first QSO with this DXCC on this band
292- $ this ->db ->select ('COL_CALL ' );
292+ // Get the callsign and mode from the first QSO with this DXCC on this band
293+ $ this ->db ->select ('COL_CALL, COL_MODE, COL_SUBMODE ' );
293294 $ this ->db ->from ($ this ->config ->item ('table_name ' ));
294295 $ this ->db ->where_in ('station_id ' , $ locations );
295296 $ this ->db ->where ('COL_DXCC ' , $ row ->COL_DXCC );
@@ -300,10 +301,16 @@ private function get_new_dxcc_by_band($locations, $start_date, $end_date, $prev_
300301 $ call_query = $ this ->db ->get ();
301302 $ call_row = $ call_query ->row ();
302303
304+ $ mode = '' ;
305+ if ($ call_row ) {
306+ $ mode = !empty ($ call_row ->COL_SUBMODE ) ? $ call_row ->COL_SUBMODE : $ call_row ->COL_MODE ;
307+ }
308+
303309 $ new_dxcc_by_band [$ band ][] = array (
304310 'dxcc_id ' => $ row ->COL_DXCC ,
305311 'name ' => $ row ->COL_COUNTRY ,
306- 'callsign ' => $ call_row ? $ call_row ->COL_CALL : ''
312+ 'callsign ' => $ call_row ? $ call_row ->COL_CALL : '' ,
313+ 'mode ' => $ mode
307314 );
308315 }
309316 }
@@ -370,22 +377,27 @@ private function get_new_gridsquares($locations, $start_date, $end_date, $prev_m
370377 $ new_grids = array ();
371378
372379 // Get all gridsquares worked this month (including VUCC grids)
373- $ this ->db ->select ('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON ' );
380+ $ this ->db ->select ('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON, COL_MODE, COL_SUBMODE ' );
374381 $ this ->db ->from ($ this ->config ->item ('table_name ' ));
375382 $ this ->db ->where_in ('station_id ' , $ locations );
376383 $ this ->db ->where ('COL_TIME_ON >= ' , $ start_date );
377384 $ this ->db ->where ('COL_TIME_ON <= ' , $ end_date );
378385 $ this ->db ->order_by ('COL_TIME_ON ' , 'ASC ' );
379386
380387 $ query = $ this ->db ->get ();
381- $ grid_callsigns = array ();
388+ $ grid_data = array ();
382389
383390 foreach ($ query ->result () as $ row ) {
391+ $ mode = !empty ($ row ->COL_SUBMODE ) ? $ row ->COL_SUBMODE : $ row ->COL_MODE ;
392+
384393 // Process main gridsquare (first 4 characters only)
385394 if (!empty ($ row ->COL_GRIDSQUARE ) && strlen ($ row ->COL_GRIDSQUARE ) >= 4 ) {
386395 $ grid_4char = strtoupper (substr ($ row ->COL_GRIDSQUARE , 0 , 4 ));
387- if (!isset ($ grid_callsigns [$ grid_4char ])) {
388- $ grid_callsigns [$ grid_4char ] = $ row ->COL_CALL ;
396+ if (!isset ($ grid_data [$ grid_4char ])) {
397+ $ grid_data [$ grid_4char ] = array (
398+ 'callsign ' => $ row ->COL_CALL ,
399+ 'mode ' => $ mode
400+ );
389401 }
390402 }
391403
@@ -396,18 +408,25 @@ private function get_new_gridsquares($locations, $start_date, $end_date, $prev_m
396408 $ grid = trim ($ grid );
397409 if (strlen ($ grid ) >= 4 ) {
398410 $ grid_4char = strtoupper (substr ($ grid , 0 , 4 ));
399- if (!isset ($ grid_callsigns [$ grid_4char ])) {
400- $ grid_callsigns [$ grid_4char ] = $ row ->COL_CALL ;
411+ if (!isset ($ grid_data [$ grid_4char ])) {
412+ $ grid_data [$ grid_4char ] = array (
413+ 'callsign ' => $ row ->COL_CALL ,
414+ 'mode ' => $ mode
415+ );
401416 }
402417 }
403418 }
404419 }
405420 }
406421
407422 // Check each grid to see if it's new
408- foreach ($ grid_callsigns as $ grid => $ callsign ) {
423+ foreach ($ grid_data as $ grid => $ data ) {
409424 if ($ this ->is_grid_new ($ locations , $ grid , $ start_date )) {
410- $ new_grids [] = array ('grid ' => $ grid , 'callsign ' => $ callsign );
425+ $ new_grids [] = array (
426+ 'grid ' => $ grid ,
427+ 'callsign ' => $ data ['callsign ' ],
428+ 'mode ' => $ data ['mode ' ]
429+ );
411430 }
412431 }
413432
@@ -426,7 +445,7 @@ private function get_new_gridsquares_by_prop($locations, $start_date, $end_date,
426445 $ new_grids = array ();
427446
428447 // Get all gridsquares worked this month with this prop mode
429- $ this ->db ->select ('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON ' );
448+ $ this ->db ->select ('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON, COL_SAT_NAME, COL_MODE, COL_SUBMODE ' );
430449 $ this ->db ->from ($ this ->config ->item ('table_name ' ));
431450 $ this ->db ->where_in ('station_id ' , $ locations );
432451 $ this ->db ->where ('COL_TIME_ON >= ' , $ start_date );
@@ -435,14 +454,20 @@ private function get_new_gridsquares_by_prop($locations, $start_date, $end_date,
435454 $ this ->db ->order_by ('COL_TIME_ON ' , 'ASC ' );
436455
437456 $ query = $ this ->db ->get ();
438- $ grid_callsigns = array ();
457+ $ grid_data = array ();
439458
440459 foreach ($ query ->result () as $ row ) {
460+ $ mode = !empty ($ row ->COL_SUBMODE ) ? $ row ->COL_SUBMODE : $ row ->COL_MODE ;
461+
441462 // Process main gridsquare (first 4 characters only)
442463 if (!empty ($ row ->COL_GRIDSQUARE ) && strlen ($ row ->COL_GRIDSQUARE ) >= 4 ) {
443464 $ grid_4char = strtoupper (substr ($ row ->COL_GRIDSQUARE , 0 , 4 ));
444- if (!isset ($ grid_callsigns [$ grid_4char ])) {
445- $ grid_callsigns [$ grid_4char ] = $ row ->COL_CALL ;
465+ if (!isset ($ grid_data [$ grid_4char ])) {
466+ $ grid_data [$ grid_4char ] = array (
467+ 'callsign ' => $ row ->COL_CALL ,
468+ 'satellite ' => !empty ($ row ->COL_SAT_NAME ) ? $ row ->COL_SAT_NAME : '' ,
469+ 'mode ' => $ mode
470+ );
446471 }
447472 }
448473
@@ -453,18 +478,27 @@ private function get_new_gridsquares_by_prop($locations, $start_date, $end_date,
453478 $ grid = trim ($ grid );
454479 if (strlen ($ grid ) >= 4 ) {
455480 $ grid_4char = strtoupper (substr ($ grid , 0 , 4 ));
456- if (!isset ($ grid_callsigns [$ grid_4char ])) {
457- $ grid_callsigns [$ grid_4char ] = $ row ->COL_CALL ;
481+ if (!isset ($ grid_data [$ grid_4char ])) {
482+ $ grid_data [$ grid_4char ] = array (
483+ 'callsign ' => $ row ->COL_CALL ,
484+ 'satellite ' => !empty ($ row ->COL_SAT_NAME ) ? $ row ->COL_SAT_NAME : '' ,
485+ 'mode ' => $ mode
486+ );
458487 }
459488 }
460489 }
461490 }
462491 }
463492
464493 // Check each grid to see if it's new for this prop mode
465- foreach ($ grid_callsigns as $ grid => $ callsign ) {
494+ foreach ($ grid_data as $ grid => $ data ) {
466495 if ($ this ->is_grid_new_for_prop ($ locations , $ grid , $ start_date , $ prop_mode )) {
467- $ new_grids [] = array ('grid ' => $ grid , 'callsign ' => $ callsign );
496+ $ new_grids [] = array (
497+ 'grid ' => $ grid ,
498+ 'callsign ' => $ data ['callsign ' ],
499+ 'satellite ' => $ data ['satellite ' ],
500+ 'mode ' => $ data ['mode ' ]
501+ );
468502 }
469503 }
470504
@@ -483,7 +517,7 @@ private function get_new_gridsquares_hf($locations, $start_date, $end_date, $pre
483517 $ new_grids = array ();
484518
485519 // Get all gridsquares worked this month via HF
486- $ this ->db ->select ('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON ' );
520+ $ this ->db ->select ('COL_CALL, COL_GRIDSQUARE, COL_VUCC_GRIDS, COL_TIME_ON, COL_MODE, COL_SUBMODE ' );
487521 $ this ->db ->from ($ this ->config ->item ('table_name ' ));
488522 $ this ->db ->where_in ('station_id ' , $ locations );
489523 $ this ->db ->where ('COL_TIME_ON >= ' , $ start_date );
@@ -492,14 +526,19 @@ private function get_new_gridsquares_hf($locations, $start_date, $end_date, $pre
492526 $ this ->db ->order_by ('COL_TIME_ON ' , 'ASC ' );
493527
494528 $ query = $ this ->db ->get ();
495- $ grid_callsigns = array ();
529+ $ grid_data = array ();
496530
497531 foreach ($ query ->result () as $ row ) {
532+ $ mode = !empty ($ row ->COL_SUBMODE ) ? $ row ->COL_SUBMODE : $ row ->COL_MODE ;
533+
498534 // Process main gridsquare (first 4 characters only)
499535 if (!empty ($ row ->COL_GRIDSQUARE ) && strlen ($ row ->COL_GRIDSQUARE ) >= 4 ) {
500536 $ grid_4char = strtoupper (substr ($ row ->COL_GRIDSQUARE , 0 , 4 ));
501- if (!isset ($ grid_callsigns [$ grid_4char ])) {
502- $ grid_callsigns [$ grid_4char ] = $ row ->COL_CALL ;
537+ if (!isset ($ grid_data [$ grid_4char ])) {
538+ $ grid_data [$ grid_4char ] = array (
539+ 'callsign ' => $ row ->COL_CALL ,
540+ 'mode ' => $ mode
541+ );
503542 }
504543 }
505544
@@ -510,18 +549,25 @@ private function get_new_gridsquares_hf($locations, $start_date, $end_date, $pre
510549 $ grid = trim ($ grid );
511550 if (strlen ($ grid ) >= 4 ) {
512551 $ grid_4char = strtoupper (substr ($ grid , 0 , 4 ));
513- if (!isset ($ grid_callsigns [$ grid_4char ])) {
514- $ grid_callsigns [$ grid_4char ] = $ row ->COL_CALL ;
552+ if (!isset ($ grid_data [$ grid_4char ])) {
553+ $ grid_data [$ grid_4char ] = array (
554+ 'callsign ' => $ row ->COL_CALL ,
555+ 'mode ' => $ mode
556+ );
515557 }
516558 }
517559 }
518560 }
519561 }
520562
521563 // Check each grid to see if it's new for HF
522- foreach ($ grid_callsigns as $ grid => $ callsign ) {
564+ foreach ($ grid_data as $ grid => $ data ) {
523565 if ($ this ->is_grid_new_for_hf ($ locations , $ grid , $ start_date )) {
524- $ new_grids [] = array ('grid ' => $ grid , 'callsign ' => $ callsign );
566+ $ new_grids [] = array (
567+ 'grid ' => $ grid ,
568+ 'callsign ' => $ data ['callsign ' ],
569+ 'mode ' => $ data ['mode ' ]
570+ );
525571 }
526572 }
527573
@@ -676,6 +722,32 @@ private function get_satellite_qsos($locations, $start_date, $end_date) {
676722 return $ row ? (int )$ row ->count : 0 ;
677723 }
678724
725+ /**
726+ * Get breakdown of QSOs per satellite
727+ */
728+ private function get_satellite_breakdown ($ locations , $ start_date , $ end_date ) {
729+ $ satellites = array ();
730+
731+ $ this ->db ->select ('COL_SAT_NAME, COUNT(*) as count ' );
732+ $ this ->db ->from ($ this ->config ->item ('table_name ' ));
733+ $ this ->db ->where_in ('station_id ' , $ locations );
734+ $ this ->db ->where ('COL_TIME_ON >= ' , $ start_date );
735+ $ this ->db ->where ('COL_TIME_ON <= ' , $ end_date );
736+ $ this ->db ->where ('COL_PROP_MODE ' , 'SAT ' );
737+ $ this ->db ->where ('COL_SAT_NAME IS NOT NULL ' );
738+ $ this ->db ->where ('COL_SAT_NAME != ' , '' );
739+ $ this ->db ->group_by ('COL_SAT_NAME ' );
740+ $ this ->db ->order_by ('count ' , 'DESC ' );
741+
742+ $ query = $ this ->db ->get ();
743+
744+ foreach ($ query ->result () as $ row ) {
745+ $ satellites [$ row ->COL_SAT_NAME ] = (int )$ row ->count ;
746+ }
747+
748+ return $ satellites ;
749+ }
750+
679751 /**
680752 * Get EME (moonbounce) QSO count
681753 */
0 commit comments