From ed101d29e590d2babf965e9ba7599a1269c05369 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 30 Jun 2008 18:10:10 +0000 Subject: Gallery vs list view, first commit git-svn-id: https://code.elgg.org/elgg/trunk@1212 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'engine/lib/elgglib.php') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 7b05ca9f6..aedfdb856 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -351,9 +351,10 @@ * @param int $offset The current indexing offset * @param int $limit The number of entities to display per page * @param true|false $fullview Whether or not to display the full view (default: true) + * @param string $viewtype "list" or "gallery" for search pages only (default: "list") * @return string The list of entities */ - function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true) { + function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtype = "list") { $count = (int) $count; $offset = (int) $offset; @@ -361,7 +362,23 @@ $html = ""; - $nav = elgg_view('navigation/pagination',array( + $context = get_context(); + + $nav = ""; + + if ($context == "search" && $count > 0) { + $viewtype = get_input('search_viewtype','list'); + $nav .= elgg_view("navigation/viewtype",array( + + 'baseurl' => $_SERVER['REQUEST_URI'], + 'offset' => $offset, + 'count' => $count, + 'viewtype' => $viewtype, + + )); + } + + $nav .= elgg_view('navigation/pagination',array( 'baseurl' => $_SERVER['REQUEST_URI'], 'offset' => $offset, @@ -370,11 +387,16 @@ )); $html .= $nav; - - if (is_array($entities) && sizeof($entities) > 0) { - foreach($entities as $entity) { - $html .= elgg_view_entity($entity, "", $fullview); + + if ($viewtype == "list") { + if (is_array($entities) && sizeof($entities) > 0) { + foreach($entities as $entity) { + $html .= elgg_view_entity($entity, "", $fullview); + } } + } else { + if (is_array($entities) && sizeof($entities) > 0) + $html .= elgg_view("navigation/gallery",array('entities' => $entities)); } if ($count) -- cgit v1.2.3