mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge pull request #2002 from prototech/ticket/12153
[ticket/12153] Assign PAGE_NUMBER in pagination.generate_template_pagination()
This commit is contained in:
commit
7015fc8a00
33 changed files with 114 additions and 147 deletions
|
@ -384,7 +384,7 @@
|
||||||
<!-- IF .pagination -->
|
<!-- IF .pagination -->
|
||||||
• <!-- INCLUDE pagination.html -->
|
• <!-- INCLUDE pagination.html -->
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
• {S_ON_PAGE}
|
• {PAGE_NUMBER}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
|
var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
|
||||||
var on_page = '{ON_PAGE}';
|
var on_page = '{CURRENT_PAGE}';
|
||||||
var per_page = '{PER_PAGE}';
|
var per_page = '{PER_PAGE}';
|
||||||
var base_url = '{BASE_URL|e('js')}';
|
var base_url = '{BASE_URL|e('js')}';
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
|
var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
|
||||||
var on_page = '{ON_PAGE}';
|
var on_page = '{CURRENT_PAGE}';
|
||||||
var per_page = '{PER_PAGE}';
|
var per_page = '{PER_PAGE}';
|
||||||
var base_url = '{BASE_URL|e('js')}';
|
var base_url = '{BASE_URL|e('js')}';
|
||||||
|
|
||||||
|
|
|
@ -1222,7 +1222,6 @@ class acp_attachments
|
||||||
'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' => $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)
|
||||||
|
|
|
@ -727,7 +727,6 @@ class acp_groups
|
||||||
'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false,
|
'S_GROUP_SPECIAL' => ($group_row['group_type'] == GROUP_SPECIAL) ? true : false,
|
||||||
'S_ACTION_OPTIONS' => $s_action_options,
|
'S_ACTION_OPTIONS' => $s_action_options,
|
||||||
|
|
||||||
'S_ON_PAGE' => $pagination->on_page($base_url, $total_members, $config['topics_per_page'], $start),
|
|
||||||
'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'],
|
'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'],
|
||||||
|
|
||||||
'U_ACTION' => $this->u_action . "&g=$group_id",
|
'U_ACTION' => $this->u_action . "&g=$group_id",
|
||||||
|
|
|
@ -295,7 +295,6 @@ 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' => $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",
|
||||||
|
|
|
@ -138,8 +138,6 @@ class acp_logs
|
||||||
'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' => $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,
|
||||||
'S_SORT_DIR' => $s_sort_dir,
|
'S_SORT_DIR' => $s_sort_dir,
|
||||||
|
|
|
@ -1174,7 +1174,6 @@ class acp_users
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_FEEDBACK' => true,
|
'S_FEEDBACK' => true,
|
||||||
'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,
|
||||||
|
@ -2130,7 +2129,6 @@ class acp_users
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_ATTACHMENTS' => true,
|
'S_ATTACHMENTS' => true,
|
||||||
'S_ON_PAGE' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start),
|
|
||||||
'S_SORT_KEY' => $s_sort_key,
|
'S_SORT_KEY' => $s_sort_key,
|
||||||
'S_SORT_DIR' => $s_sort_dir,
|
'S_SORT_DIR' => $s_sort_dir,
|
||||||
));
|
));
|
||||||
|
|
|
@ -135,7 +135,6 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
|
|
||||||
'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''),
|
'S_MCP_ACTION' => $url . "&i=$id&forum_action=$action&mode=$mode&start=$start" . (($merge_select) ? $selected_ids : ''),
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $forum_topics, $topics_per_page, $start),
|
|
||||||
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics),
|
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $forum_topics),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,6 @@ class mcp_logs
|
||||||
$pagination->generate_template_pagination($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(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count),
|
'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count),
|
||||||
|
|
||||||
'L_TITLE' => $user->lang['MCP_LOGS'],
|
'L_TITLE' => $user->lang['MCP_LOGS'],
|
||||||
|
|
|
@ -229,7 +229,6 @@ class mcp_notes
|
||||||
|
|
||||||
'L_TITLE' => $user->lang['MCP_NOTES_USER'],
|
'L_TITLE' => $user->lang['MCP_NOTES_USER'],
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $log_count, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count),
|
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count),
|
||||||
|
|
||||||
'RANK_TITLE' => $rank_title,
|
'RANK_TITLE' => $rank_title,
|
||||||
|
|
|
@ -309,7 +309,6 @@ class mcp_pm_reports
|
||||||
'S_MCP_ACTION' => $this->u_action,
|
'S_MCP_ACTION' => $this->u_action,
|
||||||
'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false,
|
'S_CLOSED' => ($mode == 'pm_reports_closed') ? true : false,
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL' => $total,
|
'TOTAL' => $total,
|
||||||
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
|
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
|
||||||
)
|
)
|
||||||
|
|
|
@ -547,7 +547,6 @@ class mcp_queue
|
||||||
'S_TOPICS' => $is_topics,
|
'S_TOPICS' => $is_topics,
|
||||||
'S_RESTORE' => $is_restore,
|
'S_RESTORE' => $is_restore,
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
|
|
||||||
'TOPIC_ID' => $topic_id,
|
'TOPIC_ID' => $topic_id,
|
||||||
'TOTAL' => $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
|
'TOTAL' => $user->lang(((!$is_topics) ? 'VIEW_TOPIC_POSTS' : 'VIEW_FORUM_TOPICS'), (int) $total),
|
||||||
));
|
));
|
||||||
|
|
|
@ -423,7 +423,6 @@ class mcp_reports
|
||||||
'S_FORUM_OPTIONS' => $forum_options,
|
'S_FORUM_OPTIONS' => $forum_options,
|
||||||
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
|
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $config['topics_per_page'], $start),
|
|
||||||
'TOPIC_ID' => $topic_id,
|
'TOPIC_ID' => $topic_id,
|
||||||
'TOTAL' => $total,
|
'TOTAL' => $total,
|
||||||
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
|
'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $total),
|
||||||
|
|
|
@ -343,7 +343,6 @@ 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']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'),
|
'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_info['forum_id']}&t={$topic_info['topic_id']}&start=$start") . '">', '</a>'),
|
||||||
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'),
|
'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", "f={$topic_info['forum_id']}&start=$start") . '">', '</a>'),
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total, $posts_per_page, $start),
|
|
||||||
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),
|
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,6 @@ class mcp_warn
|
||||||
'S_SELECT_SORT_KEY' => $s_sort_key,
|
'S_SELECT_SORT_KEY' => $s_sort_key,
|
||||||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $user_count, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count),
|
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,6 @@ class ucp_attachments
|
||||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $num_attachments, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_ATTACHMENTS' => $num_attachments,
|
'TOTAL_ATTACHMENTS' => $num_attachments,
|
||||||
|
|
||||||
'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],
|
'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],
|
||||||
|
|
|
@ -821,7 +821,6 @@ class ucp_groups
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_LIST' => true,
|
'S_LIST' => true,
|
||||||
'S_ACTION_OPTIONS' => $s_action_options,
|
'S_ACTION_OPTIONS' => $s_action_options,
|
||||||
'S_ON_PAGE' => $pagination->on_page($template, $user, $base_url, $total_members, $config['topics_per_page'], $start),
|
|
||||||
|
|
||||||
'U_ACTION' => $this->u_action . "&g=$group_id",
|
'U_ACTION' => $this->u_action . "&g=$group_id",
|
||||||
'S_UCP_ACTION' => $this->u_action . "&g=$group_id",
|
'S_UCP_ACTION' => $this->u_action . "&g=$group_id",
|
||||||
|
|
|
@ -671,7 +671,6 @@ class ucp_main
|
||||||
$pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
|
$pagination->generate_template_pagination($this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($this->u_action, $topics_count, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count),
|
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,6 @@ class ucp_notifications
|
||||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $notifications['total_count'], $config['topics_per_page'], $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $notifications['total_count'], $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_COUNT' => $notifications['total_count'],
|
'TOTAL_COUNT' => $notifications['total_count'],
|
||||||
'U_MARK_ALL' => $base_url . '&mark=all&token=' . generate_link_hash('mark_all_notifications_read'),
|
'U_MARK_ALL' => $base_url . '&mark=all&token=' . generate_link_hash('mark_all_notifications_read'),
|
||||||
));
|
));
|
||||||
|
|
|
@ -458,7 +458,6 @@ function get_pm_from($folder_id, $folder, $user_id)
|
||||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $pm_count, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
|
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
|
||||||
|
|
||||||
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
|
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
|
||||||
|
|
|
@ -1633,7 +1633,6 @@ switch ($mode)
|
||||||
|
|
||||||
// Generate page
|
// Generate page
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($pagination_url, $total_users, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $total_users),
|
'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $total_users),
|
||||||
|
|
||||||
'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']),
|
'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']),
|
||||||
|
|
|
@ -76,14 +76,11 @@ class pagination
|
||||||
public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false)
|
public function generate_template_pagination($base_url, $block_var_name, $start_name, $num_items, $per_page, $start = 1, $reverse_count = false, $ignore_on_page = false)
|
||||||
{
|
{
|
||||||
$total_pages = ceil($num_items / $per_page);
|
$total_pages = ceil($num_items / $per_page);
|
||||||
|
|
||||||
if ($total_pages == 1 || !$num_items)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$on_page = $this->get_on_page($per_page, $start);
|
$on_page = $this->get_on_page($per_page, $start);
|
||||||
|
$u_previous_page = $u_next_page = '';
|
||||||
|
|
||||||
|
if ($total_pages > 1)
|
||||||
|
{
|
||||||
if ($reverse_count)
|
if ($reverse_count)
|
||||||
{
|
{
|
||||||
$start_page = ($total_pages > 5) ? $total_pages - 4 : 1;
|
$start_page = ($total_pages > 5) ? $total_pages - 4 : 1;
|
||||||
|
@ -110,7 +107,6 @@ class pagination
|
||||||
$end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages;
|
$end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
$u_previous_page = $u_next_page = '';
|
|
||||||
if ($on_page != 1)
|
if ($on_page != 1)
|
||||||
{
|
{
|
||||||
$u_previous_page = $this->generate_page_link($base_url, $on_page - 1, $start_name, $per_page);
|
$u_previous_page = $this->generate_page_link($base_url, $on_page - 1, $start_name, $per_page);
|
||||||
|
@ -178,6 +174,7 @@ class pagination
|
||||||
'S_IS_ELLIPSIS' => false,
|
'S_IS_ELLIPSIS' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the block_var_name is a nested block, we will use the last (most
|
// If the block_var_name is a nested block, we will use the last (most
|
||||||
// inner) block as a prefix for the template variables. If the last block
|
// inner) block as a prefix for the template variables. If the last block
|
||||||
|
@ -203,6 +200,7 @@ class pagination
|
||||||
'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '',
|
'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '',
|
||||||
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
|
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
|
||||||
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
|
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
|
||||||
|
$tpl_prefix . 'PAGE_NUMBER' => $this->on_page($num_items, $per_page, $start),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($tpl_block_name)
|
if ($tpl_block_name)
|
||||||
|
@ -229,24 +227,15 @@ class pagination
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return current page
|
* Return current page
|
||||||
* This function also sets certain specific template variables
|
|
||||||
*
|
*
|
||||||
* @param string $base_url the base url used to call this page, used by Javascript for popup jump to page
|
|
||||||
* @param int $num_items the total number of items, posts, topics, etc.
|
* @param int $num_items the total number of items, posts, topics, etc.
|
||||||
* @param int $per_page the number of items, posts, etc. per page
|
* @param int $per_page the number of items, posts, etc. per page
|
||||||
* @param int $start the item which should be considered currently active, used to determine the page we're on
|
* @param int $start the item which should be considered currently active, used to determine the page we're on
|
||||||
* @return string Descriptive pagination string (e.g. "page 1 of 10")
|
* @return string Descriptive pagination string (e.g. "page 1 of 10")
|
||||||
*/
|
*/
|
||||||
public function on_page($base_url, $num_items, $per_page, $start)
|
public function on_page($num_items, $per_page, $start)
|
||||||
{
|
{
|
||||||
$on_page = $this->get_on_page($per_page, $start);
|
$on_page = $this->get_on_page($per_page, $start);
|
||||||
|
|
||||||
$this->template->assign_vars(array(
|
|
||||||
'PER_PAGE' => $per_page,
|
|
||||||
'ON_PAGE' => $on_page,
|
|
||||||
'BASE_URL' => $base_url,
|
|
||||||
));
|
|
||||||
|
|
||||||
return $this->user->lang('PAGE_OF', $on_page, max(ceil($num_items / $per_page), 1));
|
return $this->user->lang('PAGE_OF', $on_page, max(ceil($num_items / $per_page), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<a href="#" class="pagination-trigger" title="{L_JUMP_TO_PAGE}" data-lang-jump-page="{L_JUMP_PAGE|e('html_attr')}{L_COLON}" data-on-page="{ON_PAGE}" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}">{PAGE_NUMBER}</a> •
|
<a href="#" class="pagination-trigger" title="{L_JUMP_TO_PAGE}" data-lang-jump-page="{L_JUMP_PAGE|e('html_attr')}{L_COLON}" data-on-page="{CURRENT_PAGE}" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}">{PAGE_NUMBER}</a> •
|
||||||
<ul>
|
<ul>
|
||||||
<!-- BEGIN pagination -->
|
<!-- BEGIN pagination -->
|
||||||
<!-- IF pagination.S_IS_PREV -->
|
<!-- IF pagination.S_IS_PREV -->
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
<!-- IF .pagination -->
|
<!-- IF .pagination -->
|
||||||
<!-- INCLUDE pagination.html -->
|
<!-- INCLUDE pagination.html -->
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
{S_ON_PAGE}
|
{PAGE_NUMBER}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -36,7 +36,7 @@ function popup(url, width, height, name)
|
||||||
|
|
||||||
function jumpto()
|
function jumpto()
|
||||||
{
|
{
|
||||||
var page = prompt('{LA_JUMP_PAGE}{L_COLON}', '{ON_PAGE}');
|
var page = prompt('{LA_JUMP_PAGE}{L_COLON}', '{CURRENT_PAGE}');
|
||||||
var per_page = '{PER_PAGE}';
|
var per_page = '{PER_PAGE}';
|
||||||
var base_url = '{BASE_URL|e('js')}';
|
var base_url = '{BASE_URL|e('js')}';
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@
|
||||||
<!-- IF .pagination -->
|
<!-- IF .pagination -->
|
||||||
<!-- INCLUDE pagination.html -->
|
<!-- INCLUDE pagination.html -->
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
{S_ON_PAGE}
|
{PAGE_NUMBER}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -635,7 +635,6 @@ $base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((s
|
||||||
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
|
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $topics_count, $config['topics_per_page'], $start),
|
|
||||||
'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count),
|
'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,6 @@ $template->assign_vars(array(
|
||||||
'TOTAL_REGISTERED_USERS_ONLINE' => $user->lang('REG_USERS_ONLINE', (int) $logged_visible_online, $user->lang('HIDDEN_USERS_ONLINE', (int) $logged_hidden_online)),
|
'TOTAL_REGISTERED_USERS_ONLINE' => $user->lang('REG_USERS_ONLINE', (int) $logged_visible_online, $user->lang('HIDDEN_USERS_ONLINE', (int) $logged_hidden_online)),
|
||||||
'TOTAL_GUEST_USERS_ONLINE' => $user->lang('GUEST_USERS_ONLINE', (int) $guest_counter),
|
'TOTAL_GUEST_USERS_ONLINE' => $user->lang('GUEST_USERS_ONLINE', (int) $guest_counter),
|
||||||
'LEGEND' => $legend,
|
'LEGEND' => $legend,
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $counter, $config['topics_per_page'], $start),
|
|
||||||
|
|
||||||
'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
|
'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
|
||||||
'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
|
'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)),
|
||||||
|
|
|
@ -605,7 +605,6 @@ $template->assign_vars(array(
|
||||||
'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']),
|
'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']),
|
||||||
'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']),
|
'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']),
|
||||||
|
|
||||||
'PAGE_NUMBER' => $pagination->on_page($base_url, $total_posts, $config['posts_per_page'], $start),
|
|
||||||
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts),
|
'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts),
|
||||||
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '',
|
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '',
|
||||||
'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '',
|
'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '',
|
||||||
|
|
|
@ -38,6 +38,9 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
10,
|
10,
|
||||||
10,
|
10,
|
||||||
'pagination
|
'pagination
|
||||||
|
:per_page:10
|
||||||
|
:current_page:2
|
||||||
|
:base_url:page.php
|
||||||
:previous::page.php
|
:previous::page.php
|
||||||
:else:1:page.php
|
:else:1:page.php
|
||||||
:current:2:page.php?start=10
|
:current:2:page.php?start=10
|
||||||
|
@ -57,6 +60,9 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
10,
|
10,
|
||||||
20,
|
20,
|
||||||
'pagination
|
'pagination
|
||||||
|
:per_page:10
|
||||||
|
:current_page:3
|
||||||
|
:base_url:page.php
|
||||||
:previous::page.php?start=10
|
:previous::page.php?start=10
|
||||||
:else:1:page.php
|
:else:1:page.php
|
||||||
:else:2:page.php?start=10
|
:else:2:page.php?start=10
|
||||||
|
@ -77,6 +83,9 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
10,
|
10,
|
||||||
10,
|
10,
|
||||||
'pagination
|
'pagination
|
||||||
|
:per_page:10
|
||||||
|
:current_page:2
|
||||||
|
:base_url:test/page/%d
|
||||||
:previous::test
|
:previous::test
|
||||||
:else:1:test
|
:else:1:test
|
||||||
:current:2:test/page/2
|
:current:2:test/page/2
|
||||||
|
@ -96,6 +105,9 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
10,
|
10,
|
||||||
20,
|
20,
|
||||||
'pagination
|
'pagination
|
||||||
|
:per_page:10
|
||||||
|
:current_page:3
|
||||||
|
:base_url:test/page/%d
|
||||||
:previous::test/page/2
|
:previous::test/page/2
|
||||||
:else:1:test
|
:else:1:test
|
||||||
:else:2:test/page/2
|
:else:2:test/page/2
|
||||||
|
@ -127,15 +139,10 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'page.php',
|
|
||||||
10,
|
10,
|
||||||
10,
|
10,
|
||||||
0,
|
0,
|
||||||
'PAGE_OF-1-1',
|
'PAGE_OF-1-1',
|
||||||
'on_page
|
|
||||||
per_page:10
|
|
||||||
on_page:1
|
|
||||||
base_url:page.php',
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -143,13 +150,9 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
/**
|
/**
|
||||||
* @dataProvider on_page_data
|
* @dataProvider on_page_data
|
||||||
*/
|
*/
|
||||||
public function test_on_page($base_url, $num_items, $per_page, $start_item, $expect_return, $expect)
|
public function test_on_page($num_items, $per_page, $start_item, $expect_return)
|
||||||
{
|
{
|
||||||
$this->assertEquals($expect_return, $this->pagination->on_page($base_url, $num_items, $per_page, $start_item));
|
$this->assertEquals($expect_return, $this->pagination->on_page($num_items, $per_page, $start_item));
|
||||||
|
|
||||||
$this->template->set_filenames(array('test' => 'on_page.html'));
|
|
||||||
|
|
||||||
$this->assertEquals(str_replace("\t", '', $expect), $this->display('test'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validate_start_data()
|
public function validate_start_data()
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
on_page
|
|
||||||
per_page:{PER_PAGE}
|
|
||||||
on_page:{ON_PAGE}
|
|
||||||
base_url:{BASE_URL}
|
|
|
@ -1,4 +1,7 @@
|
||||||
pagination
|
pagination
|
||||||
|
:per_page:{PER_PAGE}
|
||||||
|
:current_page:{CURRENT_PAGE}
|
||||||
|
:base_url:{BASE_URL}
|
||||||
<!-- BEGIN pagination -->
|
<!-- BEGIN pagination -->
|
||||||
<!-- IF pagination.S_IS_PREV -->:previous:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
|
<!-- IF pagination.S_IS_PREV -->:previous:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
|
||||||
<!-- ELSEIF pagination.S_IS_CURRENT -->:current:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
|
<!-- ELSEIF pagination.S_IS_CURRENT -->:current:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
|
||||||
|
|
Loading…
Add table
Reference in a new issue