5093 Posts in 1516 Topics by 1113 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1517 Views |
-
SS_Report and SideReport : how to?

6 June 2010 at 1:17am
I tried to create reports, but I don't see any of them.
class DBReport_AquistatiProducts extends SideReport {
function title() {
return "Prodotti Acquistati";
}
function records() {
return DataObject::get("Product", "Aquistato = 1", "Title");
}
function fieldsToShow() {
return array(
"Title" => array("NestedTitle", array("2")),
);
}
}and under mysite/code/reports
class CurrentOrdersReport extends SSReport {
...
}Is there a guideline?
Thank you -
Re: SS_Report and SideReport : how to?

6 June 2010 at 11:49am
In 2.3 these would appear automatically after doing a ?flush=1. In 2.4 you now have to register the reports you want to include in the cms via this line of code in your _config file.
SS_Report::register("SideReport", "SideReport_NameOfReport");
-
Re: SS_Report and SideReport : how to?

3 September 2010 at 6:04am
Hi Wilr,
I have a class that extends the SS_Report. And I have this module that saves the report in a PDF format, its called DOMPDF module. Now, the thing is I want to create a custom template to render the report. Is this possible? If it is indeed possible, how do I go through this?
Thanks in advance!
-
Re: SS_Report and SideReport : how to?

11 March 2011 at 12:13pm
And again - IS THERE A GUIDELINE?
This seems to be horrendously underdocumented for something taking up a full tab in the CMS.
The only tutorial I can find is http://doc.silverstripe.org/sapphire/en/reference/site-reports and that's completely out of date.So what needs to be done to add a report for 2.4?
And is it SideReport or SS_Report now? -
Re: SS_Report and SideReport : how to?

15 September 2011 at 4:29am Last edited: 15 September 2011 4:40am
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'. -
Re: SS_Report and SideReport : how to?

11 October 2011 at 10:44am
There is now an up to date tutorial for adding reports here: http://www.ssbits.com/tutorials/2011/adding-custom-filterable-reports-to-reportadmin/
Hope that helps
Aram
| 1517 Views | ||
|
Page:
1
|
Go to Top |




