Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TCPDF.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * Piwik - free/libre analytics platform
  4. *
  5. * @link http://piwik.org
  6. * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
  7. *
  8. */
  9. namespace Piwik;
  10. use Exception;
  11. /**
  12. * @see libs/tcpdf/tcpdf.php
  13. */
  14. require_once PIWIK_INCLUDE_PATH . '/libs/tcpdf/tcpdf.php';
  15. /**
  16. * TCPDF class wrapper.
  17. *
  18. */
  19. class TCPDF extends \TCPDF
  20. {
  21. protected $footerContent = null;
  22. protected $currentPageNo = null;
  23. /**
  24. * Render page footer
  25. *
  26. * @see TCPDF::Footer()
  27. */
  28. function Footer()
  29. {
  30. //Don't show footer on the frontPage
  31. if ($this->currentPageNo > 1) {
  32. $this->SetY(-15);
  33. $this->SetFont($this->footer_font[0], $this->footer_font[1], $this->footer_font[2]);
  34. $this->Cell(0, 10, $this->footerContent . Piwik::translate('ScheduledReports_Pagination', array($this->getAliasNumPage(), $this->getAliasNbPages())), 0, false, 'C', 0, '', 0, false, 'T', 'M');
  35. }
  36. }
  37. /**
  38. * @see TCPDF::Error()
  39. * @param $msg
  40. * @throws Exception
  41. */
  42. function Error($msg)
  43. {
  44. $this->_destroy(true);
  45. throw new Exception($msg);
  46. }
  47. /**
  48. * Set current page number
  49. */
  50. function setCurrentPageNo()
  51. {
  52. if (empty($this->currentPageNo)) {
  53. $this->currentPageNo = 1;
  54. } else {
  55. $this->currentPageNo++;
  56. }
  57. }
  58. /**
  59. * Add page to document
  60. *
  61. * @see TCPDF::AddPage()
  62. *
  63. * @param string $orientation
  64. * @param mixed $format
  65. * @param bool $keepmargins
  66. * @param bool $tocpage
  67. */
  68. function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)
  69. {
  70. parent::AddPage($orientation);
  71. $this->setCurrentPageNo();
  72. }
  73. /**
  74. * Set footer content
  75. *
  76. * @param string $footerContent
  77. */
  78. function SetFooterContent($footerContent)
  79. {
  80. $this->footerContent = $footerContent;
  81. }
  82. }