Fullscreen
Loading...
 
Skip to main content

Plugin DBReport with mPDF enhancement

Status
Open
Subject
Plugin DBReport with mPDF enhancement
Version
18.x
Category
  • Patch
Feature
PDF
Resolution status
New
Submitted by
Roni Wolf
Lastmod by
Roni Wolf
Rating
(0)
Description

Hi Devs!

My setup:

Tiki: 18.0
PHP: 7.0.32
Linux: CentOS 7
mPDF: v7.0.3

One feature that bothered me was the lack of repetition of the header in PLUGIN DBReport when generated in PDF (usually via PLUGIN LISTEXECUTE) in tables that were divided into more than one page.

Reading the mPDF documentationQuestion I discovered that the header line that was wrapped around the < thead> TAG is repeated on each page that the table is split.

Repeating Table Header row on new page

If a table is split onto more than one page, the first row of the table will be repeated at the top of the new page if < thead> or < tfoot> is defined


I changed the code in /lib/wiki-plugins/wikiplugin_dbreport.php file as the snippet below:

Copy to clipboard
615 public function header_row_html($data) 616 { 617 $html = ''; 618 // generate a new table 619 if (isset($this->style)) { 620 $html .= '<table' . $this->style->attributes() . '>' . "\n" . '<thead>' . "\n"; 621 } else { 622 $html .= '<table>' . "\n" . '<thead>' . "\n"; 623 } 624 // write headers 625 $style_index = 0; 626 if (isset($this->headers)) { 627 $html .= $this->line_row_html($this->headers, $data, true); 628 } 629 $html .= '</thead>'; NEW return $html; 630 }


After this change, all tables generated by PLUGIN DBReport that split on more than one page in the PDF file automatically repeats the header.

I believe that other PLUGINS that generate tables (like PLUGIN LIST, for example) can benefit from this functionality (thead TAG involving the header line).

I have helped in something.

Salutes from Brazil!

Importance
4
Easy to solve?
10 easy
Priority
40
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
6921
Created
Wednesday 14 November, 2018 20:58:36 UTC
by Roni Wolf
LastModif
Wednesday 14 November, 2018 20:58:36 UTC


Show PHP error messages