2012-11-14 09:44:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  if  (  !  defined ( 'BASEPATH' ))  exit ( 'No direct script access allowed' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-26 21:19:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-14 09:44:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								class  Logbook  extends  CI_Controller  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 05:18:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  __construct () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										parent :: __construct (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Load language files
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> lang -> load ( array ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-02 21:21:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											'contesting' , 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 05:18:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											'qslcard' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											'lotw' , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 03:51:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											'eqsl' , 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 05:18:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											'qso' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										)); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  index () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 23:28:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Check if users logged in
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $this -> user_model -> validate_session ()  ==  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// user is not logged in
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											redirect ( 'user/login' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-02 18:38:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'stations' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-20 05:19:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// If environment is set to development then show the debug toolbar
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ENVIRONMENT  ==  'development' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $this -> output -> enable_profiler ( TRUE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-17 17:25:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> library ( 'pagination' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$config [ 'base_url' ]  =  base_url () . 'index.php/logbook/index/' ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-17 17:25:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$config [ 'total_rows' ]  =  $this -> logbook_model -> total_qsos (); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$config [ 'per_page' ]  =  '25' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$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 ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										//load the model and get results
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'results' ]  =  $this -> logbook_model -> get_qsos ( $config [ 'per_page' ], $this -> uri -> segment ( 3 )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! $data [ 'results' ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-14 19:54:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> session -> set_flashdata ( 'notice' ,  lang ( 'error_no_logbook_found' )  .  ' <a href="'  .  site_url ( 'logbooks' )  .  '" title="Station Logbooks">Station Logbooks</a>' ); 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-03 19:32:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Calculate Lat/Lng from Locator to use on Maps
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $this -> session -> userdata ( 'user_locator' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> library ( 'qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$qra_position  =  $this -> qra -> qra2latlong ( $this -> session -> userdata ( 'user_locator' )); 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-27 21:17:52 +08: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-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'qra' ]  =  " none " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// load the view
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'page_title' ]  =  " Logbook " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-14 23:46:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/header' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'view_log/index' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-14 23:46:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-13 16:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  jsonentity ( $adif )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $return [ 'dxcc' ]  =  $this -> getentity ( $adif ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-14 01:23:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        header ( 'Content-Type: application/json' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-13 16:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  json ( $tempcallsign ,  $temptype ,  $tempband ,  $tempmode ,  $tempstation_id  =  null ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Cleaning for security purposes
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$callsign  =  $this -> security -> xss_clean ( $tempcallsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$type  =  $this -> security -> xss_clean ( $temptype ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$band  =  $this -> security -> xss_clean ( $tempband ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$mode  =  $this -> security -> xss_clean ( $tempmode ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$station_id  =  $this -> security -> xss_clean ( $tempstation_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-30 04:11:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Convert - in Callsign to / Used for URL processing
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$callsign  =  str_replace ( " - " , " / " , $callsign ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-18 14:22:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$callsign  =  str_replace ( " Ø " , " 0 " , $callsign ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-30 04:11:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 15:16:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Check if callsign is an LoTW User
 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 21:02:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Check Database for all other data
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-13 23:19:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$lotw_days = $this -> logbook_model -> check_last_lotw ( $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $lotw_days  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$lotw_member = " active " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$lotw_member = " not found " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return  =  [ 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-01 22:01:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" callsign "  =>  strtoupper ( $callsign ), 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" dxcc "  =>  false , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" callsign_name "  =>  " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" callsign_qra "   =>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 22:03:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" callsign_distance "   =>  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" callsign_qth "   =>  " " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" callsign_iota "  =>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-08 00:36:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" callsign_state "  =>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-08 00:46:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" callsign_us_county "  =>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-17 18:15:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" qsl_manager "  =>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" bearing "  		=>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-16 23:37:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" workedBefore "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-29 14:41:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" timesWorked "  =>  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-16 23:37:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" lotw_member "  =>  $lotw_member , 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-13 23:19:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" lotw_days "  =>  $lotw_days , 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-03 16:28:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" image "  =>  " " , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 07:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'dxcc' ]  =  $this -> dxcheck ( $callsign ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-11 23:36:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-29 14:41:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$lookupcall = $this -> get_plaincall ( $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2023-10-11 23:36:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'partial' ]  =  $this -> partial ( $lookupcall ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-26 21:19:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-03 16:28:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$callbook  =  $this -> logbook_model -> loadCallBook ( $callsign ,  $this -> config -> item ( 'use_fullname' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08: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' ); 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-01 00:49:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-26 21:19:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 15:32:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'callsign_name' ]  		=  $this -> nval ( $callbook [ 'name' ]  ? ?  '' ,  $this -> logbook_model -> call_name ( $callsign )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ 'callsign_qra' ]  		=  $this -> nval ( $callbook [ 'gridsquare' ]  ? ?  '' ,   $this -> logbook_model -> call_qra ( $callsign )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'callsign_distance' ]  	=  $this -> distance ( $return [ 'callsign_qra' ]); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 15:32:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'callsign_qth' ]  		=  $this -> nval ( $callbook [ 'city' ]  ? ?  '' ,  $this -> logbook_model -> call_qth ( $callsign )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ 'callsign_iota' ]  		=  $this -> nval ( $callbook [ 'iota' ]  ? ?  '' ,  $this -> logbook_model -> call_iota ( $callsign )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 15:19:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'qsl_manager' ]  			=  $this -> nval ( $callbook [ 'qslmgr' ]  ? ?  '' ,  $this -> logbook_model -> call_qslvia ( $callsign )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 15:32:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'callsign_state' ]  		=  $this -> nval ( $callbook [ 'state' ]  ? ?  '' ,  $this -> logbook_model -> call_state ( $callsign )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return [ 'callsign_us_county' ]  	=  $this -> nval ( $callbook [ 'us_county' ]  ? ?  '' ,  $this -> logbook_model -> call_us_county ( $callsign )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'workedBefore' ]  		=  $this -> worked_grid_before ( $return [ 'callsign_qra' ],  $type ,  $band ,  $mode ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'confirmed' ]  		=  $this -> confirmed_grid_before ( $return [ 'callsign_qra' ],  $type ,  $band ,  $mode ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-29 14:41:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return [ 'timesWorked' ]  		=  $this -> logbook_model -> times_worked ( $lookupcall ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $this -> session -> userdata ( 'user_show_profile_image' ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 15:58:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $callbook )  &&  isset ( $callbook [ 'image' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-03 20:05:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $callbook [ 'image' ]  ==  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$return [ 'image' ]  =  " n/a " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$return [ 'image' ]  =  $callbook [ 'image' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$return [ 'image' ]  =  " n/a " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-03 16:28:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 07:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-15 02:24:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $return [ 'callsign_qra' ]  !=  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return [ 'latlng' ]  =  $this -> qralatlng ( $return [ 'callsign_qra' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return [ 'bearing' ]  =  $this -> bearing ( $return [ 'callsign_qra' ],  $measurement_base ,  $station_id ); 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-01 00:49:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-15 02:24:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-01 00:49:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-16 23:37:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-01 00:49:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-29 14:41:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get_plaincall ( $callsign )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$split_callsign = explode ( '/' , $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( count ( $split_callsign ) == 1 )  { 				// case F0ABC --> return cel 0 //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$lookupcall  =  $split_callsign [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( count ( $split_callsign ) == 3 )  { 			// case EA/F0ABC/P --> return cel 1 //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$lookupcall  =  $split_callsign [ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 										// case F0ABC/P --> return cel 0 OR  case EA/FOABC --> retunr 1  (normaly not exist) //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( in_array ( strtoupper ( $split_callsign [ 1 ]),  array ( 'P' , 'M' , 'MM' , 'QRP' , '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' )))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$lookupcall  =  $split_callsign [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( strlen ( $split_callsign [ 1 ]) > 3 )  { 	// Last Element longer than 3 chars? Take that as call
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$lookupcall  =  $split_callsign [ 1 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 									// Last Element up to 3 Chars? Take first element as Call
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$lookupcall  =  $split_callsign [ 0 ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $lookupcall ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Returns $val2 first if it has value, even if it is null or empty string, if not return $val1.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  nval ( $val1 ,  $val2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  (( $val2  ? ?  " " )  ===  " "  ?  ( $val1  ? ?  " " )  :  ( $val2  ? ?  " " )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  confirmed_grid_before ( $gridsquare ,  $type ,  $band ,  $mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( strlen ( $gridsquare )  <  4 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$user_default_confirmation  =  $this -> session -> userdata ( 'user_default_confirmation' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! empty ( $logbooks_locations_array ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$extrawhere = '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'Q' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$extrawhere = " COL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'L' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  COL_LOTW_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'E' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-20 02:29:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  COL_EQSL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 15:17:01 +08: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 21:05:58 +08: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-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 21:05:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-06 05:37:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  worked_grid_before ( $gridsquare ,  $type ,  $band ,  $mode ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( strlen ( $gridsquare )  <  4 ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:25:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! empty ( $logbooks_locations_array ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $type  ==  " SAT " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE' ,  'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 22:10:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:25:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08: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-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											foreach  ( $query -> result ()  as  $workedBeforeRow ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 	Function :  jsonlookupgrid 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									*  	Usage :  Used  to  look  up  gridsquares  when  creating  a  QSO  to  check  whether  its  needed  or  not 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:11:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									* 	the  $type  variable  is  only  used  for  satellites ,  set  this  to  SAT . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  jsonlookupgrid ( $gridsquare ,  $type ,  $band ,  $mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$return  =  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" workedBefore "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" confirmed "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										]; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$user_default_confirmation  =  $this -> session -> userdata ( 'user_default_confirmation' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:11:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( $type  ==  " SAT " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_PROP_MODE' ,  'SAT' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-28 18:21:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08: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-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$extrawhere = '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'Q' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$extrawhere = " COL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'L' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$extrawhere .= "  COL_LOTW_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'E' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-20 02:29:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$extrawhere .= "  COL_EQSL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 15:17:01 +08: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 23:57:03 +08: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-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( $extrawhere  !=  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:38:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( '(' . $extrawhere . ')' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08: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-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										header ( 'Content-Type: application/json' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  jsonlookupdxcc ( $country ,  $type ,  $band ,  $mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return  =  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" workedBefore "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" confirmed "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$user_default_confirmation  =  $this -> session -> userdata ( 'user_default_confirmation' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08: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-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! empty ( $logbooks_locations_array ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $type  ==  " SAT " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE' ,  'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 22:10:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_COUNTRY' ,  urldecode ( $country )); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' ),  1 ,  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											foreach  ( $query -> result ()  as  $workedBeforeRow ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$return [ 'workedBefore' ]  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$extrawhere = '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'Q' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$extrawhere = " COL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'L' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  COL_LOTW_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'E' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-20 02:29:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  COL_EQSL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 15:17:01 +08: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 23:57:03 +08: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-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( $extrawhere  !=  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:38:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$this -> db -> where ( '(' . $extrawhere . ')' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> db -> where ( " 1=0 " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_COUNTRY' ,  urldecode ( $country )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' ),  1 ,  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											foreach  ( $query -> result ()  as  $workedBeforeRow )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$return [ 'confirmed' ] = true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											header ( 'Content-Type: application/json' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return [ 'workedBefore' ]  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$return [ 'confirmed' ]  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											header ( 'Content-Type: application/json' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  jsonlookupcallsign ( $callsign ,  $type ,  $band ,  $mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-30 04:20:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Convert - in Callsign to / Used for URL processing
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$callsign  =  str_replace ( " - " , " / " , $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$return  =  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" workedBefore "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											" confirmed "  =>  false , 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$user_default_confirmation  =  $this -> session -> userdata ( 'user_default_confirmation' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08: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-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! empty ( $logbooks_locations_array ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( $type  ==  " SAT " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE' ,  'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 22:10:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-14 04:42:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where ( 'COL_CALL' ,  strtoupper ( $callsign )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' ),  1 ,  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											foreach  ( $query -> result ()  as  $workedBeforeRow ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$return [ 'workedBefore' ]  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$extrawhere = '' ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'Q' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$extrawhere = " COL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'L' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  COL_LOTW_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 04:39:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( isset ( $user_default_confirmation )  &&  strpos ( $user_default_confirmation ,  'E' )  !==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $extrawhere != '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-20 02:29:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$extrawhere .= "  OR " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$extrawhere .= "  COL_EQSL_QSL_RCVD='Y' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 15:17:01 +08: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 13:01:26 +08: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-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_MODE' ,  $this -> logbook_model -> get_main_mode_from_mode ( $mode )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> db -> where ( 'COL_PROP_MODE !=' , 'SAT' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( $extrawhere  !=  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:38:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$this -> db -> where ( '(' . $extrawhere . ')' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 13:01:26 +08: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-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											header ( 'Content-Type: application/json' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$return [ 'workedBefore' ]  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-11 23:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$return [ 'confirmed' ]  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											header ( 'Content-Type: application/json' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											echo  json_encode ( $return ,  JSON_PRETTY_PRINT ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-16 19:06:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  view ( $id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> library ( 'DxccFlag' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-20 00:57:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 00:50:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'qra' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-04 21:43:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> library ( 'subdivisions' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 06:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'query' ]  =  $this -> logbook_model -> get_qso ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$data [ 'dxccFlag' ]  =  $this -> dxccflag -> get ( $data [ 'query' ] -> result ()[ 0 ] -> COL_DXCC ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-15 02:24:57 +08: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 20:42:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 06:20:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> load -> model ( 'Qsl_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-27 11:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> load -> model ( 'Sstv_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-29 06:20:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $data [ 'qslimages' ]  =  $this -> Qsl_model -> getQslForQsoId ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-27 11:08:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $data [ 'sstvimages' ]  =  $this -> Sstv_model -> getSstvForQsoId ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-04 21:43:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $data [ 'primary_subdivision' ]  =  $this -> subdivisions -> get_primary_subdivision_name ( $data [ 'query' ] -> result ()[ 0 ] -> COL_DXCC ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-12 21:31:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $data [ 'secondary_subdivision' ]  =  $this -> subdivisions -> get_secondary_subdivision_name ( $data [ 'query' ] -> result ()[ 0 ] -> COL_DXCC ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-03 01:23:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$data [ 'max_upload' ]  =  ini_get ( 'upload_max_filesize' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-26 01:43:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/mini_header' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> view ( 'view_log/qso' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> view ( 'interface_assets/footer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  partial ( $id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 00:50:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 00:50:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$html  =  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! empty ( $logbooks_locations_array ))  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 14:23:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> select ( '' . $this -> config -> item ( 'table_name' ) . '.COL_CALL, ' . $this -> config -> item ( 'table_name' ) . '.COL_BAND, ' . $this -> config -> item ( 'table_name' ) . '.COL_FREQ, ' . $this -> config -> item ( 'table_name' ) . '.COL_TIME_ON, ' . $this -> config -> item ( 'table_name' ) . '.COL_RST_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_RST_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_MODE, ' . $this -> config -> item ( 'table_name' ) . '.COL_SUBMODE, ' . $this -> config -> item ( 'table_name' ) . '.COL_PRIMARY_KEY, ' . $this -> config -> item ( 'table_name' ) . '.COL_SAT_NAME, ' . $this -> config -> item ( 'table_name' ) . '.COL_GRIDSQUARE, ' . $this -> config -> item ( 'table_name' ) . '.COL_QSL_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_EQSL_QSL_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_EQSL_QSL_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_QSL_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_STX, ' . $this -> config -> item ( 'table_name' ) . '.COL_STX_STRING, ' . $this -> config -> item ( 'table_name' ) . '.COL_SRX, ' . $this -> config -> item ( 'table_name' ) . '.COL_SRX_STRING, ' . $this -> config -> item ( 'table_name' ) . '.COL_LOTW_QSL_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_LOTW_QSL_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_VUCC_GRIDS, ' . $this -> config -> item ( 'table_name' ) . '.COL_MY_GRIDSQUARE, ' . $this -> config -> item ( 'table_name' ) . '.COL_CONTEST_ID, ' . $this -> config -> item ( 'table_name' ) . '.COL_STATE, ' . $this -> config -> item ( 'table_name' ) . '.COL_QRZCOM_QSO_UPLOAD_STATUS, ' . $this -> config -> item ( 'table_name' ) . '.COL_QRZCOM_QSO_DOWNLOAD_STATUS, station_profile.*' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> from ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> join ( 'station_profile' ,  'station_profile.station_id = ' . $this -> config -> item ( 'table_name' ) . '.station_id' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> where_in ( 'station_profile.station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> group_start (); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-06 05:37:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> where ( $this -> config -> item ( 'table_name' ) . '.COL_CALL' ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> or_like ( $this -> config -> item ( 'table_name' ) . '.COL_CALL' ,  '/' . $id , 'before' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> or_like ( $this -> config -> item ( 'table_name' ) . '.COL_CALL' ,  $id . '/' , 'after' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> or_like ( $this -> config -> item ( 'table_name' ) . '.COL_CALL' ,  '/' . $id . '/' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-28 00:02:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> group_end (); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-06 05:37:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> db -> order_by ( $this -> config -> item ( 'table_name' ) . " .COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> db -> limit ( 5 ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-27 04:26:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$query  =  $this -> db -> get (); 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 06:48:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! empty ( $logbooks_locations_array )  &&  $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 20:44:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$html  .=  " <div class= \" table-responsive \" > " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$html  .=  " <table class= \" table \" > " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$html  .=  " <tr> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 21:32:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$html  .=  " <th>Date</th> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$html  .=  " <th>Callsign</th> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 01:35:21 +08: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 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													switch ( $this -> session -> userdata ( 'user_previous_qsl_type' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  0 : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 21:32:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$html  .=  " <th> " . lang ( 'gen_hamradio_qsl' ) . " </th> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  1 : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 21:32:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$html  .=  " <th> " . lang ( 'lotw_short' ) . " </th> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  2 : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 21:32:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$html  .=  " <th> " . lang ( 'eqsl_short' ) . " </th> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 14:23:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														case  4 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$html  .=  " <th>QRZ</th> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														default : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 21:32:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$html  .=  " <th> " . lang ( 'gen_hamradio_qsl' ) . " </th> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 21:32:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$html  .=  " <th></th> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$html  .=  " </tr> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 01:26:10 +08: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  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Get Default date format from /config/cloudlog.php
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$custom_date_format  =  $this -> config -> item ( 'qso_date_format' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 01:26:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$timestamp  =  strtotime ( $row -> COL_TIME_ON ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$html  .=  " <tr> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 01:26:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$html  .=  " <td> " . date ( $custom_date_format ,  $timestamp ) .  date ( ' H:i' , strtotime ( $row -> COL_TIME_ON ))  .  " </td> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-29 03:08:41 +08: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 16:32:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$html  .=  $this -> part_table_col ( $row ,  $this -> session -> userdata ( 'user_column1' ) == " " ? 'Mode' : $this -> session -> userdata ( 'user_column1' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 01:35:21 +08: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 07:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( $this -> session -> userdata ( 'user_previous_qsl_type' )  ==  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <td class= \" lotw \" > " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <span class= \" qsl- " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														switch  ( $row -> COL_LOTW_QSL_SENT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  " Y " : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " green " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " red " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " \" >▲</span> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <span class= \" qsl- " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														switch  ( $row -> COL_LOTW_QSL_RCVD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  " Y " : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " green " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " red " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " \" >▼</span> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( $this -> session -> userdata ( 'user_previous_qsl_type' )  ==  2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <td class= \" eqsl \" > " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <span class= \" qsl- " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														switch  ( $row -> COL_EQSL_QSL_SENT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  " Y " : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " green " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " red " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " \" >▲</span> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <span class= \" qsl- " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														switch  ( $row -> COL_EQSL_QSL_RCVD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  " Y " : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " green " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " red " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " \" >▼</span> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " </td> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-08 14:23:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  if  ( $this -> session -> userdata ( 'user_previous_qsl_type' )  ==  4 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <td class= \" qrz \" > " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <span class= \" qsl- " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														switch  ( $row -> COL_QRZCOM_QSO_UPLOAD_STATUS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  " Y " : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " green " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " red " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " \" >▲</span> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " <span class= \" qsl- " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														switch  ( $row -> COL_QRZCOM_QSO_DOWNLOAD_STATUS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  " Y " : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " green " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																$html  .=  " red " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " \" >▼</span> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$html  .=  " </td> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 07:22:31 +08: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-13 03:23:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 01:22:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$html  .=  " <td><span class= \" badge bg-info \" > " . $row -> station_callsign . " </span></td> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$html  .=  " </tr> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$html  .=  " </table> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 20:44:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$html  .=  " </div> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  $html ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( $this -> config -> item ( 'callbook' )  ==  " qrz "  &&  $this -> config -> item ( 'qrz_username' )  !=  null  &&  $this -> config -> item ( 'qrz_password' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Lookup using QRZ
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> load -> library ( 'qrz' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( ! $this -> session -> userdata ( 'qrz_session_key' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$qrz_session_key  =  $this -> qrz -> session ( $this -> config -> item ( 'qrz_username' ),  $this -> config -> item ( 'qrz_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> session -> set_userdata ( 'qrz_session_key' ,  $qrz_session_key ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 03:17:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$callsign [ 'callsign' ]  =  $this -> qrz -> search ( $id ,  $this -> session -> userdata ( 'qrz_session_key' ),  $this -> config -> item ( 'use_fullname' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( empty ( $callsign [ 'callsign' ][ 'callsign' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$qrz_session_key  =  $this -> qrz -> session ( $this -> config -> item ( 'qrz_username' ),  $this -> config -> item ( 'qrz_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> session -> set_userdata ( 'qrz_session_key' ,  $qrz_session_key ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$callsign [ 'callsign' ]  =  $this -> qrz -> search ( $id ,  $this -> session -> userdata ( 'qrz_session_key' ),  $this -> config -> item ( 'use_fullname' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-02 00:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( isset ( $callsign [ 'callsign' ][ 'dxcc' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$entity  =  $this -> logbook_model -> get_entity ( $callsign [ 'callsign' ][ 'dxcc' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$callsign [ 'callsign' ][ 'dxcc_name' ]  =  $entity [ 'name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 03:17:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  if  ( $this -> config -> item ( 'callbook' )  ==  " hamqth "  &&  $this -> config -> item ( 'hamqth_username' )  !=  null  &&  $this -> config -> item ( 'hamqth_password' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Load the HamQTH library
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> load -> library ( 'hamqth' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( ! $this -> session -> userdata ( 'hamqth_session_key' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$hamqth_session_key  =  $this -> hamqth -> session ( $this -> config -> item ( 'hamqth_username' ),  $this -> config -> item ( 'hamqth_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> session -> set_userdata ( 'hamqth_session_key' ,  $hamqth_session_key ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$callsign [ 'callsign' ]  =  $this -> hamqth -> search ( $id ,  $this -> session -> userdata ( 'hamqth_session_key' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// If HamQTH session has expired, start a new session and retry the search.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( $callsign [ 'callsign' ][ 'error' ]  ==  " Session does not exist or expired " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$hamqth_session_key  =  $this -> hamqth -> session ( $this -> config -> item ( 'hamqth_username' ),  $this -> config -> item ( 'hamqth_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> session -> set_userdata ( 'hamqth_session_key' ,  $hamqth_session_key ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$callsign [ 'callsign' ]  =  $this -> hamqth -> search ( $callsign ,  $this -> session -> userdata ( 'hamqth_session_key' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( isset ( $data [ 'callsign' ][ 'gridsquare' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$callsign [ 'grid_worked' ]  =  $this -> logbook_model -> check_if_grid_worked_in_logbook ( strtoupper ( substr ( $data [ 'callsign' ][ 'gridsquare' ], 0 , 4 )),  0 ,  $this -> session -> userdata ( 'user_default_band' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 03:17:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-02 00:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( isset ( $callsign [ 'callsign' ][ 'dxcc' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$entity  =  $this -> logbook_model -> get_entity ( $callsign [ 'callsign' ][ 'dxcc' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$callsign [ 'callsign' ][ 'dxcc_name' ]  =  $entity [ 'name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 03:17:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( isset ( $callsign [ 'callsign' ][ 'error' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$callsign [ 'error' ]  =  $callsign [ 'callsign' ][ 'error' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 18:06:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 03:17:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$callsign [ 'error' ]  =  'Lookup not configured. Please review configuration.' ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// There's no hamli integration? Disabled for now.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Lookup using hamli
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> load -> library ( 'hamli' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 17:01:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$callsign [ 'callsign' ]  =  $this -> hamli -> callsign ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 17:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( isset ( $callsign [ 'callsign' ][ 'gridsquare' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$callsign [ 'grid_worked' ]  =  $this -> logbook_model -> check_if_grid_worked_in_logbook ( strtoupper ( substr ( $callsign [ 'callsign' ][ 'gridsquare' ], 0 , 4 )),  0 ,  $this -> session -> userdata ( 'user_default_band' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 17:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 17:09:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( isset ( $callsign [ 'callsign' ][ 'error' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$callsign [ 'error' ]  =  $callsign [ 'callsign' ][ 'error' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-02 00:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$callsign [ 'id' ]  =  strtoupper ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-15 17:01:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  $this -> load -> view ( 'search/result' ,  $callsign ,  true ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  search_result ( $id = " " ,  $id2 = " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 17:28:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$fixedid  =  $id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $id2  !=  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-11 23:36:42 +08: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 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$query  =  $this -> querydb ( $fixedid ); 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $query -> num_rows ()  ==  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$query  =  $this -> querydb ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( $query -> num_rows ()  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$data [ 'results' ]  =  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> view ( 'view_log/partial/log_ajax.php' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> load -> model ( 'search' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$iota_search  =  $this -> search -> callsign_iota ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( $iota_search -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$data [ 'results' ]  =  $iota_search ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$this -> load -> view ( 'view_log/partial/log_ajax.php' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( $this -> config -> item ( 'callbook' )  ==  " qrz "  &&  $this -> config -> item ( 'qrz_username' )  !=  null  &&  $this -> config -> item ( 'qrz_password' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Lookup using QRZ
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> load -> library ( 'qrz' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if ( ! $this -> session -> userdata ( 'qrz_session_key' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$qrz_session_key  =  $this -> qrz -> session ( $this -> config -> item ( 'qrz_username' ),  $this -> config -> item ( 'qrz_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$this -> session -> set_userdata ( 'qrz_session_key' ,  $qrz_session_key ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$data [ 'callsign' ]  =  $this -> qrz -> search ( $id ,  $this -> session -> userdata ( 'qrz_session_key' ),  $this -> config -> item ( 'use_fullname' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-12 04:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( isset ( $data [ 'callsign' ][ 'gridsquare' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$data [ 'grid_worked' ]  =  $this -> logbook_model -> check_if_grid_worked_in_logbook ( strtoupper ( substr ( $data [ 'callsign' ][ 'gridsquare' ], 0 , 4 )),  0 ,  $this -> session -> userdata ( 'user_default_band' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-12 04:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-01 20:38:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( isset ( $data [ 'callsign' ][ 'dxcc' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$entity  =  $this -> logbook_model -> get_entity ( $data [ 'callsign' ][ 'dxcc' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$data [ 'callsign' ][ 'dxcc_name' ]  =  $entity [ 'name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-12 04:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( isset ( $data [ 'callsign' ][ 'error' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$data [ 'error' ]  =  $data [ 'callsign' ][ 'error' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 00:11:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  if  ( $this -> config -> item ( 'callbook' )  ==  " hamqth "  &&  $this -> config -> item ( 'hamqth_username' )  !=  null  &&  $this -> config -> item ( 'hamqth_password' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Load the HamQTH library
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> load -> library ( 'hamqth' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if ( ! $this -> session -> userdata ( 'hamqth_session_key' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$hamqth_session_key  =  $this -> hamqth -> session ( $this -> config -> item ( 'hamqth_username' ),  $this -> config -> item ( 'hamqth_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$this -> session -> set_userdata ( 'hamqth_session_key' ,  $hamqth_session_key ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$data [ 'callsign' ]  =  $this -> hamqth -> search ( $id ,  $this -> session -> userdata ( 'hamqth_session_key' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// If HamQTH session has expired, start a new session and retry the search.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if ( $data [ 'callsign' ][ 'error' ]  ==  " Session does not exist or expired " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$hamqth_session_key  =  $this -> hamqth -> session ( $this -> config -> item ( 'hamqth_username' ),  $this -> config -> item ( 'hamqth_password' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$this -> session -> set_userdata ( 'hamqth_session_key' ,  $hamqth_session_key ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-06 05:37:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$data [ 'callsign' ]  =  $this -> hamqth -> search ( $id ,  $this -> session -> userdata ( 'hamqth_session_key' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 00:11:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( isset ( $data [ 'callsign' ][ 'gridsquare' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$data [ 'grid_worked' ]  =  $this -> logbook_model -> check_if_grid_worked_in_logbook ( strtoupper ( substr ( $data [ 'callsign' ][ 'gridsquare' ], 0 , 4 )),  0 ,  $this -> session -> userdata ( 'user_default_band' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 00:11:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-01 20:38:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( isset ( $data [ 'callsign' ][ 'dxcc' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$this -> load -> model ( 'logbook_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$entity  =  $this -> logbook_model -> get_entity ( $data [ 'callsign' ][ 'dxcc' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$data [ 'callsign' ][ 'dxcc_name' ]  =  $entity [ 'name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 00:11:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( isset ( $data [ 'callsign' ][ 'error' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															$data [ 'error' ]  =  $data [ 'callsign' ][ 'error' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-12 05:38:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-16 00:11:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$data [ 'error' ]  =  'Lookup not configured. Please review configuration.' ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  /* else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Lookup using hamli
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$this -> load -> library ( 'hamli' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$data [ 'callsign' ]  =  $this -> hamli -> callsign ( $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} */ 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$data [ 'id' ]  =  strtoupper ( $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$this -> load -> view ( 'search/result' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$data [ 'results' ]  =  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> view ( 'view_log/partial/log_ajax.php' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  querydb ( $id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> from ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> join ( 'station_profile' ,  'station_profile.station_id = ' . $this -> config -> item ( 'table_name' ) . '.station_id' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-29 20:08:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> join ( 'dxcc_entities' ,  'dxcc_entities.adif = ' . $this -> config -> item ( 'table_name' ) . '.COL_DXCC' ,  'left outer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-19 19:05:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> join ( 'lotw_users' ,  'lotw_users.callsign = ' . $this -> config -> item ( 'table_name' ) . '.col_call' ,  'left outer' ); 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> group_start (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> like ( '' . $this -> config -> item ( 'table_name' ) . '.COL_CALL' ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> or_like ( '' . $this -> config -> item ( 'table_name' ) . '.COL_GRIDSQUARE' ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> or_like ( '' . $this -> config -> item ( 'table_name' ) . '.COL_VUCC_GRIDS' ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> group_end (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> where ( 'station_profile.user_id' ,  $this -> session -> userdata ( 'user_id' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> order_by ( '' . $this -> config -> item ( 'table_name' ) . '.COL_TIME_ON' ,  'desc' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $this -> db -> get (); 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-04 23:40:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  search_duplicates ( $station_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$station_id  =  $this -> security -> xss_clean ( $station_id ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$sql  =  'select count(*) as occurence, COL_CALL, COL_MODE, COL_SUBMODE, station_callsign, COL_SAT_NAME, COL_BAND,  min(col_time_on) Mintime, max(col_time_on) Maxtime from '  .  $this -> config -> item ( 'table_name' )  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										' join station_profile on '  .  $this -> config -> item ( 'table_name' )  .  '.station_id = station_profile.station_id where '  .  $this -> config -> item ( 'table_name' )  . '.station_id in (' .  $location_list  .  ')' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $station_id  !=  'All' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$sql  .=  ' and station_profile.station_id = '  .  $station_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-31 19:25:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$sql  .=  ' group by col_call, col_mode, COL_SUBMODE, STATION_CALLSIGN, col_band, COL_SAT_NAME having count(*) > 1 and timediff(maxtime, mintime) < 3000' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$query  =  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'qsos' ]  =  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> view ( 'search/duplicates_result.php' ,  $data ); 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-04 23:40:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 16:53:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 16:38:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  search_lotw_unconfirmed ( $station_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$station_id  =  $this -> security -> xss_clean ( $station_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 16:38:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08: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' )  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										' 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-05-26 16:38:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $station_id  !=  'All' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$sql  .=  ' and station_profile.station_id = '  .  $station_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 16:38:31 +08: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-11-01 03:09:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  search_incorrect_cq_zones ( $station_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$station_id  =  $this -> security -> xss_clean ( $station_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( 'user_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! $this -> user_model -> authorize ( $this -> config -> item ( 'auth_mode' )))  {  return ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-21 02:13:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$logbooks_locations_array  =  $this -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-01 03:09:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08: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-11-01 03:09:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										' thcv join station_profile on thcv.station_id = station_profile.station_id where thcv.station_id in (' .  $location_list  .  ' ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-02 02:47:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										and  not  exists  ( select  1  from  dxcc_master  where  countrycode  =  thcv . col_dxcc  and  cqzone  =  col_cqz )  and  col_dxcc  >  0 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-01 03:09:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $station_id  !=  'All' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$sql  .=  ' and station_profile.station_id = '  .  $station_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-07 02:20:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-01 03:09:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$query  =  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data [ 'qsos' ]  =  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> view ( 'search/cqzones_result.php' ,  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  Provide  a  dxcc  search ,  returning  results  json  encoded 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  local_find_dxcc ( $call  =  " " ,  $date  =  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( " logbook_model " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $date  ==  '' ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$date  =  date ( " Y-m-d " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$ans  =  $this -> logbook_model -> check_dxcc_stored_proc ( $call ,  $date ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										print  json_encode ( $ans ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 07:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  dxcheck ( $call  =  " " ,  $date  =  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> model ( " logbook_model " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $date  ==  '' ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$date  =  date ( " Y-m-d " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$ans  =  $this -> logbook_model -> dxcc_lookup ( $call ,  $date ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $ans ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-13 16:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  getentity ( $adif )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> load -> model ( " logbook_model " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $entity  =  $this -> logbook_model -> get_entity ( $adif ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $entity ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 20:44:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* return station bearing */ 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-25 22:26:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  searchbearing ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$locator  =  xss_clean ( $this -> input -> post ( 'grid' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$station_id  =  xss_clean ( $this -> input -> post ( 'stationProfile' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 20:44:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> library ( 'Qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $locator  !=  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-22 20:31:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												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  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get station profile
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$station_profile  =  $this -> Stations -> profile_clean ( $station_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get locator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $station_profile -> station_gridsquare ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if ( $this -> session -> userdata ( 'user_locator' )  !=  null ){ 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 20:44:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$mylocator  =  $this -> session -> userdata ( 'user_locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $this -> config -> item ( 'locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-22 20:31:01 +08: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' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-15 02:24:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$bearing  =  $this -> qra -> bearing ( $mylocator ,  $locator ,  $measurement_base ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-21 20:44:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												echo  $bearing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 00:15:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* return distance */ 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-30 05:38:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  searchdistance ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$locator  =  xss_clean ( $this -> input -> post ( 'grid' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$station_id  =  xss_clean ( $this -> input -> post ( 'stationProfile' )); 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 00:15:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> library ( 'Qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $locator  !=  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  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get station profile
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$station_profile  =  $this -> Stations -> profile_clean ( $station_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get locator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $station_profile -> station_gridsquare ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if ( $this -> session -> userdata ( 'user_locator' )  !=  null ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $this -> session -> userdata ( 'user_locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $this -> config -> item ( 'locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$distance  =  $this -> qra -> distance ( $mylocator ,  $locator ,  'K' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 03:37:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												echo  $distance ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 00:15:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* return station bearing */ 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-01 00:49:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  bearing ( $locator ,  $unit  =  'M' ,  $station_id  =  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$this -> load -> library ( 'Qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $locator  !=  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-01 00:49:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												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  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get station profile
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$station_profile  =  $this -> Stations -> profile_clean ( $station_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get locator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $station_profile -> station_gridsquare ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if ( $this -> session -> userdata ( 'user_locator' )  !=  null ){ 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													$mylocator  =  $this -> session -> userdata ( 'user_locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $this -> config -> item ( 'locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-24 21:57:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$bearing  =  $this -> qra -> bearing ( $mylocator ,  $locator ,  $unit ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 05:08:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  $bearing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 07:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 22:03:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* return distance */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  distance ( $locator ,  $station_id  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$distance  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$this -> load -> library ( 'Qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( $locator  !=  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  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get station profile
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$station_profile  =  $this -> Stations -> profile_clean ( $station_id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// get locator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $station_profile -> station_gridsquare ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if ( $this -> session -> userdata ( 'user_locator' )  !=  null ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $this -> session -> userdata ( 'user_locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$mylocator  =  $this -> config -> item ( 'locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$distance  =  $this -> qra -> distance ( $mylocator ,  $locator ,  'K' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 03:37:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  $distance ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-15 22:03:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 07:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  qralatlng ( $qra )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> load -> library ( 'Qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$latlng  =  $this -> qra -> qra2latlong ( $qra ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $latlng ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-28 21:21:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  qralatlngjson ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$qra  =  xss_clean ( $this -> input -> post ( 'qra' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 07:14:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> load -> library ( 'Qra' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$latlng  =  $this -> qra -> qra2latlong ( $qra ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										print  json_encode ( $latlng ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-17 21:29:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-13 20:42:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  get_qsos ( $num ,  $offset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> select ( '' . $this -> config -> item ( 'table_name' ) . '.COL_CALL, ' . $this -> config -> item ( 'table_name' ) . '.COL_BAND, ' . $this -> config -> item ( 'table_name' ) . '.COL_TIME_ON, ' . $this -> config -> item ( 'table_name' ) . '.COL_RST_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_RST_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_MODE, ' . $this -> config -> item ( 'table_name' ) . '.COL_SUBMODE, ' . $this -> config -> item ( 'table_name' ) . '.COL_NAME, ' . $this -> config -> item ( 'table_name' ) . '.COL_COUNTRY, ' . $this -> config -> item ( 'table_name' ) . '.COL_PRIMARY_KEY, ' . $this -> config -> item ( 'table_name' ) . '.COL_SAT_NAME, ' . $this -> config -> item ( 'table_name' ) . '.COL_GRIDSQUARE, ' . $this -> config -> item ( 'table_name' ) . '.COL_QSL_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_EQSL_QSL_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_EQSL_QSL_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_QSL_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_STX, ' . $this -> config -> item ( 'table_name' ) . '.COL_STX_STRING, ' . $this -> config -> item ( 'table_name' ) . '.COL_SRX, ' . $this -> config -> item ( 'table_name' ) . '.COL_SRX_STRING, ' . $this -> config -> item ( 'table_name' ) . '.COL_LOTW_QSL_SENT, ' . $this -> config -> item ( 'table_name' ) . '.COL_LOTW_QSL_RCVD, ' . $this -> config -> item ( 'table_name' ) . '.COL_VUCC_GRIDS, station_profile.*' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> from ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> join ( 'station_profile' ,  'station_profile.station_id = ' . $this -> config -> item ( 'table_name' ) . '.station_id' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> order_by ( '' . $this -> config -> item ( 'table_name' ) . '.COL_TIME_ON' ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> limit ( $num ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> offset ( $offset ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $this -> db -> get (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 01:35:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  part_table_header_col ( $ctx ,  $name )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$ret = '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch ( $name )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Mode' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_mode' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'RSTS' :  $ret .=  '<th class="d-none d-sm-table-cell">' . $ctx -> lang -> line ( 'gen_hamradio_rsts' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'RSTR' :  $ret .=  '<th class="d-none d-sm-table-cell">' . $ctx -> lang -> line ( 'gen_hamradio_rstr' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Country' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'general_word_country' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'IOTA' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_iota' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'SOTA' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_sota' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'WWFF' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_wwff' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'POTA' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_pota' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'State' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_state' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Grid' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_gridsquare' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Distance' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_distance' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Band' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_band' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Frequency' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_frequency' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Operator' :  $ret .=  '<th>' . $ctx -> lang -> line ( 'gen_hamradio_operator' ) . '</th>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 = '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$ci  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch ( $name )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Mode' :     $ret .=  '<td>' ;  $ret .=  $row -> COL_SUBMODE == null ? $row -> COL_MODE : $row -> COL_SUBMODE  .  '</td>' ;  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-26 16:54:29 +08: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 ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 20:35:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  'Country' :  $ret .=  '<td>'  .  ucwords ( strtolower (( $row -> COL_COUNTRY )));  if  ( $row -> end  !=  NULL )  $ret .=  ' <span class="badge text-bg-danger">' . $ci -> lang -> line ( 'gen_hamradio_deleted_dxcc' ) . '</span>'   .  '</td>' ;  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 01:35:21 +08: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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Distance' :     $ret .=  '<td>'  .  ( $row -> COL_DISTANCE  ?  $row -> COL_DISTANCE  .  ' km'  :  '' )  .  '</td>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 -> 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 -> COL_SAT_NAME . '</a></td>' ;  }  else  {  if ( $row -> COL_FREQ  !=  null )  {  $ret .=  $ci -> frequency -> hz_to_mhz ( $row -> COL_FREQ );  }  else  {  $ret .=  strtolower ( $row -> COL_BAND );  }  }  $ret .=  '</td>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'State' :    $ret .=  '<td>'  .  ( $row -> COL_STATE )  .  '</td>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  'Operator' :  $ret .=  '<td>'  .  ( $row -> COL_OPERATOR )  .  '</td>' ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 23:52:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}