2011-04-25 23:24:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  Logbook_model  extends  CI_Model  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 00:31:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  function  __construct () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      // Call the Model constructor
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      parent :: __construct (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-25 23:24:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /* Add QSO to Logbook */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  add ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Join date+time
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $datetime  =  date ( 'Y-m-d' )  . "   " .  $this -> input -> post ( 'start_time' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( $this -> input -> post ( 'prop_mode' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $prop_mode  =  $this -> input -> post ( 'prop_mode' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $prop_mode  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-13 00:39:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( $this -> input -> post ( 'sat_name' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $prop_mode  =  " SAT " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 03:32:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( $this -> session -> userdata ( 'user_locator' )){ 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-07 00:27:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $locator  =  $this -> session -> userdata ( 'user_locator' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 03:32:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-07 00:27:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $locator  =  $this -> config -> item ( 'locator' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-28 03:32:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Create array with QSO Data
 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $data  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_TIME_ON'  =>  $datetime , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_TIME_OFF'  =>  $datetime , 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_CALL'  =>  strtoupper ( trim ( $this -> input -> post ( 'callsign' ))), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_BAND'  =>  trim ( $this -> input -> post ( 'band' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_FREQ'  =>  $this -> input -> post ( 'freq_display' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_MODE'  =>  $this -> input -> post ( 'mode' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_RST_RCVD'  =>  $this -> input -> post ( 'rst_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_RST_SENT'  =>  $this -> input -> post ( 'rst_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_NAME'  =>  $this -> input -> post ( 'name' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_COMMENT'  =>  $this -> input -> post ( 'comment' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_SAT_NAME'  =>  strtoupper ( $this -> input -> post ( 'sat_name' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_SAT_MODE'  =>  strtoupper ( $this -> input -> post ( 'sat_mode' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_GRIDSQUARE'  =>  strtoupper ( trim ( $this -> input -> post ( 'locator' ))), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_COUNTRY'  =>  $this -> input -> post ( 'country' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_MY_RIG'  =>  $this -> input -> post ( 'equipment' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSLSDATE'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSLRDATE'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSL_SENT'  =>  $this -> input -> post ( 'qsl_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSL_RCVD'  =>  $this -> input -> post ( 'qsl_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSL_SENT_VIA'  =>  $this -> input -> post ( 'qsl_sent_method' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSL_RCVD_VIA'  =>  $this -> input -> post ( 'qsl_recv_method' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_QSL_VIA'  =>  $this -> input -> post ( 'qsl_via' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_OPERATOR'  =>  $this -> session -> userdata ( 'user_callsign' ), 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-07 06:10:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_STATION_CALLSIGN'  =>  $this -> session -> userdata ( 'user_callsign' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_QTH'  =>  $this -> input -> post ( 'qth' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_PROP_MODE'  =>  $prop_mode , 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_IOTA'  =>  trim ( $this -> input -> post ( 'iota_ref' )), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_MY_GRIDSQUARE'  =>  strtoupper ( $locator ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_DISTANCE'  =>  " 0 " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_FREQ_RX'  =>  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_BAND_RX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_ANT_AZ'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_ANT_EL'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_A_INDEX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_AGE'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_TEN_TEN'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_TX_PWR'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_STX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_SRX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_NR_BURSTS'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_NR_PINGS'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_MAX_BURSTS'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_K_INDEX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_SFI'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_RX_PWR'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_LAT'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_LON'  =>  null , 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 00:31:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      'COL_DXCC'  =>  $this -> input -> post ( 'dxcc_id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      'COL_CQZ'  =>  $this -> input -> post ( 'cqz' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> add_qso ( $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  /* Add QSO to Logbook */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 00:31:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  function  create_qso ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Join date+time
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $datetime  =  date ( " Y-m-d " , strtotime ( $this -> input -> post ( 'start_date' ))) . "   " .  $this -> input -> post ( 'start_time' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $this -> input -> post ( 'prop_mode' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $prop_mode  =  $this -> input -> post ( 'prop_mode' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $prop_mode  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if ( $this -> input -> post ( 'sat_name' ))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $prop_mode  =  " SAT " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if ( $this -> session -> userdata ( 'user_locator' )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $locator  =  $this -> session -> userdata ( 'user_locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $locator  =  $this -> config -> item ( 'locator' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Create array with QSO Data
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $data  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_TIME_ON'  =>  $datetime , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_TIME_OFF'  =>  $datetime , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_CALL'  =>  strtoupper ( trim ( $this -> input -> post ( 'callsign' ))), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_BAND'  =>  $this -> input -> post ( 'band' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_FREQ'  =>  $this -> input -> post ( 'freq_display' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_MODE'  =>  $this -> input -> post ( 'mode' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_RST_RCVD'  =>  $this -> input -> post ( 'rst_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_RST_SENT'  =>  $this -> input -> post ( 'rst_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_NAME'  =>  $this -> input -> post ( 'name' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_COMMENT'  =>  $this -> input -> post ( 'comment' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_SAT_NAME'  =>  strtoupper ( $this -> input -> post ( 'sat_name' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_SAT_MODE'  =>  strtoupper ( $this -> input -> post ( 'sat_mode' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_GRIDSQUARE'  =>  strtoupper ( trim ( $this -> input -> post ( 'locator' ))), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_COUNTRY'  =>  $this -> input -> post ( 'country' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_MY_RIG'  =>  $this -> input -> post ( 'equipment' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSLSDATE'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSLRDATE'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSL_SENT'  =>  $this -> input -> post ( 'qsl_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSL_RCVD'  =>  $this -> input -> post ( 'qsl_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSL_SENT_VIA'  =>  $this -> input -> post ( 'qsl_sent_method' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSL_RCVD_VIA'  =>  $this -> input -> post ( 'qsl_recv_method' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QSL_VIA'  =>  $this -> input -> post ( 'qsl_via' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_OPERATOR'  =>  $this -> session -> userdata ( 'user_callsign' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_QTH'  =>  $this -> input -> post ( 'qth' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_PROP_MODE'  =>  $prop_mode , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_IOTA'  =>  trim ( $this -> input -> post ( 'iota_ref' )), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_MY_GRIDSQUARE'  =>  $locator , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_DISTANCE'  =>  " 0 " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_FREQ_RX'  =>  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_BAND_RX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_ANT_AZ'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_ANT_EL'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_A_INDEX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_AGE'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_TEN_TEN'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_TX_PWR'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_STX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_SRX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_NR_BURSTS'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_NR_PINGS'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_MAX_BURSTS'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_K_INDEX'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_SFI'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_RX_PWR'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_LAT'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_LON'  =>  null , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_DXCC'  =>  $this -> input -> post ( 'dxcc_id' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            'COL_CQZ'  =>  $this -> input -> post ( 'cqz' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 21:55:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // if eQSL username set, default SENT & RCVD to 'N' else leave as null
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $this -> session -> userdata ( 'user_eqsl_name' )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $data [ 'COL_EQSL_QSL_SENT' ]  =  'N' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $data [ 'COL_EQSL_QSL_RCVD' ]  =  'N' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 00:31:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> add_qso ( $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-07 00:27:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  function  add_qso ( $data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Add QSO to database
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> insert ( $this -> config -> item ( 'table_name' ),  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /* Edit QSO */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  edit ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $data  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_TIME_ON'  =>  $this -> input -> post ( 'time_on' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_TIME_OFF'  =>  $this -> input -> post ( 'time_off' ), 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_CALL'  =>  strtoupper ( trim ( $this -> input -> post ( 'callsign' ))), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_BAND'  =>  $this -> input -> post ( 'band' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_FREQ'  =>  $this -> input -> post ( 'freq' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_MODE'  =>  $this -> input -> post ( 'mode' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_RST_RCVD'  =>  $this -> input -> post ( 'rst_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_RST_SENT'  =>  $this -> input -> post ( 'rst_sent' ), 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_GRIDSQUARE'  =>  strtoupper ( trim ( $this -> input -> post ( 'locator' ))), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_COMMENT'  =>  $this -> input -> post ( 'comment' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_NAME'  =>  $this -> input -> post ( 'name' ), 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:48:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_COUNTRY'  =>  $this -> input -> post ( 'country' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_SAT_NAME'  =>  $this -> input -> post ( 'sat_name' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_SAT_MODE'  =>  $this -> input -> post ( 'sat_mode' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QSLSDATE'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QSLRDATE'  =>  date ( 'Y-m-d' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QSL_SENT'  =>  $this -> input -> post ( 'qsl_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QSL_RCVD'  =>  $this -> input -> post ( 'qsl_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QSL_SENT_VIA'  =>  $this -> input -> post ( 'qsl_sent_method' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QSL_RCVD_VIA'  =>  $this -> input -> post ( 'qsl_recv_method' ), 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-12 08:55:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_EQSL_QSL_SENT'  =>  $this -> input -> post ( 'eqsl_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_EQSL_QSL_RCVD'  =>  $this -> input -> post ( 'eqsl_recv' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_LOTW_QSL_SENT'  =>  $this -> input -> post ( 'lotw_sent' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_LOTW_QSL_RCVD'  =>  $this -> input -> post ( 'lotw_recv' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_IOTA'  =>  $this -> input -> post ( 'iota_ref' ), 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_QTH'  =>  $this -> input -> post ( 'qth' ), 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-10 09:09:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_PROP_MODE'  =>  $this -> input -> post ( 'prop_mode' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								       'COL_FREQ_RX'  =>  '0' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       'COL_STX_STRING'  =>  $this -> input -> post ( 'stx_string' ), 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                   'COL_SRX_STRING'  =>  $this -> input -> post ( 'srx_string' ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> where ( 'COL_PRIMARY_KEY' ,  $this -> input -> post ( 'id' )); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> db -> update ( $this -> config -> item ( 'table_name' ),  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  /* Return last 10 QSOs */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  last_ten ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> select ( 'COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> limit ( 10 ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /* Show custom number of qsos */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  last_custom ( $num )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> select ( 'COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> limit ( $num ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Callsign QRA */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  call_qra ( $callsign )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> select ( 'COL_CALL, COL_GRIDSQUARE, COL_TIME_ON' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_CALL' ,  $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $where  =  " COL_GRIDSQUARE !=  \" \" " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> where ( $where ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> limit ( 1 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $callsign  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $data  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $callsign  =  strtoupper ( $data -> COL_GRIDSQUARE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  $callsign ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  call_name ( $callsign )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> select ( 'COL_CALL, COL_NAME, COL_TIME_ON' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_CALL' ,  $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $where  =  " COL_NAME !=  \" \" " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> where ( $where ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> limit ( 1 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $name  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $data  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $name  =  $data -> COL_NAME ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /* Return QSO Info */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  qso_info ( $id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> db -> where ( 'COL_PRIMARY_KEY' ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  get_qsos ( $num ,  $offset )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 02:27:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> db -> select ( 'COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE, COL_QSL_RCVD, COL_EQSL_QSL_RCVD, COL_EQSL_QSL_SENT, COL_QSL_SENT, COL_STX_STRING, COL_SRX_STRING, COL_OPERATOR, COL_STATION_CALLSIGN, COL_LOTW_QSL_SENT, COL_LOTW_QSL_RCVD' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' ),  $num ,  $offset ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  function  get_last_qsos ( $num )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> db -> select ( 'COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_STX_STRING, COL_SRX_STRING' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $this -> db -> limit ( $num ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 23:50:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Get All QSOs with a Valid Grid */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    function  kml_get_all_qsos ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> select ( 'COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_GRIDSQUARE != \'null\'' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 23:50:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  get_date_qsos ( $date )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> select ( 'COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> order_by ( " COL_TIME_ON " ,  " desc " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $start  =  $date . "  00:00:00 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $end  =  $date . "  23:59:59 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( " COL_TIME_ON BETWEEN ' " . $start . " ' AND ' " . $end . " ' " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:37:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get_todays_qsos ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$morning  =  date ( 'Y-m-d 00:00:00' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$night  =  date ( 'Y-m-d 23:59:59' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$query  =  $this -> db -> query ( 'SELECT * FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_TIME_ON between \'' . $morning . '\' AND \'' . $night . '\'' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-16 22:37:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  totals_year ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$query  =  $this -> db -> query ( ' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										SELECT  DATE_FORMAT ( COL_TIME_ON ,  \ ' % Y\ ' )  as  \ ' year\ ' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										COUNT ( COL_PRIMARY_KEY )  as  \ ' total\ ' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										FROM  '.$this->config->item(' table_name ').' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										GROUP  BY  DATE_FORMAT ( COL_TIME_ON ,  \ ' % Y\ ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of qsos */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     function  total_qsos ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-19 06:38:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . '' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return number of QSOs had today */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  todays_qsos ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $morning  =  date ( 'Y-m-d 00:00:00' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $night  =  date ( 'Y-m-d 23:59:59' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-19 06:38:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_TIME_ON between \'' . $morning . '\' AND \'' . $night . '\'' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return QSOs over a period of days */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  map_week_qsos ( $start ,  $end )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> where ( " COL_TIME_ON BETWEEN ' " . $start . " ' AND ' " . $end . " ' " ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> order_by ( " COL_TIME_ON " ,  " ASC " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:12:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    /* Returns QSOs for the date sent eg 2011-09-30 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    function  map_day ( $date )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $start  =  $date . "  00:00:00 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $end  =  $date . "  23:59:59 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( " COL_TIME_ON BETWEEN ' " . $start . " ' AND ' " . $end . " ' " ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> order_by ( " COL_TIME_ON " ,  " ASC " ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Return QSOs made during the current month
 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  month_qsos ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $morning  =  date ( 'Y-m-01 00:00:00' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $night  =  date ( 'Y-m-30 23:59:59' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-19 06:38:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_TIME_ON between \'' . $morning . '\' AND \'' . $night . '\'' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return QSOs made during the current Year */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  year_qsos ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $morning  =  date ( 'Y-01-01 00:00:00' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $night  =  date ( 'Y-12-31 23:59:59' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-19 06:38:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_TIME_ON between \'' . $morning . '\' AND \'' . $night . '\'' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total amount of SSB QSOs logged */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_ssb ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-13 00:39:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_MODE = \'SSB\' OR COL_MODE = \'LSB\' OR COL_MODE = \'USB\'' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   /* Return total number of satellite QSOs */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   function  total_sat ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COL_SAT_NAME, COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_SAT_NAME != \'null\' GROUP BY COL_SAT_NAME' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of CW QSOs */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_cw ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-25 06:33:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_MODE = \'CW\' ' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of FM QSOs */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_fm ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-22 07:10:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_MODE = \'FM\'' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of Digital QSOs */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_digi ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-24 00:35:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT COUNT( * ) as count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_MODE != \'SSB\' AND COL_MODE != \'LSB\' AND COL_MODE != \'USB\' AND COL_MODE != \'CW\' AND COL_MODE != \'FM\' AND COL_MODE != \'AM\'' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            foreach  ( $query -> result ()  as  $row ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of QSOs per band */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   function  total_bands ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-19 06:38:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT DISTINCT (COL_BAND) AS band, count( * ) AS count FROM ' . $this -> config -> item ( 'table_name' ) . ' GROUP BY band ORDER BY count DESC' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of QSL Cards sent */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_qsl_sent ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT DISTINCT (COL_QSL_SENT) AS band, count(COL_QSL_SENT) AS count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_QSL_SENT = "Y" GROUP BY band' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $row  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-23 03:58:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( $row  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of QSL Cards requested */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-23 03:58:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_qsl_requested ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT DISTINCT (COL_QSL_SENT) AS band, count(COL_QSL_SENT) AS count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_QSL_SENT = "R" GROUP BY band' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $row  =  $query -> row (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( $row  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of QSL Cards received */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_qsl_recv ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT DISTINCT (COL_QSL_RCVD) AS band, count(COL_QSL_RCVD) AS count FROM ' . $this -> config -> item ( 'table_name' ) . ' WHERE COL_QSL_RCVD = "Y" GROUP BY band' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $row  =  $query -> row (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $row  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  $row -> count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Return total number of countrys worked */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-22 05:17:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  total_countrys ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query  =  $this -> db -> query ( 'SELECT DISTINCT (COL_COUNTRY) FROM ' . $this -> config -> item ( 'table_name' ) . '' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  $query -> num_rows (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-17 20:52:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  function  api_search_query ( $query )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $time_start  =  microtime ( true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $results  =  $this -> db -> query ( $query ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-04 07:30:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if ( ! $results )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return  array ( 'query'  =>  $query ,  'error'  =>  $this -> db -> _error_number (),  'time'  =>  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $time_end  =  microtime ( true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $time  =  round ( $time_end  -  $time_start ,  4 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 01:15:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  array ( 'query'  =>  $query ,  'results'  =>  $results ,  'time'  =>  $time ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 23:51:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  function  api_insert_query ( $query )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $time_start  =  microtime ( true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $results  =  $this -> db -> insert ( $this -> config -> item ( 'table_name' ),  $query ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-04 07:30:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if ( ! $results )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return  array ( 'query'  =>  $query ,  'error'  =>  $this -> db -> _error_number (),  'time'  =>  0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $time_end  =  microtime ( true ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $time  =  round ( $time_end  -  $time_start ,  4 ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 23:51:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 00:01:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  array ( 'query'  =>  $this -> db -> queries [ 2 ],  'result_string'  =>  $results ,  'time'  =>  $time ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 23:51:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-30 21:45:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    /* Delete QSO based on the QSO ID */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-28 21:51:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  delete ( $id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_PRIMARY_KEY' ,  $id ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> delete ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-28 21:51:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Used to check if the qso is already in the database */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    function  import_check ( $datetime ,  $callsign ,  $band )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> select ( 'COL_TIME_ON, COL_CALL, COL_BAND' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-01 00:40:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_TIME_ON >= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL -5 MINUTE )' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_TIME_ON <= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL 5 MINUTE )' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_CALL' ,  $callsign ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( $query -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  " Found " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  " No Match " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  lotw_update ( $datetime ,  $callsign ,  $band ,  $qsl_date ,  $qsl_status )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											   'COL_LOTW_QSLRDATE'  =>  $qsl_date , 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:51:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											   'COL_LOTW_QSL_RCVD'  =>  $qsl_status , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											   'COL_LOTW_QSL_SENT'  =>  'Y' 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "' . $datetime . '"' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_CALL' ,  $callsign ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> update ( $this -> config -> item ( 'table_name' ),  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 00:41:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  " Updated " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-24 03:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  lotw_last_qsl_date ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> select ( 'COL_LOTW_QSLRDATE' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_LOTW_QSLRDATE IS NOT NULL' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		$this -> db -> order_by ( " COL_LOTW_QSLRDATE " ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> limit ( 1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-24 03:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$row  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-24 03:17:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   		return  $row -> COL_LOTW_QSLRDATE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  	} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								//////////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Update a QSO with eQSL QSL info
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// We could also probably use this use this: http://eqsl.cc/qslcard/VerifyQSO.txt
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// http://www.eqsl.cc/qslcard/ImportADIF.txt
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  eqsl_update ( $datetime ,  $callsign ,  $band ,  $qsl_status )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data  =  array ( 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-10 05:13:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											   'COL_EQSL_QSLRDATE'  =>  date ( 'Y-m-d' ),  // eQSL doesn't give us a date, so let's use current
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											   'COL_EQSL_QSL_RCVD'  =>  $qsl_status 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-10 05:13:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_TIME_ON >= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL -5 MINUTE )' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_TIME_ON <= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL 5 MINUTE )' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_CALL' ,  $callsign ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> update ( $this -> config -> item ( 'table_name' ),  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  " Updated " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-02 23:29:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Mark the QSO as sent to eQSL
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  eqsl_mark_sent ( $primarykey )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$data  =  array ( 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-10 05:13:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											   'COL_EQSL_QSLSDATE'  =>  date ( 'Y-m-d' ),  // eQSL doesn't give us a date, so let's use current
 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-02 23:29:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											   'COL_EQSL_QSL_SENT'  =>  'Y' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_PRIMARY_KEY' ,  $primarykey ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> update ( $this -> config -> item ( 'table_name' ),  $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-02 23:29:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  " eQSL Sent " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Get the last date we received an eQSL
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  eqsl_last_qsl_rcvd_date ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> select ( " DATE_FORMAT(COL_EQSL_QSLRDATE,'%Y%m%d') AS COL_EQSL_QSLRDATE " ,  FALSE ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_EQSL_QSLRDATE IS NOT NULL' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		$this -> db -> order_by ( " COL_EQSL_QSLRDATE " ,  " desc " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> limit ( 1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$row  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-26 23:43:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	if  ( isset ( $row -> COL_EQSL_QSLDATE )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       		return  $row -> COL_EQSL_QSLRDATE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       	} else { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       	    // No previous date (first time import has run?), so choose UNIX EPOCH!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       	    // Note: date is yyyy/mm/dd format
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  '1970/01/01' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       	} 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  	} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-31 22:54:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  	// Determine if we've already received an eQSL for this QSO
 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  	function  eqsl_dupe_check ( $datetime ,  $callsign ,  $band ,  $qsl_status )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-31 22:54:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$this -> db -> select ( 'COL_EQSL_QSLRDATE' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-10 05:13:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_TIME_ON >= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL -5 MINUTE )' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										$this -> db -> where ( 'COL_TIME_ON <= DATE_ADD(DATE_FORMAT("' . $datetime . '", \'%Y-%m-%d %H:%i\' ), INTERVAL 5 MINUTE )' ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-31 22:54:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_CALL' ,  $callsign ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_BAND' ,  $band ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$this -> db -> where ( 'COL_EQSL_QSL_RCVD' ,  $qsl_status ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$this -> db -> limit ( 1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    	$query  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    	$row  =  $query -> row (); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-31 22:54:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   		if  ( $row  !=  null ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   			return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   			return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   		} 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-26 02:45:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  	} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-09 04:30:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  	// Show all QSOs we need to send to eQSL
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  	function  eqsl_not_yet_sent ()  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-27 00:41:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  		//$this->db->select("COL_PRIMARY_KEY, DATE_FORMAT(COL_TIME_ON,\'%Y%m%d\') AS COL_QSO_DATE, DATE_FORMAT(COL_TIME_ON,\'%H%i\') AS TIME_ON, COL_CALL, COL_MODE, COL_BAND");
 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-26 23:43:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  		$this -> db -> select ( " COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_MODE, COL_BAND, COL_COMMENT, COL_RST_SENT " ); 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-09 04:30:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  		$this -> db -> where ( 'COL_EQSL_QSL_SENT' ,  'N' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-09 04:30:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  		return  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  	} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  import ( $record )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 23:24:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $CI  =&  get_instance (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $CI -> load -> library ( 'frequency' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Join date+time
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        //$datetime = date('Y-m-d') ." ". $this->input->post('start_time');
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        //$myDate = date('Y-m-d', $record['qso_date']);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $time_on  =  date ( 'Y-m-d' ,  strtotime ( $record [ 'qso_date' ]))  . "   " . date ( 'H:i' ,  strtotime ( $record [ 'time_on' ])); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 23:12:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( isset ( $record [ 'time_off' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $time_off  =  date ( 'Y-m-d' ,  strtotime ( $record [ 'qso_date' ]))  . "   " . date ( 'H:i' ,  strtotime ( $record [ 'time_off' ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								           $time_off  =  date ( 'Y-m-d' ,  strtotime ( $record [ 'qso_date' ]))  . "   " . date ( 'H:i' ,  strtotime ( $record [ 'time_on' ])); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 23:12:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Freq
 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-18 20:31:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Check if 'freq' is defined in the import?
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( isset ( $record [ 'freq' ])){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $cleanfreq  =  preg_replace ( '#\W#' ,  '' ,  $record [ 'freq' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $freqlng  =  strlen ( $cleanfreq ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } else { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $freqlng  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'freq' ])  &&  $freqlng  <  7  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 23:12:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $cleansedstring  =  preg_replace ( '#\W#' ,  '' ,  $record [ 'freq' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $freq  =  $cleansedstring . " 000 " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  elseif ( $freqlng  >=  7 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $cleansedstring  =  preg_replace ( '#\W#' ,  '' ,  $record [ 'freq' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $freq  =  $cleansedstring ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $freq  =  " 0 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Name
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'name' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $name  =  $record [ 'name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $name  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Notes
 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-14 05:21:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( isset ( $record [ 'comment' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $comment  =  $record [ 'comment' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  if  ( isset ( $record [ 'notes' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:41:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $comment  =  $record [ 'notes' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $comment  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Sat Name
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'sat_name' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $sat_name  =  $record [ 'sat_name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $sat_name  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Satellite Mode
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'sat_mode' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $sat_mode  =  $record [ 'sat_mode' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $sat_mode  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Gridsquare
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'gridsquare' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $gridsquare  =  $record [ 'gridsquare' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $gridsquare  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store or find country name
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'country' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $country  =  $record [ 'country' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 23:12:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $this -> load -> model ( 'dxcc' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $dxccinfo  =  $this -> dxcc -> info ( $record [ 'call' ]); 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-07 06:06:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 23:12:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( $dxccinfo -> num_rows ()  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                foreach  ( $dxccinfo -> result ()  as  $row1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    $country  =  ucfirst ( strtolower ( $row1 -> name )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $country  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store QTH
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'qth' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $qth  =  $record [ 'qth' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $qth  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Propagation Mode
 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'prop_mode' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $prop_mode  =  $record [ 'prop_mode' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $prop_mode  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // RST recevied
 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 08:30:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'rst_rcvd' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $rst_rx  =  $record [ 'rst_rcvd' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $rst_rx  =  " 59 "   ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // RST Sent
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'rst_sent' ]))  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 08:30:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $rst_tx  =  $record [ 'rst_sent' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $rst_tx  =  " 59 "   ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:55:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store Band
 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'band' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $band  =  $record [ 'band' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 23:24:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $myfreq  =  str_replace ( array ( '.' ,  ',' ),  ''  ,  $record [ 'freq' ] . '0' ); 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 23:24:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $band  =  $CI -> frequency -> GetBand ( $myfreq ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:55:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Store IOTA Ref if available
 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:51:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'iota' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $iota  =  $record [ 'iota' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $iota  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:07:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:51:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // QSL Recv date
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'qslrdate' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLRDATE  =  $record [ 'qslrdate' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLRDATE  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // QSL Recv Status
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'qsl_rcvd' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLRCVD  =  $record [ 'qsl_rcvd' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLRCVD  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:51:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // QSL Sent date
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'qslsdate' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLSDATE  =  $record [ 'qslsdate' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLSDATE  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // QSL Sent Status
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'qsl_sent' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLSENT  =  $record [ 'qsl_sent' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $QSLSENT  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-27 01:57:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        //LOTW QSL Recv
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'lotw_qsl_rcvd' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $LOTWQSLRCVD  =  $record [ 'lotw_qsl_rcvd' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $LOTWQSLRCVD  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        //LOTW QSL Sent
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'lotw_qsl_sent' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $LOTWQSLSENT  =  $record [ 'lotw_qsl_sent' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $LOTWQSLSENT  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 10:16:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'stx' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $stx  =  $record [ 'stx' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $stx  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 10:16:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( isset ( $record [ 'srx' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $srx  =  $record [ 'srx' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $srx  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-14 06:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // MY_RIG
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( isset ( $record [ 'my_rig' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $my_rig  =  $record [ 'my_rig' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $my_rig  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-14 20:48:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // TX_PWR
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( isset ( $record [ 'tx_pwr' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $tx_pwr  =  $record [ 'tx_pwr' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $tx_pwr  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // MY_GRIDSQUARE
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( isset ( $record [ 'my_gridsquare' ]))  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $my_gridsquare  =  $record [ 'my_gridsquare' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $my_gridsquare  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-31 03:56:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Filter Modes if not apart of ADIF spec
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if ( $record [ 'mode' ]  ==  " RTTY75 " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // Set RTTY75 to just RTTY
 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                $mode  =  " RTTY " ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-31 03:56:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // If no other rules just plain mode that adif includes
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $mode  =  $record [ 'mode' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 08:30:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_CALL' ,  $record [ 'call' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $this -> db -> where ( 'COL_TIME_ON' ,  $time_on ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $check  =  $this -> db -> get ( $this -> config -> item ( 'table_name' )); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $check -> num_rows ()  <=  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // Create array with QSO Data
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $data  =  array ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_TIME_ON'  =>  $time_on , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_TIME_OFF'  =>  $time_off , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_CALL'  =>  strtoupper ( $record [ 'call' ]), 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-17 23:24:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_BAND'  =>  $band , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_FREQ'  =>  $freq , 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-31 03:56:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_MODE'  =>  $mode , 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 08:30:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_RST_RCVD'  =>  $rst_rx , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_RST_SENT'  =>  $rst_tx , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_NAME'  =>  $name , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_COMMENT'  =>  $comment , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_SAT_NAME'  =>  $sat_name , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_SAT_MODE'  =>  $sat_mode , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_GRIDSQUARE'  =>  $gridsquare , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_COUNTRY'  =>  $country , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_QTH'  => $qth , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_PROP_MODE'  =>  $prop_mode , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_DISTANCE'  =>  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_FREQ_RX'  =>  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_BAND_RX'  =>  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_ANT_AZ'  =>  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_ANT_EL'  =>  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 10:16:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_STX_STRING'  =>  $stx , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_SRX_STRING'  =>  $srx , 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:51:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_IOTA'  =>  $iota , 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-26 06:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_QSLRDATE'  =>  $QSLRDATE , 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-01 01:51:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_QSL_RCVD'  =>  $QSLRCVD , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_QSLSDATE'  =>  $QSLSDATE , 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-27 01:57:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_QSL_SENT'  =>  $QSLSENT , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_LOTW_QSL_SENT'  =>  $LOTWQSLSENT , 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-14 06:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_LOTW_QSL_RCVD'  =>  $LOTWQSLRCVD , 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-14 20:48:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								               'COL_MY_RIG'  =>  $my_rig , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_TX_PWR'  =>  $tx_pwr , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               'COL_MY_GRIDSQUARE'  =>  $my_gridsquare 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-13 21:55:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // if eQSL username set, default SENT & RCVD to 'N' else leave as null
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( $this -> session -> userdata ( 'user_eqsl_name' )){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'COL_EQSL_QSL_SENT' ]  =  'N' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $data [ 'COL_EQSL_QSL_RCVD' ]  =  'N' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 06:28:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            $this -> add_qso ( $data ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-04-25 23:24:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-18 01:15:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								?>