]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3243 pulled in anirupdutta's patch with some modifications (moved tag search...
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 29 Mar 2011 01:06:45 +0000 (01:06 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 29 Mar 2011 01:06:45 +0000 (01:06 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8874 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/groups/languages/en.php
mod/groups/lib/groups.php
mod/groups/start.php
mod/groups/views/default/groups/sidebar/find.php

index b0c728b69ea6f79a8c5a31f36fb91bd798331547..789a9efe8f65e6306c26f304f4342d1f7d4fee16 100644 (file)
@@ -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',
index c0a8a9a94f91c99ad7b5263c22beb871c5aca9b0..ec75078eb199c057be69a49a09b08e7790a481c9 100644 (file)
@@ -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
  */
index e04485bb2f596998c594d77e34fb4f3e6760ad82..4eaaa5a7b077e82010ceb2ca7f0ff6df45d92cd0 100644 (file)
@@ -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;
index 181f437e3f67ffb41eaac08a51a3f3104c18d5d7..c5c98675987dedb54d82abaa2b0584770924b672 100644 (file)
@@ -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);