blob: f9d8dd283c629c5b3ced21de1362a52166582fbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
/**
*
* @package Elgg
* @subpackage Core
* @author Curverider Ltd
* @link http://elgg.org/
*
*/
?>
<div class="river_item_list">
<?php
if (isset($vars['items']) && is_array($vars['items'])) {
$i = 0;
if (!empty($vars['items'])) {
foreach($vars['items'] as $item) {
echo elgg_view_river_item($item);
$i++;
if ($i >= $vars['limit']) {
break;
}
}
}
}
if ($vars['pagination'] !== false) {
$baseurl = $_SERVER['REQUEST_URI'];
$baseurl = elgg_http_remove_url_query_element($baseurl, 'offset');
$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;
}
$nav .= '<a class="back" href="'.$nexturl.'">« ' . 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') . ' »</a> ';
}
if (!empty($nav)) {
echo '<div class="river_pagination"><p>'.$nav.'</p><div class="clearfloat"></div></div>';
}
}
?>
</div>
|