blob: b96ce32d1860ef9a021f9e5e147dacf1edafd180 (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<?php
/**
* Elgg pagination
*
* @package Elgg
* @subpackage Core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
*
*/
if (!isset($vars['offset'])) {
$offset = 0;
} else {
$offset = $vars['offset'];
}
if (!isset($vars['limit'])) {
$limit = 10;
} else {
$limit = $vars['limit'];
}
if (!isset($vars['count'])) {
$count = 0;
} else {
$count = $vars['count'];
}
$totalpages = ceil($count / $limit);
$currentpage = ceil($offset / $limit) + 1;
$baseurl = preg_replace('/[\&\?]offset\=[0-9]*/',"",$vars['baseurl']);
?>
<div class="pagination">
<p>
<?php
if ($count == 0) {
static $notfounddisplayed;
if (!isset($notfounddisplayed)) {
echo elgg_echo("notfound");
$notfounddisplayed = true;
}
}
if ($offset > 0) {
$prevoffset = $offset - $limit;
if ($prevoffset < 0) $prevoffset = 0;
$prevurl = $baseurl;
if (substr_count($baseurl,'?')) {
$prevurl .= "&offset=" . $prevoffset;
} else {
$prevurl .= "?offset=" . $prevoffset;
}
echo "<a href=\"{$prevurl}\"><< ". elgg_echo("previous") ."</a> ";
}
if ($offset < ($count - $limit)) {
$nextoffset = $offset + $limit;
if ($nextoffset >= $count) $nextoffset--;
$nexturl = $baseurl;
if (substr_count($baseurl,'?')) {
$nexturl .= "&offset=" . $nextoffset;
} else {
$nexturl .= "?offset=" . $nextoffset;
}
echo " <a href=\"{$nexturl}\">" . elgg_echo("next") . " >></a>";
}
?>
</p>
</div>
|