rwestera, I know I'm replying to a months old post and you've probably switched to Drupal by now, but for anyone else trying to do this...
This seems to be horrendously underdocumented for something taking up a full tab in the CMS.
See http://api.silverstripe.org/2.4/cms/reports/SS_Report.html
If you use the code as documentation, then you have everything you need.
E.g. See cms/code/reports/BrokenLinksReport.php to see how to write a report. Search all php files for 'BrokenLinksReport' to see how it's utilised.
This report allows users to download a csv of all users in the newsletter group:
class UserReport extends SS_Report {
function title() {
return 'Users';
}
function sourceRecords($params, $sort, $limit) {
return DataObject::get(
"Member"
, "`Group`.`code`='newsletter'"
, $sort
, "inner join group_members on member.id = group_members.MemberId inner join `group` on group_members.GroupId = `group`.id"
, $limit
);
}
function columns() {
$fields = array(
'FirstName' => array(
'title' => 'First name'
)
, 'Surname' => array(
'title' => 'Surname'
)
, 'Email' => array(
'title' => 'Email'
)
);
return $fields;
}
}
To register a report in the CMS 'Reports' tab...
SS_Report::register('ReportAdmin', 'UserReport', -19);
I guess the number at the end determines the order they are shown in the menu.
I think...
SS_Report::register("SideReport", "SideReport_NameOfReport");
...is for reports that appear on the pages tab under 'Site Reports'.