Skip to content
This repository
Browse code

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

…dmin
  • Loading branch information...
commit 8df5cd74fc3d610230057515dca05dea3c223d08 1 parent 3222e2d
Julian Seidenberg authored
18  code/controllers/ReportAdmin.php
@@ -15,7 +15,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
15 15
 	
16 16
 	static $url_segment = 'reports';
17 17
 	
18  
-	static $url_rule = '/$Action/$ID';
  18
+	static $url_rule = '/$ReportClass/$Action';
19 19
 	
20 20
 	static $menu_title = 'Reports';	
21 21
 	
@@ -23,6 +23,10 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
23 23
 	
24 24
 	static $tree_class = 'SS_Report';
25 25
 
  26
+	public static $url_handlers = array(
  27
+		'$ReportClass/$Action' => 'handleAction'
  28
+	);
  29
+
26 30
 	/**
27 31
 	 * Variable that describes which report we are currently viewing based on the URL (gets set in init method)
28 32
 	 * @var String
@@ -35,7 +39,7 @@ public function init() {
35 39
 		parent::init();
36 40
 
37 41
 		//set the report we are currently viewing from the URL
38  
-		$this->reportClass = (isset($this->urlParams['ID'])) ? $this->urlParams['ID'] : null;
  42
+		$this->reportClass = (isset($this->urlParams['ReportClass'])) ? $this->urlParams['ReportClass'] : null;
39 43
 		$allReports = SS_Report::get_reports();
40 44
 		$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;
41 45
 
@@ -118,6 +122,16 @@ public function Breadcrumbs() {
118 122
 		return $items;
119 123
 	}
120 124
 
  125
+	/**
  126
+	 * Returns the link to the report admin section, or the specific report that is currently displayed
  127
+	 * @return String
  128
+	 */
  129
+	public function Link($action = null) {
  130
+		$link = parent::Link($action);
  131
+		if ($this->reportObject) $link = $this->reportObject->getLink($action);
  132
+		return $link;
  133
+	}
  134
+
121 135
 	function providePermissions() {
122 136
 		$title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
123 137
 		return array(
9  code/reports/Report.php
@@ -134,8 +134,13 @@ function dataClass() {
134 134
 		return $this->dataClass;
135 135
 	}
136 136
 
137  
-	function getLink() {
138  
-		return 'admin/reports/show/' . $this->class;
  137
+	function getLink($action = null) {
  138
+		return Controller::join_links(
  139
+			'admin/reports/',
  140
+			"$this->class",
  141
+			'/', // trailing slash needed if $action is null!
  142
+			"$action"
  143
+		);
139 144
 	}
140 145
 
141 146
 

0 notes on commit 8df5cd7

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