2019-06-27 04:11:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  Gridsquares_model  extends  CI_Model  {  
						 
					
						
							
								
									
										
										
										
											2019-06-29 00:07:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  get_worked_sat_squares ( $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 01:06:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> select ( 'distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME' ,  FALSE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_GRIDSQUARE !=' ,  '' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_SAT_NAME !=' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-26 19:30:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-27 04:11:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get_confirmed_sat_squares ( $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-29 00:07:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 01:06:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$sql  =  'SELECT distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM ' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											.  $this -> config -> item ( 'table_name' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											.  ' WHERE station_id in ('  .  $location_list  .  ') AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")' ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-26 19:30:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-29 00:07:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-18 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get_confirmed_sat_vucc_squares ( $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 01:06:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$sql  =  'SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM ' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											.  $this -> config -> item ( 'table_name' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											.  ' WHERE station_id in ('  .  $location_list  .  ') AND COL_VUCC_GRIDS != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y") AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-29 00:07:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  get_worked_sat_vucc_squares ( $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-26 19:30:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 01:06:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									    $this -> db -> select ( 'COL_PRIMARY_KEY, COL_VUCC_GRIDS, COL_SAT_NAME' ,  FALSE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-27 04:11:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_VUCC_GRIDS !=' ,  " " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_SAT_NAME !=' ,  " " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  get_band ( $band ,  $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 01:06:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> select ( 'distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND' ,  FALSE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where_in ( 'station_id' ,  $logbooks_locations_array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_GRIDSQUARE !=' ,  '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $band  !=  'All' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $this -> db -> where ( 'COL_PROP_MODE !=' ,  " SAT " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $this -> db -> where ( 'COL_PROP_MODE !=' ,  " INTERNET " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $this -> db -> where ( 'COL_PROP_MODE !=' ,  " ECH " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $this -> db -> where ( 'COL_PROP_MODE !=' ,  " RPT " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $this -> db -> where ( 'COL_SAT_NAME =' ,  " " ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-29 00:07:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get_band_confirmed ( $band ,  $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
									
										
										
										
											2021-11-15 01:06:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( ! $logbooks_locations_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$sql  =  'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM ' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											. $this -> config -> item ( 'table_name' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											. ' WHERE station_id in (' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											. $location_list . ') AND COL_GRIDSQUARE != ""' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $band  !=  'All' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$sql  .=  ' AND COL_BAND = "'  .  $band 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												. ' " 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " SAT " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " INTERNET " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " ECH " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " RPT " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_SAT_NAME  =  " " ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$sql  .=  ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")' ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 00:11:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:35:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  search_band ( $band ,  $gridsquare ,  $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:35:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-18 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $sql  =  'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . $this -> config -> item ( 'table_name' ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            . ' WHERE station_id IN ('  .  $location_list  .  ') ' 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-18 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											.  ' AND (COL_GRIDSQUARE LIKE "%' . $gridsquare . '%" or COL_VUCC_GRIDS LIKE "%' . $gridsquare . '%")' ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $band  !=  'All' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $sql  .=  ' AND COL_BAND = "'  .  $band 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-18 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                . ' " 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:35:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " SAT " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " INTERNET " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " ECH " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            AND  COL_PROP_MODE  !=  " RPT " 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 14:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            AND  COL_SAT_NAME  =  " " ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $result  =  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:35:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        //print_r($result);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  json_encode ( $result -> result ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 02:31:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  search_sat ( $gridsquare ,  $StationLocationsArray  =  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $StationLocationsArray  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $CI -> load -> model ( 'logbooks_model' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $logbooks_locations_array  =  $StationLocationsArray ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $location_list  =  " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:35:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-18 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $sql  =  'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM '  . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$this -> config -> item ( 'table_name' ) . 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-08 21:32:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												' WHERE station_id IN (' . $location_list .  ')'  . 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-18 18:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												' AND (COL_GRIDSQUARE LIKE "%' . $gridsquare . '%" or COL_VUCC_GRIDS LIKE "%' . $gridsquare . '%")' . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												' AND COL_PROP_MODE = "SAT"' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $result  =  $this -> db -> query ( $sql ); 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:35:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        //print_r($result);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  json_encode ( $result -> result ()); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 21:59:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}