mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-04 17:18:52 +00:00
[ticket/11849] Update some ACP modules with new pagination
PHPBB3-11849
This commit is contained in:
parent
e4950ced92
commit
8652589469
3 changed files with 16 additions and 20 deletions
|
@ -25,7 +25,7 @@ class acp_attachments
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache;
|
global $db, $user, $auth, $template, $cache, $phpbb_container;
|
||||||
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
|
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
|
||||||
|
@ -1166,10 +1166,9 @@ class acp_attachments
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure $start is set to the last page if it exceeds the amount
|
// Make sure $start is set to the last page if it exceeds the amount
|
||||||
if ($start < 0 || $start > $num_files)
|
|
||||||
{
|
$pagination = $phpbb_container->get('pagination');
|
||||||
$start = ($start < 0) ? 0 : floor(($num_files - 1) / $attachments_per_page) * $attachments_per_page;
|
$start = $pagination->validate_start($start, $attachments_per_page, $num_files);
|
||||||
}
|
|
||||||
|
|
||||||
// If the user is trying to reach the second half of the attachments list, fetch it starting from the end
|
// If the user is trying to reach the second half of the attachments list, fetch it starting from the end
|
||||||
$store_reverse = false;
|
$store_reverse = false;
|
||||||
|
@ -1179,15 +1178,11 @@ class acp_attachments
|
||||||
{
|
{
|
||||||
$store_reverse = true;
|
$store_reverse = true;
|
||||||
|
|
||||||
if ($start + $attachments_per_page > $num_files)
|
|
||||||
{
|
|
||||||
$sql_limit = min($attachments_per_page, max(1, $num_files - $start));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select the sort order. Add time sort anchor for non-time sorting cases
|
// Select the sort order. Add time sort anchor for non-time sorting cases
|
||||||
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : '';
|
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : '';
|
||||||
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor;
|
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor;
|
||||||
$sql_start = max(0, $num_files - $sql_limit - $start);
|
$sql_limit = $pagination->reverse_limit($start, $sql_limit, $num_files);
|
||||||
|
$sql_start = $pagination->reverse_start($start, $sql_limit, $num_files);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1195,7 +1190,6 @@ class acp_attachments
|
||||||
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : '';
|
$sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : '';
|
||||||
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor;
|
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor;
|
||||||
$sql_start = $start;
|
$sql_start = $start;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$attachments_list = array();
|
$attachments_list = array();
|
||||||
|
@ -1222,13 +1216,13 @@ class acp_attachments
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$base_url = $this->u_action . "&$u_sort_param";
|
$base_url = $this->u_action . "&$u_sort_param";
|
||||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'TOTAL_FILES' => $num_files,
|
'TOTAL_FILES' => $num_files,
|
||||||
'TOTAL_SIZE' => get_formatted_filesize($total_size),
|
'TOTAL_SIZE' => get_formatted_filesize($total_size),
|
||||||
|
|
||||||
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $num_files, $attachments_per_page, $start),
|
'S_ON_PAGE' => $pagination->on_page($base_url, $num_files, $attachments_per_page, $start),
|
||||||
'S_LIMIT_DAYS' => $s_limit_days,
|
'S_LIMIT_DAYS' => $s_limit_days,
|
||||||
'S_SORT_KEY' => $s_sort_key,
|
'S_SORT_KEY' => $s_sort_key,
|
||||||
'S_SORT_DIR' => $s_sort_dir)
|
'S_SORT_DIR' => $s_sort_dir)
|
||||||
|
|
|
@ -30,7 +30,7 @@ class acp_inactive
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template;
|
global $config, $db, $user, $auth, $template, $phpbb_container;
|
||||||
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
|
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||||
|
@ -49,6 +49,7 @@ class acp_inactive
|
||||||
|
|
||||||
$form_key = 'acp_inactive';
|
$form_key = 'acp_inactive';
|
||||||
add_form_key($form_key);
|
add_form_key($form_key);
|
||||||
|
$pagination = $phpbb_container->get('pagination');
|
||||||
|
|
||||||
// We build the sort key and per page settings here, because they may be needed later
|
// We build the sort key and per page settings here, because they may be needed later
|
||||||
|
|
||||||
|
@ -285,7 +286,7 @@ class acp_inactive
|
||||||
}
|
}
|
||||||
|
|
||||||
$base_url = $this->u_action . "&$u_sort_param&users_per_page=$per_page";
|
$base_url = $this->u_action . "&$u_sort_param&users_per_page=$per_page";
|
||||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_INACTIVE_USERS' => true,
|
'S_INACTIVE_USERS' => true,
|
||||||
|
@ -294,7 +295,7 @@ class acp_inactive
|
||||||
'S_LIMIT_DAYS' => $s_limit_days,
|
'S_LIMIT_DAYS' => $s_limit_days,
|
||||||
'S_SORT_KEY' => $s_sort_key,
|
'S_SORT_KEY' => $s_sort_key,
|
||||||
'S_SORT_DIR' => $s_sort_dir,
|
'S_SORT_DIR' => $s_sort_dir,
|
||||||
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $inactive_count, $per_page, $start),
|
'S_ON_PAGE' => $pagination->on_page($base_url, $inactive_count, $per_page, $start),
|
||||||
'USERS_PER_PAGE' => $per_page,
|
'USERS_PER_PAGE' => $per_page,
|
||||||
|
|
||||||
'U_ACTION' => $this->u_action . "&$u_sort_param&users_per_page=$per_page&start=$start",
|
'U_ACTION' => $this->u_action . "&$u_sort_param&users_per_page=$per_page&start=$start",
|
||||||
|
|
|
@ -24,7 +24,7 @@ class acp_logs
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache;
|
global $db, $user, $auth, $template, $cache, $phpbb_container;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
global $request;
|
global $request;
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ class acp_logs
|
||||||
|
|
||||||
$this->tpl_name = 'acp_logs';
|
$this->tpl_name = 'acp_logs';
|
||||||
$this->log_type = constant('LOG_' . strtoupper($mode));
|
$this->log_type = constant('LOG_' . strtoupper($mode));
|
||||||
|
$pagination = $phpbb_container->get('pagination');
|
||||||
|
|
||||||
// Delete entries if requested and able
|
// Delete entries if requested and able
|
||||||
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
|
if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
|
||||||
|
@ -130,14 +131,14 @@ class acp_logs
|
||||||
$start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
|
$start = view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
|
||||||
|
|
||||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'L_TITLE' => $l_title,
|
'L_TITLE' => $l_title,
|
||||||
'L_EXPLAIN' => $l_title_explain,
|
'L_EXPLAIN' => $l_title_explain,
|
||||||
'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start",
|
'U_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start",
|
||||||
|
|
||||||
'S_ON_PAGE' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start),
|
'S_ON_PAGE' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
|
||||||
|
|
||||||
'S_LIMIT_DAYS' => $s_limit_days,
|
'S_LIMIT_DAYS' => $s_limit_days,
|
||||||
'S_SORT_KEY' => $s_sort_key,
|
'S_SORT_KEY' => $s_sort_key,
|
||||||
|
|
Loading…
Add table
Reference in a new issue