2013-01-17 01:27:14 +01:00
|
|
|
<?php
|
|
|
|
|
2016-07-22 01:32:32 +02:00
|
|
|
namespace SilverStripe\CMS\Reports;
|
|
|
|
|
2017-01-26 05:21:00 +01:00
|
|
|
use SilverStripe\CMS\Model\SiteTree;
|
2016-06-16 06:57:19 +02:00
|
|
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
|
|
|
use SilverStripe\ORM\DataObject;
|
2016-09-09 01:26:24 +02:00
|
|
|
use SilverStripe\Reports\Report;
|
2016-06-16 06:57:19 +02:00
|
|
|
|
2017-01-25 21:59:25 +01:00
|
|
|
class RecentlyEditedReport extends Report
|
|
|
|
{
|
|
|
|
|
|
|
|
public function title()
|
|
|
|
{
|
2017-05-08 07:57:24 +02:00
|
|
|
return _t(__CLASS__.'.LAST2WEEKS', "Pages edited in the last 2 weeks");
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function group()
|
|
|
|
{
|
2017-05-08 07:57:24 +02:00
|
|
|
return _t(__CLASS__.'.ContentGroupTitle', "Content reports");
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function sort()
|
|
|
|
{
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sourceRecords($params = null)
|
|
|
|
{
|
2019-05-17 03:40:15 +02:00
|
|
|
$tableName = DataObject::singleton(SiteTree::class)->baseTable();
|
2017-01-26 05:21:00 +01:00
|
|
|
$threshold = strtotime('-14 days', DBDatetime::now()->getTimestamp());
|
|
|
|
return SiteTree::get()
|
|
|
|
->filter('LastEdited:GreaterThan', date("Y-m-d H:i:s", $threshold))
|
2019-05-17 03:40:15 +02:00
|
|
|
->sort("\"$tableName\".\"LastEdited\" DESC");
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function columns()
|
|
|
|
{
|
2020-04-19 06:18:01 +02:00
|
|
|
return [
|
|
|
|
"Title" => [
|
2017-01-25 21:59:25 +01:00
|
|
|
"title" => "Title", // todo: use NestedTitle(2)
|
|
|
|
"link" => true,
|
2020-04-19 06:18:01 +02:00
|
|
|
],
|
|
|
|
];
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
2015-11-10 03:23:58 +01:00
|
|
|
}
|