2012-11-14 01:44:23 +00:00
< ? php if ( ! defined ( 'BASEPATH' )) exit ( 'No direct script access allowed' );
2026-01-22 11:55:30 +01:00
use Wavelog\Dxcc\Dxcc ;
require_once APPPATH . '../src/Dxcc/Dxcc.php' ;
2019-02-26 14:19:52 +01:00
2012-11-14 01:44:23 +00:00
class Logbook extends CI_Controller {
2026-01-05 19:23:01 +00:00
function index () {
2021-11-08 15:28:16 +00:00
// Check if users logged in
if ( $this -> user_model -> validate_session () == 0 ) {
// user is not logged in
redirect ( 'user/login' );
}
2022-05-02 12:38:55 +02:00
$this -> load -> model ( 'stations' );
2019-02-26 22:08:12 +01:00
2021-10-17 11:25:01 +02:00
$this -> load -> model ( 'logbook_model' );
2019-02-26 22:08:12 +01:00
$this -> load -> library ( 'pagination' );
$config [ 'base_url' ] = base_url () . 'index.php/logbook/index/' ;
2021-10-17 11:25:01 +02:00
$config [ 'total_rows' ] = $this -> logbook_model -> total_qsos ();
2026-01-20 13:50:22 +01:00
$config [ 'per_page' ] = 25 ;
2019-02-26 22:08:12 +01:00
$config [ 'num_links' ] = 6 ;
$config [ 'full_tag_open' ] = '' ;
$config [ 'full_tag_close' ] = '' ;
$config [ 'cur_tag_open' ] = '<strong class="active"><a href="">' ;
$config [ 'cur_tag_close' ] = '</a></strong>' ;
$this -> pagination -> initialize ( $config );
2024-09-10 13:17:08 +02:00
2019-02-26 22:08:12 +01:00
//load the model and get results
$data [ 'results' ] = $this -> logbook_model -> get_qsos ( $config [ 'per_page' ], $this -> uri -> segment ( 3 ));
2024-09-10 13:17:08 +02:00
2026-05-07 22:07:12 +02:00
$data [ 'adif_propmodes' ] = $this -> config -> item ( 'adif_propmodes' );
2024-05-31 15:45:32 +02:00
$data [ 'user_map_custom' ] = $this -> optionslib -> get_map_custom ();
2019-02-26 22:08:12 +01:00
2023-08-06 20:20:16 +02:00
if ( ! $data [ 'results' ]) {
2024-06-07 21:38:09 +02:00
$this -> session -> set_flashdata ( 'notice' , __ ( " No logbooks were found. You need to define a logbook under Station Logbooks! Do it here: " ) . ' <a href="' . site_url ( 'logbooks' ) . '" title="Station Logbooks">' . __ ( " Station Logbooks " ) . '</a>' );
2022-07-03 13:32:12 +02:00
}
2019-02-26 22:08:12 +01:00
// Calculate Lat/Lng from Locator to use on Maps
if ( $this -> session -> userdata ( 'user_locator' )) {
2024-07-15 05:59:47 +02:00
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
$this -> load -> library ( 'Qra' );
}
2019-02-26 22:08:12 +01:00
$qra_position = $this -> qra -> qra2latlong ( $this -> session -> userdata ( 'user_locator' ));
2022-10-27 15:17:52 +02:00
if ( isset ( $qra_position [ 0 ]) and isset ( $qra_position [ 1 ])) {
$data [ 'qra' ] = " set " ;
$data [ 'qra_lat' ] = $qra_position [ 0 ];
$data [ 'qra_lng' ] = $qra_position [ 1 ];
} else {
$data [ 'qra' ] = " none " ;
}
2019-02-26 22:08:12 +01:00
} else {
$data [ 'qra' ] = " none " ;
}
// load the view
2024-06-08 11:01:59 +02:00
$data [ 'page_title' ] = __ ( " Logbook " );
2019-02-26 22:08:12 +01:00
2019-05-14 16:46:16 +01:00
$this -> load -> view ( 'interface_assets/header' , $data );
2019-02-26 22:08:12 +01:00
$this -> load -> view ( 'view_log/index' );
2019-05-14 16:46:16 +01:00
$this -> load -> view ( 'interface_assets/footer' );
2019-02-26 22:08:12 +01:00
}
2020-04-13 10:34:02 +02:00
function jsonentity ( $adif ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2020-04-13 10:34:02 +02:00
2026-01-05 19:23:01 +00:00
$return [ 'dxcc' ] = $this -> getentity ( $adif );
header ( 'Content-Type: application/json' );
echo json_encode ( $return , JSON_PRETTY_PRINT );
}
2020-04-13 10:34:02 +02:00
2025-01-29 12:29:37 +01:00
function json ( $tempcallsign , $tempband , $tempmode , $tempstation_id = null , $date = " " , $count = 5 ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-01-13 11:06:05 +00:00
session_write_close ();
2025-07-14 14:02:20 +02:00
// Normalize the date only if it's not empty
if ( ! empty ( $date )) {
2025-09-24 08:43:58 -04:00
// Characters '/' and ',' are not URL safe, so we replace
// them with '_' and '%'. Switch them back here.
2025-07-20 22:38:15 +02:00
if ( strpos ( $date , '_' ) !== false ) {
$date = str_replace ( '_' , '/' , $date );
}
2025-09-24 08:43:58 -04:00
if ( strpos ( $date , '%' ) !== false ) {
$date = str_replace ( '%' , ',' , $date );
}
2025-07-14 14:02:20 +02:00
// Get user-preferred date format
if ( $this -> session -> userdata ( 'user_date_format' )) {
$date_format = $this -> session -> userdata ( 'user_date_format' );
} else {
$date_format = $this -> config -> item ( 'qso_date_format' );
}
$date = urldecode ( $date );
$dt = DateTime :: createFromFormat ( $date_format , $date );
if ( $dt !== false ) {
$date = $dt -> format ( 'Y-m-d' ); // or any normalized format
} else {
// Invalid date for the expected format, handle gracefully
$date = null ;
}
2024-05-29 04:51:28 +00:00
}
2023-08-06 20:20:16 +02:00
// Cleaning for security purposes
$callsign = $this -> security -> xss_clean ( $tempcallsign );
$band = $this -> security -> xss_clean ( $tempband );
$mode = $this -> security -> xss_clean ( $tempmode );
$station_id = $this -> security -> xss_clean ( $tempstation_id );
2024-05-29 04:51:28 +00:00
$date = $this -> security -> xss_clean ( $date );
2023-08-06 20:20:16 +02:00
2019-02-26 22:08:12 +01:00
2021-01-29 20:11:35 +00:00
// Convert - in Callsign to / Used for URL processing
$callsign = str_replace ( " - " , " / " , $callsign );
2023-09-18 08:22:55 +02:00
$callsign = str_replace ( " Ø " , " 0 " , $callsign );
2021-01-29 20:11:35 +00:00
2023-07-27 09:16:55 +02:00
// Check if callsign is an LoTW User
2020-09-21 14:02:50 +01:00
// Check Database for all other data
2019-02-26 22:08:12 +01:00
$this -> load -> model ( 'logbook_model' );
2023-08-06 20:20:16 +02:00
2024-11-26 17:21:11 +01:00
$lotw_days = $this -> logbook_model -> check_last_lotw ( $callsign );
2023-07-13 15:19:08 +00:00
if ( $lotw_days != null ) {
$lotw_member = " active " ;
} else {
$lotw_member = " not found " ;
}
2019-02-26 22:08:12 +01:00
$return = [
2022-12-01 14:01:15 +00:00
" callsign " => strtoupper ( $callsign ),
2019-02-26 22:08:12 +01:00
" dxcc " => false ,
" callsign_name " => " " ,
" callsign_qra " => " " ,
2023-06-15 16:03:24 +02:00
" callsign_distance " => 0 ,
2019-02-26 22:08:12 +01:00
" callsign_qth " => " " ,
" callsign_iota " => " " ,
2020-03-07 16:36:21 +00:00
" callsign_state " => " " ,
2020-03-07 16:46:31 +00:00
" callsign_us_county " => " " ,
2024-08-27 08:50:09 +02:00
" callsign_ituz " => " " ,
2024-08-27 10:13:30 +02:00
" callsign_cqz " => " " ,
2019-06-17 11:15:05 +01:00
" qsl_manager " => " " ,
2019-02-26 22:08:12 +01:00
" bearing " => " " ,
2019-06-16 16:37:26 +01:00
" workedBefore " => false ,
2023-12-29 06:41:45 +00:00
" timesWorked " => 0 ,
2019-06-16 16:37:26 +01:00
" lotw_member " => $lotw_member ,
2023-07-13 15:19:08 +00:00
" lotw_days " => $lotw_days ,
2022-04-03 10:28:36 +02:00
" image " => " " ,
2019-02-26 22:08:12 +01:00
];
2024-05-29 04:51:28 +00:00
$return [ 'dxcc' ] = $this -> dxcheck ( $callsign , $date );
2023-10-11 15:36:42 +00:00
2025-09-30 08:25:15 +02:00
$this -> load -> library ( 'callbook' );
$lookupcall = $this -> callbook -> get_plaincall ( $callsign );
2019-02-26 14:19:52 +01:00
2022-04-03 10:28:36 +02:00
$callbook = $this -> logbook_model -> loadCallBook ( $callsign , $this -> config -> item ( 'use_fullname' ));
2025-01-29 12:29:37 +01:00
$return [ 'partial' ] = $this -> partial ( $lookupcall , $callbook , $callsign , $return [ 'dxcc' ], $lotw_days , $band , $count );
2024-11-25 18:42:41 +01:00
2023-08-06 20:20:16 +02:00
if ( $this -> session -> userdata ( 'user_measurement_base' ) == NULL ) {
$measurement_base = $this -> config -> item ( 'measurement_base' );
} else {
$measurement_base = $this -> session -> userdata ( 'user_measurement_base' );
2021-12-31 17:49:44 +01:00
}
2019-02-26 14:19:52 +01:00
2025-10-30 15:37:20 +01:00
// Get user's lookup priority preference
$lookup_priority = $this -> get_lookup_priority ();
2026-02-25 10:36:27 +00:00
// Consolidated callsign lookup - reduces queries from 11 to 2
$callsign_info = $this -> logbook_model -> get_callsign_all_info ( $callsign );
$return [ 'callsign_name' ] = $this -> nval ( $callsign_info [ 'name' ], $callbook [ 'name' ] ? ? '' , $lookup_priority );
$return [ 'callsign_qra' ] = $this -> nval ( $callsign_info [ 'qra' ], $callbook [ 'gridsquare' ] ? ? '' , $lookup_priority );
2025-09-04 16:12:02 +02:00
$return [ 'callsign_geoloc' ] = $callbook [ 'geoloc' ] ? ? '' ;
2024-08-17 17:09:32 +02:00
$return [ 'callsign_distance' ] = $this -> distance ( $return [ 'callsign_qra' ], $station_id );
2026-02-25 10:36:27 +00:00
$return [ 'callsign_qth' ] = $this -> nval ( $callsign_info [ 'qth' ], $callbook [ 'city' ] ? ? '' , $lookup_priority );
$return [ 'callsign_iota' ] = $this -> nval ( $callsign_info [ 'iota' ], $callbook [ 'iota' ] ? ? '' , $lookup_priority );
$return [ 'callsign_email' ] = $this -> nval ( $callsign_info [ 'email' ], $callbook [ 'email' ] ? ? '' , $lookup_priority );
$return [ 'qsl_manager' ] = $this -> nval ( $callsign_info [ 'qslvia' ], $callbook [ 'qslmgr' ] ? ? '' , $lookup_priority );
$return [ 'callsign_state' ] = $this -> nval ( $callsign_info [ 'state' ], $callbook [ 'state' ] ? ? '' , $lookup_priority );
$return [ 'callsign_us_county' ] = $this -> nval ( $callsign_info [ 'us_county' ], $callbook [ 'us_county' ] ? ? '' , $lookup_priority );
$return [ 'callsign_ituz' ] = $this -> nval ( $callsign_info [ 'ituz' ], $callbook [ 'ituz' ] ? ? '' , $lookup_priority );
$return [ 'callsign_cqz' ] = $this -> nval ( $callsign_info [ 'cqz' ], $callbook [ 'cqz' ] ? ? '' , $lookup_priority );
// call_darc_dok remains separate due to different query pattern (uses logbooks_relationships)
2026-02-19 09:25:17 +01:00
$return [ 'callsign_darc_dok' ] = $this -> nval ( $this -> logbook_model -> call_darc_dok ( $callsign ), $callbook [ 'darc_dok' ] ? ? '' , $lookup_priority );
2024-04-16 11:40:34 +02:00
$return [ 'workedBefore' ] = $this -> worked_grid_before ( $return [ 'callsign_qra' ], $band , $mode );
2025-10-28 23:10:43 +01:00
$return [ 'confirmed' ] = $this -> confirmed_grid_before ( $return [ 'callsign_qra' ], $band , $mode );
$return [ 'timesWorked' ] = $this -> logbook_model -> times_worked ( $lookupcall );
2023-08-06 20:20:16 +02:00
if ( $this -> session -> userdata ( 'user_show_profile_image' )) {
2023-11-15 08:58:42 +01:00
if ( isset ( $callbook ) && isset ( $callbook [ 'image' ])) {
2022-04-03 14:05:05 +02:00
if ( $callbook [ 'image' ] == " " ) {
$return [ 'image' ] = " n/a " ;
} else {
$return [ 'image' ] = $callbook [ 'image' ];
}
2023-08-06 20:20:16 +02:00
} else {
$return [ 'image' ] = " n/a " ;
2022-04-03 10:28:36 +02:00
}
2025-10-28 23:10:43 +01:00
// Additional profile information from QRZ
$return [ 'profile_url' ] = $callbook [ 'url' ] ? ? '' ;
$return [ 'profile_class' ] = $callbook [ 'class' ] ? ? '' ;
$return [ 'profile_born' ] = $callbook [ 'born' ] ? ? '' ;
$return [ 'profile_eqsl' ] = $callbook [ 'eqsl' ] ? ? '' ;
$return [ 'profile_lotw' ] = $callbook [ 'lotw' ] ? ? '' ;
$return [ 'profile_mqsl' ] = $callbook [ 'mqsl' ] ? ? '' ;
$return [ 'profile_fname' ] = $callbook [ 'fname' ] ? ? '' ;
$return [ 'profile_name_last' ] = $callbook [ 'name_last' ] ? ? '' ;
$return [ 'profile_nickname' ] = $callbook [ 'nickname' ] ? ? '' ;
$return [ 'profile_aliases' ] = $callbook [ 'aliases' ] ? ? '' ;
$return [ 'profile_p_call' ] = $callbook [ 'p_call' ] ? ? '' ;
$return [ 'profile_addr1' ] = $callbook [ 'addr1' ] ? ? '' ;
$return [ 'profile_addr2' ] = $callbook [ 'addr2' ] ? ? '' ;
$return [ 'profile_state' ] = $callbook [ 'state' ] ? ? '' ;
$return [ 'profile_zip' ] = $callbook [ 'zip' ] ? ? '' ;
$return [ 'profile_country' ] = $callbook [ 'country' ] ? ? '' ;
$return [ 'profile_dxcc' ] = $callbook [ 'dxcc' ] ? ? '' ;
$return [ 'profile_lat' ] = $callbook [ 'lat' ] ? ? '' ;
$return [ 'profile_lon' ] = $callbook [ 'lon' ] ? ? '' ;
$return [ 'profile_efdate' ] = $callbook [ 'efdate' ] ? ? '' ;
$return [ 'profile_expdate' ] = $callbook [ 'expdate' ] ? ? '' ;
$return [ 'profile_GMTOffset' ] = $callbook [ 'GMTOffset' ] ? ? '' ;
$return [ 'profile_qslmgr' ] = $callbook [ 'qslmgr' ] ? ? '' ;
2019-06-14 00:14:39 +01:00
}
2020-09-14 20:24:57 +02:00
2024-11-12 13:04:55 +01:00
if ( $return [ 'callsign_qra' ] != " " || $return [ 'callsign_qra' ] != null ) {
2023-08-06 20:20:16 +02:00
$return [ 'latlng' ] = $this -> qralatlng ( $return [ 'callsign_qra' ]);
$return [ 'bearing' ] = $this -> bearing ( $return [ 'callsign_qra' ], $measurement_base , $station_id );
2026-08-06 05:54:07 +00:00
// numeric counterpart of 'bearing', used to prefill the antenna azimuth while logging
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
$this -> load -> library ( 'Qra' );
}
$mylocator = $this -> my_locator ( $station_id );
$bearing_deg = ( $mylocator === false ) ? false : $this -> qra -> get_bearing ( $mylocator , $return [ 'callsign_qra' ]);
$return [ 'bearing_deg' ] = ( $bearing_deg === false ) ? null : ( int ) $bearing_deg ;
2021-12-31 17:49:44 +01:00
}
2026-01-26 11:55:02 +01:00
$return [ 'callbook_source' ] = $callbook [ 'source' ] ? ? '' ;
2020-09-14 20:24:57 +02:00
2021-12-31 17:49:44 +01:00
echo json_encode ( $return , JSON_PRETTY_PRINT );
2019-06-16 16:37:26 +01:00
2021-12-31 17:49:44 +01:00
return ;
2019-02-26 22:08:12 +01:00
}
2025-10-30 15:37:20 +01:00
// Helper function to get user's lookup priority setting
// Returns 1 for database priority, 2 for external lookup priority (default)
function get_lookup_priority () {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2025-10-30 15:37:20 +01:00
$this -> load -> model ( 'user_options_model' );
$priority = $this -> user_options_model -> get_options ( 'qso_db_search_priority' , array ( 'option_name' => 'enable' , 'option_key' => 'boolean' )) -> row ();
// If setting is 'Y' (Yes), prioritize database (return 1), otherwise prioritize external lookup (return 2)
return ( isset ( $priority -> option_value ) && $priority -> option_value == 'Y' ) ? 1 : 2 ;
}
2023-08-06 20:20:16 +02:00
// Returns $val2 first if it has value, even if it is null or empty string, if not return $val1.
2025-10-30 15:37:20 +01:00
// When $priority is set to 1, returns $val1 first if it has value, if not return $val2.
2026-01-05 19:23:01 +00:00
private function nval ( $val1 , $val2 , $priority = 2 ) {
2025-10-30 15:37:20 +01:00
if ( $priority == 1 ) {
return (( $val1 ? ? " " ) === " " ? ( $val2 ? ? " " ) : ( $val1 ? ? " " ));
}
2023-08-06 20:20:16 +02:00
return (( $val2 ? ? " " ) === " " ? ( $val1 ? ? " " ) : ( $val2 ? ? " " ));
}
2026-01-05 19:23:01 +00:00
private function confirmed_grid_before ( $gridsquare , $band , $mode ) {
2023-09-12 13:05:58 +00:00
if ( strlen ( $gridsquare ) < 4 )
return false ;
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
2023-10-16 22:39:33 +02:00
$user_default_confirmation = $this -> session -> userdata ( 'user_default_confirmation' );
2023-09-12 13:05:58 +00:00
2026-03-18 09:00:48 +01:00
if ( $logbooks_locations_array [ 0 ] !== - 1 ) {
2023-09-12 13:05:58 +00:00
$extrawhere = '' ;
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Q' ) !== false ) {
2023-12-27 17:02:19 +01:00
$extrawhere = " COL_QSL_RCVD='Y' " ;
2023-09-12 13:05:58 +00:00
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'L' ) !== false ) {
2023-09-12 13:05:58 +00:00
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_LOTW_QSL_RCVD='Y' " ;
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'E' ) !== false ) {
2023-09-12 13:05:58 +00:00
if ( $extrawhere != '' ) {
2023-09-19 18:29:07 +00:00
$extrawhere .= " OR " ;
2023-09-12 13:05:58 +00:00
}
$extrawhere .= " COL_EQSL_QSL_RCVD='Y' " ;
}
2023-12-08 07:17:01 +00:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Z' ) !== false ) {
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' " ;
}
2024-05-13 08:02:10 +00:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'C' ) !== false ) {
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_CLUBLOG_QSO_DOWNLOAD_STATUS='Y' " ;
}
2023-09-12 13:05:58 +00:00
2024-04-16 11:40:34 +02:00
if ( $band == " SAT " ) {
2023-09-12 13:05:58 +00:00
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
if ( $extrawhere != '' ) {
$this -> db -> where ( '(' . $extrawhere . ')' );
} else {
$this -> db -> where ( " 1=0 " );
}
} else {
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbook_model' );
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2023-09-12 13:05:58 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2023-09-12 13:05:58 +00:00
if ( $extrawhere != '' ) {
$this -> db -> where ( '(' . $extrawhere . ')' );
} else {
$this -> db -> where ( " 1=0 " );
}
}
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
$this -> db -> like ( 'SUBSTRING(COL_GRIDSQUARE, 1, 4)' , substr ( $gridsquare , 0 , 4 ));
$this -> db -> order_by ( $this -> config -> item ( 'table_name' ) . " .COL_TIME_ON " , " desc " );
$this -> db -> limit ( 1 );
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ));
foreach ( $query -> result () as $workedBeforeRow ) {
return true ;
}
}
return false ;
}
2026-01-05 19:23:01 +00:00
private function worked_grid_before ( $gridsquare , $band , $mode ) {
2019-02-26 22:08:12 +01:00
if ( strlen ( $gridsquare ) < 4 )
2021-05-05 17:52:42 +02:00
return false ;
2019-02-26 22:08:12 +01:00
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
2019-08-16 12:25:31 +01:00
2026-03-18 09:00:48 +01:00
if ( $logbooks_locations_array [ 0 ] !== - 1 ) {
2024-04-16 11:40:34 +02:00
if ( $band == " SAT " ) {
2021-11-14 22:48:39 +00:00
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
} else {
2023-07-25 14:10:08 +00:00
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2021-11-14 22:48:39 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2019-08-16 12:25:31 +01:00
2021-11-14 22:48:39 +00:00
}
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
$this -> db -> like ( 'SUBSTRING(COL_GRIDSQUARE, 1, 4)' , substr ( $gridsquare , 0 , 4 ));
$this -> db -> order_by ( $this -> config -> item ( 'table_name' ) . " .COL_TIME_ON " , " desc " );
$this -> db -> limit ( 1 );
2019-09-26 21:26:20 +01:00
2021-11-14 22:48:39 +00:00
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ));
2019-09-26 21:26:20 +01:00
2021-11-14 22:48:39 +00:00
foreach ( $query -> result () as $workedBeforeRow )
{
return true ;
}
2019-02-26 22:08:12 +01:00
}
return false ;
}
2019-08-16 12:06:19 +01:00
/*
* Function : jsonlookupgrid
*
2021-05-05 17:52:42 +02:00
* Usage : Used to look up gridsquares when creating a QSO to check whether its needed or not
2019-08-16 12:11:46 +01:00
* the $type variable is only used for satellites , set this to SAT .
*
2019-08-16 12:06:19 +01:00
*/
function jsonlookupgrid ( $gridsquare , $type , $band , $mode ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-01-13 11:06:05 +00:00
session_write_close ();
2019-08-16 12:06:19 +01:00
$return = [
" workedBefore " => false ,
2023-09-11 15:57:03 +00:00
" confirmed " => false ,
2019-08-16 12:06:19 +01:00
];
2023-10-16 22:39:33 +02:00
$user_default_confirmation = $this -> session -> userdata ( 'user_default_confirmation' );
2026-01-05 19:23:01 +00:00
$this -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
2019-09-26 21:11:10 +01:00
2019-08-16 12:06:19 +01:00
if ( $type == " SAT " ) {
2021-05-05 17:52:42 +02:00
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
2019-08-16 12:06:19 +01:00
} else {
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbook_model' );
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2021-05-05 17:52:42 +02:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2019-08-16 12:06:19 +01:00
}
2021-09-28 11:21:12 +01:00
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
2021-05-05 17:52:42 +02:00
2019-08-16 12:06:19 +01:00
$this -> db -> like ( 'SUBSTRING(COL_GRIDSQUARE, 1, 4)' , substr ( $gridsquare , 0 , 4 ));
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ), 1 , 0 );
foreach ( $query -> result () as $workedBeforeRow )
{
$return [ 'workedBefore' ] = true ;
2019-10-13 22:42:41 +02:00
}
2023-12-27 17:02:19 +01:00
2023-09-11 15:57:03 +00:00
$extrawhere = '' ;
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Q' ) !== false ) {
2023-12-27 17:02:19 +01:00
$extrawhere = " COL_QSL_RCVD='Y' " ;
2023-09-11 15:57:03 +00:00
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'L' ) !== false ) {
2023-09-11 15:57:03 +00:00
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_LOTW_QSL_RCVD='Y' " ;
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'E' ) !== false ) {
2023-09-11 15:57:03 +00:00
if ( $extrawhere != '' ) {
2023-09-19 18:29:07 +00:00
$extrawhere .= " OR " ;
2023-09-11 15:57:03 +00:00
}
$extrawhere .= " COL_EQSL_QSL_RCVD='Y' " ;
}
2023-12-08 07:17:01 +00:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Z' ) !== false ) {
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' " ;
}
2023-09-11 15:57:03 +00:00
if ( $type == " SAT " ) {
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
if ( $extrawhere != '' ) {
$this -> db -> where ( '(' . $extrawhere . ')' );
} else {
$this -> db -> where ( " 1=0 " );
}
} else {
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbook_model' );
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2023-09-11 15:57:03 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2023-09-11 15:57:03 +00:00
if ( $extrawhere != '' ) {
2023-09-12 05:38:07 +00:00
$this -> db -> where ( '(' . $extrawhere . ')' );
2023-09-11 15:57:03 +00:00
} else {
$this -> db -> where ( " 1=0 " );
}
}
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
$this -> db -> like ( 'SUBSTRING(COL_GRIDSQUARE, 1, 4)' , substr ( $gridsquare , 0 , 4 ));
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ), 1 , 0 );
foreach ( $query -> result () as $workedBeforeRow ) {
$return [ 'confirmed' ] = true ;
}
2019-10-13 22:42:41 +02:00
header ( 'Content-Type: application/json' );
echo json_encode ( $return , JSON_PRETTY_PRINT );
return ;
}
function jsonlookupdxcc ( $country , $type , $band , $mode ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-01-13 11:06:05 +00:00
session_write_close ();
2021-05-05 17:52:42 +02:00
2019-10-13 22:42:41 +02:00
$return = [
" workedBefore " => false ,
2023-09-11 15:57:03 +00:00
" confirmed " => false ,
2019-10-13 22:42:41 +02:00
];
2023-10-16 22:39:33 +02:00
$user_default_confirmation = $this -> session -> userdata ( 'user_default_confirmation' );
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
$this -> load -> model ( 'logbook_model' );
2019-10-13 22:42:41 +02:00
2026-03-18 09:00:48 +01:00
if ( $logbooks_locations_array [ 0 ] !== - 1 ) {
2021-11-14 22:48:39 +00:00
if ( $type == " SAT " ) {
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
} else {
2023-07-25 14:10:08 +00:00
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2021-11-14 22:48:39 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2019-10-13 22:42:41 +02:00
2021-11-14 22:48:39 +00:00
}
2019-10-13 22:42:41 +02:00
2021-11-14 22:48:39 +00:00
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
2025-09-24 07:10:02 +00:00
$this -> db -> where ( 'COL_DXCC' , urldecode ( $country ));
2021-05-05 17:52:42 +02:00
2021-11-14 22:48:39 +00:00
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ), 1 , 0 );
foreach ( $query -> result () as $workedBeforeRow )
{
$return [ 'workedBefore' ] = true ;
}
2019-10-13 22:42:41 +02:00
2023-09-11 15:57:03 +00:00
$extrawhere = '' ;
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Q' ) !== false ) {
2023-12-27 17:02:19 +01:00
$extrawhere = " COL_QSL_RCVD='Y' " ;
2023-09-11 15:57:03 +00:00
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'L' ) !== false ) {
2023-09-11 15:57:03 +00:00
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_LOTW_QSL_RCVD='Y' " ;
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'E' ) !== false ) {
2023-09-11 15:57:03 +00:00
if ( $extrawhere != '' ) {
2023-09-19 18:29:07 +00:00
$extrawhere .= " OR " ;
2023-09-11 15:57:03 +00:00
}
$extrawhere .= " COL_EQSL_QSL_RCVD='Y' " ;
}
2023-12-08 07:17:01 +00:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Z' ) !== false ) {
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' " ;
}
2023-09-11 15:57:03 +00:00
if ( $type == " SAT " ) {
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
if ( $extrawhere != '' ) {
$this -> db -> where ( '(' . $extrawhere . ')' );
} else {
$this -> db -> where ( " 1=0 " );
}
} else {
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbook_model' );
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2023-09-11 15:57:03 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2023-09-11 15:57:03 +00:00
if ( $extrawhere != '' ) {
2023-09-12 05:38:07 +00:00
$this -> db -> where ( '(' . $extrawhere . ')' );
2023-09-11 15:57:03 +00:00
} else {
$this -> db -> where ( " 1=0 " );
}
}
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
2025-09-24 07:10:02 +00:00
$this -> db -> where ( 'COL_DXCC' , urldecode ( $country ));
2023-09-11 15:57:03 +00:00
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ), 1 , 0 );
foreach ( $query -> result () as $workedBeforeRow ) {
$return [ 'confirmed' ] = true ;
}
2021-11-14 22:48:39 +00:00
header ( 'Content-Type: application/json' );
echo json_encode ( $return , JSON_PRETTY_PRINT );
2019-10-13 22:42:41 +02:00
2021-11-14 22:48:39 +00:00
return ;
} else {
$return [ 'workedBefore' ] = false ;
2023-09-11 15:57:03 +00:00
$return [ 'confirmed' ] = false ;
2021-11-14 22:48:39 +00:00
header ( 'Content-Type: application/json' );
echo json_encode ( $return , JSON_PRETTY_PRINT );
return ;
}
2019-10-13 22:42:41 +02:00
}
function jsonlookupcallsign ( $callsign , $type , $band , $mode ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-01-13 11:06:05 +00:00
session_write_close ();
2021-05-05 17:52:42 +02:00
2021-01-29 20:20:01 +00:00
// Convert - in Callsign to / Used for URL processing
$callsign = str_replace ( " - " , " / " , $callsign );
2019-10-13 22:42:41 +02:00
$return = [
" workedBefore " => false ,
2023-09-11 15:57:03 +00:00
" confirmed " => false ,
2019-10-13 22:42:41 +02:00
];
2023-10-16 22:39:33 +02:00
$user_default_confirmation = $this -> session -> userdata ( 'user_default_confirmation' );
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
$this -> load -> model ( 'logbook_model' );
2019-10-13 22:42:41 +02:00
2026-03-18 09:00:48 +01:00
if ( $logbooks_locations_array [ 0 ] !== - 1 ) {
2021-11-14 22:48:39 +00:00
if ( $type == " SAT " ) {
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
} else {
2023-07-25 14:10:08 +00:00
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2021-11-14 22:48:39 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2019-10-13 22:42:41 +02:00
2021-11-14 22:48:39 +00:00
}
2021-05-05 17:52:42 +02:00
2021-11-14 22:48:39 +00:00
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
$this -> db -> where ( 'COL_CALL' , strtoupper ( $callsign ));
2019-08-16 12:06:19 +01:00
2021-11-14 22:48:39 +00:00
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ), 1 , 0 );
foreach ( $query -> result () as $workedBeforeRow )
{
$return [ 'workedBefore' ] = true ;
}
2019-08-16 12:06:19 +01:00
2023-09-12 05:01:26 +00:00
$extrawhere = '' ;
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Q' ) !== false ) {
2023-12-27 17:02:19 +01:00
$extrawhere = " COL_QSL_RCVD='Y' " ;
2023-09-12 05:01:26 +00:00
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'L' ) !== false ) {
2023-09-12 05:01:26 +00:00
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_LOTW_QSL_RCVD='Y' " ;
}
2023-10-16 22:39:33 +02:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'E' ) !== false ) {
2023-09-12 05:01:26 +00:00
if ( $extrawhere != '' ) {
2023-09-19 18:29:07 +00:00
$extrawhere .= " OR " ;
2023-09-12 05:01:26 +00:00
}
$extrawhere .= " COL_EQSL_QSL_RCVD='Y' " ;
}
2023-12-08 07:17:01 +00:00
if ( isset ( $user_default_confirmation ) && strpos ( $user_default_confirmation , 'Z' ) !== false ) {
if ( $extrawhere != '' ) {
$extrawhere .= " OR " ;
}
$extrawhere .= " COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y' " ;
}
2023-09-12 05:01:26 +00:00
if ( $type == " SAT " ) {
$this -> db -> where ( 'COL_PROP_MODE' , 'SAT' );
if ( $extrawhere != '' ) {
$this -> db -> where ( '(' . $extrawhere . ')' );
} else {
$this -> db -> where ( " 1=0 " );
}
} else {
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbook_model' );
$this -> db -> where ( 'COL_MODE' , $this -> logbook_model -> get_main_mode_from_mode ( $mode ));
2023-09-12 05:01:26 +00:00
$this -> db -> where ( 'COL_BAND' , $band );
2026-03-31 19:08:59 +00:00
$this -> db -> where ( " (COL_PROP_MODE != 'SAT' OR COL_PROP_MODE IS NULL) " );
2023-09-12 05:01:26 +00:00
if ( $extrawhere != '' ) {
2023-09-12 05:38:07 +00:00
$this -> db -> where ( '(' . $extrawhere . ')' );
2023-09-12 05:01:26 +00:00
} else {
$this -> db -> where ( " 1=0 " );
}
}
$this -> db -> where_in ( 'station_id' , $logbooks_locations_array );
$this -> db -> where ( 'COL_CALL' , strtoupper ( $callsign ));
$query = $this -> db -> get ( $this -> config -> item ( 'table_name' ), 1 , 0 );
foreach ( $query -> result () as $workedBeforeRow ) {
$return [ 'confirmed' ] = true ;
}
2021-11-14 22:48:39 +00:00
header ( 'Content-Type: application/json' );
echo json_encode ( $return , JSON_PRETTY_PRINT );
return ;
} else {
$return [ 'workedBefore' ] = false ;
2023-09-11 15:57:03 +00:00
$return [ 'confirmed' ] = false ;
2021-11-14 22:48:39 +00:00
header ( 'Content-Type: application/json' );
echo json_encode ( $return , JSON_PRETTY_PRINT );
return ;
}
2019-08-16 12:06:19 +01:00
}
2019-02-26 22:08:12 +01:00
function view ( $id ) {
2021-11-14 17:50:11 +01:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2019-02-26 22:08:12 +01:00
2026-01-05 19:23:01 +00:00
$this -> load -> library ( 'DxccFlag' );
2024-07-15 05:59:47 +02:00
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
$this -> load -> library ( 'Qra' );
}
2023-12-04 14:43:07 +01:00
$this -> load -> library ( 'subdivisions' );
2019-02-26 22:08:12 +01:00
2019-09-24 23:10:59 +01:00
$this -> load -> model ( 'logbook_model' );
$data [ 'query' ] = $this -> logbook_model -> get_qso ( $id );
2025-12-04 06:29:07 +00:00
if ( $data [ 'query' ]) { // QSO not found // Skip fetching details
$data [ 'dxccFlag' ] = $this -> dxccflag -> get ( $data [ 'query' ] -> result ()[ 0 ] -> COL_DXCC );
2026-05-07 22:07:12 +02:00
$data [ 'adif_propmodes' ] = $this -> config -> item ( 'adif_propmodes' );
2020-09-14 20:24:57 +02:00
2025-12-04 06:29:07 +00:00
// Check for note for this callsign and current user
$callsign = $data [ 'query' ] -> result ()[ 0 ] -> COL_CALL ;
$user_id = $this -> session -> userdata ( 'user_id' );
$this -> load -> model ( 'note' );
$data [ 'contacts_note_id' ] = $this -> note -> get_note_id_by_category ( $user_id , 'Contacts' , $callsign );
2025-10-07 23:52:13 +02:00
2025-12-04 06:29:07 +00:00
if ( $this -> session -> userdata ( 'user_measurement_base' ) == NULL ) {
$data [ 'measurement_base' ] = $this -> config -> item ( 'measurement_base' );
}
else {
$data [ 'measurement_base' ] = $this -> session -> userdata ( 'user_measurement_base' );
}
2020-09-13 14:42:49 +02:00
2025-12-04 06:29:07 +00:00
$this -> load -> model ( 'Qsl_model' );
$data [ 'qslimages' ] = $this -> Qsl_model -> getQslForQsoId ( $id );
$data [ 'primary_subdivision' ] = $this -> subdivisions -> get_primary_subdivision_name ( $data [ 'query' ] -> result ()[ 0 ] -> COL_DXCC );
$data [ 'secondary_subdivision' ] = $this -> subdivisions -> get_secondary_subdivision_name ( $data [ 'query' ] -> result ()[ 0 ] -> COL_DXCC );
$data [ 'max_upload' ] = ini_get ( 'upload_max_filesize' );
2026-01-22 11:55:30 +01:00
}
2019-05-25 18:43:32 +01:00
$this -> load -> view ( 'interface_assets/mini_header' , $data );
$this -> load -> view ( 'view_log/qso' );
$this -> load -> view ( 'interface_assets/footer' );
2019-02-26 22:08:12 +01:00
}
2021-05-05 17:52:42 +02:00
2025-01-29 12:29:37 +01:00
function partial ( $lookupcall , $callbook , $callsign , $dxcc , $lotw_days , $band = null , $count = 5 ) {
2021-11-14 17:50:11 +01:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2021-05-05 17:52:42 +02:00
2023-12-20 18:13:51 +00:00
$this -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
2019-09-26 21:26:20 +01:00
2021-11-14 17:50:11 +01:00
$html = " " ;
2019-09-26 21:26:20 +01:00
2026-02-05 12:54:20 +00:00
// Load all satellites once for PHP-side join (much faster than SQL join)
$satellites = [];
$sat_query = $this -> db -> query ( 'SELECT name, displayname FROM satellite' );
foreach ( $sat_query -> result () as $sat ) {
$satellites [ $sat -> name ] = $sat -> displayname ;
}
2019-09-26 21:26:20 +01:00
2026-03-18 09:00:48 +01:00
if ( $logbooks_locations_array [ 0 ] !== - 1 ) {
2026-02-05 12:54:20 +00:00
$station_ids = implode ( ',' , array_map ( function ( $id ) { return ( int ) $id ; }, $logbooks_locations_array ));
$bindings = [
$lookupcall , // Exact match: COL_CALL = ?
2026-02-08 11:48:06 +01:00
'%/' . $lookupcall , // Starts with /: COL_CALL LIKE '/ABC'
$lookupcall . '/%' , // Ends with /: COL_CALL LIKE 'ABC/'
'%/' . $lookupcall . '/%' , // Both sides: COL_CALL LIKE '/ABC/'
2026-02-05 12:54:20 +00:00
( int ) $count // LIMIT
];
$sql = " SELECT
qsos . COL_CALL , qsos . COL_BAND , qsos . COL_FREQ , qsos . COL_TIME_ON ,
qsos . COL_RST_RCVD , qsos . COL_RST_SENT , qsos . COL_MODE , qsos . COL_SUBMODE ,
qsos . COL_PRIMARY_KEY , qsos . COL_SAT_NAME , qsos . COL_GRIDSQUARE ,
qsos . COL_QSL_RCVD , qsos . COL_EQSL_QSL_RCVD , qsos . COL_EQSL_QSL_SENT ,
qsos . COL_QSL_SENT , qsos . COL_STX , qsos . COL_STX_STRING , qsos . COL_SRX ,
qsos . COL_SRX_STRING , qsos . COL_LOTW_QSL_SENT , qsos . COL_LOTW_QSL_RCVD ,
qsos . COL_VUCC_GRIDS , qsos . COL_MY_GRIDSQUARE , qsos . COL_CONTEST_ID ,
qsos . COL_STATE , qsos . COL_QRZCOM_QSO_UPLOAD_STATUS ,
qsos . COL_QRZCOM_QSO_DOWNLOAD_STATUS , qsos . COL_CLUBLOG_QSO_UPLOAD_STATUS ,
qsos . COL_CLUBLOG_QSO_DOWNLOAD_STATUS , qsos . COL_POTA_REF , qsos . COL_IOTA ,
qsos . COL_SOTA_REF , qsos . COL_WWFF_REF , qsos . COL_OPERATOR , qsos . COL_COUNTRY ,
station_profile .*
FROM " . $this->config ->item('table_name') . " qsos
JOIN station_profile ON station_profile . station_id = qsos . station_id
WHERE station_profile . station_id IN ( $station_ids )
AND (
qsos . COL_CALL = ?
OR qsos . COL_CALL LIKE ?
OR qsos . COL_CALL LIKE ?
OR qsos . COL_CALL LIKE ?
)
ORDER BY qsos . COL_TIME_ON DESC , qsos . COL_PRIMARY_KEY DESC
LIMIT ? " ;
$query = $this -> db -> query ( $sql , $bindings );
// Add satellite data via PHP-side join
$results = $query -> result ();
foreach ( $results as & $row ) {
$row -> sat_name = $row -> COL_SAT_NAME ? ? null ;
$row -> sat_displayname = null ;
if ( ! empty ( $row -> COL_SAT_NAME ) && isset ( $satellites [ $row -> COL_SAT_NAME ])) {
$row -> sat_displayname = $satellites [ $row -> COL_SAT_NAME ];
}
}
unset ( $row );
} else {
$results = [];
2021-11-14 22:48:39 +00:00
}
2019-02-26 22:08:12 +01:00
2026-02-05 12:54:20 +00:00
if ( ! empty ( $results )) {
2019-05-21 13:44:22 +01:00
$html .= " <div class= \" table-responsive \" > " ;
2024-05-09 13:15:10 +02:00
$html .= " <table class= \" table table-striped \" > " ;
2019-02-26 22:08:12 +01:00
$html .= " <tr> " ;
2023-09-04 15:32:51 +02:00
$html .= " <th>Date</th> " ;
$html .= " <th>Callsign</th> " ;
2023-09-03 17:35:21 +00:00
$html .= $this -> part_table_header_col ( $this , $this -> session -> userdata ( 'user_column1' ) == " " ? 'Mode' : $this -> session -> userdata ( 'user_column1' ));
$html .= $this -> part_table_header_col ( $this , $this -> session -> userdata ( 'user_column2' ) == " " ? 'RSTS' : $this -> session -> userdata ( 'user_column2' ));
$html .= $this -> part_table_header_col ( $this , $this -> session -> userdata ( 'user_column3' ) == " " ? 'RSTR' : $this -> session -> userdata ( 'user_column3' ));
$html .= $this -> part_table_header_col ( $this , $this -> session -> userdata ( 'user_column4' ) == " " ? 'Band' : $this -> session -> userdata ( 'user_column4' ));
2022-11-25 00:22:31 +01:00
switch ( $this -> session -> userdata ( 'user_previous_qsl_type' )) {
case 0 :
2024-06-06 21:32:42 +02:00
$html .= " <th> " . __ ( " QSL " ) . " </th> " ;
2022-11-25 00:22:31 +01:00
break ;
case 1 :
2024-06-06 21:32:42 +02:00
$html .= " <th> " . __ ( " LoTW " ) . " </th> " ;
2022-11-25 00:22:31 +01:00
break ;
case 2 :
2024-06-06 21:32:42 +02:00
$html .= " <th> " . __ ( " eQSL " ) . " </th> " ;
2022-11-25 00:22:31 +01:00
break ;
2023-12-08 06:23:01 +00:00
case 4 :
$html .= " <th>QRZ</th> " ;
break ;
2024-05-13 08:02:10 +00:00
case 8 :
2024-06-07 20:02:24 +02:00
$html .= " <th> " . __ ( " Clublog " ) . " </th> " ;
2024-05-13 08:02:10 +00:00
break ;
2022-11-25 00:22:31 +01:00
default :
2024-06-06 21:32:42 +02:00
$html .= " <th> " . __ ( " QSL " ) . " </th> " ;
2022-11-25 00:22:31 +01:00
break ;
}
2023-09-04 15:32:51 +02:00
$html .= " <th></th> " ;
2019-02-26 22:08:12 +01:00
$html .= " </tr> " ;
2021-07-23 19:26:10 +02:00
// Get Date format
if ( $this -> session -> userdata ( 'user_date_format' )) {
// If Logged in and session exists
$custom_date_format = $this -> session -> userdata ( 'user_date_format' );
} else {
2024-01-17 14:13:23 +00:00
// Get Default date format from /config/wavelog.php
2021-07-23 19:26:10 +02:00
$custom_date_format = $this -> config -> item ( 'qso_date_format' );
}
2026-02-05 12:54:20 +00:00
foreach ( $results as $row ) {
2024-08-29 10:25:51 +00:00
$timestamp = strtotime ( $row -> COL_TIME_ON ? ? '1970-01-01 00:00:00' );
2019-02-26 22:08:12 +01:00
$html .= " <tr> " ;
2024-08-29 10:25:51 +00:00
$html .= " <td> " . date ( $custom_date_format , $timestamp ) . date ( ' H:i' , strtotime ( $row -> COL_TIME_ON ? ? '1970-01-01 00:00:00' )) . " </td> " ;
2021-12-28 20:08:41 +01:00
$html .= " <td><a id='edit_qso' href='javascript:displayQso( " . $row -> COL_PRIMARY_KEY . " );'> " . str_replace ( '0' , 'Ø' , strtoupper ( $row -> COL_CALL )) . " </a></td> " ;
2023-09-10 10:32:40 +02:00
$html .= $this -> part_table_col ( $row , $this -> session -> userdata ( 'user_column1' ) == " " ? 'Mode' : $this -> session -> userdata ( 'user_column1' ));
2023-09-03 17:35:21 +00:00
$html .= $this -> part_table_col ( $row , $this -> session -> userdata ( 'user_column2' ) == " " ? 'RSTS' : $this -> session -> userdata ( 'user_column2' ));
$html .= $this -> part_table_col ( $row , $this -> session -> userdata ( 'user_column3' ) == " " ? 'RSTR' : $this -> session -> userdata ( 'user_column3' ));
$html .= $this -> part_table_col ( $row , $this -> session -> userdata ( 'user_column4' ) == " " ? 'Band' : $this -> session -> userdata ( 'user_column4' ));
2022-11-25 00:22:31 +01:00
if ( $this -> session -> userdata ( 'user_previous_qsl_type' ) == 1 ) {
$html .= " <td class= \" lotw \" > " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" lotw- " ;
2022-11-25 00:22:31 +01:00
switch ( $row -> COL_LOTW_QSL_SENT ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:11:39 +01:00
case " I " :
$html .= " grey " ;
break ;
2022-11-25 00:22:31 +01:00
default :
$html .= " red " ;
}
$html .= " \" >▲</span> " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" lotw- " ;
2022-11-25 00:22:31 +01:00
switch ( $row -> COL_LOTW_QSL_RCVD ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:11:39 +01:00
case " I " :
$html .= " grey " ;
break ;
2022-11-25 00:22:31 +01:00
default :
$html .= " red " ;
}
$html .= " \" >▼</span> " ;
$html .= " </td> " ;
} else if ( $this -> session -> userdata ( 'user_previous_qsl_type' ) == 2 ) {
$html .= " <td class= \" eqsl \" > " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" eqsl- " ;
2022-11-25 00:22:31 +01:00
switch ( $row -> COL_EQSL_QSL_SENT ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:11:39 +01:00
case " I " :
$html .= " grey " ;
break ;
2022-11-25 00:22:31 +01:00
default :
$html .= " red " ;
}
$html .= " \" >▲</span> " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" eqsl- " ;
2022-11-25 00:22:31 +01:00
switch ( $row -> COL_EQSL_QSL_RCVD ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:11:39 +01:00
case " I " :
$html .= " grey " ;
break ;
2022-11-25 00:22:31 +01:00
default :
$html .= " red " ;
}
$html .= " \" >▼</span> " ;
$html .= " </td> " ;
2023-12-08 06:23:01 +00:00
} else if ( $this -> session -> userdata ( 'user_previous_qsl_type' ) == 4 ) {
$html .= " <td class= \" qrz \" > " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" qrz- " ;
2023-12-08 06:23:01 +00:00
switch ( $row -> COL_QRZCOM_QSO_UPLOAD_STATUS ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:25:42 +01:00
case " I " :
$html .= " grey " ;
break ;
2023-12-08 06:23:01 +00:00
default :
$html .= " red " ;
}
$html .= " \" >▲</span> " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" qrz- " ;
2023-12-08 06:23:01 +00:00
switch ( $row -> COL_QRZCOM_QSO_DOWNLOAD_STATUS ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:25:42 +01:00
case " I " :
$html .= " grey " ;
break ;
2023-12-08 06:23:01 +00:00
default :
$html .= " red " ;
}
2024-05-13 08:02:10 +00:00
$html .= " \" >▼</span> " ;
$html .= " </td> " ;
} else if ( $this -> session -> userdata ( 'user_previous_qsl_type' ) == 8 ) {
$html .= " <td class= \" clublog \" > " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" clublog- " ;
2024-05-13 08:02:10 +00:00
switch ( $row -> COL_CLUBLOG_QSO_UPLOAD_STATUS ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:25:42 +01:00
case " I " :
$html .= " grey " ;
break ;
2024-05-13 08:02:10 +00:00
default :
$html .= " red " ;
}
$html .= " \" >▲</span> " ;
2026-01-27 16:11:39 +01:00
$html .= " <span class= \" clublog- " ;
2024-05-13 08:02:10 +00:00
switch ( $row -> COL_CLUBLOG_QSO_DOWNLOAD_STATUS ) {
case " Y " :
$html .= " green " ;
break ;
2026-01-27 16:25:42 +01:00
case " I " :
$html .= " grey " ;
break ;
2024-05-13 08:02:10 +00:00
default :
$html .= " red " ;
}
2023-12-08 06:23:01 +00:00
$html .= " \" >▼</span> " ;
$html .= " </td> " ;
2022-11-25 00:22:31 +01:00
} else {
$html .= " <td class= \" qsl \" > " ;
$html .= " <span class= \" qsl- " ;
switch ( $row -> COL_QSL_SENT ) {
case " Y " :
$html .= " green " ;
break ;
case " Q " :
$html .= " yellow " ;
break ;
case " R " :
$html .= " yellow " ;
break ;
case " I " :
$html .= " grey " ;
break ;
default :
$html .= " red " ;
}
$html .= " \" >▲</span> " ;
$html .= " <span class= \" qsl- " ;
switch ( $row -> COL_QSL_RCVD ) {
case " Y " :
$html .= " green " ;
break ;
case " Q " :
$html .= " yellow " ;
break ;
case " R " :
$html .= " yellow " ;
break ;
case " I " :
$html .= " grey " ;
break ;
default :
$html .= " red " ;
}
$html .= " \" >▼</span> " ;
$html .= " </td> " ;
2019-10-12 21:23:58 +02:00
}
2023-11-17 18:22:02 +01:00
$html .= " <td><span class= \" badge bg-info \" > " . $row -> station_callsign . " </span></td> " ;
2019-02-26 22:08:12 +01:00
$html .= " </tr> " ;
}
$html .= " </table> " ;
2019-05-21 13:44:22 +01:00
$html .= " </div> " ;
2019-02-26 22:08:12 +01:00
return $html ;
} else {
2024-11-25 18:42:41 +01:00
$callsigninfo [ 'callsign' ] = $callbook ;
2019-02-26 22:08:12 +01:00
2024-11-26 17:21:11 +01:00
if ( $dxcc [ 'adif' ] !== 0 ) {
2024-11-26 09:46:40 +01:00
$this -> load -> model ( 'logbook_model' );
2024-11-26 17:21:11 +01:00
$callsigninfo [ 'callsign' ][ 'dxcc_name' ] = $dxcc [ 'entity' ];
$callsigninfo [ 'dxcc_worked' ] = $this -> logbook_model -> check_if_dxcc_worked_in_logbook ( $dxcc [ 'adif' ], null , $this -> session -> userdata ( 'user_default_band' ));
$callsigninfo [ 'dxcc_confirmed' ] = $this -> logbook_model -> check_if_dxcc_cnfmd_in_logbook ( $dxcc [ 'adif' ], null , $this -> session -> userdata ( 'user_default_band' ));
2024-11-24 15:34:56 +01:00
}
2019-02-26 22:08:12 +01:00
2024-11-25 18:42:41 +01:00
if ( isset ( $callsigninfo [ 'callsign' ][ 'gridsquare' ])) {
2024-11-24 15:34:56 +01:00
$this -> load -> model ( 'logbook_model' );
2024-11-25 18:42:41 +01:00
$callsigninfo [ 'grid_worked' ] = $this -> logbook_model -> check_if_grid_worked_in_logbook ( strtoupper ( substr ( $callsigninfo [ 'callsign' ][ 'gridsquare' ], 0 , 4 )), null , $band ) -> num_rows ();
2024-11-24 15:34:56 +01:00
}
2026-01-28 00:46:39 +01:00
$source_callbooks = $this -> config -> item ( 'callbook' );
if ( is_array ( $source_callbooks )) {
$callsigninfo [ 'error' ] = '<b>' . __ ( 'All callbook lookups failed or provided no results.' ) . '</b>' ;
foreach ( $source_callbooks as $source ) {
2026-02-01 22:10:23 +01:00
if ( isset ( $callsigninfo [ 'callsign' ][ 'error_' . $source ]) && isset ( $callsigninfo [ 'callsign' ][ 'error_' . $source . '_name' ])) {
$callsigninfo [ 'error' ] .= " <br /> " . $callsigninfo [ 'callsign' ][ 'error_' . $source . '_name' ] . ': ' . $callsigninfo [ 'callsign' ][ 'error_' . $source ];
}
2026-01-28 00:46:39 +01:00
}
} else {
if ( isset ( $callsigninfo [ 'callsign' ][ 'error' ])) {
$callsigninfo [ 'error' ] = $callsigninfo [ 'callsign' ][ 'error' ];
}
2024-11-24 15:34:56 +01:00
}
2019-02-26 22:08:12 +01:00
2024-11-25 18:42:41 +01:00
$callsigninfo [ 'lookupcall' ] = strtoupper ( $lookupcall );
$callsigninfo [ 'realcall' ] = strtoupper ( $callsign );
2024-11-26 17:21:11 +01:00
$callsigninfo [ 'lotw_lastupload' ] = $lotw_days ;
2024-11-25 18:42:41 +01:00
return $this -> load -> view ( 'search/result' , $callsigninfo , true );
2019-02-26 22:08:12 +01:00
}
}
2022-10-28 10:53:45 +02:00
function search_result ( $id = " " , $id2 = " " ) {
2019-02-26 22:08:12 +01:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2023-08-06 20:20:16 +02:00
2026-01-05 19:23:01 +00:00
$this -> load -> model ( 'logbook_model' );
2026-01-26 09:00:42 +01:00
$id = str_replace ( 'Ø' , " 0 " , $id );
$id2 = str_replace ( 'Ø' , " 0 " , $id2 );
2022-10-28 11:28:03 +02:00
$fixedid = $id ;
2022-10-28 10:53:45 +02:00
if ( $id2 != " " ) {
2023-10-11 15:36:42 +00:00
if ( strlen ( $id2 ) > 3 ) { // Last Element longer than 3 chars? Take that as call
$fixedid = $id2 ;
} else { // Last Element up to 3 Chars? Take first element as Call
$fixedid = $id ;
}
2022-10-28 10:53:45 +02:00
}
2019-02-26 22:08:12 +01:00
2022-10-28 10:53:45 +02:00
$query = $this -> querydb ( $fixedid );
2021-05-05 17:52:42 +02:00
2022-10-28 10:53:45 +02:00
if ( $query -> num_rows () == 0 ) {
$query = $this -> querydb ( $id );
2023-08-06 20:20:16 +02:00
2022-10-28 10:53:45 +02:00
if ( $query -> num_rows () > 0 ) {
$data [ 'results' ] = $query ;
2026-05-09 08:08:06 +00:00
$data [ 'adif_propmodes' ] = $this -> config -> item ( 'adif_propmodes' );
2022-10-28 10:53:45 +02:00
$this -> load -> view ( 'view_log/partial/log_ajax.php' , $data );
2024-01-09 05:59:41 +00:00
} else {
2022-10-28 10:53:45 +02:00
$this -> load -> model ( 'search' );
2019-02-26 22:08:12 +01:00
2022-10-28 10:53:45 +02:00
$iota_search = $this -> search -> callsign_iota ( $id );
2019-02-26 22:08:12 +01:00
2024-01-09 05:59:41 +00:00
if ( $iota_search -> num_rows () > 0 ) {
2022-10-28 10:53:45 +02:00
$data [ 'results' ] = $iota_search ;
2026-05-09 08:08:06 +00:00
$data [ 'adif_propmodes' ] = $this -> config -> item ( 'adif_propmodes' );
2022-10-28 10:53:45 +02:00
$this -> load -> view ( 'view_log/partial/log_ajax.php' , $data );
} else {
2024-11-24 15:34:56 +01:00
if ( ! $this -> load -> is_loaded ( 'callbook' )) {
$this -> load -> library ( 'callbook' );
}
2023-11-15 17:11:45 +01:00
2024-11-24 15:34:56 +01:00
$data [ 'callsign' ] = $this -> callbook -> getCallbookData ( $id );
2019-02-26 22:08:12 +01:00
2024-11-24 15:34:56 +01:00
if ( isset ( $data [ 'callsign' ][ 'gridsquare' ])) {
$data [ 'grid_worked' ] = $this -> logbook_model -> check_if_grid_worked_in_logbook ( strtoupper ( substr ( $data [ 'callsign' ][ 'gridsquare' ], 0 , 4 )), null , $this -> session -> userdata ( 'user_default_band' )) -> num_rows ();
}
if ( isset ( $data [ 'callsign' ][ 'dxcc' ])) {
2025-09-03 11:10:08 +00:00
//if Callbook lookup does not result in any DXCC, try to resolve it ourselves
if ( $data [ 'callsign' ][ 'dxcc' ] == " " ){
$data [ 'callsign' ][ 'dxcc' ] = $this -> dxcheck ( $data [ 'callsign' ][ 'callsign' ], " " )[ 'adif' ];
}
2024-11-24 15:34:56 +01:00
$entity = $this -> logbook_model -> get_entity ( $data [ 'callsign' ][ 'dxcc' ]);
$data [ 'callsign' ][ 'dxcc_name' ] = $entity [ 'name' ];
$data [ 'dxcc_worked' ] = $this -> logbook_model -> check_if_dxcc_worked_in_logbook ( $data [ 'callsign' ][ 'dxcc' ], null , $this -> session -> userdata ( 'user_default_band' ));
$data [ 'dxcc_confirmed' ] = $this -> logbook_model -> check_if_dxcc_cnfmd_in_logbook ( $data [ 'callsign' ][ 'dxcc' ], null , $this -> session -> userdata ( 'user_default_band' ));
}
if ( isset ( $data [ 'callsign' ][ 'error' ])) {
$data [ 'error' ] = $data [ 'callsign' ][ 'error' ];
}
2019-02-26 22:08:12 +01:00
2024-11-26 17:21:11 +01:00
$data [ 'lookupcall' ] = strtoupper ( $id );
$data [ 'realcall' ] = strtoupper ( $id );
2024-01-08 15:23:18 +01:00
$data [ 'lotw_lastupload' ] = $this -> logbook_model -> check_last_lotw ( $id );
2019-02-26 22:08:12 +01:00
2022-10-28 10:53:45 +02:00
$this -> load -> view ( 'search/result' , $data );
}
2019-02-26 22:08:12 +01:00
}
2022-10-28 10:53:45 +02:00
} else {
$data [ 'results' ] = $query ;
2026-05-09 08:08:06 +00:00
$data [ 'adif_propmodes' ] = $this -> config -> item ( 'adif_propmodes' );
2022-10-28 10:53:45 +02:00
$this -> load -> view ( 'view_log/partial/log_ajax.php' , $data );
2019-02-26 22:08:12 +01:00
}
}
2026-01-05 19:23:01 +00:00
private function querydb ( $id ) {
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2026-06-23 21:16:14 -07:00
$stationsactivelogonly_sql = '' ;
if ( ! empty ( $this -> session -> userdata ( 'user_stations_active_log_only' ))) {
$stationid_array = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
$station_id_list = " ' " . implode ( " ',' " , $stationid_array ) . " ' " ;
$stationsactivelogonly_sql = " AND `station_profile`.`station_id` IN ( " . $station_id_list . " ) " ;
}
2026-01-26 09:00:42 +01:00
$binding = array ();
$sql = " SELECT dxcc_entities.adif, lotw_users.callsign, COL_BAND, COL_CALL, COL_CLUBLOG_QSO_DOWNLOAD_DATE, COL_DCL_QSLRDATE, COL_DCL_QSLSDATE, COL_DCL_QSL_SENT, COL_DCL_QSL_RCVD,
2026-05-09 08:08:06 +00:00
COL_PROP_MODE ,
2024-12-05 10:05:23 +01:00
COL_CLUBLOG_QSO_DOWNLOAD_STATUS , COL_CLUBLOG_QSO_UPLOAD_DATE , COL_CLUBLOG_QSO_UPLOAD_STATUS ,
COL_CONTEST_ID , COL_DISTANCE , COL_EQSL_QSL_RCVD , COL_EQSL_QSLRDATE , COL_EQSL_QSLSDATE , COL_EQSL_QSL_SENT ,
COL_FREQ , COL_GRIDSQUARE , COL_IOTA , COL_LOTW_QSL_RCVD , COL_LOTW_QSLRDATE , COL_LOTW_QSLSDATE ,
COL_LOTW_QSL_SENT , COL_MODE , COL_NAME , COL_OPERATOR , COL_POTA_REF , COL_PRIMARY_KEY ,
COL_QRZCOM_QSO_DOWNLOAD_DATE , COL_QRZCOM_QSO_DOWNLOAD_STATUS , COL_QRZCOM_QSO_UPLOAD_DATE ,
COL_QRZCOM_QSO_UPLOAD_STATUS , COL_QSL_RCVD , COL_QSL_RCVD_VIA , COL_QSLRDATE , COL_QSLSDATE , COL_QSL_SENT ,
COL_QSL_SENT_VIA , COL_QSL_VIA , COL_RST_RCVD , COL_RST_SENT , COL_SAT_NAME , COL_SOTA_REF , COL_SRX ,
COL_SRX_STRING , COL_STATE , COL_STX , COL_STX_STRING , COL_SUBMODE , COL_TIME_ON , COL_VUCC_GRIDS , COL_WWFF_REF ,
2026-01-26 09:00:42 +01:00
dxcc_entities . end , lotw_users . lastupload , satellite . name AS sat_name , satellite . displayname AS sat_displayname ,
station_profile . station_callsign , station_profile . station_gridsquare , station_profile . station_profile_name ,
dxcc_entities . name
FROM " . $this->config ->item('table_name'). " qsos
JOIN `station_profile` ON `station_profile` . `station_id` = qsos . `station_id`
LEFT OUTER JOIN `dxcc_entities` ON qsos . `col_dxcc` = `dxcc_entities` . `adif`
LEFT OUTER JOIN `lotw_users` ON `lotw_users` . `callsign` = qsos . `col_call`
LEFT OUTER JOIN satellite ON qsos . col_prop_mode = 'SAT' and qsos . COL_SAT_NAME = COALESCE ( NULLIF ( satellite . name , '' ), NULLIF ( satellite . displayname , '' ))
WHERE ( qsos . COL_CALL LIKE ? ESCAPE '!' OR qsos . COL_GRIDSQUARE LIKE ? ESCAPE '!' OR qsos . COL_VUCC_GRIDS LIKE ? ESCAPE '!' )
AND station_profile . user_id = " . $this->session ->userdata('user_id'). "
2026-06-23 21:16:14 -07:00
" . $stationsactivelogonly_sql . "
2026-01-26 09:00:42 +01:00
ORDER BY COL_TIME_ON DESC ; " ;
$binding [] = '%' . $id . '%' ;
$binding [] = '%' . $id . '%' ;
$binding [] = '%' . $id . '%' ;
return $this -> db -> query ( $sql , $binding );
2026-01-05 19:23:01 +00:00
}
2022-11-04 16:40:15 +01:00
2023-05-26 10:38:31 +02:00
function search_lotw_unconfirmed ( $station_id ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-09-11 19:33:02 +02:00
$clean_station_id = $this -> security -> xss_clean ( $station_id );
if ( ! is_numeric ( $clean_station_id ) && $clean_station_id !== 'All' ) {
show_404 ();
2025-12-30 08:19:17 +00:00
return ;
2024-09-11 19:33:02 +02:00
}
2023-05-26 10:38:31 +02:00
2024-09-11 19:33:02 +02:00
$this -> load -> model ( 'stations' );
2026-06-23 21:16:14 -07:00
if ( ! empty ( $this -> session -> userdata ( 'user_stations_active_log_only' ))) {
$station_ids = $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
if ( $station_ids == array ( - 1 )) {
return null ;
}
} else {
$logbooks_locations_array = $this -> stations -> all_of_user ();
2024-09-11 19:33:02 +02:00
2026-06-23 21:16:14 -07:00
$station_ids = array ();
2023-08-06 20:20:16 +02:00
2026-06-23 21:16:14 -07:00
if ( $logbooks_locations_array -> num_rows () > 0 ){
foreach ( $logbooks_locations_array -> result () as $row ) {
array_push ( $station_ids , $row -> station_id );
}
} else {
return null ;
2024-09-11 19:33:02 +02:00
}
2023-05-26 10:38:31 +02:00
}
2024-09-11 19:33:02 +02:00
$location_list = " ' " . implode ( " ',' " , $station_ids ) . " ' " ;
2023-08-06 20:20:16 +02:00
$sql = 'select COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND, COL_TIME_ON, lotw_users.lastupload from ' . $this -> config -> item ( 'table_name' ) .
2026-01-05 19:23:01 +00:00
' join station_profile on ' . $this -> config -> item ( 'table_name' ) . ' . station_id = station_profile . station_id
join lotw_users on ' . $this->config->item(' table_name ') . ' . col_call = lotw_users . callsign
where ' . $this->config->item(' table_name ') .' . station_id in ( '. $location_list . ' ) ' ;
2023-08-06 20:20:16 +02:00
2025-12-30 08:19:17 +00:00
if ( $clean_station_id != 'All' ) {
$sql .= ' and station_profile.station_id = ' . $clean_station_id ;
2023-05-26 10:38:31 +02:00
}
2023-08-06 20:20:16 +02:00
2023-05-26 10:38:31 +02:00
$sql .= " and COL_LOTW_QSL_RCVD <> 'Y' and " . $this -> config -> item ( 'table_name' ) . " .COL_TIME_ON < lotw_users.lastupload " ;
$query = $this -> db -> query ( $sql );
$data [ 'qsos' ] = $query ;
$this -> load -> view ( 'search/lotw_unconfirmed_result.php' , $data );
}
2022-10-31 20:09:19 +01:00
function search_incorrect_cq_zones ( $station_id ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-08-12 14:11:31 +02:00
$clean_station_id = $this -> security -> xss_clean ( $station_id );
2024-08-15 00:54:30 +02:00
if ( ! is_numeric ( $clean_station_id ) && $clean_station_id !== 'All' ) {
2024-08-12 14:11:31 +02:00
show_404 ();
}
2022-10-31 20:09:19 +01:00
2024-09-11 19:33:02 +02:00
$this -> load -> model ( 'stations' );
$logbooks_locations_array = $this -> stations -> all_of_user ();
$station_ids = array ();
2023-08-06 20:20:16 +02:00
2024-09-11 19:33:02 +02:00
if ( $logbooks_locations_array -> num_rows () > 0 ){
foreach ( $logbooks_locations_array -> result () as $row ) {
array_push ( $station_ids , $row -> station_id );
}
} else {
2022-10-31 20:09:19 +01:00
return null ;
}
2024-09-11 19:33:02 +02:00
$location_list = " ' " . implode ( " ',' " , $station_ids ) . " ' " ;
2022-10-31 20:09:19 +01:00
2023-08-06 20:20:16 +02:00
$sql = 'select *, (select group_concat(distinct cqzone order by cqzone) from dxcc_master where countrycode = thcv.col_dxcc and cqzone <> \'\' order by cqzone asc) as correctcqzone from ' . $this -> config -> item ( 'table_name' ) .
2022-10-31 20:09:19 +01:00
' thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in (' . $location_list . ' )
2022-11-01 19:47:06 +01:00
and not exists ( select 1 from dxcc_master where countrycode = thcv . col_dxcc and cqzone = col_cqz ) and col_dxcc > 0
2023-08-06 20:20:16 +02:00
' ;
2024-08-12 14:11:31 +02:00
$params = [];
if ( $clean_station_id != 'All' ) {
$sql .= ' and station_profile.station_id = ?' ;
$params [] = $clean_station_id ;
2022-10-31 20:09:19 +01:00
}
2023-08-06 20:20:16 +02:00
2025-06-18 12:45:09 +02:00
$sql .= " order by thcv.col_time_on desc
limit 5000 " ;
2024-08-12 14:11:31 +02:00
$query = $this -> db -> query ( $sql , $params );
2022-10-31 20:09:19 +01:00
$data [ 'qsos' ] = $query ;
$this -> load -> view ( 'search/cqzones_result.php' , $data );
}
2024-09-10 13:17:08 +02:00
function search_incorrect_itu_zones ( $station_id ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-09-10 13:17:08 +02:00
$clean_station_id = $this -> security -> xss_clean ( $station_id );
if ( ! is_numeric ( $clean_station_id ) && $clean_station_id !== 'All' ) {
show_404 ();
}
2024-09-11 19:33:02 +02:00
$this -> load -> model ( 'stations' );
$logbooks_locations_array = $this -> stations -> all_of_user ();
$station_ids = array ();
2024-09-10 13:17:08 +02:00
2024-09-11 19:33:02 +02:00
if ( $logbooks_locations_array -> num_rows () > 0 ){
foreach ( $logbooks_locations_array -> result () as $row ) {
array_push ( $station_ids , $row -> station_id );
}
} else {
2024-09-10 13:17:08 +02:00
return null ;
}
2024-09-11 19:33:02 +02:00
$location_list = " ' " . implode ( " ',' " , $station_ids ) . " ' " ;
2024-09-10 13:17:08 +02:00
$sql = " select *, (select group_concat(distinct ituzone order by ituzone) from dxcc_master where countrycode = thcv.col_dxcc and ituzone <> '' order by ituzone asc) as correctituzone from " . $this -> config -> item ( 'table_name' ) .
" thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in ( " . $location_list . " )
and not exists ( select 1 from dxcc_master where countrycode = thcv . col_dxcc and ituzone = col_ituz ) and col_dxcc > 0
" ;
$params = [];
if ( $clean_station_id != 'All' ) {
$sql .= ' and station_profile.station_id = ?' ;
$params [] = $clean_station_id ;
}
2024-09-11 19:33:02 +02:00
$sql .= " order by thcv.col_time_on desc
2025-06-18 12:45:09 +02:00
limit 5000 " ;
2024-09-11 19:33:02 +02:00
2024-09-10 13:17:08 +02:00
$query = $this -> db -> query ( $sql , $params );
$data [ 'qsos' ] = $query ;
$this -> load -> view ( 'search/ituzones_result.php' , $data );
}
2019-02-26 22:08:12 +01:00
/*
* Provide a dxcc search , returning results json encoded
*/
2026-01-05 19:23:01 +00:00
private function dxcheck ( $call = " " , $date = " " ) {
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2019-06-14 00:14:39 +01:00
if ( $date == '' ){
$date = date ( " Y-m-d " );
}
2026-02-17 14:11:11 +01:00
$dxccobj = new Dxcc ();
2026-01-22 11:55:30 +01:00
$ans = $dxccobj -> dxcc_lookup ( $call , $date );
2019-06-14 00:14:39 +01:00
return $ans ;
}
2026-01-05 19:23:01 +00:00
private function getentity ( $adif ) {
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
$this -> load -> model ( " logbook_model " );
2020-04-13 10:34:02 +02:00
2026-01-05 19:23:01 +00:00
$entity = $this -> logbook_model -> get_entity ( $adif );
return $entity ;
}
2020-04-13 10:34:02 +02:00
2019-02-26 22:08:12 +01:00
2026-08-06 05:47:23 +00:00
/*
* Resolve the operator ' s own locator .
* Returns FALSE if a station profile was given which isn ' t accessible to the user .
*/
private function my_locator ( $station_id = null ) {
if ( isset ( $station_id )) {
// be sure that station belongs to user
$this -> load -> model ( 'Stations' );
if ( ! $this -> Stations -> check_station_is_accessible ( $station_id )) {
return false ;
}
// get locator from station profile
return $this -> Stations -> profile_clean ( $station_id ) -> station_gridsquare ;
}
if ( $this -> session -> userdata ( 'user_locator' ) != null ){
return $this -> session -> userdata ( 'user_locator' );
}
return $this -> config -> item ( 'locator' );
}
/*
* Bearing to a grid , as JSON :
* bearing => int degrees ( long path already applied ), NULL if not calculable
* distance_km => distance in km , regardless of the user ' s measurement base
* text => ready - to - display string in the user ' s measurement base
*/
2023-08-25 16:26:25 +02:00
function searchbearing () {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2021-12-22 13:31:01 +01:00
2026-01-05 19:23:01 +00:00
$locator = xss_clean ( $this -> input -> post ( 'grid' ));
$ant_path = xss_clean ( $this -> input -> post ( 'ant_path' )) == '' ? NULL : xss_clean ( $this -> input -> post ( 'ant_path' ));
$station_id = xss_clean ( $this -> input -> post ( 'stationProfile' ));
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
$this -> load -> library ( 'Qra' );
}
2021-12-22 13:31:01 +01:00
2026-08-06 05:47:23 +00:00
$payload = array ( 'bearing' => null , 'distance_km' => null , 'text' => '' );
2026-01-05 19:23:01 +00:00
if ( $locator != null ) {
2026-08-06 05:47:23 +00:00
$mylocator = $this -> my_locator ( $station_id );
2019-05-21 13:44:22 +01:00
2026-08-06 05:47:23 +00:00
if ( $mylocator !== false ) {
if ( $this -> session -> userdata ( 'user_measurement_base' ) == NULL ) {
$measurement_base = $this -> config -> item ( 'measurement_base' );
}
else {
$measurement_base = $this -> session -> userdata ( 'user_measurement_base' );
}
2020-09-14 20:24:57 +02:00
2026-08-06 05:47:23 +00:00
$bearing = $this -> qra -> get_bearing ( $mylocator , $locator , $ant_path );
$text = $this -> qra -> bearing ( $mylocator , $locator , $measurement_base , $ant_path );
2019-05-21 13:44:22 +01:00
2026-08-06 05:47:23 +00:00
$payload = array (
'bearing' => ( $bearing === false ) ? null : ( int ) $bearing ,
'distance_km' => $this -> qra -> distance ( $mylocator , $locator , 'K' , $ant_path ),
'text' => ( $text === false ) ? '' : $text ,
);
2026-01-05 19:23:01 +00:00
}
}
2026-08-06 05:47:23 +00:00
$this -> output -> set_content_type ( 'application/json' ) -> set_output ( json_encode ( $payload ));
2019-05-21 13:44:22 +01:00
}
2023-06-15 18:15:29 +02:00
/* return distance */
2023-08-29 23:38:24 +02:00
function searchdistance () {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2023-06-15 18:15:29 +02:00
2026-01-05 19:23:01 +00:00
$locator = xss_clean ( $this -> input -> post ( 'grid' ));
$ant_path = xss_clean ( $this -> input -> post ( 'ant_path' )) == '' ? NULL : xss_clean ( $this -> input -> post ( 'ant_path' ));
$station_id = xss_clean ( $this -> input -> post ( 'stationProfile' ));
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
$this -> load -> library ( 'Qra' );
}
2023-06-15 18:15:29 +02:00
2026-01-05 19:23:01 +00:00
if ( $locator != null ) {
2026-08-06 05:47:23 +00:00
$mylocator = $this -> my_locator ( $station_id );
if ( $mylocator === false ) {
return 0 ;
2023-06-15 18:15:29 +02:00
}
2026-01-05 19:23:01 +00:00
$distance = $this -> qra -> distance ( $mylocator , $locator , 'K' , $ant_path );
echo $distance ;
}
return 0 ;
2023-06-15 18:15:29 +02:00
}
2019-02-26 22:08:12 +01:00
/* return station bearing */
2024-11-21 15:26:35 +01:00
function bearing ( $locator , $unit = 'M' , $station_id = null , $ant_path = null ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-07-15 05:59:47 +02:00
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
2019-02-26 22:08:12 +01:00
$this -> load -> library ( 'Qra' );
2024-07-15 05:59:47 +02:00
}
2019-02-26 22:08:12 +01:00
2024-07-15 05:59:47 +02:00
if ( $locator != null ) {
2026-08-06 05:47:23 +00:00
$mylocator = $this -> my_locator ( $station_id );
if ( $mylocator === false ) {
return " " ;
2019-02-26 22:08:12 +01:00
}
2024-07-15 05:59:47 +02:00
2024-11-21 15:26:35 +01:00
$bearing = $this -> qra -> bearing ( $mylocator , $locator , $unit , $ant_path );
2024-07-15 05:59:47 +02:00
return $bearing ;
}
return " " ;
2019-02-26 22:08:12 +01:00
}
2019-06-14 00:14:39 +01:00
2023-06-15 16:03:24 +02:00
/* return distance */
2024-11-21 15:26:35 +01:00
function distance ( $locator , $station_id = null , $ant_path = null ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2023-06-15 16:03:24 +02:00
2026-01-05 19:23:01 +00:00
$distance = 0 ;
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
$this -> load -> library ( 'Qra' );
}
2023-06-15 16:03:24 +02:00
2026-01-05 19:23:01 +00:00
if ( $locator != null ) {
2026-08-06 05:47:23 +00:00
$mylocator = $this -> my_locator ( $station_id );
if ( $mylocator === false ) {
return 0 ;
2023-06-15 16:03:24 +02:00
}
2026-01-05 19:23:01 +00:00
$distance = $this -> qra -> distance ( $mylocator , $locator , 'K' , $ant_path );
}
return $distance ;
2023-06-15 16:03:24 +02:00
}
2019-06-14 00:14:39 +01:00
function qralatlng ( $qra ) {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2024-07-15 05:59:47 +02:00
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
2026-01-05 19:23:01 +00:00
$this -> load -> library ( 'Qra' );
}
2019-06-14 00:14:39 +01:00
$latlng = $this -> qra -> qra2latlong ( $qra );
return $latlng ;
}
2023-08-28 15:21:56 +02:00
function qralatlngjson () {
2026-01-05 19:23:01 +00:00
if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' ))) { return ; }
2023-08-28 15:21:56 +02:00
$qra = xss_clean ( $this -> input -> post ( 'qra' ));
2024-07-15 05:59:47 +02:00
if ( ! $this -> load -> is_loaded ( 'Qra' )) {
2026-01-05 19:23:01 +00:00
$this -> load -> library ( 'Qra' );
}
2019-06-14 00:14:39 +01:00
$latlng = $this -> qra -> qra2latlong ( $qra );
print json_encode ( $latlng );
}
2019-06-17 14:29:03 +01:00
2023-09-03 17:35:21 +00:00
function part_table_header_col ( $ctx , $name ) {
$ret = '' ;
switch ( $name ) {
2024-06-07 00:17:39 +02:00
case 'Mode' : $ret .= '<th>' . __ ( " Mode " ) . '</th>' ; break ;
case 'RSTS' : $ret .= '<th class="d-none d-sm-table-cell">' . __ ( " RST (S) " ) . '</th>' ; break ;
case 'RSTR' : $ret .= '<th class="d-none d-sm-table-cell">' . __ ( " RST (R) " ) . '</th>' ; break ;
case 'Country' : $ret .= '<th>' . __ ( " Country " ) . '</th>' ; break ;
case 'IOTA' : $ret .= '<th>' . __ ( " IOTA " ) . '</th>' ; break ;
case 'SOTA' : $ret .= '<th>' . __ ( " SOTA " ) . '</th>' ; break ;
case 'WWFF' : $ret .= '<th>' . __ ( " WWFF " ) . '</th>' ; break ;
case 'POTA' : $ret .= '<th>' . __ ( " POTA " ) . '</th>' ; break ;
case 'State' : $ret .= '<th>' . __ ( " State " ) . '</th>' ; break ;
case 'Grid' : $ret .= '<th>' . __ ( " Gridsquare " ) . '</th>' ; break ;
case 'Distance' : $ret .= '<th>' . __ ( " Distance " ) . '</th>' ; break ;
case 'Band' : $ret .= '<th>' . __ ( " Band " ) . '</th>' ; break ;
case 'Frequency' : $ret .= '<th>' . __ ( " Frequency " ) . '</th>' ; break ;
case 'Operator' : $ret .= '<th>' . __ ( " Operator " ) . '</th>' ; break ;
2023-09-03 17:35:21 +00:00
}
return $ret ;
}
function part_QrbCalcLink ( $mygrid , $grid , $vucc ) {
$ret = '' ;
if ( ! empty ( $grid )) {
$ret .= $grid . ' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>' ;
} else if ( ! empty ( $vucc )) {
$ret .= $vucc . ' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $vucc . '\')"><i class="fas fa-globe"></i></a>' ;
}
return $ret ;
}
function part_table_col ( $row , $name ) {
$ret = '' ;
switch ( $name ) {
case 'Mode' : $ret .= '<td>' ; $ret .= $row -> COL_SUBMODE == null ? $row -> COL_MODE : $row -> COL_SUBMODE . '</td>' ; break ;
2023-11-26 08:54:29 +00:00
case 'RSTS' : $ret .= '<td class="d-none d-sm-table-cell">' . $row -> COL_RST_SENT ; if ( $row -> COL_STX ) { $ret .= ' <span data-bs-toggle="tooltip" title="' . ( $row -> COL_CONTEST_ID != " " ? $row -> COL_CONTEST_ID : " n/a " ) . '" class="badge text-bg-light">' ; $ret .= sprintf ( " %03d " , $row -> COL_STX ); $ret .= '</span>' ;} if ( $row -> COL_STX_STRING ) { $ret .= ' <span data-bs-toggle="tooltip" title="' . ( $row -> COL_CONTEST_ID != " " ? $row -> COL_CONTEST_ID : " n/a " ) . '" class="badge text-bg-light">' . $row -> COL_STX_STRING . '</span>' ;} $ret .= '</td>' ; break ;
case 'RSTR' : $ret .= '<td class="d-none d-sm-table-cell">' . $row -> COL_RST_RCVD ; if ( $row -> COL_SRX ) { $ret .= ' <span data-bs-toggle="tooltip" title="' . ( $row -> COL_CONTEST_ID != " " ? $row -> COL_CONTEST_ID : " n/a " ) . '" class="badge text-bg-light">' ; $ret .= sprintf ( " %03d " , $row -> COL_SRX ); $ret .= '</span>' ;} if ( $row -> COL_SRX_STRING ) { $ret .= ' <span data-bs-toggle="tooltip" title="' . ( $row -> COL_CONTEST_ID != " " ? $row -> COL_CONTEST_ID : " n/a " ) . '" class="badge text-bg-light">' . $row -> COL_SRX_STRING . '</span>' ;} $ret .= '</td>' ; break ;
2024-06-06 21:32:42 +02:00
case 'Country' : $ret .= '<td>' . ucwords ( strtolower (( $row -> COL_COUNTRY ? ? '' ))); if ( $row -> end ? ? '' != '' ) $ret .= ' <span class="badge text-bg-danger">' . __ ( " Deleted DXCC " ) . '</span>' . '</td>' ; break ;
2023-09-03 17:35:21 +00:00
case 'IOTA' : $ret .= '<td>' . ( $row -> COL_IOTA ) . '</td>' ; break ;
case 'SOTA' : $ret .= '<td>' . ( $row -> COL_SOTA_REF ) . '</td>' ; break ;
case 'WWFF' : $ret .= '<td>' . ( $row -> COL_WWFF_REF ) . '</td>' ; break ;
case 'POTA' : $ret .= '<td>' . ( $row -> COL_POTA_REF ) . '</td>' ; break ;
case 'Grid' : $ret .= '<td>' . $this -> part_QrbCalcLink ( $row -> COL_MY_GRIDSQUARE , $row -> COL_VUCC_GRIDS , $row -> COL_GRIDSQUARE ) . '</td>' ; break ;
2024-02-18 11:47:16 +00:00
case 'Distance' : $ret .= '<td>' . (( $row -> COL_DISTANCE ? ? '' != '' ) ? $row -> COL_DISTANCE . ' km' : '' ) . '</td>' ; break ;
2024-12-02 14:29:41 +01:00
case 'Band' : $ret .= '<td>' ; if ( $row -> COL_SAT_NAME != null ) { $ret .= '<a href="https://db.satnogs.org/search/?q=' . $row -> COL_SAT_NAME . '" target="_blank">' . ( $row -> sat_displayname != null ? $row -> sat_displayname . " ( " . $row -> COL_SAT_NAME . " ) " : $row -> COL_SAT_NAME ) . '</a></td>' ; } else { $ret .= strtolower ( $row -> COL_BAND ); } $ret .= '</td>' ; break ;
case 'Frequency' : $ret .= '<td>' ; if ( $row -> COL_SAT_NAME != null ) { $ret .= '<a href="https://db.satnogs.org/search/?q=' . $row -> COL_SAT_NAME . '" target="_blank">' . ( $row -> sat_displayname != null ? $row -> sat_displayname . " ( " . $row -> COL_SAT_NAME . " ) " : $row -> COL_SAT_NAME ) . '</a></td>' ; } else { if ( $row -> COL_FREQ != null ) { $ret .= $this -> frequency -> qrg_conversion ( $row -> COL_FREQ ); } else { $ret .= strtolower ( $row -> COL_BAND ); } } $ret .= '</td>' ; break ;
2023-09-03 17:35:21 +00:00
case 'State' : $ret .= '<td>' . ( $row -> COL_STATE ) . '</td>' ; break ;
case 'Operator' : $ret .= '<td>' . ( $row -> COL_OPERATOR ) . '</td>' ; break ;
}
return $ret ;
}
2021-05-05 17:52:42 +02:00
}