Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR set Print flag correctly on TLF

MINOR custom print template for SSReport TLF's that exposes the report title, and filters set (from r97138) (from r98208)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@105852 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit d1101b0150dcd38828c2df94fea1f58c568f8e0c 1 parent 1bff281
@chillu chillu authored
Showing with 42 additions and 0 deletions.
  1. +16 −0 code/ReportAdmin.php
  2. +26 −0 templates/SSReportTableField_printable.ss
View
16 code/ReportAdmin.php
@@ -72,6 +72,22 @@ public function Reports() {
}
/**
+ * Get the current report
+ *
+ * @return SSReport
+ */
+ public function CurrentReport() {
+ $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentReport');
+
+ if($id) {
+ foreach($this->Reports() as $report) {
+ if($id == $report->ID()) return $report;
+ }
+ }
+ return false;
+ }
+
+ /**
* Return a Form instance with fields for the
* particular report currently viewed.
*
View
26 templates/SSReportTableField_printable.ss
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<% base_tag %>
+<title>Print</title>
+</head>
+
+<!-- <body onload="window.print();"> -->
+<body>
+ <% control Form.Controller %>
+ <h1 style="margin-bottom: 0">$CurrentReport.Title</h1>
+ <% control CurrentReport.getCmsFields %>
+ <% if Name == Filters %>
+ <h2 style="margin-bottom: 0; margin-top: 0;">Filters</h2>
+ <ul style="margin-top: 0">
+ <% control FieldSet %>
+ <li>$Title = $performReadonlyTransformation.Field</li>
+ <% end_control %>
+ </ul>
+ <% end_if %>
+ <% end_control %>
+ <% end_control %>
+ <% include TableListField %>
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.