mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-22 09:31:28 +02:00
[feature/pagination-as-list] Rename and deprecate functions
Returned and marked deprecated topic_generate_pagination. Rename new function in line with coding guidelines. PHPBB3-10968
This commit is contained in:
@@ -1223,7 +1223,7 @@ class acp_attachments
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$base_url = $this->u_action . "&$u_sort_param";
|
||||
generate_template_pagination($base_url, 'pagination', $num_files, $attachments_per_page, $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $total_members, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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);
|
||||
|
||||
generate_template_pagination($this->u_action, 'pagination', $item_count, $config['smilies_per_page'], $pagination_start);
|
||||
phpbb_generate_template_pagination($this->u_action, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $inactive_count, $per_page, $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_ATTACHMENTS' => true,
|
||||
|
@@ -1882,7 +1882,7 @@ function tracking_unserialize($string, $max_depth = 3)
|
||||
|
||||
/**
|
||||
* Pagination routine, generates page number sequence
|
||||
* To generate pagination which is rendered fully within the template use generate_template_pagination
|
||||
* To generate pagination which is rendered fully within the template use phpbb_generate_template_pagination
|
||||
*
|
||||
* @param string $base_url the base url is prepended to all links generated within the function
|
||||
* @param int $num_items the total number of items, posts, topics, etc., used to determine the number of pages to produce
|
||||
@@ -1985,7 +1985,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
|
||||
* @param bool $ignore_on_page decides whether we enable an active (unlinked) item, used primarily for embedded lists
|
||||
*
|
||||
*/
|
||||
function generate_template_pagination($base_url, $block_var_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false)
|
||||
function phpbb_generate_template_pagination($base_url, $block_var_name, $num_items, $per_page, $start_item = 1, $reverse_count = false, $ignore_on_page = false)
|
||||
{
|
||||
global $template;
|
||||
|
||||
|
@@ -639,6 +639,49 @@ function get_forum_parents(&$forum_data)
|
||||
return $forum_parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate topic pagination
|
||||
* @deprecated - Use phpbb_generate_template_pagination
|
||||
*/
|
||||
function topic_generate_pagination($replies, $url)
|
||||
{
|
||||
global $config, $user;
|
||||
|
||||
// Make sure $per_page is a valid value
|
||||
$per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page'];
|
||||
|
||||
if (($replies + 1) > $per_page)
|
||||
{
|
||||
$total_pages = ceil(($replies + 1) / $per_page);
|
||||
$pagination = '';
|
||||
|
||||
$times = 1;
|
||||
for ($j = 0; $j < $replies + 1; $j += $per_page)
|
||||
{
|
||||
$pagination .= '<a href="' . $url . ($j == 0 ? '' : '&start=' . $j) . '">' . $times . '</a>';
|
||||
if ($times == 1 && $total_pages > 5)
|
||||
{
|
||||
$pagination .= '<span class="page-dots"> ... </span>';
|
||||
|
||||
// Display the last three pages
|
||||
$times = $total_pages - 3;
|
||||
$j += ($total_pages - 4) * $per_page;
|
||||
}
|
||||
else if ($times < $total_pages)
|
||||
{
|
||||
$pagination .= '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>';
|
||||
}
|
||||
$times++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pagination = '';
|
||||
}
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain list of moderators of each forum
|
||||
*/
|
||||
|
@@ -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 : '');
|
||||
generate_template_pagination($base_url, 'pagination', $forum_topics, $topics_per_page, $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => on_page($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";
|
||||
generate_template_pagination($base_url, 'pagination', $log_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $total, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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)
|
||||
{
|
||||
generate_template_pagination($base_url, 'pagination', $total, $posts_per_page, $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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");
|
||||
generate_template_pagination($base_url, 'pagination', $user_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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";
|
||||
generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $num_attachments, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => on_page($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";
|
||||
generate_template_pagination($base_url, 'pagination', $total_members, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $total_members, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_LIST' => true,
|
||||
|
@@ -670,7 +670,7 @@ class ucp_main
|
||||
|
||||
if ($topics_count)
|
||||
{
|
||||
generate_template_pagination($this->u_action, 'pagination', $topics_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($this->u_action, 'pagination', $topics_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => on_page($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),
|
||||
));
|
||||
|
||||
generate_template_pagination(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(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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");
|
||||
generate_template_pagination($base_url, 'pagination', $pm_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $pm_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => on_page($base_url, $pm_count, $config['topics_per_page'], $start),
|
||||
|
@@ -1572,7 +1572,7 @@ switch ($mode)
|
||||
}
|
||||
}
|
||||
|
||||
generate_template_pagination($pagination_url, 'pagination', $total_users, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($pagination_url, 'pagination', $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;
|
||||
}
|
||||
|
||||
generate_template_pagination($u_search, 'pagination', $total_match_count, $per_page, $start);
|
||||
phpbb_generate_template_pagination($u_search, 'pagination', $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')
|
||||
{
|
||||
generate_template_pagination($view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
phpbb_generate_template_pagination($view_topic_url, 'searchresults.pagination', $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" : ''));
|
||||
generate_template_pagination($base_url, 'pagination', $topics_count, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $topics_count, $config['topics_per_page'], $start);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'PAGE_NUMBER' => on_page($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)
|
||||
);
|
||||
|
||||
generate_template_pagination($view_topic_url, 'topicrow.pagination', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
phpbb_generate_template_pagination($view_topic_url, 'topicrow.pagination', $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");
|
||||
generate_template_pagination($base_url, 'pagination', $counter, $config['topics_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $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" : ''));
|
||||
generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start);
|
||||
phpbb_generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start);
|
||||
|
||||
// Send vars to template
|
||||
$template->assign_vars(array(
|
||||
|
Reference in New Issue
Block a user