3 abstract class SideReport
extends Object {
4 abstract function records();
5 abstract function fieldsToShow();
6 abstract function title();
9 $records = $this->records();
10 $fieldsToShow = $this->fieldsToShow();
13 $result = "<ul class=\"$this->class\">\n";
15 foreach($records as $record) {
17 foreach($fieldsToShow as $fieldTitle => $fieldSource) {
18 $fieldName = ereg_replace('[^A-Za-z0-9]+','',$fieldTitle);
19 if(is_string($fieldSource)) {
20 $val = $record->$fieldSource;
22 $val = $record->val($fieldSource[0], $fieldSource[1]);
25 $result .= "<a class=\"$fieldName\" href=\"admin/show/$record->ID\">$val</a>";
27 $result .= "\n</li>\n";
31 $result = 'The '.$this->title().' report is empty.';
37 class SideReport_EmptyPages
extends SideReport
{
42 return DataObject
::get("SiteTree", "Content = '' OR Content IS NULL OR Content LIKE '<p></p>' OR Content LIKE '<p> </p>'", "Title");
44 function fieldsToShow() {
46 "Title" => array("NestedTitle", array("2")),
51 class SideReport_RecentlyEdited
extends SideReport
{
53 return "Pages edited in the last 2 weeks";
56 return DataObject
::get("SiteTree", "`SiteTree`.LastEdited > NOW() - INTERVAL 14 DAY", "`SiteTree`.`LastEdited` DESC");
58 function fieldsToShow() {
60 "Title" => array("NestedTitle", array("2")),