aboutsummaryrefslogtreecommitdiff
path: root/views/default/navigation
diff options
context:
space:
mode:
authorpete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-31 14:27:22 +0000
committerpete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-31 14:27:22 +0000
commitd24ea04c56a519aa15be0d4d3d9ff4b894daf237 (patch)
tree5af73ddfdfce3e30989fb4a87f098c3c711edf54 /views/default/navigation
parent7e8a3d71ca771f077edea92e3e73685d30ca7aba (diff)
downloadelgg-d24ea04c56a519aa15be0d4d3d9ff4b894daf237.tar.gz
elgg-d24ea04c56a519aa15be0d4d3d9ff4b894daf237.tar.bz2
footer logo added, widget gallery instructions changed, pagination block styles added to all pagination
git-svn-id: https://code.elgg.org/elgg/trunk@1631 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/navigation')
-rw-r--r--views/default/navigation/pagination.php296
1 files changed, 148 insertions, 148 deletions
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php
index a4e2f16ac..bba122d5a 100644
--- a/views/default/navigation/pagination.php
+++ b/views/default/navigation/pagination.php
@@ -1,149 +1,149 @@
-<?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'];
- }
- if (!isset($vars['word'])) {
- $word = "offset";
- } else {
- $word = $vars['word'];
- }
- if (isset($vars['nonefound'])) {
- $nonefound = $vars['nonefound'];
- } else {
- $nonefound = true;
- }
-
- $totalpages = ceil($count / $limit);
- $currentpage = ceil($offset / $limit) + 1;
-
- $baseurl = preg_replace('/[\&\?]'.$word.'\=[0-9]*/',"",$vars['baseurl']);
-
-?>
-
-<div class="pagination">
- <p>
-<?php
-
- if ($count == 0) {
-
- static $notfounddisplayed;
- if (!isset($notfounddisplayed) && $nonefound) {
- echo elgg_echo("notfound");
- $notfounddisplayed = true;
- }
-
- }
-
- if ($offset > 0) {
-
- $prevoffset = $offset - $limit;
- if ($prevoffset < 0) $prevoffset = 0;
-
- $prevurl = $baseurl;
- if (substr_count($baseurl,'?')) {
- $prevurl .= "&{$word}=" . $prevoffset;
- } else {
- $prevurl .= "?{$word}=" . $prevoffset;
- }
-
- echo "<a href=\"{$prevurl}\">&laquo; ". elgg_echo("previous") ."</a> ";
-
- }
-
- if ($offset > 0 || $offset < ($count - $limit)) {
-
- $currentpage = round($offset / $limit) + 1;
- $allpages = ceil($count / $limit);
-
- $i = 1;
- $pagesarray = array();
- while ($i <= $allpages && $i <= 4) {
- $pagesarray[] = $i;
- $i++;
- }
- $i = $currentpage - 2;
- while ($i <= $allpages && $i <= ($currentpage + 2)) {
- if ($i > 0 && !in_array($i,$pagesarray))
- $pagesarray[] = $i;
- $i++;
- }
- $i = $allpages - 3;
- while ($i <= $allpages) {
- if ($i > 0 && !in_array($i,$pagesarray))
- $pagesarray[] = $i;
- $i++;
- }
-
- sort($pagesarray);
-
- $prev = 0;
- foreach($pagesarray as $i) {
-
- if (($i - $prev) > 1) {
-
- echo " ... ";
-
- }
-
- $counturl = $baseurl;
- $curoffset = (($i - 1) * $limit);
- if (substr_count($baseurl,'?')) {
- $counturl .= "&{$word}=" . $curoffset;
- } else {
- $counturl .= "?{$word}=" . $curoffset;
- }
- if ($curoffset != $offset) {
- echo " <a href=\"{$counturl}\">{$i}</a> ";
- } else {
- echo " {$i} ";
- }
- $prev = $i;
-
- }
-
- }
-
- if ($offset < ($count - $limit)) {
-
- $nextoffset = $offset + $limit;
- if ($nextoffset >= $count) $nextoffset--;
-
- $nexturl = $baseurl;
- if (substr_count($baseurl,'?')) {
- $nexturl .= "&{$word}=" . $nextoffset;
- } else {
- $nexturl .= "?{$word}=" . $nextoffset;
- }
-
- echo " <a href=\"{$nexturl}\">" . elgg_echo("next") . " &raquo;</a>";
-
- }
-
-?>
- </p>
+<?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'];
+ }
+ if (!isset($vars['word'])) {
+ $word = "offset";
+ } else {
+ $word = $vars['word'];
+ }
+ if (isset($vars['nonefound'])) {
+ $nonefound = $vars['nonefound'];
+ } else {
+ $nonefound = true;
+ }
+
+ $totalpages = ceil($count / $limit);
+ $currentpage = ceil($offset / $limit) + 1;
+
+ $baseurl = preg_replace('/[\&\?]'.$word.'\=[0-9]*/',"",$vars['baseurl']);
+
+?>
+
+<div class="pagination">
+ <p>
+<?php
+
+ if ($count == 0) {
+
+ static $notfounddisplayed;
+ if (!isset($notfounddisplayed) && $nonefound) {
+ echo elgg_echo("notfound");
+ $notfounddisplayed = true;
+ }
+
+ }
+
+ if ($offset > 0) {
+
+ $prevoffset = $offset - $limit;
+ if ($prevoffset < 0) $prevoffset = 0;
+
+ $prevurl = $baseurl;
+ if (substr_count($baseurl,'?')) {
+ $prevurl .= "&{$word}=" . $prevoffset;
+ } else {
+ $prevurl .= "?{$word}=" . $prevoffset;
+ }
+
+ echo "<a href=\"{$prevurl}\" class=\"pagination_previous\">&laquo; ". elgg_echo("previous") ."</a> ";
+
+ }
+
+ if ($offset > 0 || $offset < ($count - $limit)) {
+
+ $currentpage = round($offset / $limit) + 1;
+ $allpages = ceil($count / $limit);
+
+ $i = 1;
+ $pagesarray = array();
+ while ($i <= $allpages && $i <= 4) {
+ $pagesarray[] = $i;
+ $i++;
+ }
+ $i = $currentpage - 2;
+ while ($i <= $allpages && $i <= ($currentpage + 2)) {
+ if ($i > 0 && !in_array($i,$pagesarray))
+ $pagesarray[] = $i;
+ $i++;
+ }
+ $i = $allpages - 3;
+ while ($i <= $allpages) {
+ if ($i > 0 && !in_array($i,$pagesarray))
+ $pagesarray[] = $i;
+ $i++;
+ }
+
+ sort($pagesarray);
+
+ $prev = 0;
+ foreach($pagesarray as $i) {
+
+ if (($i - $prev) > 1) {
+
+ echo " ... ";
+
+ }
+
+ $counturl = $baseurl;
+ $curoffset = (($i - 1) * $limit);
+ if (substr_count($baseurl,'?')) {
+ $counturl .= "&{$word}=" . $curoffset;
+ } else {
+ $counturl .= "?{$word}=" . $curoffset;
+ }
+ if ($curoffset != $offset) {
+ echo " <a href=\"{$counturl}\" class=\"pagination_number\">{$i}</a> ";
+ } else {
+ echo "<span class=\"pagination_currentpage\"> {$i} </span>";
+ }
+ $prev = $i;
+
+ }
+
+ }
+
+ if ($offset < ($count - $limit)) {
+
+ $nextoffset = $offset + $limit;
+ if ($nextoffset >= $count) $nextoffset--;
+
+ $nexturl = $baseurl;
+ if (substr_count($baseurl,'?')) {
+ $nexturl .= "&{$word}=" . $nextoffset;
+ } else {
+ $nexturl .= "?{$word}=" . $nextoffset;
+ }
+
+ echo " <a href=\"{$nexturl}\" class=\"pagination_next\">" . elgg_echo("next") . " &raquo;</a>";
+
+ }
+
+?>
+ </p>
</div> \ No newline at end of file