From c39cbbe58a5caa518a0a840e2b8a39ea368f1959 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 7 Oct 2008 05:32:09 +0000 Subject: [PATCH] ENHANCEMENT Added missing "abstract" Report class to compliment ReportAdmin. Currently it is unclear what abstract base class you're supposed to implement from. BUGFIX Use of getOwnerID() in ReportAdmin which doesn't make sense, since ID() is sufficient. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@63748 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/Report.php | 90 ++++++++++++++++++++++++++++++++++++++++++++ code/ReportAdmin.php | 2 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 code/Report.php diff --git a/code/Report.php b/code/Report.php new file mode 100644 index 00000000..330101f4 --- /dev/null +++ b/code/Report.php @@ -0,0 +1,90 @@ +{$this->title}"), + new LiteralField('ReportDescription', "

{$this->description}

"), + $this->getReportField() + ) + ) + ); + + $this->extend('augmentReportCMSFields', $fields); + + return $fields; + } + + /** + * Return a field, such as a {@link ComplexTableField} that is + * used to show and manipulate data relating to this report. + * + * For example, if this were an "Unprinted Orders" report, this + * field would return a table that shows all Orders with "Unprinted = 1". + * + * @return FormField subclass + */ + function getReportField() { + user_error('Please implement getReportField() on ' . $this->class, E_USER_ERROR); + } + + /** + * Return the name of this report, which + * is used by the templates to render the + * name of the report in the report tree, + * the left hand pane inside ReportAdmin. + * + * @return string + */ + function TreeTitle() { + return $this->title; + } + + /** + * Return the ID of this Report class. + * Because it doesn't have a number, we + * use the class name as the ID. + * + * @return string + */ + function ID() { + return $this->class; + } + +} + +?> \ No newline at end of file diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index fcf81c00..32259143 100755 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -134,7 +134,7 @@ class ReportAdmin extends LeftAndMain { foreach($subClasses as $subClass) { if($subClass != 'Report') { $obj = new $subClass(); - $ids[] = $obj->getOwnerID(); + $ids[] = $obj->ID(); } } }