diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index 92fe41d3..815db34d 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -75,6 +75,37 @@ class Visitor extends CI_Controller { $this->load->model('logbook_model'); + // load config and init pagination + $this->load->library('pagination'); + + //Pagination config + $config['base_url'] = base_url().'index.php/visitor/'. $public_slug . '/index'; + $config['total_rows'] = $this->logbook_model->total_qsos($logbooks_locations_array); + $config['per_page'] = '25'; + $config['num_links'] = $this->logbook_model->total_qsos($logbooks_locations_array) / 25; + $config['full_tag_open'] = ''; + $config['attributes'] = ['class' => 'page-link']; + $config['first_link'] = false; + $config['last_link'] = false; + $config['first_tag_open'] = '
  • '; + $config['first_tag_close'] = '
  • '; + $config['prev_link'] = '«'; + $config['prev_tag_open'] = '
  • '; + $config['prev_tag_close'] = '
  • '; + $config['next_link'] = '»'; + $config['next_tag_open'] = '
  • '; + $config['next_tag_close'] = '
  • '; + $config['last_tag_open'] = '
  • '; + $config['last_tag_close'] = '
  • '; + $config['cur_tag_open'] = '
  • '; + $config['cur_tag_close'] = '(current)
  • '; + $config['num_tag_open'] = '
  • '; + $config['num_tag_close'] = '
  • '; + + $this->pagination->initialize($config); + + // Public visitor so no QRA to setup $data['qra'] = "none"; @@ -107,8 +138,9 @@ class Visitor extends CI_Controller { $data['total_lotw_sent'] = $QSLStatsBreakdownArray['LoTW_Sent']; $data['total_lotw_rcvd'] = $QSLStatsBreakdownArray['LoTW_Received']; - - $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array); + + // Show paginated results + $data['results'] = $this->logbook_model->get_qsos($config['per_page'], $this->uri->segment(4), $logbooks_locations_array); $data['page_title'] = "Dashboard"; $data['slug'] = $public_slug; diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index 898e9fcd..9edffdc1 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -80,12 +80,11 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { 0) { - foreach ($last_five_qsos->result() as $row) { ?> + if(!empty($results)) { + foreach ($results->result() as $row) { ?> '; ?> session->userdata('user_date_format')) { // If Logged in and session exists @@ -114,6 +113,9 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) { +