diff options
Diffstat (limited to 'mod/search/views/default/search/listing.php')
-rw-r--r-- | mod/search/views/default/search/listing.php | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/mod/search/views/default/search/listing.php b/mod/search/views/default/search/listing.php index 37850c911..f947bd808 100644 --- a/mod/search/views/default/search/listing.php +++ b/mod/search/views/default/search/listing.php @@ -7,11 +7,8 @@ * @author Curverider Ltd * @link http://elgg.org/ */ -?> -<div class="search_listing"> -<?php $entities = $vars['entities']; $count = $vars['count'] - count($vars['entities']); @@ -19,24 +16,52 @@ if (!is_array($vars['entities']) || !count($vars['entities'])) { return FALSE; } -$title_str = elgg_echo("item:{$vars['params']['type']}:{$vars['params']['subtype']}"); -$body = elgg_view_title($title_str); +// figure out what we're deal with. +if (array_key_exists('type', $vars['params']) && array_key_exists('subtype', $vars['params'])) { + $type_str = elgg_echo("item:{$vars['params']['type']}:{$vars['params']['subtype']}"); +} elseif (array_key_exists('type', $vars['params'])) { + $type_str = elgg_echo("item:{$vars['params']['type']}"); +} else { + $type_str = elgg_echo('search:unknown_entity'); +} $query = htmlspecialchars(http_build_query( array( 'q' => $vars['params']['query'], 'entity_type' => $vars['params']['type'], 'entity_subtype' => $vars['params']['subtype'], - 'limit' => get_input('limit', 10), - 'offset' => get_input('offset', 0), 'search_type' => 'entities', ) )); $url = "{$vars['url']}pg/search?$query"; -$more = "<a href=\"$url\">+$count more $title_str</a>"; -echo elgg_view('page_elements/contentwrapper', array('body' => $body)); +// get pagination +if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) { + $nav .= elgg_view('navigation/pagination',array( + 'baseurl' => $url, + 'offset' => $vars['params']['offset'], + 'count' => $vars['count'], + 'limit' => $vars['params']['limit'], + )); +} else { + $nav = ''; +} + +// get any more links. +$more_check = $vars['count'] - ($vars['params']['offset'] + $vars['params']['limit']); +$more = ($more_check > 0) ? $more_check : 0; + +if ($more) { + $title_key = ($more == 1) ? 'comment' : 'comments'; + $more_str = sprintf(elgg_echo('search:more'), $count, $type_str); + $more_link = "<a href=\"$url\">$more_str</a>"; +} else { + $more_link = ''; +} + +echo $nav; +$body = elgg_view_title($title_str); foreach ($entities as $entity) { if ($owner = $entity->getOwnerEntity()) { @@ -53,16 +78,14 @@ foreach ($entities as $entity) { $tu = $entity->time_updated; $time = friendly_time(($tu > $tc) ? $tu : $tc); - echo <<<___END + $body .= <<<___END <span class="searchListing"> <h3 class="searchTitle">$title</h3> - <span class="searchDetails"> - <span class="searchDescription">$description</span><br /> - $icon $time - $more</a> - </span> + <span class="searchDescription">$description</span><br /> + <span class="searchInfo">$icon $time - $more_link</span> </span> ___END; } -?> -</div>
\ No newline at end of file +echo elgg_view('page_elements/contentwrapper', array('body' => $body)); +echo $nav;
\ No newline at end of file |