Beispiel #1
0
function aga_handle_stats_page($group)
{
    //only show if enabled or is admin
    if (!(($group->canEdit() || $group->aga_stats_enable == 'yes') && (elgg_get_plugin_setting('aga_stats', 'au_group_activity') != 'no' || elgg_is_admin_logged_in()))) {
        forward(REFERER);
    }
    $title = elgg_echo('aga:groupstats', array($group->name));
    elgg_push_breadcrumb($group->name, $group->getURL());
    elgg_push_breadcrumb(elgg_echo('aga:groupstats'));
    $content = "";
    // Get entity statistics
    //first get array of possible objects
    $guid = $group->guid;
    $types = get_registered_entity_types('object');
    $content .= elgg_view_module('info', elgg_echo('aga:note'), elgg_echo('aga:statscaution'));
    // generate a table of stats
    $even_odd = "";
    $statscontent = "<table class=\"elgg-table-alt\">";
    //member count
    $statscontent .= "<tr class=\"odd\"><td>" . elgg_echo('aga:nummembers') . "</td><td>" . aga_get_member_count($group) . "</td></tr>";
    //post count
    $statscontent .= "<tr class=\"even\"><td>" . elgg_echo('aga:numposts') . "</td><td>" . aga_get_post_count($group) . "</td></tr>";
    //count comments and discussion replies
    $statscontent .= "<tr><td>" . elgg_echo('aga:generic_comment') . "</td><td>" . aga_get_annotation_count($group, 'generic_comment') . "</td></tr>";
    $statscontent .= "<tr><td>" . elgg_echo('aga:group_topic_post') . "</td><td>" . aga_get_annotation_count($group, 'group_topic_post') . "</td></tr>";
    //get first and most recent posts
    $statscontent .= "<tr class=\"odd\"><td>" . elgg_echo('aga:first_post') . "</td><td>" . aga_get_firstlast_post($group, 'first') . "</td></tr>";
    $statscontent .= "<tr class=\"even\"><td>" . elgg_echo('aga:last_post') . "</td><td>" . aga_get_firstlast_post($group, 'last') . "</td></tr>";
    // show per-object stats
    $statscontent .= "<tr><td><h4>" . elgg_echo('aga:perobjecttype') . "</h4></td><td>" . elgg_echo('aga:perobjecttypehelp') . "</td></tr>";
    foreach ($types as $k => $object) {
        //This function controls the alternating class
        $even_odd = 'odd' != $even_odd ? 'odd' : 'even';
        $count = aga_get_post_count($group, $object);
        $objectNice = elgg_echo("item:object:{$object}");
        $statscontent .= "<tr class=\"{$even_odd}\">\n\t\t\t\t\t<td>{$objectNice}</td>\n\t\t\t\t\t<td><a href=\"{$handler}ingroup?type=object&subtype={$object}\">{$count}</a></td>\n\t\t\t\t</tr> ";
    }
    /* trying to get things set with group acl but can't make it work yet
    	$inacl=aga_get_acl_count($group,'in');
    	$outacl=aga_get_acl_count($group,'out');
    	$content.="<tr><td>".elgg_echo('aga:accesscount:in')."</td><td>".$inacl."</td></tr>";
    	$content.="<tr><td>".elgg_echo('aga:accesscount:out')."</td><td>".$outacl."</td></tr>";
    	*/
    //end table
    $statscontent .= "</table>";
    $content .= elgg_view_module('aside', elgg_echo('aga:generalstats'), $statscontent);
    //show tags
    $content .= elgg_view_module('aside', elgg_echo('aga:populartags'), elgg_view_tagcloud(array('container_guid' => $guid, 'limit' => 500)));
    $params = array('filter_context' => 'aga', 'content' => $content, 'title' => $title);
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
echo "<div>";
echo elgg_echo('aga:joindate') . aga_group_join_date($group, $user);
echo "</div>";
echo "<div> ";
echo elgg_echo('aga:numposts');
echo elgg_view('output/url', array('text' => aga_get_post_count($group, '', $user), 'href' => "{$handler}/group/{$group->guid}/ingroup/{$user->username}"));
echo "</div>";
echo "<div> ";
echo elgg_echo('aga:generic_comment');
echo elgg_view('output/url', array('text' => aga_get_annotation_count($group, 'generic_comment', $user), 'href' => "{$handler}/group/{$group->guid}/ingroup/{$user->username}?type=object"));
echo "</div>";
echo "<div> ";
echo elgg_echo('aga:group_topic_post');
echo elgg_view('output/url', array('text' => aga_get_annotation_count($group, 'group_topic_post', $user), 'href' => "{$handler}/group/{$group->guid}/ingroup/{$user->username}?type=object&subtype=groupforumtopic"));
echo "</div>";
echo "<div> ";
echo elgg_echo('aga:first_post');
echo elgg_view('output/url', array('text' => aga_get_firstlast_post($group, 'first', $user), 'href' => "{$handler}/group/{$group->guid}/ingroup/{$user->username}/asc"));
echo "</div>";
echo "<div> ";
echo elgg_echo('aga:last_post');
echo elgg_view('output/url', array('text' => aga_get_firstlast_post($group, 'last', $user), 'href' => "{$handler}/group/{$group->guid}/ingroup/{$user->username}"));
echo "</div>";
echo "<div> ";
echo elgg_echo('aga:numpostsoverall');
echo elgg_view('output/url', array('text' => aga_get_post_count('', '', $user), 'href' => "{$handler}/group/{$group->guid}/outgroup/{$user->username}"));
echo "</div>";
echo "<div>";
echo elgg_echo('aga:last_postsite');
echo elgg_view('output/url', array('text' => aga_get_firstlast_post(0, 'last', $user), 'href' => "{$handler}/group/{$group->guid}/outgroup/{$user->username}"));
echo "</div>";