diff --git a/application/controllers/Distancerecords.php b/application/controllers/Distancerecords.php index 170d8f59b..54711d2dc 100644 --- a/application/controllers/Distancerecords.php +++ b/application/controllers/Distancerecords.php @@ -50,11 +50,11 @@ class Distancerecords extends CI_Controller { } public function sat_records_ajax() { - $this->load->model('logbook_model'); + $this->load->model('distancerecords_model'); $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); - $data['results'] = $this->logbook_model->sat_distances($sat); + $data['results'] = $this->distancerecords_model->sat_distances($sat); $data['page_title'] = __("Log View")." - " . __("Satellite Distance Records"); $data['filter'] = $sat; diff --git a/application/models/Distancerecords_model.php b/application/models/Distancerecords_model.php index 5d8fe4466..4b6bde127 100644 --- a/application/models/Distancerecords_model.php +++ b/application/models/Distancerecords_model.php @@ -74,6 +74,19 @@ class Distancerecords_model extends CI_Model { } return($result); } + + public function sat_distances($sat){ + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->where('COL_SAT_NAME', $sat); + $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); + $this->db->order_by("COL_DISTANCE", "desc"); + $this->db->limit(500); + + return $this->db->get($this->config->item('table_name')); + } + } ?> diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 8f92059a4..b0fd9d5cf 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -419,17 +419,6 @@ class Logbook_model extends CI_Model { return($row); } } - public function sat_distances($sat){ - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->where('COL_SAT_NAME', $sat); - $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); - $this->db->order_by("COL_DISTANCE", "desc"); - $this->db->limit(500); - - return $this->db->get($this->config->item('table_name')); - } /* * Used to fetch QSOs from the logbook in the awards @@ -623,7 +612,7 @@ class Logbook_model extends CI_Model { return $this->db->get($this->config->item('table_name')); } - + public function vucc_qso_details($gridsquare, $band) { $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -3402,7 +3391,7 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = $this->db->where('COL_STATION_CALLSIGN', $station_callsign); $this->db->where('COL_PRIMARY_KEY', $qsoid); - + $this->db->update($this->config->item('table_name'), $data); unset($data);