[ticket/11849] Update more MCP calls to pagination class

PHPBB3-11849
This commit is contained in:
Joas Schilling 2013-12-18 00:33:01 +01:00
parent 8652589469
commit edd183b53a
5 changed files with 17 additions and 17 deletions

View file

@ -39,6 +39,7 @@ class mcp_pm_reports
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
$start = request_var('start', 0);
$pagination = $phpbb_container->get('pagination');
$this->page_title = 'MCP_PM_REPORTS';
@ -297,7 +298,7 @@ class mcp_pm_reports
}
$base_url = $this->u_action . "&st=$sort_days&sk=$sort_key&sd=$sort_dir";
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
// Now display the page
$template->assign_vars(array(
@ -308,7 +309,7 @@ class mcp_pm_reports
'S_MCP_ACTION' => $this->u_action,
'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false,
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
'TOTAL' => $total,
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
)

View file

@ -337,6 +337,7 @@ class mcp_queue
$topic_id = $request->variable('t', 0);
$forum_info = array();
$pagination = $phpbb_container->get('pagination');
if ($topic_id)
{
@ -532,7 +533,7 @@ class mcp_queue
unset($rowset, $forum_names);
$base_url = $this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir";
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
// Now display the page
$template->assign_vars(array(
@ -546,7 +547,7 @@ class mcp_queue
'S_TOPICS' => $is_topics,
'S_RESTORE' => $is_restore,
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
));

View file

@ -315,6 +315,7 @@ class mcp_reports
$forum_list[] = 0;
$forum_data = array();
$pagination = $phpbb_container->get('pagination');
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
foreach ($forum_list_reports as $row)
@ -410,7 +411,7 @@ class mcp_reports
}
$base_url = $this->u_action . "&amp;f=$forum_id&amp;t=$topic_id&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir";
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
// Now display the page
$template->assign_vars(array(
@ -422,7 +423,7 @@ class mcp_reports
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),

View file

@ -26,6 +26,7 @@ function mcp_topic_view($id, $mode, $action)
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
$user->add_lang('viewtopic');
$pagination = $phpbb_container->get('pagination');
$topic_id = request_var('t', 0);
$topic_info = get_topic_data(array($topic_id), false, true);
@ -129,12 +130,7 @@ function mcp_topic_view($id, $mode, $action)
{
$start = 0;
}
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start >= $total)
{
$start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
}
$start = $pagination->validate_start($start, $posts_per_page, $total);
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
@ -304,7 +300,7 @@ function mcp_topic_view($id, $mode, $action)
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;t={$topic_info['topic_id']}&amp;mode=$mode&amp;action=$action&amp;to_topic_id=$to_topic_id&amp;posts_per_page=$posts_per_page&amp;st=$sort_days&amp;sk=$sort_key&amp;sd=$sort_dir");
if ($posts_per_page)
{
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start);
}
$template->assign_vars(array(
@ -347,7 +343,7 @@ function mcp_topic_view($id, $mode, $action)
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&amp;t={$topic_info['topic_id']}&amp;start=$start") . '">', '</a>'),
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&amp;start=$start") . '">', '</a>'),
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $posts_per_page, $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $posts_per_page, $start),
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),
));
}

View file

@ -134,10 +134,11 @@ class mcp_warn
*/
function mcp_warn_list_view($action)
{
global $phpEx, $phpbb_root_path, $config;
global $phpEx, $phpbb_root_path, $config, $phpbb_container;
global $template, $db, $user, $auth;
$user->add_lang('memberlist');
$pagination = $phpbb_container->get('pagination');
$start = request_var('start', 0);
$st = request_var('st', 0);
@ -176,7 +177,7 @@ class mcp_warn
}
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&amp;mode=list&amp;st=$st&amp;sk=$sk&amp;sd=$sd");
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start);
$template->assign_vars(array(
'U_POST_ACTION' => $this->u_action,
@ -185,7 +186,7 @@ class mcp_warn
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $user_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => $pagination->on_page($base_url, $user_count, $config['topics_per_page'], $start),
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count),
));
}