"ingroup", 'text' => elgg_echo('aga:ingroupactivities'), 'href' => "$handler/group/{$guid}/ingroup", 'selected' => $selected=='ingroup'?true:false, ); elgg_register_menu_item('filter', $tab); $tab = array( 'name' => "outgroup", 'text' => elgg_echo('aga:outgroupactivities'), 'href' => "$handler/group/{$guid}/outgroup", 'selected' => $selected=='outgroup'?true:false, ); elgg_register_menu_item('filter', $tab); if (($group->canEdit() || $group->aga_members_enable=='yes')&& (elgg_get_plugin_setting('aga_members','au_group_activity')!='no'|| elgg_is_admin_logged_in())){ $tab = array( 'name' => "members", 'text' => elgg_echo('aga:memberactivities'), 'href' => "$handler/group/{$guid}/members", 'selected' => $selected=='members'?true:false, ); elgg_register_menu_item('filter', $tab); } if (($group->canEdit() || $group->aga_stats_enable=='yes')&& (elgg_get_plugin_setting('aga_stats','au_group_activity')!='no'|| elgg_is_admin_logged_in())){ $tab = array( 'name' => "stats", 'text' => elgg_echo('aga:groupstats'), 'href' => "$handler/group/{$guid}/stats", 'selected' => $selected=='stats'?true:false, ); elgg_register_menu_item('filter', $tab); } } /** * main page handler */ function aga_page_handler($page,$handler) { if ($page[0] == 'group') { $guid=$page[1]; $db_prefix = elgg_get_config('dbprefix'); //username if ($page[3]){ $person=get_user_by_username($page[3]); if(elgg_instanceof($person,'user')){ $persons=array($person->guid); $membername = $person->name; } } $group = get_entity($guid); if (elgg_instanceof($group, 'group')) { $addtitle=""; switch ($page[2]) { case 'ingroup' : aga_tabs($handler,$guid,'ingroup'); $options['joins'] = array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"); $options['wheres']= array("e.container_guid = $guid"); $options['selected']='ingroup'; if ($persons){ $options['subject_guids'] = $persons; $addtitle=" (".elgg_echo('aga:member').": $membername)"; } $titlepart=elgg_echo('aga:ingroupactivities').$addtitle; //sort order, used by member stats page if($page[4]=='asc'){ $options['order_by']='rv.posted ASC'; } aga_handle_activity_page($group,$page[2],$options,$titlepart); break; case 'outgroup': aga_tabs($handler,$guid,'outgroup'); $id=$group->group_acl; $members = get_members_of_access_collection($id, TRUE); if (!$persons){ $options['subject_guids'] = $members; }else{ $options['subject_guids'] = $persons; $addtitle=" (".elgg_echo('aga:member').": $membername)"; } //sort order, used by member stats page if($page[4]=='asc'){ $options['order_by']='rv.posted ASC'; } $titlepart=elgg_echo('aga:outgroupactivities').$addtitle; $options['selected']='outgroup'; aga_handle_activity_page($group,$page[2],$options,$titlepart); break; case 'members': aga_tabs($handler,$guid,'members'); aga_handle_members_page($group,$page[3]); break; case 'stats': aga_tabs($handler,$guid,'stats'); aga_handle_stats_page($group); break; default: return false; } return true; }else{ //this is not an actual group - stop right here return false; } }else{ //it never even claimed to be a group so why are we even here? return false; } } //generate the activity listing tabs function aga_handle_activity_page($group,$page,$options,$titlepart){ //checking for filter $type = preg_replace('[\W]', '', get_input('type', 'all')); $subtype = preg_replace('[\W]', '', get_input('subtype', '')); if ($type != 'all') { $options['type'] = $type; if ($subtype) { $options['subtype'] = $subtype; } } if ($subtype) { $selector = "type=$type&subtype=$subtype"; } else { $selector = "type=$type"; } // now start building the page $content=""; $content .= elgg_view_module('info',elgg_echo('aga:note'),elgg_echo('aga:activitycaution')); elgg_set_page_owner_guid($group->guid); $title = $titlepart; elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); // this is where we actually build the list of content $content.= elgg_view('core/river/filter', array('selector' => $selector)); $options['pagination'] = true; $results = elgg_list_river($options); if ($results) { $content .= $results; }else{ $content .= '
' . elgg_echo('groups:activity:none') .'
'; } $params = array( 'filter_context' => 'aga', 'content' => $content, 'title' => $title, 'class' => 'elgg-river-layout', ); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); return true; } // generate the member stats page function aga_handle_members_page($group,$member){ //only show if enabled or is admin if (!(($group->canEdit() || $group->aga_members_enable=='yes')&& (elgg_get_plugin_setting('aga_members','au_group_activity')!='no'|| elgg_is_admin_logged_in()))){ forward(REFERER); } $group=elgg_get_page_owner_entity(); if (elgg_instanceof($group,'group')){ $title = elgg_echo('aga:membertitle', array($group->name)); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb(elgg_echo('aga:membertitle')); $content .= elgg_view_module('info',elgg_echo('aga:note'),elgg_echo('aga:membercaution')); $db_prefix = elgg_get_config('dbprefix'); //we want to show some stats for each user elgg_extend_view('user/default','au_group_activity/user_activity_link'); //set up basic options to display members $options=array( 'relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => 20, 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC', ); //allow filtering of names $chosenmembers=get_input('members'); if($chosenmembers){ $options['guids']=$chosenmembers; } //form to enter user details $formbody=""; $formbody.= elgg_view('input/userpicker', array( 'name' => 'members', 'internalid' => 'user_picker', 'value' => $chosenmembers )); $formbody.= elgg_view('input/hidden', array('name' => 'guid', 'value' => $group->guid)); $formbody.= elgg_view('input/submit', array('value' => elgg_echo('aga:filterbutton'))); $filtercontent.="".elgg_echo('aga:nummembers')." | ".aga_get_member_count($group)." |
".elgg_echo('aga:numposts')." | ".aga_get_post_count($group)." |
".elgg_echo('aga:generic_comment')." | ".aga_get_annotation_count($group,'generic_comment')." |
".elgg_echo('aga:group_topic_post')." | ".aga_get_annotation_count($group,'group_topic_post')." |
".elgg_echo('aga:first_post')." | ".aga_get_firstlast_post($group,'first')." |
".elgg_echo('aga:last_post')." | ".aga_get_firstlast_post($group,'last')." |
".elgg_echo('aga:perobjecttype')." | ".elgg_echo('aga:perobjecttypehelp')." |
{$objectNice} | {$count} |
".elgg_echo('aga:accesscount:in')." | ".$inacl." |
".elgg_echo('aga:accesscount:out')." | ".$outacl." |