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 +++++++++++++++++++----- languages/en.php | 4 +++ search/index.php | 2 +- views/default/css.php | 26 +++++++++++++++++++ views/default/navigation/gallery.php | 49 +++++++++++++++++++++++++++++++++++ views/default/navigation/viewtype.php | 34 ++++++++++++++++++++++++ 6 files changed, 142 insertions(+), 7 deletions(-) create mode 100644 views/default/navigation/gallery.php create mode 100644 views/default/navigation/viewtype.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) diff --git a/languages/en.php b/languages/en.php index b792b2fc5..a13476ae6 100644 --- a/languages/en.php +++ b/languages/en.php @@ -229,6 +229,10 @@ 'next' => "Next", 'previous' => "Previous", + 'viewtype:change' => "Change listing type", + 'viewtype:list' => "List view", + 'viewtype:gallery' => "Gallery", + /** * Account */ diff --git a/search/index.php b/search/index.php index 30ed459e8..0553879b2 100644 --- a/search/index.php +++ b/search/index.php @@ -33,7 +33,7 @@ } if (!empty($tag)) { - $body = elgg_view_title(elgg_echo('searchtitle'),$tag); + $body = elgg_view_title(sprintf(elgg_echo('searchtitle'),$tag)); $body .= list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid, 10, false); $body = elgg_view_layout('one_column',$body); } diff --git a/views/default/css.php b/views/default/css.php index 802a38e51..82fcc2597 100644 --- a/views/default/css.php +++ b/views/default/css.php @@ -959,6 +959,32 @@ p.user_menu_friends_of { .search_listing_info p { margin:0 0 3px 0; line-height:1.2em; +} + +.search_gallery_item { + border:1px dotted silver; + background-color: white; + width: 210px; + height: 200px; +} + +.search_gallery_item .search_listing { + background: none; + text-align: center; +} + +.search_gallery_item .search_listing_icon { + position: absolute; + margin-bottom: 20px; +} + +.search_gallery_item .search_listing_info { + margin: 5px; +} + +.search_gallery_item .search_listing_info p { + margin: 5px; + margin-bottom: 10px; } diff --git a/views/default/navigation/gallery.php b/views/default/navigation/gallery.php new file mode 100644 index 000000000..4c099e603 --- /dev/null +++ b/views/default/navigation/gallery.php @@ -0,0 +1,49 @@ + 0) { + +?> + + + +"; + + } + echo ""; + $col++; + if ($col > 4) { + echo ""; + $col = 0; + } + } + if ($col > 0) echo ""; + +?> + + + + \ No newline at end of file diff --git a/views/default/navigation/viewtype.php b/views/default/navigation/viewtype.php new file mode 100644 index 000000000..103e9c450 --- /dev/null +++ b/views/default/navigation/viewtype.php @@ -0,0 +1,34 @@ + + +

+ : + +

\ No newline at end of file -- cgit v1.2.3