mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Merge pull request #2 from sunnysideup/master
adding counts to report links
This commit is contained in:
commit
0759392980
@ -136,6 +136,7 @@ class SS_Report extends ViewableData {
|
|||||||
return $this->dataClass;
|
return $this->dataClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getLink($action = null) {
|
public function getLink($action = null) {
|
||||||
return Controller::join_links(
|
return Controller::join_links(
|
||||||
'admin/reports/',
|
'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
|
* 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
|
* @param $reportClass Can be either a string with the report classname or an array of reports classnames
|
||||||
|
@ -170,9 +170,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
'title' => _t('ReportAdmin.ReportTitle', 'Title'),
|
'title' => _t('ReportAdmin.ReportTitle', 'Title'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$columns->setFieldFormatting(array(
|
$columns->setFieldFormatting(array(
|
||||||
'title' => '<a href=\"$Link\" class=\"cms-panel-link\">$value</a>'
|
'title' => '<a href=\"$Link\" class=\"cms-panel-link\">$value ($Count)</a>'
|
||||||
));
|
));
|
||||||
$gridField->addExtraClass('all-reports-gridfield');
|
$gridField->addExtraClass('all-reports-gridfield');
|
||||||
$fields->push($gridField);
|
$fields->push($gridField);
|
||||||
}
|
}
|
||||||
@ -186,4 +186,4 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user