mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/pagination-as-list] New parameter for name of start var
Add a new parameter to hold the name of the start variable. This fulfills ticket PHPBB3-8535. PHPBB3-10968
This commit is contained in:
parent
27d8aef528
commit
584d49459d
24 changed files with 32 additions and 31 deletions
|
@ -1223,7 +1223,7 @@ class acp_attachments
|
|||
$db->sql_freeresult($result);
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $num_files, $attachments_per_page, $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'TOTAL_FILES' => $num_files,
|
||||
|
|
|
@ -683,7 +683,7 @@ class acp_groups
|
|||
}
|
||||
|
||||
$base_url = $this->u_action . "&action=$action&g=$group_id";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_members, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_LIST' => true,
|
||||
|
|
|
@ -928,7 +928,7 @@ class acp_icons
|
|||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', $item_count, $config['smilies_per_page'], $pagination_start);
|
||||
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $item_count, $config['smilies_per_page'], $pagination_start);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -289,7 +289,7 @@ class acp_inactive
|
|||
}
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param&users_per_page=$per_page";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $inactive_count, $per_page, $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_INACTIVE_USERS' => true,
|
||||
|
|
|
@ -130,7 +130,7 @@ 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);
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'L_TITLE' => $l_title,
|
||||
|
|
|
@ -1121,7 +1121,7 @@ class acp_users
|
|||
$start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort);
|
||||
|
||||
$base_url = $this->u_action . "&u=$user_id&$u_sort_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_FEEDBACK' => true,
|
||||
|
@ -2038,7 +2038,7 @@ class acp_users
|
|||
$db->sql_freeresult($result);
|
||||
|
||||
$base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_ATTACHMENTS' => true,
|
||||
|
|
|
@ -1887,6 +1887,7 @@ function tracking_unserialize($string, $max_depth = 3)
|
|||
* @param object $template the template object
|
||||
* @param string $base_url is url prepended to all links generated within the function
|
||||
* @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->)
|
||||
* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20)
|
||||
* @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce
|
||||
* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
|
||||
* @param int $start_item the item which should be considered currently active, used to determine the page we're on
|
||||
|
@ -1894,7 +1895,7 @@ function tracking_unserialize($string, $max_depth = 3)
|
|||
* @param bool $ignore_on_page decides whether we enable an active (unlinked) item, used primarily for embedded lists
|
||||
* @return null
|
||||
*/
|
||||
function phpbb_generate_template_pagination($template, $base_url, $block_var_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false)
|
||||
function phpbb_generate_template_pagination($template, $base_url, $block_var_name, $start_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false)
|
||||
{
|
||||
// Make sure $per_page is a valid value
|
||||
$per_page = ($per_page <= 0) ? 1 : $per_page;
|
||||
|
@ -1938,7 +1939,7 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
|
|||
{
|
||||
$template->assign_block_vars($block_var_name, array(
|
||||
'PAGE_NUMBER' => '',
|
||||
'PAGE_URL' => $base_url . "{$url_delim}start=" . ($on_page * $per_page),
|
||||
'PAGE_URL' => $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page),
|
||||
'S_IS_CURRENT' => false,
|
||||
'S_IS_PREV' => false,
|
||||
'S_IS_NEXT' => true,
|
||||
|
@ -1952,7 +1953,7 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
|
|||
$at_page = 1;
|
||||
do
|
||||
{
|
||||
$page_url = $base_url . (($at_page == 1) ? '' : $url_delim . 'start=' . (($at_page - 1) * $per_page));
|
||||
$page_url = $base_url . (($at_page == 1) ? '' : $url_delim . $start_name . '=' . (($at_page - 1) * $per_page));
|
||||
|
||||
// We decide whether to display the ellipsis during the loop. The ellipsis is always
|
||||
// displayed as either the second or penultimate item in the list. So are we at either
|
||||
|
@ -1992,7 +1993,7 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
|
|||
{
|
||||
$template->assign_block_vars($block_var_name, array(
|
||||
'PAGE_NUMBER' => '',
|
||||
'PAGE_URL' => $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page),
|
||||
'PAGE_URL' => $base_url . $url_delim . $start_name . '=' . (($on_page - 2) * $per_page),
|
||||
'S_IS_CURRENT' => false,
|
||||
'S_IS_PREV' => true,
|
||||
'S_IS_NEXT' => false,
|
||||
|
|
|
@ -102,7 +102,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
|||
$limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
|
||||
$base_url = $url . "&i=$id&action=$action&mode=$mode&sd=$sort_dir&sk=$sort_key&st=$sort_days" . (($merge_select) ? $selected_ids : '');
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $forum_topics, $topics_per_page, $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $forum_topics, $topics_per_page, $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'ACTION' => $action,
|
||||
|
|
|
@ -172,7 +172,7 @@ class mcp_logs
|
|||
$start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords);
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $log_count, $config['topics_per_page'], $start),
|
||||
|
|
|
@ -216,7 +216,7 @@ class mcp_notes
|
|||
}
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param$keywords_param";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => $this->u_action,
|
||||
|
|
|
@ -299,7 +299,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', $total, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
|
|
|
@ -420,7 +420,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', $total, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
|
|
|
@ -412,7 +412,7 @@ class mcp_reports
|
|||
}
|
||||
|
||||
$base_url = $this->u_action . "&f=$forum_id&t=$topic_id&st=$sort_days&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $total, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start);
|
||||
|
||||
// Now display the page
|
||||
$template->assign_vars(array(
|
||||
|
|
|
@ -309,7 +309,7 @@ function mcp_topic_view($id, $mode, $action)
|
|||
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir");
|
||||
if ($posts_per_page)
|
||||
{
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $total, $posts_per_page, $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $posts_per_page, $start);
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
|
|
|
@ -176,7 +176,7 @@ class mcp_warn
|
|||
}
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd");
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $user_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'U_POST_ACTION' => $this->u_action,
|
||||
|
|
|
@ -171,7 +171,7 @@ class ucp_attachments
|
|||
$db->sql_freeresult($result);
|
||||
|
||||
$base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $num_attachments, $config['topics_per_page'], $start),
|
||||
|
|
|
@ -845,7 +845,7 @@ class ucp_groups
|
|||
}
|
||||
|
||||
$base_url = $this->u_action . "&action=$action&g=$group_id";
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_members, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_LIST' => true,
|
||||
|
|
|
@ -670,7 +670,7 @@ class ucp_main
|
|||
|
||||
if ($topics_count)
|
||||
{
|
||||
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', $topics_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $this->u_action, $topics_count, $config['topics_per_page'], $start),
|
||||
|
@ -838,7 +838,7 @@ class ucp_main
|
|||
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
|
||||
));
|
||||
|
||||
phpbb_generate_template_pagination($template, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&t=$topic_id"), 'topicrow.pagination', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
phpbb_generate_template_pagination($template, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -452,7 +452,7 @@ function get_pm_from($folder_id, $folder, $user_id)
|
|||
}
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param");
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $pm_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $pm_count, $config['topics_per_page'], $start),
|
||||
|
|
|
@ -1572,7 +1572,7 @@ switch ($mode)
|
|||
}
|
||||
}
|
||||
|
||||
phpbb_generate_template_pagination($template, $pagination_url, 'pagination', $total_users, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $pagination_url, 'pagination', 'start', $total_users, $config['topics_per_page'], $start);
|
||||
|
||||
// Generate page
|
||||
$template->assign_vars(array(
|
||||
|
|
|
@ -603,7 +603,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
$phrase_search_disabled = $search->supports_phrase_search() ? false : true;
|
||||
}
|
||||
|
||||
phpbb_generate_template_pagination($template, $u_search, 'pagination', $total_match_count, $per_page, $start);
|
||||
phpbb_generate_template_pagination($template, $u_search, 'pagination', 'start', $total_match_count, $per_page, $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'SEARCH_TITLE' => $l_search_title,
|
||||
|
@ -1006,7 +1006,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
|
||||
if ($show_results == 'topics')
|
||||
{
|
||||
phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ if ($s_display_active)
|
|||
$total_topic_count = $topics_count - sizeof($global_announce_forums);
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''));
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $topics_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $topics_count, $config['topics_per_page'], $start),
|
||||
|
@ -745,7 +745,7 @@ if (sizeof($topic_list))
|
|||
'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
|
||||
);
|
||||
|
||||
phpbb_generate_template_pagination($template, $view_topic_url, 'topicrow.pagination', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
phpbb_generate_template_pagination($template, $view_topic_url, 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
|
||||
$s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ $db->sql_freeresult($result);
|
|||
meta_refresh(60, append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir&start=$start"));
|
||||
|
||||
$base_url = append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir");
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $counter, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $counter, $config['topics_per_page'], $start);
|
||||
|
||||
// Send data to template
|
||||
$template->assign_vars(array(
|
||||
|
|
|
@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL))
|
|||
|
||||
// If we've got a hightlight set pass it on to pagination.
|
||||
$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : ''));
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_posts, $config['posts_per_page'], $start);
|
||||
phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start);
|
||||
|
||||
// Send vars to template
|
||||
$template->assign_vars(array(
|
||||
|
|
Loading…
Add table
Reference in a new issue