Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Creating new Site Reports


Go to End


3 Posts   1609 Views

Avatar
cerelac

Community Member, 34 Posts

17 June 2008 at 4:54am

Edited: 17/06/2008 4:54am

Hi everyone.
I've read the tutorial about creating new site reports here and I've created the "All Pages" site report example.
I want to know is if it's possible to create custom site reports like "Pages edited in the last 2 weeks" but, instead of 2 weeks, I would like to have something like "Pages edited in the last 3 weeks" or "Pages edited in the last month".
Best regards.

Avatar
Willr

Forum Moderator, 5523 Posts

17 June 2008 at 10:47am

You can just copy the Pages edited in the last 2 weeks reports code and change the date or something. Assuming you have read the Tutorial and understand how to write your own report class etc your records() method would be

// get latest 3 weeks (21 days) of edits
function records() {
return DataObject::get("SiteTree", "`SiteTree`.LastEdited > NOW() - INTERVAL 21 DAY", "`SiteTree`.`LastEdited` DESC");
	}

Avatar
cerelac

Community Member, 34 Posts

21 June 2008 at 2:58am

Thanks willr.