mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
Pagination
This commit is contained in:
@@ -29,12 +29,31 @@ class eqsl extends CI_Controller {
|
||||
$folder_name = $this->eqsl_images->get_imagePath('p');
|
||||
$data['storage_used'] = $this->genfunctions->sizeFormat($this->genfunctions->folderSize($folder_name));
|
||||
|
||||
// Pagination
|
||||
$this->load->library('pagination');
|
||||
$config['base_url'] = base_url().'index.php/eqsl/index/';
|
||||
$config['total_rows'] = $this->eqsl_images->count_eqsl_qso_list();
|
||||
$config['per_page'] = '25';
|
||||
$config['num_links'] = 6;
|
||||
$config['full_tag_open'] = '';
|
||||
$config['full_tag_close'] = '';
|
||||
$config['cur_tag_open'] = '<strong class="active"><a href="">';
|
||||
$config['cur_tag_close'] = '</a></strong>';
|
||||
|
||||
$this->pagination->initialize($config);
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = __("eQSL Cards");
|
||||
|
||||
$offset = $this->uri->segment(3) ? $this->uri->segment(3) : 0;
|
||||
$data['qslarray'] = $this->eqsl_images->eqsl_qso_list($config['per_page'], $offset);
|
||||
|
||||
$data['qslarray'] = $this->eqsl_images->eqsl_qso_list();
|
||||
// Calculate result range for display
|
||||
$total_rows = $config['total_rows'];
|
||||
$per_page = $config['per_page'];
|
||||
$start = $total_rows > 0 ? $offset + 1 : 0;
|
||||
$end = min($offset + $per_page, $total_rows);
|
||||
$data['result_range'] = sprintf(__("Showing %d to %d of %d entries"), $start, $end, $total_rows);
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('eqslcard/index');
|
||||
|
||||
@@ -41,7 +41,16 @@ class Eqsl_images extends CI_Model {
|
||||
$this->db->insert('eQSL_images', $data);
|
||||
}
|
||||
|
||||
function eqsl_qso_list() {
|
||||
function count_eqsl_qso_list() {
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
$this->db->join($this->config->item('table_name'), 'qso_id = COL_PRIMARY_KEY', 'left outer');
|
||||
$this->db->join('station_profile', $this->config->item('table_name').'.station_id = station_profile.station_id', 'left outer');
|
||||
$this->db->where_in('station_profile.station_id', $logbooks_locations_array);
|
||||
return $this->db->count_all_results('eQSL_images');
|
||||
}
|
||||
|
||||
function eqsl_qso_list($limit = null, $offset = null) {
|
||||
$this->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
$this->db->select('COL_PRIMARY_KEY, qso_id, COL_CALL, COL_MODE, COL_SUBMODE, COL_TIME_ON, COL_BAND, COL_PROP_MODE, COL_SAT_NAME, COL_QSLMSG_RCVD, COL_EQSL_QSLRDATE, image_file');
|
||||
@@ -49,6 +58,9 @@ class Eqsl_images extends CI_Model {
|
||||
$this->db->join('station_profile', $this->config->item('table_name').'.station_id = station_profile.station_id', 'left outer');
|
||||
$this->db->where_in('station_profile.station_id', $logbooks_locations_array);
|
||||
$this->db->order_by('COL_TIME_ON', 'DESC');
|
||||
if ($limit !== null && $offset !== null) {
|
||||
$this->db->limit($limit, $offset);
|
||||
}
|
||||
return $this->db->get('eQSL_images');
|
||||
}
|
||||
|
||||
|
||||
@@ -69,4 +69,36 @@
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (isset($this->pagination)){ ?>
|
||||
<div class="d-flex justify-content-between align-items-center mt-3">
|
||||
<?php
|
||||
$config['full_tag_open'] = '<ul class="pagination">';
|
||||
$config['full_tag_close'] = '</ul>';
|
||||
$config['attributes'] = ['class' => 'page-link'];
|
||||
$config['first_link'] = false;
|
||||
$config['last_link'] = false;
|
||||
$config['first_tag_open'] = '<li class="page-item">';
|
||||
$config['first_tag_close'] = '</li>';
|
||||
$config['prev_link'] = '«';
|
||||
$config['prev_tag_open'] = '<li class="page-item">';
|
||||
$config['prev_tag_close'] = '</li>';
|
||||
$config['next_link'] = '»';
|
||||
$config['next_tag_open'] = '<li class="page-item">';
|
||||
$config['next_tag_close'] = '</li>';
|
||||
$config['last_tag_open'] = '<li class="page-item">';
|
||||
$config['last_tag_close'] = '</li>';
|
||||
$config['cur_tag_open'] = '<li class="page-item active"><a href="#" class="page-link">';
|
||||
$config['cur_tag_close'] = '<span class="visually-hidden">(current)</span></a></li>';
|
||||
$config['num_tag_open'] = '<li class="page-item">';
|
||||
$config['num_tag_close'] = '</li>';
|
||||
$this->pagination->initialize($config);
|
||||
?>
|
||||
|
||||
<?php echo $this->pagination->create_links(); ?>
|
||||
<?php if (isset($result_range)){ ?>
|
||||
<span><?= $result_range; ?></span>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -2434,10 +2434,13 @@ $('#sats').change(function(){
|
||||
</script>
|
||||
<?php if ($this->uri->segment(1) == "qsl") {
|
||||
$qsl_eqsl_table = '.qsltable';
|
||||
$qsl_eqsl_info = 'true';
|
||||
} else if ($this->uri->segment(1) == "generic_qsl") {
|
||||
$qsl_eqsl_table = '.qsltable';
|
||||
$qsl_eqsl_info = 'true';
|
||||
} else if ($this->uri->segment(1) == "eqsl") {
|
||||
$qsl_eqsl_table = '.eqsltable';
|
||||
$qsl_eqsl_info = 'false'; // Server-side pagination, hide DataTables info
|
||||
} ?>
|
||||
<script>
|
||||
$('<?php echo $qsl_eqsl_table ?>').DataTable({
|
||||
@@ -2452,6 +2455,7 @@ $('#sats').change(function(){
|
||||
url: getDataTablesLanguageUrl(),
|
||||
},
|
||||
"order": [ 2, 'desc' ],
|
||||
"info": <?php echo $qsl_eqsl_info; ?>,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user