2012-10-31 20:34:57 +00:00
< ? php if ( ! defined ( 'BASEPATH' )) exit ( 'No direct script access allowed' );
/*
Handles Displaying of information for awards .
2021-03-20 10:24:13 +00:00
These are taken from comments fields or ADIF fields
2012-10-31 20:34:57 +00:00
*/
class Awards extends CI_Controller {
2021-03-20 10:24:13 +00:00
2019-10-05 18:35:55 +00:00
function __construct ()
{
parent :: __construct ();
$this -> load -> model ( 'user_model' );
if ( ! $this -> user_model -> authorize ( 2 )) { $this -> session -> set_flashdata ( 'notice' , 'You\'re not allowed to do that!' ); redirect ( 'dashboard' ); }
2022-02-15 21:35:17 +00:00
$this -> lang -> load ( array (
'lotw' ,
'eqsl'
));
2019-10-05 18:35:55 +00:00
}
2012-10-31 20:34:57 +00:00
public function index ()
{
2012-11-20 17:24:50 +00:00
// Render Page
$data [ 'page_title' ] = " Awards " ;
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/header' , $data );
2012-11-20 17:24:50 +00:00
$this -> load -> view ( 'awards/index' );
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/footer' );
2012-10-31 20:34:57 +00:00
}
2021-03-20 10:24:13 +00:00
2019-06-26 08:17:06 +00:00
public function dok ()
{
2023-01-16 16:08:27 +00:00
$CI =& get_instance ();
$CI -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
2019-06-26 08:17:06 +00:00
$this -> load -> model ( 'dok' );
2021-11-13 14:55:17 +00:00
$this -> load -> model ( 'bands' );
2023-01-16 16:08:27 +00:00
$this -> load -> model ( 'modes' );
2021-11-13 14:55:17 +00:00
2022-01-26 08:18:29 +00:00
if ( $this -> input -> method () === 'post' ) {
2023-08-01 12:20:14 +00:00
$postdata [ 'doks' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'doks' ));
2022-01-26 08:18:29 +00:00
} else {
$postdata [ 'doks' ] = 'both' ;
}
2021-11-13 14:55:17 +00:00
2023-01-16 16:08:27 +00:00
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands ( 'dok' );
$data [ 'modes' ] = $this -> modes -> active ();
if ( $this -> input -> post ( 'band' ) != NULL ) {
if ( $this -> input -> post ( 'band' ) == 'All' ) {
$bands = $data [ 'worked_bands' ];
} else {
2023-08-01 12:20:14 +00:00
$bands [] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
2023-01-16 16:08:27 +00:00
}
} else {
$bands = $data [ 'worked_bands' ];
}
$data [ 'bands' ] = $bands ;
if ( $this -> input -> method () === 'post' ) {
2023-08-01 12:20:14 +00:00
$postdata [ 'qsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'qsl' ));
$postdata [ 'lotw' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'lotw' ));
$postdata [ 'eqsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'eqsl' ));
$postdata [ 'worked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'worked' ));
$postdata [ 'confirmed' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'confirmed' ));
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2023-01-16 16:08:27 +00:00
} else {
$postdata [ 'qsl' ] = 1 ;
$postdata [ 'lotw' ] = 1 ;
$postdata [ 'eqsl' ] = 0 ;
$postdata [ 'worked' ] = 1 ;
$postdata [ 'confirmed' ] = 1 ;
$postdata [ 'band' ] = 'All' ;
$postdata [ 'mode' ] = 'All' ;
}
if ( $logbooks_locations_array ) {
$location_list = " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ;
$data [ 'dok_array' ] = $this -> dok -> get_dok_array ( $bands , $postdata , $location_list );
$data [ 'dok_summary' ] = $this -> dok -> get_dok_summary ( $bands , $postdata , $location_list );
} else {
$location_list = null ;
$data [ 'dok_array' ] = null ;
$data [ 'dok_summary' ] = null ;
}
2019-06-26 08:17:06 +00:00
// Render Page
2019-06-26 09:07:41 +00:00
$data [ 'page_title' ] = " Awards - DOK " ;
2019-06-26 08:17:06 +00:00
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/dok/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
2021-03-20 10:24:13 +00:00
2020-02-09 12:20:59 +00:00
public function dxcc () {
2016-02-12 16:31:29 +00:00
$this -> load -> model ( 'dxcc' );
2020-12-11 22:45:06 +00:00
$this -> load -> model ( 'modes' );
2021-11-13 14:55:17 +00:00
$this -> load -> model ( 'bands' );
2020-12-11 22:45:06 +00:00
2022-09-05 18:26:08 +00:00
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands ( 'dxcc' ); // Used in the view for band select
2020-12-11 22:45:06 +00:00
$data [ 'modes' ] = $this -> modes -> active (); // Used in the view for mode select
2020-03-03 11:39:45 +00:00
if ( $this -> input -> post ( 'band' ) != NULL ) { // Band is not set when page first loads.
if ( $this -> input -> post ( 'band' ) == 'All' ) { // Did the user specify a band? If not, use all bands
$bands = $data [ 'worked_bands' ];
}
else {
2023-08-01 12:20:14 +00:00
$bands [] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
2020-03-03 11:39:45 +00:00
}
}
else {
$bands = $data [ 'worked_bands' ];
}
$data [ 'bands' ] = $bands ; // Used for displaying selected band(s) in the table in the view
if ( $this -> input -> method () === 'post' ) {
2023-08-01 12:20:14 +00:00
$postdata [ 'qsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'qsl' ));
$postdata [ 'lotw' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'lotw' ));
$postdata [ 'eqsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'eqsl' ));
$postdata [ 'worked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'worked' ));
$postdata [ 'confirmed' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'confirmed' ));
$postdata [ 'notworked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'notworked' ));
$postdata [ 'includedeleted' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'includedeleted' ));
$postdata [ 'Africa' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Africa' ));
$postdata [ 'Asia' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Asia' ));
$postdata [ 'Europe' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Europe' ));
$postdata [ 'NorthAmerica' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'NorthAmerica' ));
$postdata [ 'SouthAmerica' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'SouthAmerica' ));
$postdata [ 'Oceania' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Oceania' ));
$postdata [ 'Antarctica' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Antarctica' ));
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2020-03-03 11:39:45 +00:00
}
else { // Setting default values at first load of page
$postdata [ 'qsl' ] = 1 ;
2023-01-18 12:51:46 +00:00
$postdata [ 'lotw' ] = 1 ;
$postdata [ 'eqsl' ] = 0 ;
2020-03-03 11:39:45 +00:00
$postdata [ 'worked' ] = 1 ;
$postdata [ 'confirmed' ] = 1 ;
$postdata [ 'notworked' ] = 1 ;
2021-11-14 11:58:19 +00:00
$postdata [ 'includedeleted' ] = 0 ;
2020-03-03 11:39:45 +00:00
$postdata [ 'Africa' ] = 1 ;
$postdata [ 'Asia' ] = 1 ;
$postdata [ 'Europe' ] = 1 ;
$postdata [ 'NorthAmerica' ] = 1 ;
$postdata [ 'SouthAmerica' ] = 1 ;
$postdata [ 'Oceania' ] = 1 ;
$postdata [ 'Antarctica' ] = 1 ;
$postdata [ 'band' ] = 'All' ;
2020-12-11 22:45:06 +00:00
$postdata [ 'mode' ] = 'All' ;
2020-03-03 11:39:45 +00:00
}
$dxcclist = $this -> dxcc -> fetchdxcc ( $postdata );
$data [ 'dxcc_array' ] = $this -> dxcc -> get_dxcc_array ( $dxcclist , $bands , $postdata );
2021-12-31 13:05:33 +00:00
$data [ 'dxcc_summary' ] = $this -> dxcc -> get_dxcc_summary ( $bands , $postdata );
2016-02-12 16:31:29 +00:00
// Render Page
$data [ 'page_title' ] = " Awards - DXCC " ;
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/header' , $data );
2016-02-12 16:31:29 +00:00
$this -> load -> view ( 'awards/dxcc/index' );
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/footer' );
2012-11-20 17:25:54 +00:00
}
2016-02-15 17:46:33 +00:00
2020-03-15 13:18:49 +00:00
public function vucc () {
$this -> load -> model ( 'vucc' );
2021-11-13 14:55:17 +00:00
$this -> load -> model ( 'bands' );
2022-09-05 18:26:08 +00:00
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands ( 'vucc' );
2020-03-15 13:18:49 +00:00
$data [ 'vucc_array' ] = $this -> vucc -> get_vucc_array ( $data );
// Render Page
$data [ 'page_title' ] = " Awards - VUCC " ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/vucc/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
public function vucc_band (){
$this -> load -> model ( 'vucc' );
2023-08-01 12:20:14 +00:00
$band = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> get ( " Band " )));
$type = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> get ( " Type " )));
2020-10-25 13:59:03 +00:00
$data [ 'vucc_array' ] = $this -> vucc -> vucc_details ( $band , $type );
$data [ 'type' ] = $type ;
2020-03-15 13:18:49 +00:00
// Render Page
2020-12-22 09:33:08 +00:00
$data [ 'page_title' ] = " VUCC - " . $band . " Band " ;
2020-03-15 13:18:49 +00:00
$data [ 'filter' ] = " band " . $band ;
$data [ 'band' ] = $band ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/vucc/band' );
$this -> load -> view ( 'interface_assets/footer' );
}
2020-09-20 12:09:46 +00:00
public function vucc_details_ajax (){
$this -> load -> model ( 'logbook_model' );
2023-08-01 12:20:14 +00:00
$gridsquare = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " Gridsquare " )));
$band = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " Band " )));
2020-09-20 12:09:46 +00:00
$data [ 'results' ] = $this -> logbook_model -> vucc_qso_details ( $gridsquare , $band );
// Render Page
$data [ 'page_title' ] = " Log View - VUCC " ;
$data [ 'filter' ] = " vucc " . $gridsquare . " and band " . $band ;
2020-10-19 17:24:11 +00:00
$this -> load -> view ( 'awards/details' , $data );
2020-09-20 12:09:46 +00:00
}
2021-07-24 12:31:16 +00:00
/*
* Used to fetch QSOs from the logbook in the awards
*/
public function qso_details_ajax (){
$this -> load -> model ( 'logbook_model' );
2023-08-01 12:20:14 +00:00
$searchphrase = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " Searchphrase " )));
$band = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " Band " )));
$mode = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " Mode " )));
$type = $this -> security -> xss_clean ( $this -> input -> post ( 'Type' ));
$qsl = $this -> input -> post ( 'QSL' ) == null ? '' : $this -> security -> xss_clean ( $this -> input -> post ( 'QSL' ));
2023-01-16 16:08:27 +00:00
$data [ 'results' ] = $this -> logbook_model -> qso_details ( $searchphrase , $band , $mode , $type , $qsl );
2021-07-24 12:31:16 +00:00
2021-07-29 08:38:27 +00:00
// This is done because we have two different ways to get dxcc info in Cloudlog. Once is using the name (in awards), and the other one is using the ADIF DXCC.
// We replace the values to make it look a bit nicer
if ( $type == 'DXCC2' ) {
$type = 'DXCC' ;
$dxccname = $this -> logbook_model -> get_entity ( $searchphrase );
$searchphrase = $dxccname [ 'name' ];
}
2023-01-16 16:08:27 +00:00
$qsltype = [];
if ( strpos ( $qsl , " Q " ) !== false ) {
$qsltype [] = " QSL " ;
}
if ( strpos ( $qsl , " L " ) !== false ) {
2023-04-26 03:44:54 +00:00
$qsltype [] = " LoTW " ;
2023-01-16 16:08:27 +00:00
}
if ( strpos ( $qsl , " E " ) !== false ) {
$qsltype [] = " eQSL " ;
}
2021-07-24 12:31:16 +00:00
// Render Page
$data [ 'page_title' ] = " Log View - " . $type ;
$data [ 'filter' ] = $type . " " . $searchphrase . " and band " . $band . " and mode " . $mode ;
2023-01-16 16:08:27 +00:00
if ( ! empty ( $qsltype )) {
$data [ 'filter' ] .= " and " . implode ( '/' , $qsltype );
}
2021-07-24 12:31:16 +00:00
$this -> load -> view ( 'awards/details' , $data );
}
2012-11-01 01:50:11 +00:00
/*
Handles showing worked SOTAs
Comment field - SOTA : #
*/
public function sota () {
2021-03-20 10:24:13 +00:00
2012-11-01 01:50:11 +00:00
// Grab all worked sota stations
$this -> load -> model ( 'sota' );
$data [ 'sota_all' ] = $this -> sota -> get_all ();
2021-03-20 10:24:13 +00:00
2012-11-01 01:50:11 +00:00
// Render page
$data [ 'page_title' ] = " Awards - SOTA " ;
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/header' , $data );
2012-11-01 01:50:11 +00:00
$this -> load -> view ( 'awards/sota/index' );
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/footer' );
2012-11-01 01:50:11 +00:00
}
2021-03-20 10:24:13 +00:00
2022-09-10 13:04:05 +00:00
/*
Handles showing worked WWFFs
Comment field - WWFF : #
*/
public function wwff () {
// Grab all worked wwff stations
$this -> load -> model ( 'wwff' );
$data [ 'wwff_all' ] = $this -> wwff -> get_all ();
// Render page
$data [ 'page_title' ] = " Awards - WWFF " ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/wwff/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
2022-10-05 20:13:12 +00:00
/*
Handles showing worked POTAs
Comment field - POTA : #
*/
public function pota () {
// Grab all worked pota stations
$this -> load -> model ( 'pota' );
$data [ 'pota_all' ] = $this -> pota -> get_all ();
// Render page
$data [ 'page_title' ] = " Awards - POTA " ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/pota/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
2021-09-09 16:14:41 +00:00
public function cq () {
2021-03-27 13:28:29 +00:00
$CI =& get_instance ();
2021-09-08 20:07:00 +00:00
$CI -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
2016-04-13 15:16:07 +00:00
$this -> load -> model ( 'cq' );
2021-07-26 07:00:52 +00:00
$this -> load -> model ( 'modes' );
2021-11-13 14:55:17 +00:00
$this -> load -> model ( 'bands' );
2016-04-13 15:16:07 +00:00
2022-09-05 18:26:08 +00:00
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands ( 'cq' );
2021-07-26 07:00:52 +00:00
$data [ 'modes' ] = $this -> modes -> active (); // Used in the view for mode select
2020-03-30 19:03:38 +00:00
if ( $this -> input -> post ( 'band' ) != NULL ) { // Band is not set when page first loads.
if ( $this -> input -> post ( 'band' ) == 'All' ) { // Did the user specify a band? If not, use all bands
$bands = $data [ 'worked_bands' ];
}
else {
$bands [] = $this -> input -> post ( 'band' );
}
}
else {
$bands = $data [ 'worked_bands' ];
}
$data [ 'bands' ] = $bands ; // Used for displaying selected band(s) in the table in the view
if ( $this -> input -> method () === 'post' ) {
2023-08-01 12:20:14 +00:00
$postdata [ 'qsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'qsl' ));
$postdata [ 'lotw' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'lotw' ));
$postdata [ 'eqsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'eqsl' ));
$postdata [ 'worked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'worked' ));
$postdata [ 'confirmed' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'confirmed' ));
$postdata [ 'notworked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'notworked' ));
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2020-03-30 19:03:38 +00:00
}
else { // Setting default values at first load of page
$postdata [ 'qsl' ] = 1 ;
2023-01-18 12:35:58 +00:00
$postdata [ 'lotw' ] = 1 ;
$postdata [ 'eqsl' ] = 0 ;
2020-03-30 19:03:38 +00:00
$postdata [ 'worked' ] = 1 ;
$postdata [ 'confirmed' ] = 1 ;
$postdata [ 'notworked' ] = 1 ;
$postdata [ 'band' ] = 'All' ;
2021-07-26 07:00:52 +00:00
$postdata [ 'mode' ] = 'All' ;
2020-03-30 19:03:38 +00:00
}
2021-11-14 16:11:59 +00:00
if ( $logbooks_locations_array ) {
$location_list = " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ;
$data [ 'cq_array' ] = $this -> cq -> get_cq_array ( $bands , $postdata , $location_list );
2022-01-06 18:35:08 +00:00
$data [ 'cq_summary' ] = $this -> cq -> get_cq_summary ( $bands , $postdata , $location_list );
2021-11-14 16:11:59 +00:00
} else {
$location_list = null ;
$data [ 'cq_array' ] = null ;
$data [ 'cq_summary' ] = null ;
}
2020-03-30 19:03:38 +00:00
2016-04-13 15:16:07 +00:00
// Render page
$data [ 'page_title' ] = " Awards - CQ Magazine " ;
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/header' , $data );
2016-04-13 15:16:07 +00:00
$this -> load -> view ( 'awards/cq/index' );
2019-02-10 22:47:57 +00:00
$this -> load -> view ( 'interface_assets/footer' );
2016-04-13 15:16:07 +00:00
}
2020-02-09 12:20:59 +00:00
public function was () {
$this -> load -> model ( 'was' );
2021-07-27 10:11:41 +00:00
$this -> load -> model ( 'modes' );
2021-11-13 14:55:17 +00:00
$this -> load -> model ( 'bands' );
2021-07-27 10:11:41 +00:00
2022-09-05 18:26:08 +00:00
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands ( 'was' );
2021-07-27 10:11:41 +00:00
$data [ 'modes' ] = $this -> modes -> active (); // Used in the view for mode select
2020-02-09 12:20:59 +00:00
2020-03-28 23:36:18 +00:00
if ( $this -> input -> post ( 'band' ) != NULL ) { // Band is not set when page first loads.
if ( $this -> input -> post ( 'band' ) == 'All' ) { // Did the user specify a band? If not, use all bands
$bands = $data [ 'worked_bands' ];
}
else {
2023-08-01 12:20:14 +00:00
$bands [] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
2020-03-28 23:36:18 +00:00
}
}
else {
$bands = $data [ 'worked_bands' ];
}
$data [ 'bands' ] = $bands ; // Used for displaying selected band(s) in the table in the view
if ( $this -> input -> method () === 'post' ) {
2023-08-01 12:20:14 +00:00
$postdata [ 'qsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'qsl' ));
$postdata [ 'lotw' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'lotw' ));
$postdata [ 'eqsl' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'eqsl' ));
$postdata [ 'worked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'worked' ));
$postdata [ 'confirmed' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'confirmed' ));
$postdata [ 'notworked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'notworked' ));
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2020-03-28 23:36:18 +00:00
}
else { // Setting default values at first load of page
$postdata [ 'qsl' ] = 1 ;
2023-01-18 13:08:56 +00:00
$postdata [ 'lotw' ] = 1 ;
$postdata [ 'eqsl' ] = 0 ;
2020-03-28 23:36:18 +00:00
$postdata [ 'worked' ] = 1 ;
$postdata [ 'confirmed' ] = 1 ;
$postdata [ 'notworked' ] = 1 ;
$postdata [ 'band' ] = 'All' ;
2021-07-27 10:11:41 +00:00
$postdata [ 'mode' ] = 'All' ;
2020-03-28 23:36:18 +00:00
}
$data [ 'was_array' ] = $this -> was -> get_was_array ( $bands , $postdata );
2022-01-04 18:13:41 +00:00
$data [ 'was_summary' ] = $this -> was -> get_was_summary ( $bands , $postdata );
2020-03-28 23:36:18 +00:00
2020-02-09 12:20:59 +00:00
// Render Page
2020-11-23 02:04:33 +00:00
$data [ 'page_title' ] = " Awards - WAS (Worked All States) " ;
2020-02-09 12:20:59 +00:00
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/was/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
2020-03-07 10:39:22 +00:00
public function iota () {
$this -> load -> model ( 'iota' );
2021-07-26 11:13:16 +00:00
$this -> load -> model ( 'modes' );
2021-11-13 14:55:17 +00:00
$this -> load -> model ( 'bands' );
2021-07-26 11:13:16 +00:00
2022-09-05 18:26:08 +00:00
$data [ 'worked_bands' ] = $this -> bands -> get_worked_bands ( 'iota' ); // Used in the view for band select
2020-03-07 10:39:22 +00:00
if ( $this -> input -> post ( 'band' ) != NULL ) { // Band is not set when page first loads.
if ( $this -> input -> post ( 'band' ) == 'All' ) { // Did the user specify a band? If not, use all bands
$bands = $data [ 'worked_bands' ];
}
else {
2023-08-01 12:20:14 +00:00
$bands [] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
2020-03-07 10:39:22 +00:00
}
}
else {
$bands = $data [ 'worked_bands' ];
}
$data [ 'bands' ] = $bands ; // Used for displaying selected band(s) in the table in the view
2021-07-26 11:13:16 +00:00
$data [ 'modes' ] = $this -> modes -> active (); // Used in the view for mode select
2020-03-07 10:39:22 +00:00
if ( $this -> input -> method () === 'post' ) {
2023-08-01 12:20:14 +00:00
$postdata [ 'worked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'worked' ));
$postdata [ 'confirmed' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'confirmed' ));
$postdata [ 'notworked' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'notworked' ));
$postdata [ 'includedeleted' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'includedeleted' ));
$postdata [ 'Africa' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Africa' ));
$postdata [ 'Asia' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Asia' ));
$postdata [ 'Europe' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Europe' ));
$postdata [ 'NorthAmerica' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'NorthAmerica' ));
$postdata [ 'SouthAmerica' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'SouthAmerica' ));
$postdata [ 'Oceania' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Oceania' ));
$postdata [ 'Antarctica' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'Antarctica' ));
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2020-03-07 10:39:22 +00:00
}
else { // Setting default values at first load of page
$postdata [ 'worked' ] = 1 ;
$postdata [ 'confirmed' ] = 1 ;
$postdata [ 'notworked' ] = 1 ;
2021-11-14 11:58:19 +00:00
$postdata [ 'includedeleted' ] = 0 ;
2020-03-07 10:39:22 +00:00
$postdata [ 'Africa' ] = 1 ;
$postdata [ 'Asia' ] = 1 ;
$postdata [ 'Europe' ] = 1 ;
$postdata [ 'NorthAmerica' ] = 1 ;
$postdata [ 'SouthAmerica' ] = 1 ;
$postdata [ 'Oceania' ] = 1 ;
$postdata [ 'Antarctica' ] = 1 ;
$postdata [ 'band' ] = 'All' ;
2021-07-26 11:13:16 +00:00
$postdata [ 'mode' ] = 'All' ;
2020-03-07 10:39:22 +00:00
}
$iotalist = $this -> iota -> fetchIota ( $postdata );
$data [ 'iota_array' ] = $this -> iota -> get_iota_array ( $iotalist , $bands , $postdata );
2022-01-06 19:02:53 +00:00
$data [ 'iota_summary' ] = $this -> iota -> get_iota_summary ( $bands , $postdata );
2020-03-07 10:39:22 +00:00
// Render Page
$data [ 'page_title' ] = " Awards - IOTA (Islands On The Air) " ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/iota/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
2021-02-06 23:03:05 +00:00
public function counties () {
$this -> load -> model ( 'counties' );
$data [ 'counties_array' ] = $this -> counties -> get_counties_array ();
// Render Page
$data [ 'page_title' ] = " Awards - US Counties " ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/counties/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
2021-02-07 14:22:03 +00:00
public function counties_details () {
$this -> load -> model ( 'counties' );
2023-08-01 12:20:14 +00:00
$state = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> get ( " State " )));
$type = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> get ( " Type " )));
2021-02-07 14:22:03 +00:00
$data [ 'counties_array' ] = $this -> counties -> counties_details ( $state , $type );
$data [ 'type' ] = $type ;
// Render Page
$data [ 'page_title' ] = " US Counties " ;
$data [ 'filter' ] = $type . " counties in state " . $state ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/counties/details' );
$this -> load -> view ( 'interface_assets/footer' );
}
public function counties_details_ajax (){
$this -> load -> model ( 'logbook_model' );
2023-08-01 12:20:14 +00:00
$state = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " State " )));
$county = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> post ( " County " )));
2021-02-07 14:22:03 +00:00
$data [ 'results' ] = $this -> logbook_model -> county_qso_details ( $state , $county );
// Render Page
$data [ 'page_title' ] = " Log View - Counties " ;
$data [ 'filter' ] = " county " . $state ;
$this -> load -> view ( 'awards/details' , $data );
}
2021-03-20 10:24:13 +00:00
/*
Handles showing worked Sigs
Adif fields : my_sig
*/
public function sig () {
// Grab all worked sig stations
$this -> load -> model ( 'sig' );
$data [ 'sig_types' ] = $this -> sig -> get_all_sig_types ();
// Render page
$data [ 'page_title' ] = " Awards - SIG " ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/sig/index' );
$this -> load -> view ( 'interface_assets/footer' );
}
/*
Handles showing worked Sigs
*/
public function sig_details () {
// Grab all worked sig stations
$this -> load -> model ( 'sig' );
2023-08-01 12:20:14 +00:00
$type = str_replace ( '"' , " " , $this -> security -> xss_clean ( $this -> input -> get ( " type " )));
2021-03-20 10:24:13 +00:00
$data [ 'sig_all' ] = $this -> sig -> get_all ( $type );
$data [ 'type' ] = $type ;
// Render page
$data [ 'page_title' ] = " Awards - SIG - " . $type ;
$this -> load -> view ( 'interface_assets/header' , $data );
$this -> load -> view ( 'awards/sig/qso_list' );
$this -> load -> view ( 'interface_assets/footer' );
}
/*
Handles exporting SIGS to ADIF
*/
public function sigexportadif () {
// Set memory limit to unlimited to allow heavy usage
ini_set ( 'memory_limit' , '-1' );
$this -> load -> model ( 'adif_data' );
2021-09-09 20:29:59 +00:00
2023-08-01 12:20:14 +00:00
$type = $this -> security -> xss_clean ( $this -> uri -> segment ( 3 ));
2021-03-20 10:24:13 +00:00
$data [ 'qsos' ] = $this -> adif_data -> sig_all ( $type );
2021-03-20 10:43:32 +00:00
$this -> load -> view ( 'adif/data/exportall' , $data );
2021-03-20 10:24:13 +00:00
}
2021-04-29 21:38:55 +00:00
2021-04-30 15:25:38 +00:00
/*
function was_map
2021-07-27 10:11:41 +00:00
This displays the WAS map and requires the $band_type and $mode_type
2021-04-30 15:25:38 +00:00
*/
2021-07-27 10:11:41 +00:00
public function was_map ( $band_type , $mode_type ) {
2021-04-29 21:38:55 +00:00
$this -> load -> model ( 'was' );
2021-07-27 10:11:41 +00:00
$data [ 'mode' ] = $mode_type ;
2021-04-29 21:38:55 +00:00
2021-07-27 10:11:41 +00:00
$bands [] = $band_type ;
2021-04-29 21:38:55 +00:00
2021-04-30 15:25:38 +00:00
$postdata [ 'qsl' ] = 1 ;
2023-01-18 13:08:56 +00:00
$postdata [ 'lotw' ] = 1 ;
$postdata [ 'eqsl' ] = 0 ;
2021-04-30 15:25:38 +00:00
$postdata [ 'worked' ] = 1 ;
$postdata [ 'confirmed' ] = 1 ;
$postdata [ 'notworked' ] = 1 ;
$postdata [ 'band' ] = $band_type ;
2021-07-27 10:11:41 +00:00
$postdata [ 'mode' ] = $mode_type ;
2021-04-29 21:38:55 +00:00
$data [ 'was_array' ] = $this -> was -> get_was_array ( $bands , $postdata );
$data [ 'page_title' ] = " " ;
2021-05-01 05:57:08 +00:00
2021-04-29 21:38:55 +00:00
$this -> load -> view ( 'awards/was/map' , $data );
}
2022-10-12 07:44:13 +00:00
/*
function cq_map
This displays the CQ Zone map and requires the $band_type and $mode_type
*/
public function cq_map () {
$CI =& get_instance ();
$CI -> load -> model ( 'logbooks_model' );
$logbooks_locations_array = $CI -> logbooks_model -> list_logbook_relationships ( $this -> session -> userdata ( 'active_station_logbook' ));
$this -> load -> model ( 'cq' );
$bands [] = $this -> input -> post ( 'band' );
$postdata [ 'qsl' ] = $this -> input -> post ( 'qsl' ) == 0 ? NULL : 1 ;
2023-01-18 12:35:58 +00:00
$postdata [ 'lotw' ] = $this -> input -> post ( 'lotw' ) == 0 ? NULL : 1 ;
$postdata [ 'eqsl' ] = $this -> input -> post ( 'eqsl' ) == 0 ? NULL : 1 ;
2022-10-12 07:44:13 +00:00
$postdata [ 'worked' ] = $this -> input -> post ( 'worked' ) == 0 ? NULL : 1 ;
$postdata [ 'confirmed' ] = $this -> input -> post ( 'confirmed' ) == 0 ? NULL : 1 ;
$postdata [ 'notworked' ] = $this -> input -> post ( 'notworked' ) == 0 ? NULL : 1 ;
2023-08-01 12:20:14 +00:00
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2022-10-12 07:44:13 +00:00
if ( $logbooks_locations_array ) {
$location_list = " ' " . implode ( " ',' " , $logbooks_locations_array ) . " ' " ;
$cq_array = $this -> cq -> get_cq_array ( $bands , $postdata , $location_list );
} else {
$location_list = null ;
$cq_array = null ;
}
foreach ( $cq_array as $cq => $value ) {
foreach ( $value as $key ) {
if ( $key != " " ) {
if ( strpos ( $key , '>W<' ) !== false ) {
$zones [] = 'W' ;
break ;
}
if ( strpos ( $key , '>C<' ) !== false ) {
$zones [] = 'C' ;
break ;
}
if ( strpos ( $key , '-' ) !== false ) {
$zones [] = '-' ;
break ;
}
}
}
}
header ( 'Content-Type: application/json' );
echo json_encode ( $zones );
}
2023-08-01 12:20:14 +00:00
2022-11-11 18:23:41 +00:00
/*
function dxcc_map
This displays the DXCC map
*/
public function dxcc_map () {
$this -> load -> model ( 'dxcc' );
$this -> load -> model ( 'bands' );
2023-08-01 12:20:14 +00:00
$bands [] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
2022-11-11 18:23:41 +00:00
$postdata [ 'qsl' ] = $this -> input -> post ( 'qsl' ) == 0 ? NULL : 1 ;
2023-01-18 12:51:46 +00:00
$postdata [ 'lotw' ] = $this -> input -> post ( 'lotw' ) == 0 ? NULL : 1 ;
$postdata [ 'eqsl' ] = $this -> input -> post ( 'eqsl' ) == 0 ? NULL : 1 ;
2022-11-11 18:23:41 +00:00
$postdata [ 'worked' ] = $this -> input -> post ( 'worked' ) == 0 ? NULL : 1 ;
$postdata [ 'confirmed' ] = $this -> input -> post ( 'confirmed' ) == 0 ? NULL : 1 ;
$postdata [ 'notworked' ] = $this -> input -> post ( 'notworked' ) == 0 ? NULL : 1 ;
2023-08-01 12:20:14 +00:00
$postdata [ 'band' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
$postdata [ 'mode' ] = $this -> security -> xss_clean ( $this -> input -> post ( 'mode' ));
2022-11-11 18:23:41 +00:00
$postdata [ 'includedeleted' ] = $this -> input -> post ( 'includedeleted' ) == 0 ? NULL : 1 ;
$postdata [ 'Africa' ] = $this -> input -> post ( 'Africa' ) == 0 ? NULL : 1 ;
$postdata [ 'Asia' ] = $this -> input -> post ( 'Asia' ) == 0 ? NULL : 1 ;
$postdata [ 'Europe' ] = $this -> input -> post ( 'Europe' ) == 0 ? NULL : 1 ;
$postdata [ 'NorthAmerica' ] = $this -> input -> post ( 'NorthAmerica' ) == 0 ? NULL : 1 ;
$postdata [ 'SouthAmerica' ] = $this -> input -> post ( 'SouthAmerica' ) == 0 ? NULL : 1 ;
$postdata [ 'Oceania' ] = $this -> input -> post ( 'Oceania' ) == 0 ? NULL : 1 ;
$postdata [ 'Antarctica' ] = $this -> input -> post ( 'Antarctica' ) == 0 ? NULL : 1 ;
$dxcclist = $this -> dxcc -> fetchdxcc ( $postdata );
$dxcc_array = $this -> dxcc -> get_dxcc_array ( $dxcclist , $bands , $postdata );
$i = 0 ;
foreach ( $dxcclist as $dxcc ) {
$newdxcc [ $i ][ 'adif' ] = $dxcc -> adif ;
$newdxcc [ $i ][ 'prefix' ] = $dxcc -> prefix ;
2022-11-12 09:50:46 +00:00
$newdxcc [ $i ][ 'name' ] = ucwords ( strtolower ( $dxcc -> name ), " - (/ " );
if ( $dxcc -> Enddate != null ) {
$newdxcc [ $i ][ 'name' ] .= ' (deleted)' ;
}
2022-11-11 18:23:41 +00:00
$newdxcc [ $i ][ 'lat' ] = $dxcc -> lat ;
$newdxcc [ $i ][ 'long' ] = $dxcc -> long ;
2022-11-22 16:51:31 +00:00
$newdxcc [ $i ++ ][ 'status' ] = isset ( $dxcc_array [ $dxcc -> adif ]) ? $this -> returnStatus ( $dxcc_array [ $dxcc -> adif ]) : 'x' ;
2022-11-11 18:23:41 +00:00
}
header ( 'Content-Type: application/json' );
echo json_encode ( $newdxcc );
}
2022-12-11 16:47:36 +00:00
/*
function iota
This displays the IOTA map
*/
public function iota_map () {
$this -> load -> model ( 'iota' );
$this -> load -> model ( 'bands' );
2023-08-01 12:20:14 +00:00
$bands [] = $this -> security -> xss_clean ( $this -> input -> post ( 'band' ));
2022-12-11 16:47:36 +00:00
$postdata [ 'lotw' ] = $this -> input -> post ( 'lotw' ) == 0 ? NULL : 1 ;
$postdata [ 'qsl' ] = $this -> input -> post ( 'qsl' ) == 0 ? NULL : 1 ;
$postdata [ 'worked' ] = $this -> input -> post ( 'worked' ) == 0 ? NULL : 1 ;
$postdata [ 'confirmed' ] = $this -> input -> post ( 'confirmed' ) == 0 ? NULL : 1 ;
$postdata [ 'notworked' ] = $this -> input -> post ( 'notworked' ) == 0 ? NULL : 1 ;
$postdata [ 'band' ] = $this -> input -> post ( 'band' );
2022-12-12 08:30:59 +00:00
$postdata [ 'mode' ] = $this -> input -> post ( 'mode' );
2022-12-11 16:47:36 +00:00
$postdata [ 'includedeleted' ] = $this -> input -> post ( 'includedeleted' ) == 0 ? NULL : 1 ;
$postdata [ 'Africa' ] = $this -> input -> post ( 'Africa' ) == 0 ? NULL : 1 ;
$postdata [ 'Asia' ] = $this -> input -> post ( 'Asia' ) == 0 ? NULL : 1 ;
$postdata [ 'Europe' ] = $this -> input -> post ( 'Europe' ) == 0 ? NULL : 1 ;
$postdata [ 'NorthAmerica' ] = $this -> input -> post ( 'NorthAmerica' ) == 0 ? NULL : 1 ;
$postdata [ 'SouthAmerica' ] = $this -> input -> post ( 'SouthAmerica' ) == 0 ? NULL : 1 ;
$postdata [ 'Oceania' ] = $this -> input -> post ( 'Oceania' ) == 0 ? NULL : 1 ;
$postdata [ 'Antarctica' ] = $this -> input -> post ( 'Antarctica' ) == 0 ? NULL : 1 ;
$iotalist = $this -> iota -> fetchIota ( $postdata );
$iota_array = $this -> iota -> get_iota_array ( $iotalist , $bands , $postdata );
$i = 0 ;
foreach ( $iotalist as $iota ) {
$newiota [ $i ][ 'tag' ] = $iota -> tag ;
$newiota [ $i ][ 'prefix' ] = $iota -> prefix ;
$newiota [ $i ][ 'name' ] = ucwords ( strtolower ( $iota -> name ), " - (/ " );
if ( $iota -> status == 'D' ) {
$newiota [ $i ][ 'name' ] .= ' (deleted)' ;
}
$newiota [ $i ][ 'lat1' ] = $iota -> lat1 ;
$newiota [ $i ][ 'lon1' ] = $iota -> lon1 ;
$newiota [ $i ][ 'lat2' ] = $iota -> lat2 ;
$newiota [ $i ][ 'lon2' ] = $iota -> lon2 ;
$newiota [ $i ++ ][ 'status' ] = isset ( $iota_array [ $iota -> tag ]) ? $this -> returnStatus ( $iota_array [ $iota -> tag ]) : 'x' ;
}
header ( 'Content-Type: application/json' );
echo json_encode ( $newiota );
}
function returnStatus ( $string ) {
foreach ( $string as $key ) {
if ( $key != " " ) {
if ( strpos ( $key , '>W<' ) !== false ) {
return 'W' ;
}
if ( strpos ( $key , '>C<' ) !== false ) {
return 'C' ;
}
if ( $key == '-' ) {
return '-' ;
}
}
}
}
2023-01-16 16:08:27 +00:00
}