mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX: SSF-168 fixing "print" and "export to CSV" button in Report Admin
This commit is contained in:
parent
3222e2de4f
commit
8df5cd74fc
@ -15,7 +15,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
static $url_segment = 'reports';
|
||||
|
||||
static $url_rule = '/$Action/$ID';
|
||||
static $url_rule = '/$ReportClass/$Action';
|
||||
|
||||
static $menu_title = 'Reports';
|
||||
|
||||
@ -23,6 +23,10 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
static $tree_class = 'SS_Report';
|
||||
|
||||
public static $url_handlers = array(
|
||||
'$ReportClass/$Action' => 'handleAction'
|
||||
);
|
||||
|
||||
/**
|
||||
* Variable that describes which report we are currently viewing based on the URL (gets set in init method)
|
||||
* @var String
|
||||
@ -35,7 +39,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
||||
parent::init();
|
||||
|
||||
//set the report we are currently viewing from the URL
|
||||
$this->reportClass = (isset($this->urlParams['ID'])) ? $this->urlParams['ID'] : null;
|
||||
$this->reportClass = (isset($this->urlParams['ReportClass'])) ? $this->urlParams['ReportClass'] : null;
|
||||
$allReports = SS_Report::get_reports();
|
||||
$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;
|
||||
|
||||
@ -118,6 +122,16 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the link to the report admin section, or the specific report that is currently displayed
|
||||
* @return String
|
||||
*/
|
||||
public function Link($action = null) {
|
||||
$link = parent::Link($action);
|
||||
if ($this->reportObject) $link = $this->reportObject->getLink($action);
|
||||
return $link;
|
||||
}
|
||||
|
||||
function providePermissions() {
|
||||
$title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
|
||||
return array(
|
||||
|
@ -134,8 +134,13 @@ class SS_Report extends ViewableData {
|
||||
return $this->dataClass;
|
||||
}
|
||||
|
||||
function getLink() {
|
||||
return 'admin/reports/show/' . $this->class;
|
||||
function getLink($action = null) {
|
||||
return Controller::join_links(
|
||||
'admin/reports/',
|
||||
"$this->class",
|
||||
'/', // trailing slash needed if $action is null!
|
||||
"$action"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user