Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX: SSF-168 fixing "print" and "export to CSV" button in Report A…

…dmin
  • Loading branch information...
commit 8df5cd74fc3d610230057515dca05dea3c223d08 1 parent 3222e2d
@candidasa candidasa authored
Showing with 23 additions and 4 deletions.
  1. +16 −2 code/controllers/ReportAdmin.php
  2. +7 −2 code/reports/Report.php
View
18 code/controllers/ReportAdmin.php
@@ -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 @@ public function init() {
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 @@ public function Breadcrumbs() {
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(
View
9 code/reports/Report.php
@@ -134,8 +134,13 @@ function dataClass() {
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"
+ );
}

0 comments on commit 8df5cd7

Please sign in to comment.
Something went wrong with that request. Please try again.