diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-29 01:06:45 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-03-29 01:06:45 +0000 |
commit | e697c4de72672c43d49bfbcea7b4f8bc17ffc5fd (patch) | |
tree | 07e8dc35d554c27ce42cab273b43aba8f49f15c9 /mod | |
parent | 7d290fd28e4bdceb4b22007d16c07550bff078f7 (diff) | |
download | elgg-e697c4de72672c43d49bfbcea7b4f8bc17ffc5fd.tar.gz elgg-e697c4de72672c43d49bfbcea7b4f8bc17ffc5fd.tar.bz2 |
Fixes #3243 pulled in anirupdutta's patch with some modifications (moved tag search to its own page handler function)
git-svn-id: http://code.elgg.org/elgg/trunk@8874 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r-- | mod/groups/languages/en.php | 2 | ||||
-rw-r--r-- | mod/groups/lib/groups.php | 33 | ||||
-rw-r--r-- | mod/groups/start.php | 3 | ||||
-rw-r--r-- | mod/groups/views/default/groups/sidebar/find.php | 8 |
4 files changed, 44 insertions, 2 deletions
diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index b0c728b69..789a9efe8 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -58,6 +58,8 @@ $english = array( 'groups:viagroups' => "via groups", 'groups:group' => "Group", 'groups:search:tags' => "tag", + 'groups:search:title' => "Search for groups tagged with '%s'", + 'groups:search:none' => "No matching groups were found", 'groups:activity' => "Group activity", 'groups:enableactivity' => 'Enable group activity', diff --git a/mod/groups/lib/groups.php b/mod/groups/lib/groups.php index c0a8a9a94..ec75078eb 100644 --- a/mod/groups/lib/groups.php +++ b/mod/groups/lib/groups.php @@ -56,6 +56,39 @@ function groups_handle_all_page() { echo elgg_view_page(elgg_echo('groups:all'), $body); } +function groups_search_page() { + elgg_push_breadcrumb(elgg_echo('search')); + + $tag = get_input("tag"); + $title = elgg_echo('groups:search:title', array($tag)); + + // groups plugin saves tags as "interests" - see groups_fields_setup() in start.php + $params = array( + 'metadata_name' => 'interests', + 'metadata_value' => $tag, + 'types' => 'group', + 'full_view' => FALSE, + ); + $content = elgg_list_entities_from_metadata($params); + if (!$content) { + $content = elgg_echo('groups:search:none'); + } + + $sidebar = elgg_view('groups/sidebar/find'); + $sidebar .= elgg_view('groups/sidebar/featured'); + + $params = array( + 'content' => $content, + 'sidebar' => $sidebar, + 'filter' => false, + 'buttons' => false, + 'title' => $title, + ); + $body = elgg_view_layout('content', $params); + + echo elgg_view_page($title, $body); +} + /** * List owned groups */ diff --git a/mod/groups/start.php b/mod/groups/start.php index e04485bb2..4eaaa5a7b 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -181,6 +181,9 @@ function groups_page_handler($page) { case 'all': groups_handle_all_page(); break; + case 'search': + groups_search_page(); + break; case 'owner': groups_handle_owned_page(); break; diff --git a/mod/groups/views/default/groups/sidebar/find.php b/mod/groups/views/default/groups/sidebar/find.php index 181f437e3..c5c986759 100644 --- a/mod/groups/views/default/groups/sidebar/find.php +++ b/mod/groups/views/default/groups/sidebar/find.php @@ -4,7 +4,11 @@ * * @package ElggGroups */ -$url = elgg_get_site_url() . 'groups/world'; -$body = elgg_view_form('groups/search', array('action' => $url, 'method' => 'get')); +$url = elgg_get_site_url() . 'groups/search'; +$body = elgg_view_form('groups/search', array( + 'action' => $url, + 'method' => 'get', + 'disable_security' => true, +)); echo elgg_view_module('aside', elgg_echo('groups:searchtag'), $body); |