cogDisplays the list of top most active contributors in a specified group for the past N days
Developed by

Marius Dumitru Florea

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

You can easily configure the group, the number of contributors to display and the period. Statistics have to be enabled and this code must be saved with programming rights to work because the search is done using protected API.

{{velocity}}
##
## Define the scope: $top most active contributors in $group
##
#set($group = "XWiki.XWikiAllGroup")
#set($top = 10)
#set($scope = "select prop.value from BaseObject obj, StringProperty prop where obj.className = 'XWiki.XWikiGroups' and obj.name = ? and prop.id.id = obj.id and prop.name = 'member'")
##
## Define the period: last $days days
##
#set($days = 7)
#set($period = $xwiki.criteriaService.periodFactory.createSinceDaysPeriod($days))
#set($startDate = $util.getDate($xwiki.criteriaService.periodFactory.createDayPeriod($period.start).start))
#set($endDate = $util.getDate($xwiki.criteriaService.periodFactory.createDayPeriod($period.end).end))
##
## Retrieve the stats.
##
#set($hql = "select vs.name, sum(vs.pageSaves) from VisitStats vs where ? <= vs.startDate and vs.endDate < ? and vs.pageSaves > 0 and vs.name in (${scope}) group by vs.name order by sum(vs.pageSaves) desc")
#set($stats = $context.xWiki.store.search($hql, $top, 0, [$startDate, $endDate, $group], $context.context))
##
## Display the stats.
##
|=User|=Edits
#foreach($stat in $stats)
|$stat.get(0)|(% style="text-align:right;" %)$stat.get(1)
#end
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags: statistics
Created by Marius Dumitru Florea on 2010/04/29 09:55
     

Get Connected