aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation/pagination.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-01 19:41:34 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-06-01 19:41:34 +0000
commit66afe94653b5980350a3795744015b6f235b6ea7 (patch)
treec5f87d03cb661a95b3496786af323aa9cfe6b984 /views/default/navigation/pagination.php
parent1f669812407501050980057021b44b65d5ccff74 (diff)
downloadelgg-66afe94653b5980350a3795744015b6f235b6ea7.tar.gz
elgg-66afe94653b5980350a3795744015b6f235b6ea7.tar.bz2
Pagination uses elgg_get_array_value().
git-svn-id: http://code.elgg.org/elgg/trunk@6313 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/navigation/pagination.php')
-rw-r--r--views/default/navigation/pagination.php38
1 files changed, 12 insertions, 26 deletions
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php
index e20891070..e0c57637d 100644
--- a/views/default/navigation/pagination.php
+++ b/views/default/navigation/pagination.php
@@ -7,39 +7,25 @@
* @author Curverider Ltd
* @link http://elgg.org/
*
+ * @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
*/
-if (!isset($vars['offset'])) {
- $offset = 0;
-} else {
- $offset = $vars['offset'];
-}
-if ((!isset($vars['limit'])) || (!$vars['limit'])) {
+$offset = (int) elgg_get_array_value('offset', $vars, 0);
+// because you can say $vars['limit'] = 0
+if (!$limit = (int) elgg_get_array_value('limit', $vars, 10)) {
$limit = 10;
-} else {
- $limit = (int)$vars['limit'];
-}
-if (!isset($vars['count'])) {
- $count = 0;
-} else {
- $count = $vars['count'];
-}
-if (!isset($vars['word'])) {
- $word = "offset";
-} else {
- $word = $vars['word'];
-}
-if (isset($vars['nonefound'])) {
- $nonefound = $vars['nonefound'];
-} else {
- $nonefound = true;
}
+$count = (int) elgg_get_array_value('count', $vars, 0);
+$word = elgg_get_array_value('word', $vars, 'offset');
+$baseurl = elgg_get_array_value('baseurl', $vars, current_page_url());
$totalpages = ceil($count / $limit);
$currentpage = ceil($offset / $limit) + 1;
-$baseurl = isset($vars['baseurl']) ? $vars['baseurl'] : current_page_url();
-
//only display if there is content to paginate through or if we already have an offset
if (($count > $limit || $offset > 0) && get_context() != 'widget') {
@@ -123,4 +109,4 @@ if (($count > $limit || $offset > 0) && get_context() != 'widget') {
?>
</div>
<?php
-} // end of pagination check if statement \ No newline at end of file
+} \ No newline at end of file