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->{$dxcc.'_grids'}).'\')'; return $this->db->query($sql); } function get_paper($dxcc) { $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->{$dxcc.'_grids'}).'\')'; return $this->db->query($sql); } function get_worked($dxcc) { $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->{$dxcc.'_grids'}).'\')'; return $this->db->query($sql); } function get_vucc_lotw($dxcc) { $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->{$dxcc.'_grids'})) { if (!in_array(substr($grid, 0, 4), $vucc_grids)) { $vucc_grids[] = substr($grid, 0, 4); } } } } return $vucc_grids; } function get_vucc_paper($dxcc) { $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->{$dxcc.'_grids'})) { if (!in_array(substr($grid, 0, 4), $vucc_grids)) { $vucc_grids[] = substr($grid, 0, 4); } } } } return $vucc_grids; } function get_vucc_worked($dxcc) { $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->{$dxcc.'_grids'})) { if (!in_array(substr($grid, 0, 4), $vucc_grids)) { $vucc_grids[] = substr($grid, 0, 4); } } } } return $vucc_grids; } function get_grid_count($dxcc) { return count($this->{$dxcc.'_grids'}); } function get_grids($dxcc) { return $this->{$dxcc.'_grids'}; } function get_lat($dxcc) { return $this->{$dxcc.'_lat'}; } function get_lon($dxcc) { return $this->{$dxcc.'_lon'}; } function get_zoom($dxcc) { return $this->{$dxcc.'_zoom'}; } }