diff options
-rw-r--r-- | engine/lib/views.php | 1 | ||||
-rw-r--r-- | views/default/layout/objects/list.php | 2 | ||||
-rw-r--r-- | views/default/navigation/pagination.php | 18 |
3 files changed, 12 insertions, 9 deletions
diff --git a/engine/lib/views.php b/engine/lib/views.php index 5b98214cb..abc1f9221 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -843,6 +843,7 @@ function elgg_view_annotation_list($annotations, $count, $offset, $limit) { 'limit' => (int) $limit, 'list-class' => 'elgg-annotation-list', 'full_view' => true, + 'offset_key' => 'annoff', ); return elgg_view('layout/objects/list', $params); diff --git a/views/default/layout/objects/list.php b/views/default/layout/objects/list.php index b65e79102..2c3a8206e 100644 --- a/views/default/layout/objects/list.php +++ b/views/default/layout/objects/list.php @@ -22,6 +22,7 @@ $count = $vars['count']; $base_url = $vars['base_url']; $pagination = elgg_get_array_value('pagination', $vars, true); $full_view = elgg_get_array_value('full_view', $vars, false); +$offset_key = elgg_get_array_value('offset_key', $vars, 'offset'); $list_class = 'elgg-list'; if (isset($vars['list_class'])) { @@ -42,6 +43,7 @@ if ($pagination) { 'offset' => $offset, 'count' => $count, 'limit' => $limit, + 'offset_key' => $offset_key, )); } diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index 9fcd8153e..b8c576d43 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -5,11 +5,11 @@ * @package Elgg * @subpackage Core * - * @uses int $vars['offset'] - * @uses int $vars['limit'] - * @uses int $vars['count'] Number of entities. - * @uses string $vars['word'] Word to use in GET params for the offset - * @uses string $vars['baseurl'] Base URL to use in links + * @uses int $vars['offset'] The offset in the list + * @uses int $vars['limit'] Number of items per page + * @uses int $vars['count'] Number of items in list + * @uses string $vars['baseurl'] Base URL to use in links + * @uses string $vars['offset_key'] The string to use for offet in the URL */ if (elgg_in_context('widget')) { @@ -24,7 +24,7 @@ if (!$limit = (int) elgg_get_array_value('limit', $vars, 10)) { } $count = (int) elgg_get_array_value('count', $vars, 0); -$word = elgg_get_array_value('word', $vars, 'offset'); +$offset_key = elgg_get_array_value('offset_key', $vars, 'offset'); $base_url = elgg_get_array_value('baseurl', $vars, current_page_url()); $num_pages = elgg_get_array_value('num_pages', $vars, 10); @@ -56,7 +56,7 @@ if ($current_page > 1) { $prev_offset = 0; } - $pages->prev['href'] = elgg_http_add_url_query_elements($base_url, array($word => $prev_offset)); + $pages->prev['href'] = elgg_http_add_url_query_elements($base_url, array($offset_key => $prev_offset)); $first_page = $current_page - $delta; if ($first_page < 1) { @@ -77,7 +77,7 @@ if ($current_page < $total_pages) { $next_offset--; } - $pages->next['href'] = elgg_http_add_url_query_elements($base_url, array($word => $next_offset)); + $pages->next['href'] = elgg_http_add_url_query_elements($base_url, array($offset_key => $next_offset)); $last_page = $current_page + $delta; if ($last_page > $total_pages) { @@ -102,7 +102,7 @@ foreach ($pages->items as $page) { echo "<li><span class=\"active\">$page</span></li>"; } else { $page_offset = (($page - 1) * $limit); - $url = elgg_http_add_url_query_elements($base_url, array($word => $page_offset)); + $url = elgg_http_add_url_query_elements($base_url, array($offset_key => $page_offset)); echo "<li><a href=\"$url\">$page</a></li>"; } } |