diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 432bd82e..072abac3 100755 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -27,9 +27,11 @@ class Logbook extends CI_Controller { } } + $this->load->model('logbook_model'); + $this->load->library('pagination'); $config['base_url'] = base_url().'index.php/logbook/index/'; - $config['total_rows'] = $this->db->count_all($this->config->item('table_name')); + $config['total_rows'] = $this->logbook_model->total_qsos(); $config['per_page'] = '25'; $config['num_links'] = 6; $config['full_tag_open'] = ''; @@ -40,7 +42,6 @@ class Logbook extends CI_Controller { $this->pagination->initialize($config); //load the model and get results - $this->load->model('logbook_model'); $data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3)); // Calculate Lat/Lng from Locator to use on Maps diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 2ac6f8d7..105506dd 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -822,10 +822,15 @@ class Logbook_model extends CI_Model { } function get_qsos($num, $offset) { + $CI =& get_instance(); + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + //$this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_NAME, '.$this->config->item('table_name').'.COL_COUNTRY, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); $this->db->from($this->config->item('table_name')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->where_in('station_profile.station_id', $logbooks_locations_array); $this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc"); $this->db->limit($num);