config->item('table_name') .' WHERE station_id in ('.$location_list.')' ." and COL_LOTW_QSL_RCVD = 'Y'" ." and COL_BAND = '6M'" .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; return $this->db->query($sql); } function get_paper($location_list) { $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_BAND = '6M'" .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; return $this->db->query($sql); } function get_worked($location_list) { $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_BAND = '6M'" .' AND substring(COL_GRIDSQUARE,1,4) in (\''.implode('\',\'', $this->us_grids).'\')'; return $this->db->query($sql); } function get_vucc_lotw($location_list) { $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_BAND = '6M'"; $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($location_list) { $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_BAND = '6M'"; $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($location_list) { $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_BAND = '6M'"; $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_grid_count() { return count($this->us_grids); } function get_grids() { return $this->us_grids; } }