From 9c3cfc97df8c91965fcec4ae380623cbcd74b150 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 4 Aug 2008 11:32:08 +0000 Subject: Hidden viewtype toggle on search. git-svn-id: https://code.elgg.org/elgg/trunk@1679 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 5 +++-- engine/lib/metadata.php | 5 +++-- search/index.php | 2 +- views/default/search/entity_list.php | 8 +++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 8fc1b3da9..6d61dfb9e 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -467,10 +467,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") + * @param true|false $viewtypetoggle Whether or not to allow users to toggle to gallery view * @return string The list of entities */ - function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtype = "list") { + function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtypetoggle = true) { $count = (int) $count; $offset = (int) $offset; @@ -486,6 +486,7 @@ 'baseurl' => $_SERVER['REQUEST_URI'], 'fullview' => $fullview, 'context' => $context, + 'viewtypetoggle' => $viewtypetoggle, 'viewtype' => get_input('search_viewtype','list'), )); diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 51b3c03d9..0bfbebd70 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -534,17 +534,18 @@ * @param string $entity_subtype The subtype of the entity * @param int $limit Number of entities to display per page * @param true|false $fullview Whether or not to display the full view (default: true) + * @param true|false $viewtypetoggle Whether or not to allow users to toggle to the gallery view * * @return string A list of entities suitable for display */ - function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true) { + function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true) { $offset = (int) get_input('offset'); $limit = (int) $limit; $count = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, true); $entities = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, false); - return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview); + return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle); } diff --git a/search/index.php b/search/index.php index 4d4d269ca..776f6cb89 100644 --- a/search/index.php +++ b/search/index.php @@ -37,7 +37,7 @@ $body .= elgg_view_title(sprintf(elgg_echo('searchtitle'),$tag)); $body .= trigger_plugin_hook('search','',$tag,""); $body .= elgg_view('search/startblurb',array('tag' => $tag)); - $body .= list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid, 10, false); + $body .= list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid, 10, false, false); $body = elgg_view_layout('one_column',$body); } diff --git a/views/default/search/entity_list.php b/views/default/search/entity_list.php index 4fc23c2ba..7f9018b2f 100644 --- a/views/default/search/entity_list.php +++ b/views/default/search/entity_list.php @@ -8,8 +8,14 @@ $baseurl = $vars['baseurl']; $context = $vars['context']; $viewtype = $vars['viewtype']; + + if (isset($vars['viewtypetoggle'])) { + $viewtypetoggle = $vars['viewtypetoggle']; + } else { + $viewtypetoggle = true; + } - if ($context == "search" && $count > 0) { + if ($context == "search" && $count > 0 && $viewtypetoggle) { $nav .= elgg_view("navigation/viewtype",array( 'baseurl' => $baseurl, -- cgit v1.2.3