diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-16 20:26:12 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-16 20:26:12 +0000 |
commit | c66831fa5138a277a9729174caf14c7eb323fb07 (patch) | |
tree | 2444b54badf4914b59c88700cc1ce30a57ae7ff1 /views/default/navigation | |
parent | 8048313e87b9fd5ab6734e29a0e951524fa33e45 (diff) | |
download | elgg-c66831fa5138a277a9729174caf14c7eb323fb07.tar.gz elgg-c66831fa5138a277a9729174caf14c7eb323fb07.tar.bz2 |
Standardizing views.`
git-svn-id: http://code.elgg.org/elgg/trunk@3555 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/navigation')
-rw-r--r-- | views/default/navigation/pagination.php | 144 | ||||
-rw-r--r-- | views/default/navigation/topbar_tools.php | 68 | ||||
-rw-r--r-- | views/default/navigation/viewtype.php | 50 |
3 files changed, 127 insertions, 135 deletions
diff --git a/views/default/navigation/pagination.php b/views/default/navigation/pagination.php index e141675c8..aec005eaf 100644 --- a/views/default/navigation/pagination.php +++ b/views/default/navigation/pagination.php @@ -1,75 +1,74 @@ <?php +/** + * Elgg pagination + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + */ - /** - * Elgg pagination - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - */ - - if (!isset($vars['offset'])) { - $offset = 0; - } else { - $offset = $vars['offset']; - } - if ((!isset($vars['limit'])) || (!$vars['limit'])) { - $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; - } - - $totalpages = ceil($count / $limit); - $currentpage = ceil($offset / $limit) + 1; +if (!isset($vars['offset'])) { + $offset = 0; +} else { + $offset = $vars['offset']; +} +if ((!isset($vars['limit'])) || (!$vars['limit'])) { + $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; +} - $baseurl = preg_replace('/[\&\?]'.$word.'\=[0-9]*/',"",$vars['baseurl']); - - //only display if there is content to paginate through or if we already have an offset - if (($count > $limit || $offset > 0) && get_context() != 'widget') { +$totalpages = ceil($count / $limit); +$currentpage = ceil($offset / $limit) + 1; -?> +$baseurl = preg_replace('/[\&\?]'.$word.'\=[0-9]*/',"",$vars['baseurl']); -<div class="pagination"> -<?php +//only display if there is content to paginate through or if we already have an offset +if (($count > $limit || $offset > 0) && get_context() != 'widget') { + + ?> + + <div class="pagination"> + <?php 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\">« ". 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) { @@ -78,28 +77,27 @@ } $i = $currentpage - 2; while ($i <= $allpages && $i <= ($currentpage + 2)) { - if ($i > 0 && !in_array($i,$pagesarray)) + if ($i > 0 && !in_array($i,$pagesarray)) { $pagesarray[] = $i; + } $i++; } $i = $allpages - 3; while ($i <= $allpages) { - if ($i > 0 && !in_array($i,$pagesarray)) + if ($i > 0 && !in_array($i,$pagesarray)) { $pagesarray[] = $i; + } $i++; } - + sort($pagesarray); - + $prev = 0; foreach($pagesarray as $i) { - if (($i - $prev) > 1) { - echo "<span class=\"pagination_more\">...</span>"; - } - + $counturl = $baseurl; $curoffset = (($i - 1) * $limit); if (substr_count($baseurl,'?')) { @@ -113,30 +111,30 @@ echo "<span class=\"pagination_currentpage\"> {$i} </span>"; } $prev = $i; - - } + } } - + if ($offset < ($count - $limit)) { - + $nextoffset = $offset + $limit; - if ($nextoffset >= $count) $nextoffset--; - + 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") . " »</a>"; - + } -?> -<div class="clearfloat"></div> -</div> -<?php - } // end of pagination check if statement -?>
\ No newline at end of file + ?> + <div class="clearfloat"></div> + </div> + <?php +} // end of pagination check if statement
\ No newline at end of file diff --git a/views/default/navigation/topbar_tools.php b/views/default/navigation/topbar_tools.php index 49dacde72..897a827d6 100644 --- a/views/default/navigation/topbar_tools.php +++ b/views/default/navigation/topbar_tools.php @@ -1,47 +1,45 @@ <?php +/** + * Elgg standard tools drop down + * This will be populated depending on the plugins active - only plugin navigation will appear here + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + * + */ - /** - * Elgg standard tools drop down - * This will be populated depending on the plugins active - only plugin navigation will appear here - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd - * @link http://elgg.org/ - * - */ - - $menu = get_register('menu'); - - //var_export($menu); +$menu = get_register('menu'); + +//var_export($menu); + +if (is_array($menu) && sizeof($menu) > 0) { + $alphamenu = array(); + foreach($menu as $item) { + $alphamenu[$item->name] = $item; + } + ksort($alphamenu); - if (is_array($menu) && sizeof($menu) > 0) { - $alphamenu = array(); - foreach($menu as $item) { - $alphamenu[$item->name] = $item; - } - ksort($alphamenu); - ?> <ul class="topbardropdownmenu"> - <li class="drop"><a href="#" class="menuitemtools"><?php echo(elgg_echo('tools')); ?></a> - <ul> - <?php - foreach($alphamenu as $item) { - echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>"; - } - ?> - </ul> - </li> + <li class="drop"><a href="#" class="menuitemtools"><?php echo(elgg_echo('tools')); ?></a> + <ul> + <?php + foreach($alphamenu as $item) { + echo "<li><a href=\"{$item->value}\">" . $item->name . "</a></li>"; + } + ?> + </ul> + </li> </ul> <script type="text/javascript"> - $(function() { - $('ul.topbardropdownmenu').elgg_topbardropdownmenu(); - }); +$(function() { + $('ul.topbardropdownmenu').elgg_topbardropdownmenu(); +}); </script> <?php - } -?> +}
\ No newline at end of file diff --git a/views/default/navigation/viewtype.php b/views/default/navigation/viewtype.php index c5f3a80a1..fcea39b61 100644 --- a/views/default/navigation/viewtype.php +++ b/views/default/navigation/viewtype.php @@ -1,34 +1,30 @@ <?php +/** + * Elgg list view switcher + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ - /** - * Elgg list view switcher - * - * @package Elgg - * @subpackage Core +$baseurl = preg_replace('/[\&\?]search\_viewtype\=[A-Za-z0-9]*/',"",$vars['baseurl']); - * @author Curverider Ltd +if ($vars['viewtype'] == "list") { + $viewtype = "gallery"; +} else { + $viewtype = "list"; +} - * @link http://elgg.org/ - */ - - - $baseurl = preg_replace('/[\&\?]search\_viewtype\=[A-Za-z0-9]*/',"",$vars['baseurl']); - - if ($vars['viewtype'] == "list") { - $viewtype = "gallery"; - } else { - $viewtype = "list"; - } - - if (substr_count($baseurl,'?')) { - $baseurl .= "&search_viewtype=" . $viewtype; - } else { - $baseurl .= "?search_viewtype=" . $viewtype; - } +if (substr_count($baseurl,'?')) { + $baseurl .= "&search_viewtype=" . $viewtype; +} else { + $baseurl .= "?search_viewtype=" . $viewtype; +} ?> - <div class="contentWrapper"> - <?php echo elgg_echo("viewtype:change") ?>: - <a href="<?php echo $baseurl; ?>"><?php echo elgg_echo("viewtype:{$viewtype}"); ?></a> - </div>
\ No newline at end of file +<div class="contentWrapper"> + <?php echo elgg_echo("viewtype:change") ?>: + <a href="<?php echo $baseurl; ?>"><?php echo elgg_echo("viewtype:{$viewtype}"); ?></a> +</div>
\ No newline at end of file |