2013-01-17 01:27:14 +01:00
|
|
|
<?php
|
|
|
|
|
2016-07-22 01:32:32 +02:00
|
|
|
namespace SilverStripe\CMS\Reports;
|
|
|
|
|
2017-11-01 04:33:16 +01:00
|
|
|
use SilverStripe\CMS\Model\RedirectorPage;
|
2016-07-22 01:32:32 +02:00
|
|
|
use SilverStripe\CMS\Model\SiteTree;
|
2017-11-01 05:19:04 +01:00
|
|
|
use SilverStripe\ORM\DataList;
|
2016-09-09 01:26:24 +02:00
|
|
|
use SilverStripe\Reports\Report;
|
2016-07-22 01:32:32 +02:00
|
|
|
|
2017-01-25 21:59:25 +01:00
|
|
|
class EmptyPagesReport extends Report
|
|
|
|
{
|
|
|
|
|
|
|
|
public function title()
|
|
|
|
{
|
2017-05-08 07:57:24 +02:00
|
|
|
return _t(__CLASS__.'.EMPTYPAGES', "Pages with no content");
|
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 100;
|
|
|
|
}
|
|
|
|
|
2017-11-01 05:19:04 +01:00
|
|
|
/**
|
|
|
|
* Gets the source records
|
|
|
|
*
|
|
|
|
* @param array $params
|
|
|
|
* @return DataList
|
|
|
|
*/
|
2017-01-25 21:59:25 +01:00
|
|
|
public function sourceRecords($params = null)
|
|
|
|
{
|
2017-11-01 04:33:16 +01:00
|
|
|
return SiteTree::get()
|
2017-11-01 05:19:04 +01:00
|
|
|
->exclude('ClassName', RedirectorPage::class)
|
|
|
|
->filter('Content', [null, '', '<p></p>', '<p> </p>'])
|
2017-11-01 04:33:16 +01:00
|
|
|
->sort('Title');
|
2017-01-25 21:59:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function columns()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
"Title" => array(
|
|
|
|
"title" => "Title", // todo: use NestedTitle(2)
|
|
|
|
"link" => true,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2015-11-10 03:23:58 +01:00
|
|
|
}
|