diff --git a/code/Report.php b/code/Report.php index 9d29f6ea..baa0c1f0 100644 --- a/code/Report.php +++ b/code/Report.php @@ -136,6 +136,7 @@ class SS_Report extends ViewableData { return $this->dataClass; } + public function getLink($action = null) { return Controller::join_links( 'admin/reports/', @@ -145,6 +146,21 @@ class SS_Report extends ViewableData { ); } + + /** + * counts the number of objects returned + * @param Array $params - any parameters for the sourceRecords + * @return Int + */ + public function getCount($params = array()){ + $sourceRecords = $this->sourceRecords($params, null, null); + if(!$sourceRecords instanceOf SS_List){ + user_error($this->class."::sourceRecords does not return an SS_List", E_USER_NOTICE); + return "-1"; + } + return $sourceRecords->count(); + } + /** * Exclude certain reports classes from the list of Reports in the CMS * @param $reportClass Can be either a string with the report classname or an array of reports classnames diff --git a/code/ReportAdmin.php b/code/ReportAdmin.php index 33a967a1..ae2fe8f9 100644 --- a/code/ReportAdmin.php +++ b/code/ReportAdmin.php @@ -170,9 +170,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { 'title' => _t('ReportAdmin.ReportTitle', 'Title'), )); - $columns->setFieldFormatting(array( - 'title' => '$value' - )); + $columns->setFieldFormatting(array( + 'title' => '$value ($Count)' + )); $gridField->addExtraClass('all-reports-gridfield'); $fields->push($gridField); } @@ -186,4 +186,4 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { return $form; } -} \ No newline at end of file +}