diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 663518e4..cd405b62 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -523,6 +523,112 @@ class Awards extends CI_Controller { $this->load->view('awards/details', $data); } + public function gridmaster() { + $data['page_title']= lang('menu_us_gridmaster'); + + $this->load->model('bands'); + $this->load->model('gridmap_model'); + $this->load->model('stations'); + + $data['homegrid']= explode(',', $this->stations->find_gridsquare()); + + $data['modes'] = $this->gridmap_model->get_worked_modes(); + $data['bands']= $this->bands->get_worked_bands(); + $data['sats_available']= $this->bands->get_worked_sats(); + + $data['layer']= $this->optionslib->get_option('option_map_tile_server'); + + $data['attribution']= $this->optionslib->get_option('option_map_tile_server_copyright'); + + $data['gridsquares_gridsquares']= lang('gridsquares_gridsquares'); + $data['gridsquares_gridsquares_worked']= lang('gridsquares_gridsquares_worked'); + $data['gridsquares_gridsquares_lotw']= lang('gridsquares_gridsquares_lotw'); + $data['gridsquares_gridsquares_paper']= lang('gridsquares_gridsquares_paper'); + + $footerData = []; + $footerData['scripts']= [ + 'assets/js/leaflet/geocoding.js', + 'assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js', + 'assets/js/sections/gridmaster.js?' + ]; + + $this->load->view('interface_assets/header',$data); + $this->load->view('awards/gridmaster/index'); + $this->load->view('interface_assets/footer',$footerData); + } + + public function getGridmasterGridsjs() { + $this->load->model('gridmaster_model'); + + $array_grid_4char = array(); + $array_grid_4char_lotw = array(); + $array_grid_4char_paper = array(); + + $grid_4char = ""; + $grid_4char_lotw = ""; + + $query = $this->gridmaster_model->get_lotw(); + if ($query && $query->num_rows() > 0) { + foreach ($query->result() as $row) { + $grid_4char_lotw = strtoupper(substr($row->GRID_SQUARES,0,4)); + if(!in_array($grid_4char_lotw, $array_grid_4char_lotw)){ + array_push($array_grid_4char_lotw, $grid_4char_lotw); + } + } + } + + $query = $this->gridmaster_model->get_paper(); + if ($query && $query->num_rows() > 0) { + foreach ($query->result() as $row) { + $grid_4char_paper = strtoupper(substr($row->GRID_SQUARES,0,4)); + if(!in_array($grid_4char_paper, $array_grid_4char_paper)){ + array_push($array_grid_4char_paper, $grid_4char_paper); + } + } + } + + $query = $this->gridmaster_model->get_worked(); + if ($query && $query->num_rows() > 0) { + foreach ($query->result() as $row) { + $grid_four = strtoupper(substr($row->GRID_SQUARES,0,4)); + if(!in_array($grid_four, $array_grid_4char)){ + array_push($array_grid_4char, $grid_four); + } + } + } + + $vucc_grids = $this->gridmaster_model->get_vucc_lotw(); + foreach($vucc_grids as $key) { + $grid_four_lotw = strtoupper(substr($key,0,4)); + if(!in_array($grid_four_lotw, $array_grid_4char_lotw)){ + array_push($array_grid_4char_lotw, $grid_four_lotw); + } + } + + $vucc_grids = $this->gridmaster_model->get_vucc_paper(); + foreach($vucc_grids as $key) { + $grid_four_paper = strtoupper(substr($key,0,4)); + if(!in_array($grid_four_paper, $array_grid_4char_paper)){ + array_push($array_grid_4char_paper, $grid_four_paper); + } + } + + $vucc_grids = $this->gridmaster_model->get_vucc_worked(); + foreach($vucc_grids as $key) { + $grid_four = strtoupper(substr($key,0,4)); + if(!in_array($grid_four, $array_grid_4char)){ + array_push($array_grid_4char, $grid_four); + } + } + + $data['grid_4char_lotw'] = ($array_grid_4char_lotw); + $data['grid_4char_paper'] = ($array_grid_4char_paper); + $data['grid_4char'] = ($array_grid_4char); + + header('Content-Type: application/json'); + echo json_encode($data); + } + /* Handles showing worked Sigs Adif fields: my_sig diff --git a/application/language/bulgarian/menu_lang.php b/application/language/bulgarian/menu_lang.php index a0722674..9a61fb7d 100644 --- a/application/language/bulgarian/menu_lang.php +++ b/application/language/bulgarian/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/chinese_simplified/gridsquares_lang.php b/application/language/chinese_simplified/gridsquares_lang.php index 7f461cc1..a2d127dd 100644 --- a/application/language/chinese_simplified/gridsquares_lang.php +++ b/application/language/chinese_simplified/gridsquares_lang.php @@ -23,5 +23,7 @@ $lang['gridsquares_button_plot'] = '绘制'; $lang['gridsquares_gridsquares'] = '网格'; $lang['gridsquares_gridsquares_confirmed'] = '已确认的网格'; $lang['gridsquares_gridsquares_not_confirmed'] = '未确认的网格'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_total_worked'] = '总共工作过的网格'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/chinese_simplified/menu_lang.php b/application/language/chinese_simplified/menu_lang.php index 3872580d..0d8609d8 100644 --- a/application/language/chinese_simplified/menu_lang.php +++ b/application/language/chinese_simplified/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/czech/gridsquares_lang.php b/application/language/czech/gridsquares_lang.php index fd6949fb..13ffd30d 100644 --- a/application/language/czech/gridsquares_lang.php +++ b/application/language/czech/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Zobrazit'; $lang['gridsquares_gridsquares'] = 'Lokátory'; $lang['gridsquares_gridsquares_confirmed'] = 'Potvrzené lokátory'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Nepotvrzené lokátory'; $lang['gridsquares_gridsquares_total_worked'] = 'Celkový počet odpracovaných lokátorů'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/czech/menu_lang.php b/application/language/czech/menu_lang.php index bb2d244d..db5861f6 100644 --- a/application/language/czech/menu_lang.php +++ b/application/language/czech/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US okresy'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/dutch/gridsquares_lang.php b/application/language/dutch/gridsquares_lang.php index aa739b29..d8d4a1b7 100644 --- a/application/language/dutch/gridsquares_lang.php +++ b/application/language/dutch/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; $lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file diff --git a/application/language/dutch/menu_lang.php b/application/language/dutch/menu_lang.php index 7428ddd3..7672f1be 100644 --- a/application/language/dutch/menu_lang.php +++ b/application/language/dutch/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/english/gridsquares_lang.php b/application/language/english/gridsquares_lang.php index ae5e2867..0b18933e 100644 --- a/application/language/english/gridsquares_lang.php +++ b/application/language/english/gridsquares_lang.php @@ -21,7 +21,10 @@ $lang['gridsquares_confirmation'] = 'Confirmation'; $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; +$lang['gridsquares_gridsquares_worked'] = 'Gridsquares worked'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/english/menu_lang.php b/application/language/english/menu_lang.php index 4d6acd63..52a06af3 100644 --- a/application/language/english/menu_lang.php +++ b/application/language/english/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/finnish/gridsquares_lang.php b/application/language/finnish/gridsquares_lang.php index fadea256..af17febc 100644 --- a/application/language/finnish/gridsquares_lang.php +++ b/application/language/finnish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Merkitse'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; $lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file diff --git a/application/language/finnish/menu_lang.php b/application/language/finnish/menu_lang.php index b7d762e0..9ae8e3ec 100644 --- a/application/language/finnish/menu_lang.php +++ b/application/language/finnish/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'USA Osavaltiot'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/french/gridsquares_lang.php b/application/language/french/gridsquares_lang.php index 572124c8..d1611bf6 100644 --- a/application/language/french/gridsquares_lang.php +++ b/application/language/french/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Locators'; $lang['gridsquares_gridsquares_confirmed'] = 'Locators confirmés'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Locators non confirmés'; $lang['gridsquares_gridsquares_total_worked'] = 'Total des Locators contactés'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/german/gridsquares_lang.php b/application/language/german/gridsquares_lang.php index 6fc2a3c9..9d9fb621 100644 --- a/application/language/german/gridsquares_lang.php +++ b/application/language/german/gridsquares_lang.php @@ -21,7 +21,10 @@ $lang['gridsquares_confirmation'] = 'Bestätigung'; $lang['gridsquares_button_plot'] = 'Kartieren'; $lang['gridsquares_gridsquares'] = 'Planquadrate'; +$lang['gridsquares_gridsquares_worked'] = 'Gearbeitete Planquadrate'; $lang['gridsquares_gridsquares_confirmed'] = 'Planquadrate bestätigt'; -$lang['gridsquares_gridsquares_not_confirmed'] = 'Planquadrate nicht bestätigt'; +$lang['gridsquares_gridsquares_lotw'] = 'Auf LoTW bestätigte Planquadrate'; +$lang['gridsquares_gridsquares_paper'] = 'Per Papier QSL bestätigte Planquadrate'; +$lang['gridsquares_gridsquares_not_confirmed'] = 'Unbestätigte Planquadrate'; $lang['gridsquares_gridsquares_total_worked'] = 'Summe gearbeiteter Planquadrate'; -$lang['gridsquares_gridsquares_total_activated'] = 'Summe aktivierter Planquadrate'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Summe aktivierter Planquadrate'; diff --git a/application/language/german/menu_lang.php b/application/language/german/menu_lang.php index 88aac521..ac6f7103 100644 --- a/application/language/german/menu_lang.php +++ b/application/language/german/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Countys'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/greek/gridsquares_lang.php b/application/language/greek/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/greek/gridsquares_lang.php +++ b/application/language/greek/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/greek/menu_lang.php b/application/language/greek/menu_lang.php index 4d6acd63..52a06af3 100644 --- a/application/language/greek/menu_lang.php +++ b/application/language/greek/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/italian/gridsquares_lang.php b/application/language/italian/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/italian/gridsquares_lang.php +++ b/application/language/italian/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/italian/menu_lang.php b/application/language/italian/menu_lang.php index 4d6acd63..52a06af3 100644 --- a/application/language/italian/menu_lang.php +++ b/application/language/italian/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/polish/gridsquares_lang.php b/application/language/polish/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/polish/gridsquares_lang.php +++ b/application/language/polish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/polish/menu_lang.php b/application/language/polish/menu_lang.php index 4d6acd63..52a06af3 100644 --- a/application/language/polish/menu_lang.php +++ b/application/language/polish/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/russian/gridsquares_lang.php b/application/language/russian/gridsquares_lang.php index 224dca7f..3f7ccdd2 100644 --- a/application/language/russian/gridsquares_lang.php +++ b/application/language/russian/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Отобразить'; $lang['gridsquares_gridsquares'] = 'Квадраты'; $lang['gridsquares_gridsquares_confirmed'] = 'Подтверждёно квадратов'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Неподтверждёно квадратов'; $lang['gridsquares_gridsquares_total_worked'] = 'Всего сработано квадратов'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/russian/menu_lang.php b/application/language/russian/menu_lang.php index ecae3659..f8758a76 100644 --- a/application/language/russian/menu_lang.php +++ b/application/language/russian/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/spanish/gridsquares_lang.php b/application/language/spanish/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/spanish/gridsquares_lang.php +++ b/application/language/spanish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/spanish/menu_lang.php b/application/language/spanish/menu_lang.php index 4d6acd63..52a06af3 100644 --- a/application/language/spanish/menu_lang.php +++ b/application/language/spanish/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/swedish/gridsquares_lang.php b/application/language/swedish/gridsquares_lang.php index 48e8bdee..32b06bd0 100644 --- a/application/language/swedish/gridsquares_lang.php +++ b/application/language/swedish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares bekräftad'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares inte bekräftat'; $lang['gridsquares_gridsquares_total_worked'] = 'Totala gridsquares arbetade'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/swedish/menu_lang.php b/application/language/swedish/menu_lang.php index dba3fe04..e7b0ca27 100644 --- a/application/language/swedish/menu_lang.php +++ b/application/language/swedish/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'USA:s grevskap'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/language/turkish/gridsquares_lang.php b/application/language/turkish/gridsquares_lang.php index ae5e2867..cecb256c 100644 --- a/application/language/turkish/gridsquares_lang.php +++ b/application/language/turkish/gridsquares_lang.php @@ -22,6 +22,8 @@ $lang['gridsquares_button_plot'] = 'Plot'; $lang['gridsquares_gridsquares'] = 'Gridsquares'; $lang['gridsquares_gridsquares_confirmed'] = 'Gridsquares confirmed'; +$lang['gridsquares_gridsquares_lotw'] = 'Gridsquares confirmed on LoTW'; +$lang['gridsquares_gridsquares_paper'] = 'Gridsquares confirmed by paper QSL'; $lang['gridsquares_gridsquares_not_confirmed'] = 'Gridsquares not confirmed'; $lang['gridsquares_gridsquares_total_worked'] = 'Total gridsquares worked'; -$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; \ No newline at end of file +$lang['gridsquares_gridsquares_total_activated'] = 'Total gridsquares activated'; diff --git a/application/language/turkish/menu_lang.php b/application/language/turkish/menu_lang.php index 4d6acd63..52a06af3 100644 --- a/application/language/turkish/menu_lang.php +++ b/application/language/turkish/menu_lang.php @@ -42,6 +42,7 @@ $lang['menu_pota'] = 'POTA'; $lang['menu_sig'] = 'SIG'; $lang['menu_sota'] = 'SOTA'; $lang['menu_us_counties'] = 'US Counties'; +$lang['menu_us_gridmaster'] = 'US Gridmaster'; $lang['menu_vucc'] = 'VUCC'; $lang['menu_was'] = 'WAS'; $lang['menu_wwff'] = 'WWFF'; diff --git a/application/models/Gridmaster_model.php b/application/models/Gridmaster_model.php new file mode 100644 index 00000000..868c7b44 --- /dev/null +++ b/application/models/Gridmaster_model.php @@ -0,0 +1,189 @@ +load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_LOTW_QSL_RCVD = 'Y'" + ." and COL_PROP_MODE = 'SAT'" + .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; + return $this->db->query($sql); + } + + function get_paper() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_QSL_RCVD = 'Y'" + ." and COL_PROP_MODE = 'SAT'" + .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; + return $this->db->query($sql); + } + + function get_worked() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,4) as GRID_SQUARES FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_PROP_MODE = 'SAT'" + .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; + return $this->db->query($sql); + } + + function get_vucc_lotw() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct COL_VUCC_GRIDS as VUCC_GRIDS FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_LOTW_QSL_RCVD = 'Y'" + ." and COL_VUCC_GRIDS != ''" + ." and COL_VUCC_GRIDS IS NOT NULL" + ." and COL_PROP_MODE = 'SAT'"; + $query = $this->db->query($sql); + $vucc_grids = []; + foreach ($query->result() as $row) { + $grids = explode(',', $row->VUCC_GRIDS); + foreach ($grids as $grid) { + if (in_array(substr($grid, 0, 4), $this->us_grids)) { + if (!in_array(substr($grid, 0, 4), $vucc_grids)) { + $vucc_grids[] = substr($grid, 0, 4); + } + } + } + } + return $vucc_grids; + } + + function get_vucc_paper() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct COL_VUCC_GRIDS as VUCC_GRIDS FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_QSL_RCVD = 'Y'" + ." and COL_VUCC_GRIDS != ''" + ." and COL_VUCC_GRIDS IS NOT NULL" + ." and COL_PROP_MODE = 'SAT'"; + $query = $this->db->query($sql); + $vucc_grids = []; + foreach ($query->result() as $row) { + $grids = explode(',', $row->VUCC_GRIDS); + foreach ($grids as $grid) { + if (in_array(substr($grid, 0, 4), $this->us_grids)) { + if (!in_array(substr($grid, 0, 4), $vucc_grids)) { + $vucc_grids[] = substr($grid, 0, 4); + } + } + } + } + return $vucc_grids; + } + + function get_vucc_worked() { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $sql = 'SELECT distinct COL_VUCC_GRIDS as VUCC_GRIDS FROM ' + .$this->config->item('table_name') + .' WHERE station_id in ('.$location_list.')' + ." and COL_VUCC_GRIDS != ''" + ." and COL_VUCC_GRIDS IS NOT NULL" + ." and COL_PROP_MODE = 'SAT'"; + $query = $this->db->query($sql); + $vucc_grids = []; + foreach ($query->result() as $row) { + $grids = explode(',', $row->VUCC_GRIDS); + foreach ($grids as $grid) { + if (in_array(substr($grid, 0, 4), $this->us_grids)) { + if (!in_array(substr($grid, 0, 4), $vucc_grids)) { + $vucc_grids[] = substr($grid, 0, 4); + } + } + } + } + return $vucc_grids; + } + +} diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index cff40679..d0917603 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -420,14 +420,17 @@ class Logbook_model extends CI_Model { $this->db->where($sql); } - if ($mode != 'All') { + if ($mode != 'All' && $mode != '') { $this->db->where("(COL_MODE='" . $mode . "' OR COL_SUBMODE='" . $mode ."')"); } $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit(500); - return $this->db->get($this->config->item('table_name')); + $result = $this->db->get($this->config->item('table_name')); + log_message('debug', 'SQL: '.$this->db->last_query()); + return $result; + //return $this->db->get($this->config->item('table_name')); } public function activated_grids_qso_details($searchphrase, $band, $mode){ diff --git a/application/views/awards/gridmaster/index.php b/application/views/awards/gridmaster/index.php new file mode 100644 index 00000000..6caed124 --- /dev/null +++ b/application/views/awards/gridmaster/index.php @@ -0,0 +1,84 @@ + + + +
+ +
+ +

+ + session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ +
+ +
+
+
+
+
Latitude:
+
+
Longitude:
+
+
Gridsquare:
+
+
Distance:
+
+
Bearing:
+
+
+ diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index fcd2af2f..4bf71553 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -147,6 +147,8 @@ + + diff --git a/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js b/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js new file mode 100644 index 00000000..f805c3e0 --- /dev/null +++ b/assets/js/leaflet/L.MaidenheadColouredGridmasterMap.js @@ -0,0 +1,185 @@ +/* + * L.Maidenhead displays a Maidenhead Locator of lines on the map. + */ + +L.Maidenhead = L.LayerGroup.extend({ + + + options: { + // Line and label color + color: 'rgba(255, 0, 0, 0.4)', + + // Redraw on move or moveend + redraw: 'move' + }, + + initialize: function (options) { + L.LayerGroup.prototype.initialize.call(this); + L.Util.setOptions(this, options); + }, + + onAdd: function (map) { + this._map = map; + var grid = this.redraw(); + this._map.on('viewreset '+ this.options.redraw, function () { + grid.redraw(); + }); + + this.eachLayer(map.addLayer, map); + }, + + onRemove: function (map) { + // remove layer listeners and elements + map.off('viewreset '+ this.options.redraw, this.map); + this.eachLayer(this.removeLayer, this); + }, + + redraw: function () { + var d3 = new Array(20, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); + var lat_cor = new Array(0, 8, 8, 8, 2.5, 2.2, 6, 8, 8, 8, 8, 8, 8); // Used for gridsquare text offset + var bounds = map.getBounds(); + var zoom = map.getZoom(); + var unit = d3[zoom]; + var lcor = lat_cor[zoom]; + var w = bounds.getWest(); + var e = bounds.getEast(); + var n = bounds.getNorth(); + var s = bounds.getSouth(); + var c = 0.2; + if (n > 85) n = 85; + if (s < -85) s = -85; + var left = Math.floor(w/(unit*2))*(unit*2); + var right = Math.ceil(e/(unit*2))*(unit*2); + var top = Math.ceil(n/unit)*unit; + var bottom = Math.floor(s/unit)*unit; + this.eachLayer(this.removeLayer, this); + const grids_unworked = ['EN29', 'CN78', 'CN88', 'CN98', 'DN08', 'DN18', 'DN28', 'DN38', 'DN48', 'DN58', 'DN68', 'DN78', 'DN88', 'DN98', + 'EN08', 'EN18', 'EN28', 'EN38', 'EN48', 'EN58', 'CN77', 'CN87', 'CN97', 'DN07', 'DN17', 'DN27', 'DN37', 'DN47', 'DN57', 'DN67', + 'DN77', 'DN87', 'DN97', 'EN07', 'EN17', 'EN27', 'EN37', 'EN47', 'EN57', 'EN67', 'FN57', 'FN67', 'CN76', 'CN86', 'CN96', 'DN06', + 'DN16', 'DN26', 'DN36', 'DN46', 'DN56', 'DN66', 'DN76', 'DN86', 'DN96', 'EN06', 'EN16', 'EN26', 'EN36', 'EN46', 'EN56', 'EN66', + 'EN76', 'EN86', 'FN46', 'FN56', 'FN66', 'CN75', 'CN85', 'CN95', 'DN05', 'DN15', 'DN25', 'DN35', 'DN45', 'DN55', 'DN65', 'DN75', + 'DN85', 'DN95', 'EN05', 'EN15', 'EN25', 'EN35', 'EN45', 'EN55', 'EN65', 'EN75', 'EN85', 'FN25', 'FN35', 'FN45', 'FN55', 'FN65', + 'CN74', 'CN84', 'CN94', 'DN04', 'DN14', 'DN24', 'DN34', 'DN44', 'DN54', 'DN64', 'DN74', 'DN84', 'DN94', 'EN04', 'EN14', 'EN24', + 'EN34', 'EN44', 'EN54', 'EN64', 'EN74', 'EN84', 'FN14', 'FN24', 'FN34', 'FN44', 'FN54', 'FN64', 'CN73', 'CN83', 'CN93', 'DN03', + 'DN13', 'DN23', 'DN33', 'DN43', 'DN53', 'DN63', 'DN73', 'DN83', 'DN93', 'EN03', 'EN13', 'EN23', 'EN33', 'EN43', 'EN53', 'EN63', + 'EN73', 'EN83', 'FN03', 'FN13', 'FN23', 'FN33', 'FN43', 'FN53', 'CN72', 'CN82', 'CN92', 'DN02', 'DN12', 'DN22', 'DN32', 'DN42', + 'DN52', 'DN62', 'DN72', 'DN82', 'DN92', 'EN02', 'EN12', 'EN22', 'EN32', 'EN42', 'EN52', 'EN62', 'EN72', 'EN82', 'EN92', 'FN02', + 'FN12', 'FN22', 'FN32', 'FN42', 'CN71', 'CN81', 'CN91', 'DN01', 'DN11', 'DN21', 'DN31', 'DN41', 'DN51', 'DN61', 'DN71', 'DN81', + 'DN91', 'EN01', 'EN11', 'EN21', 'EN31', 'EN41', 'EN51', 'EN61', 'EN71', 'EN81', 'EN91', 'FN01', 'FN11', 'FN21', 'FN31', 'FN41', + 'FN51', 'CN70', 'CN80', 'CN90', 'DN00', 'DN10', 'DN20', 'DN30', 'DN40', 'DN50', 'DN60', 'DN70', 'DN80', 'DN90', 'EN00', 'EN10', + 'EN20', 'EN30', 'EN40', 'EN50', 'EN60', 'EN70', 'EN80', 'EN90', 'FN00', 'FN10', 'FN20', 'FN30', 'CM79', 'CM89', 'CM99', 'DM09', + 'DM19', 'DM29', 'DM39', 'DM49', 'DM59', 'DM69', 'DM79', 'DM89', 'DM99', 'EM09', 'EM19', 'EM29', 'EM39', 'EM49', 'EM59', 'EM69', + 'EM79', 'EM89', 'EM99', 'FM09', 'FM19', 'FM29', 'CM88', 'CM98', 'DM08', 'DM18', 'DM28', 'DM38', 'DM48', 'DM58', 'DM68', 'DM78', + 'DM88', 'DM98', 'EM08', 'EM18', 'EM28', 'EM38', 'EM48', 'EM58', 'EM68', 'EM78', 'EM88', 'EM98', 'FM08', 'FM18', 'FM28', 'CM87', + 'CM97', 'DM07', 'DM17', 'DM27', 'DM37', 'DM47', 'DM57', 'DM67', 'DM77', 'DM87', 'DM97', 'EM07', 'EM17', 'EM27', 'EM37', 'EM47', + 'EM57', 'EM67', 'EM77', 'EM87', 'EM97', 'FM07', 'FM17', 'FM27', 'CM86', 'CM96', 'DM06', 'DM16', 'DM26', 'DM36', 'DM46', 'DM56', + 'DM66', 'DM76', 'DM86', 'DM96', 'EM06', 'EM16', 'EM26', 'EM36', 'EM46', 'EM56', 'EM66', 'EM76', 'EM86', 'EM96', 'FM06', 'FM16', + 'FM26', 'CM95', 'DM05', 'DM15', 'DM25', 'DM35', 'DM45', 'DM55', 'DM65', 'DM75', 'DM85', 'DM95', 'EM05', 'EM15', 'EM25', 'EM35', + 'EM45', 'EM55', 'EM65', 'EM75', 'EM85', 'EM95', 'FM05', 'FM15', 'FM25', 'CM94', 'DM04', 'DM14', 'DM24', 'DM34', 'DM44', 'DM54', + 'DM64', 'DM74', 'DM84', 'DM94', 'EM04', 'EM14', 'EM24', 'EM34', 'EM44', 'EM54', 'EM64', 'EM74', 'EM84', 'EM94', 'FM04', 'FM14', + 'CM93', 'DM03', 'DM13', 'DM23', 'DM33', 'DM43', 'DM53', 'DM63', 'DM73', 'DM83', 'DM93', 'EM03', 'EM13', 'EM23', 'EM33', 'EM43', + 'EM53', 'EM63', 'EM73', 'EM83', 'EM93', 'FM03', 'FM13', 'DM02', 'DM12', 'DM22', 'DM32', 'DM42', 'DM52', 'DM62', 'DM72', 'DM82', + 'DM92', 'EM02', 'EM12', 'EM22', 'EM32', 'EM42', 'EM52', 'EM62', 'EM72', 'EM82', 'EM92', 'FM02', 'DM31', 'DM41', 'DM51', 'DM61', + 'DM71', 'DM81', 'DM91', 'EM01', 'EM11', 'EM21', 'EM31', 'EM41', 'EM51', 'EM61', 'EM71', 'EM81', 'EM91', 'DM70', 'DM80', 'DM90', + 'EM00', 'EM10', 'EM20', 'EM30', 'EM40', 'EM50', 'EM60', 'EM70', 'EM80', 'EM90', 'DL79', 'DL89', 'DL99', 'EL09', 'EL19', 'EL29', + 'EL39', 'EL49', 'EL59', 'EL79', 'EL89', 'EL99', 'DL88', 'DL98', 'EL08', 'EL18', 'EL28', 'EL58', 'EL88', 'EL98', 'EL07', 'EL17', + 'EL87', 'EL97', 'EL06', 'EL16', 'EL86', 'EL96', 'EL15', 'EL95', 'EL84', 'EL94' + ]; + + for (var lon = left; lon < right; lon += (unit*2)) { + if (lon > -180 || lon < 180) { + for (var lat = bottom; lat < top; lat += unit) { + var bounds = [[lat,lon],[lat+unit,lon+(unit*2)]]; + var locator = this._getLocator(lon,lat); + + if(grid_four.includes(locator)) { + + if(grid_four_lotw.includes(locator)) { + var rectConfirmed = L.rectangle(bounds, {className: 'grid-rectangle grid-confirmed', color: 'rgba(144,238,144, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false}); + this.addLayer(rectConfirmed); + } else if (grid_four_paper.includes(locator)) { + var rectPaper = L.rectangle(bounds, {className: 'grid-rectangle grid-confirmed', color: 'rgba(0,176,240, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false}); + this.addLayer(rectPaper); + } else { + var rectWorked = L.rectangle(bounds, {className: 'grid-rectangle grid-worked', color: 'rgba(255,215,87, 0.6)', weight: 1, fillOpacity: 1, fill:true, interactive: false}) + this.addLayer(rectWorked); + } + // Controls text on grid on various zoom levels + this.addLayer(this._getLabel(lon+unit-(unit/lcor),lat+(unit/2)+(unit/lcor*c))); + } else if (grids_unworked.includes(locator)) { + var rect = L.rectangle(bounds, {className: 'grid-rectangle grid-unworked', color: 'rgba(0,0,0, 0.3)', weight: 1, fillOpacity: 0.15, fill:true, interactive: false}) + this.addLayer(rect); + this.addLayer(this._getLabel(lon+unit-(unit/lcor),lat+(unit/2)+(unit/lcor*c))); + } + } + } + } + // Added this to print fields and field name, while still showing worked/confirmed gridsquares + unit = 10; + var left = Math.floor(w / (unit * 2)) * (unit * 2); + var right = Math.ceil(e / (unit * 2)) * (unit * 2); + var top = Math.ceil(n / unit) * unit; + var bottom = Math.floor(s / unit) * unit; + for (var lon = left; lon < right; lon += (unit * 2)) { + for (var lat = bottom; lat < top; lat += unit) { + var bounds = [[lat, lon], [lat + unit, lon + (unit * 2)]]; + + this.addLayer(L.rectangle(bounds, { + className: 'grid-rectangle', + color: this.options.color, + weight: 1, + fill: false, + interactive: false + })); + } + } + return this; + }, + + _getLabel: function(lon,lat) { + var title_size = new Array(0, 10, 14, 16, 8.5, 13, 14, 16, 24, 36, 36, 64, 128); // Controls text size on labels + var zoom = map.getZoom(); + var size = title_size[zoom]+'px'; + var title = ''; + var locator = this._getLocator(lon,lat); + title = '' + locator + ''; + var myIcon = L.divIcon({className: 'my-div-icon', html: title}); + var marker = L.marker([lat,lon], {icon: myIcon}, clickable=false); + if (typeof gridsquaremap !== 'undefined' && gridsquaremap == true) { + marker.on('click', function(event) { + spawnGridsquareModal(locator); + }); + } + return marker; + }, + + _getLocator: function(lon,lat) { + var ydiv_arr=new Array(10, 1, 1/24, 1/240, 1/240/24); + var d1 = "ABCDEFGHIJKLMNOPQR".split(""); + var d4 = new Array(0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5); + var locator = ""; + var x = lon; + var y = lat; + var precision = d4[map.getZoom()]; + while (x < -180) {x += 360;} + while (x > 180) {x -=360;} + x = x + 180; + y = y + 90; + locator = locator + d1[Math.floor(x/20)] + d1[Math.floor(y/10)]; + for (var i=0; i<4; i=i+1) { + if (precision > i+1) { + rlon = x%(ydiv_arr[i]*2); + rlat = y%(ydiv_arr[i]); + if ((i%2)==0) { + locator += Math.floor(rlon/(ydiv_arr[i+1]*2)) +""+ Math.floor(rlat/(ydiv_arr[i+1])); + } + } + } + return locator; + }, + +}); + +L.maidenhead = function (options) { + return new L.Maidenhead(options); +}; diff --git a/assets/js/sections/gridmaster.js b/assets/js/sections/gridmaster.js new file mode 100644 index 00000000..2df3f3ff --- /dev/null +++ b/assets/js/sections/gridmaster.js @@ -0,0 +1,138 @@ +var map; +var grid_four = ''; +var grid_four_lotw = ''; +var grid_four_paper = ''; + +function gridPlot(form) { + $(".ld-ext-right-plot").addClass('running'); + $(".ld-ext-right-plot").prop('disabled', true); + $('#plot').prop("disabled", true); + // If map is already initialized + var container = L.DomUtil.get('gridsquare_map'); + + if(container != null){ + container._leaflet_id = null; + container.remove(); + $("#gridmapcontainer").append('
'); + } + + ajax_url = site_url + '/awards/getGridmasterGridsjs'; + + $.ajax({ + url: ajax_url, + type: 'get', + success: function (data) { + $('.cohidden').show(); + $(".ld-ext-right-plot").removeClass('running'); + $(".ld-ext-right-plot").prop('disabled', false); + $('#plot').prop("disabled", false); + grid_four = data.grid_4char; + grid_four_lotw = data.grid_4char_lotw; + grid_four_paper = data.grid_4char_paper; + paper_count = 0; + grid_four_paper.forEach((element) => { + if (!grid_four_lotw.includes(element)) { + paper_count++; + } + }); + var layer = L.tileLayer(jslayer, { + maxZoom: 12, + attribution: jsattribution, + id: 'mapbox.streets' + }); + + map = L.map('gridsquare_map', { + layers: [layer], + center: [38, -91], + zoom: 5, + minZoom: 4, + maxZoom: 12, + fullscreenControl: true, + fullscreenControlOptions: { + position: 'topleft' + }, + }); + + var printer = L.easyPrint({ + tileLayer: layer, + sizeModes: ['Current'], + filename: 'myMap', + exportOnly: true, + hideControlContainer: true + }).addTo(map); + + /*Legend specific*/ + var legend = L.control({ position: "topright" }); + + legend.onAdd = function(map) { + var div = L.DomUtil.create("div", "legend"); + div.innerHTML += "

" + gridsquares_gridsquares + "

"; + div.innerHTML += '' + gridsquares_gridsquares_lotw + ' ('+grid_four_lotw.length+')
'; + div.innerHTML += '' + gridsquares_gridsquares_paper + ' ('+paper_count+')
'; + div.innerHTML += '' + gridsquares_gridsquares_worked + ' ('+(grid_four.length)+')
'; + return div; + }; + + legend.addTo(map); + + var maidenhead = L.maidenhead().addTo(map); + map.on('mousemove', onMapMove); + + }, + error: function (data) { + }, + }); +} + +function spawnGridsquareModal(loc_4char) { + var ajax_data = ({ + 'Searchphrase': loc_4char, + 'Band': 'SAT', + 'Type': 'VUCC' + }) + $.ajax({ + url: base_url + 'index.php/awards/qso_details_ajax', + type: 'post', + data: ajax_data, + success: function (html) { + BootstrapDialog.show({ + title: lang_general_word_qso_data, + cssClass: 'qso-dialog', + size: BootstrapDialog.SIZE_WIDE, + nl2br: false, + message: html, + onshown: function(dialog) { + + $('[data-toggle="tooltip"]').tooltip(); + $('.contacttable').DataTable({ + "pageLength": 25, + responsive: false, + ordering: false, + "scrollY": "550px", + "scrollCollapse": true, + "paging": false, + "scrollX": true, + dom: 'Bfrtip', + buttons: [ + 'csv' + ] + }); + // change color of csv-button if dark mode is chosen + if (isDarkModeTheme()) { + $(".buttons-csv").css("color", "white"); + } + }, + buttons: [{ + label: 'Close', + action: function(dialogItself) { + dialogItself.close(); + } + }] + }); + } + }); +} + +$(document).ready(function(){ + gridPlot(this.form); +})