$vars['area1'])); set_context('search'); if ($tag != "") $objects = list_entities_from_metadata('tags',$tag,'group',"","", $limit, false); else{ switch($filter){ case "newest": $objects = list_entities('group',"", 0, $limit, false); break; case "pop": $objects = list_entities_by_relationship_count('member', true, "", "", 0, 10, false); break; case "active": $objects = list_entities_from_annotations("object", "groupforumtopic", "group_topic_post", "", 40, 0, 0, false, true); break; case "bytitle": $tmp_objects = search_for_group("", $limit, $offset, "LOWER(g.name) COLLATE utf8_bin", false); $tmp_count = search_for_group("", $limit, $offset, "LOWER(g.name) COLLATE utf8_bin", true); $objects = elgg_view_entity_list($tmp_objects, $tmp_count, $offset, $limit, false, false, true); break; case "bytype": $bytypes = get_community_types(); $bytype_options = array(); foreach($bytypes as $btkey => $bttitle) { $bytype_options[$bttitle] = $btkey; } $bytype_type = get_input('type'); if (!($bytype_type && array_key_exists($bytype_type, $bytypes))) { $bytype_type = 'sg'; } $objects = "
"; $objects .= << jQuery(document).ready(function(){ jQuery('[name="group_type"]').change(function(){ var bytype_type = jQuery(this).val(); window.location = '{$CONFIG->wwwroot}pg/groups/world?filter=bytype&type='+bytype_type; }); }); EOT; $objects .= elgg_view('input/radio', array('internalname' => 'group_type', 'options' => $bytype_options, 'value' => $bytype_type)); $objects .= "
"; $objects .= list_entities_from_metadata("gtype", $bytype_type, "group", "", 0, $limit, false, false, true); break; case "search": $search_criteria = get_input('criteria'); $objects = "
"; $objects .= << jQuery(document).ready(function(){ jQuery('#search_groups').click(function(){ var search_criteria = jQuery('#search_criteria').val(); window.location = '{$CONFIG->wwwroot}pg/groups/world?filter=search&criteria='+search_criteria; }); }); EOT; /*translation:Search groups*/ $objects .= "
"; $objects .= elgg_view('input/text', array('internalname' => 'search_criteria', 'internalid' => 'search_criteria', 'value' => $search_criteria, 'class' => 'search_input')); $objects .= elgg_view('input/button', array('internalname' => 'search_groups', 'internalid' => 'search_groups', 'value' => elgg_echo('search:go'), 'type' => 'button')); $objects .= "
"; if ($search_criteria) { $tmp_count = search_for_group($search_criteria, $limit, $offset, "", true); $tmp_objects = search_for_group($search_criteria, $limit, $offset, false); $objects .= elgg_view_entity_list($tmp_objects, $tmp_count, $offset, $limit, false, false, true); } break; case 'default': $objects = list_entities('group',"", 0, $limit, false); break; } } //get a group count $group_count = get_entities("group", "", 0, "", 10, 0, true, 0, null); //find groups //$area1 = elgg_view("groups/find"); //menu options //$area1 .= elgg_view("groups/side_menu"); //featured groups //$featured_groups = get_entities_from_metadata("featured_group", "yes", "group", "", 0, 10, false, false, false); //$area1 .= elgg_view("groups/featured", array("featured" => $featured_groups)); set_context($context); $title = sprintf(elgg_echo("groups:all"),page_owner_entity()->name); $area2 = elgg_view_title($title); $area2 .= elgg_view('groups/contentwrapper', array('body' => elgg_view("groups/group_sort_menu", array("count" => $group_count, "filter" => $filter)) . $objects)); $body = elgg_view_layout('sidebar_boxes',$area1, $area2); // Finally draw the page page_draw($title, $body); ?>