aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-19 20:03:55 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-19 20:03:55 +0000
commit541ca24c3903f691130f5dd33e879272b31fcd96 (patch)
tree987a27132cfdd803f05de5eac5802155dc2603b9
parent849148f0079b5f723c89f332a0eb6b6b3b2e0137 (diff)
downloadelgg-541ca24c3903f691130f5dd33e879272b31fcd96.tar.gz
elgg-541ca24c3903f691130f5dd33e879272b31fcd96.tar.bz2
Pagination is now optional on river lists; is removed on the river widget
git-svn-id: https://code.elgg.org/elgg/trunk@2834 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/river2.php4
-rw-r--r--mod/riverdashboard/views/default/widgets/river_widget/view.php2
-rw-r--r--views/default/river/item/list.php44
3 files changed, 28 insertions, 22 deletions
diff --git a/engine/lib/river2.php b/engine/lib/river2.php
index 6932c44e2..b529e6eff 100644
--- a/engine/lib/river2.php
+++ b/engine/lib/river2.php
@@ -232,7 +232,8 @@
$action_type = '',
$limit = 20,
$posted_min = 0,
- $posted_max = 0) {
+ $posted_max = 0,
+ $pagination = true) {
// Get input from outside world and sanitise it
$offset = (int) get_input('offset',0);
@@ -244,6 +245,7 @@
'limit' => $limit,
'offset' => $offset,
'items' => $riveritems,
+ 'pagination' => $pagination
));
}
diff --git a/mod/riverdashboard/views/default/widgets/river_widget/view.php b/mod/riverdashboard/views/default/widgets/river_widget/view.php
index 375ba16d2..0a8f23c41 100644
--- a/mod/riverdashboard/views/default/widgets/river_widget/view.php
+++ b/mod/riverdashboard/views/default/widgets/river_widget/view.php
@@ -28,7 +28,7 @@
$limit = 4;
//grab the river
- $river = elgg_view_river_items($owner->getGuid(), 0, $content_type, $content[0], $content[1], '', $limit);
+ $river = elgg_view_river_items($owner->getGuid(), 0, $content_type, $content[0], $content[1], '', $limit,0,0,false);
//display
echo "<div class=\"contentWrapper\">";
diff --git a/views/default/river/item/list.php b/views/default/river/item/list.php
index 08f8d455d..f529aac3f 100644
--- a/views/default/river/item/list.php
+++ b/views/default/river/item/list.php
@@ -16,31 +16,35 @@
}
- $baseurl = $_SERVER['REQUEST_URI'];
- $baseurl = $baseurl = preg_replace('/[\&\?]offset\=[0-9]*/',"",$baseurl);
+ if ($vars['pagination'] !== false) {
- $nav = '';
-
- if (sizeof($vars['items']) > $vars['limit']) {
- $newoffset = $vars['offset'] + $vars['limit'];
- $urladdition = 'offset='.$newoffset;
- if (substr_count($baseurl,'?')) $nexturl=$baseurl . '&' . $urladdition; else $nexturl=$baseurl . '?' . $urladdition;
+ $baseurl = $_SERVER['REQUEST_URI'];
+ $baseurl = $baseurl = preg_replace('/[\&\?]offset\=[0-9]*/',"",$baseurl);
- $nav .= '<a class="back" href="'.$nexturl.'">&laquo; ' . elgg_echo('previous') . '</a> ';
- }
+ $nav = '';
- if ($vars['offset'] > 0) {
- $newoffset = $vars['offset'] - $vars['limit'];
- if ($newoffset < 0) $newoffset = 0;
- $urladdition = 'offset='.$newoffset;
- if (substr_count($baseurl,'?')) $prevurl=$baseurl . '&' . $urladdition; else $prevurl=$baseurl . '?' . $urladdition;
+ if (sizeof($vars['items']) > $vars['limit']) {
+ $newoffset = $vars['offset'] + $vars['limit'];
+ $urladdition = 'offset='.$newoffset;
+ if (substr_count($baseurl,'?')) $nexturl=$baseurl . '&' . $urladdition; else $nexturl=$baseurl . '?' . $urladdition;
+
+ $nav .= '<a class="back" href="'.$nexturl.'">&laquo; ' . elgg_echo('previous') . '</a> ';
+ }
+
+ if ($vars['offset'] > 0) {
+ $newoffset = $vars['offset'] - $vars['limit'];
+ if ($newoffset < 0) $newoffset = 0;
+ $urladdition = 'offset='.$newoffset;
+ if (substr_count($baseurl,'?')) $prevurl=$baseurl . '&' . $urladdition; else $prevurl=$baseurl . '?' . $urladdition;
+
+ $nav .= '<a class="forward" href="'.$prevurl.'">' . elgg_echo('next') . ' &raquo;</a> ';
+ }
+
- $nav .= '<a class="forward" href="'.$prevurl.'">' . elgg_echo('next') . ' &raquo;</a> ';
- }
-
+ if (!empty($nav)) {
+ echo '<div class="river_pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
+ }
- if (!empty($nav)) {
- echo '<div class="river_pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
}
?>