diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index fa707115..f3ca0e4b 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -664,110 +664,6 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer',$footerData); } - public function ja_gridmaster() { - $data['page_title']= lang('menu_ja_gridmaster'); - - $this->load->model('bands'); - $this->load->model('ja_gridmaster_model'); - $this->load->model('stations'); - - $data['homegrid']= explode(',', $this->stations->find_gridsquare()); - - $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.MaidenheadColouredJaGridmasterMap.js', - 'assets/js/sections/ja_gridmaster.js?' - ]; - - $this->load->view('interface_assets/header',$data); - $this->load->view('awards/ja_gridmaster/index'); - $this->load->view('interface_assets/footer',$footerData); - } - - public function getJaGridmasterGridsjs() { - $this->load->model('ja_gridmaster_model'); - - $array_grid_4char = array(); - $array_grid_4char_lotw = array(); - $array_grid_4char_paper = array(); - - $grid_4char = ""; - $grid_4char_lotw = ""; - - $query = $this->ja_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->ja_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->ja_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->ja_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->ja_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->ja_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); - $data['grid_count'] = $this->ja_gridmaster_model->get_grid_count(); - $data['grids'] = $this->ja_gridmaster_model->get_grids(); - - header('Content-Type: application/json'); - echo json_encode($data); - } - public function getFfmaGridsjs() { $this->load->model('ffma_model'); diff --git a/application/models/Ja_gridmaster_model.php b/application/models/Ja_gridmaster_model.php deleted file mode 100644 index 5f98535e..00000000 --- a/application/models/Ja_gridmaster_model.php +++ /dev/null @@ -1,172 +0,0 @@ -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->ja_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->ja_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->ja_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->ja_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->ja_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->ja_grids)) { - if (!in_array(substr($grid, 0, 4), $vucc_grids)) { - $vucc_grids[] = substr($grid, 0, 4); - } - } - } - } - return $vucc_grids; - } - - function get_grid_count() { - return count($this->ja_grids); - } - - function get_grids() { - return $this->ja_grids; - } - -} diff --git a/application/views/awards/ja_gridmaster/index.php b/application/views/awards/ja_gridmaster/index.php deleted file mode 100644 index 9568b622..00000000 --- a/application/views/awards/ja_gridmaster/index.php +++ /dev/null @@ -1,97 +0,0 @@ - - - -
| ' + gridsquares_gridsquares_lotw + ': | '+grid_four_lotw.length+' / '+grid_max+' |
| ' + gridsquares_gridsquares_paper + ': | '+paper_count+' / '+grid_max+' |
| ' + gridsquares_gridsquares_worked + ' ('+(Math.round((grid_four.length / grid_max) * 10000) / 100)+'%): | '+(grid_four.length)+' / '+grid_max+' |