Passed
Push — 1.7 ( 23cbb7...8df8a8 )
by Greg
08:15
created
app/Report/ReportBaseImage.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -19,91 +19,91 @@
 block discarded – undo
19 19
  * Class ReportBaseImage
20 20
  */
21 21
 class ReportBaseImage extends ReportBaseElement {
22
-	/**
23
-	 * Filename of the image
24
-	 *
25
-	 * @var string
26
-	 */
27
-	public $file;
28
-	/**
29
-	 * Height of the image
30
-	 *
31
-	 * @var float
32
-	 */
33
-	public $height;
34
-	/**
35
-	 * Width of the image
36
-	 *
37
-	 * @var float
38
-	 */
39
-	public $width;
40
-	/**
41
-	 * X-position (left) of the image
42
-	 *
43
-	 * @var float
44
-	 */
45
-	public $x;
46
-	/**
47
-	 * Y-position (top) of the image
48
-	 *
49
-	 * @var float
50
-	 */
51
-	public $y;
52
-	/**
53
-	 * Placement fo the image. L: left, C:center, R:right
54
-	 *
55
-	 * @var string
56
-	 */
57
-	public $align = "";
58
-	/**
59
-	 * T:same line, N:next line
60
-	 *
61
-	 * @var string
62
-	 */
63
-	public $line = "";
22
+    /**
23
+     * Filename of the image
24
+     *
25
+     * @var string
26
+     */
27
+    public $file;
28
+    /**
29
+     * Height of the image
30
+     *
31
+     * @var float
32
+     */
33
+    public $height;
34
+    /**
35
+     * Width of the image
36
+     *
37
+     * @var float
38
+     */
39
+    public $width;
40
+    /**
41
+     * X-position (left) of the image
42
+     *
43
+     * @var float
44
+     */
45
+    public $x;
46
+    /**
47
+     * Y-position (top) of the image
48
+     *
49
+     * @var float
50
+     */
51
+    public $y;
52
+    /**
53
+     * Placement fo the image. L: left, C:center, R:right
54
+     *
55
+     * @var string
56
+     */
57
+    public $align = "";
58
+    /**
59
+     * T:same line, N:next line
60
+     *
61
+     * @var string
62
+     */
63
+    public $line = "";
64 64
 
65
-	/**
66
-	 * Image class function - Base
67
-	 *
68
-	 * @param string $file  Filename of the image
69
-	 * @param float  $x     X-position (left) of the image
70
-	 * @param float  $y     Y-position (top) of the image
71
-	 * @param float  $w     Width of the image
72
-	 * @param float  $h     Height of the image
73
-	 * @param string $align Placement of the image. L: left, C:center, R:right
74
-	 * @param string $ln    T:same line, N:next line
75
-	 */
76
-	public function __construct($file, $x, $y, $w, $h, $align, $ln) {
77
-		$this->file   = $file;
78
-		$this->width  = $w;
79
-		$this->height = $h;
80
-		$this->x      = $x;
81
-		$this->y      = $y;
82
-		$this->align  = $align;
83
-		$this->line   = $ln;
65
+    /**
66
+     * Image class function - Base
67
+     *
68
+     * @param string $file  Filename of the image
69
+     * @param float  $x     X-position (left) of the image
70
+     * @param float  $y     Y-position (top) of the image
71
+     * @param float  $w     Width of the image
72
+     * @param float  $h     Height of the image
73
+     * @param string $align Placement of the image. L: left, C:center, R:right
74
+     * @param string $ln    T:same line, N:next line
75
+     */
76
+    public function __construct($file, $x, $y, $w, $h, $align, $ln) {
77
+        $this->file   = $file;
78
+        $this->width  = $w;
79
+        $this->height = $h;
80
+        $this->x      = $x;
81
+        $this->y      = $y;
82
+        $this->align  = $align;
83
+        $this->line   = $ln;
84 84
 
85
-		return 0;
86
-	}
85
+        return 0;
86
+    }
87 87
 
88
-	/**
89
-	 * Get the height.
90
-	 *
91
-	 * @param $renderer
92
-	 *
93
-	 * @return float
94
-	 */
95
-	public function getHeight($renderer) {
96
-		return $this->height;
97
-	}
88
+    /**
89
+     * Get the height.
90
+     *
91
+     * @param $renderer
92
+     *
93
+     * @return float
94
+     */
95
+    public function getHeight($renderer) {
96
+        return $this->height;
97
+    }
98 98
 
99
-	/**
100
-	 * Get the width.
101
-	 *
102
-	 * @param $renderer
103
-	 *
104
-	 * @return float
105
-	 */
106
-	public function getWidth($renderer) {
107
-		return $this->width;
108
-	}
99
+    /**
100
+     * Get the width.
101
+     *
102
+     * @param $renderer
103
+     *
104
+     * @return float
105
+     */
106
+    public function getWidth($renderer) {
107
+        return $this->width;
108
+    }
109 109
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportBaseImage
20 20
  */
21
-class ReportBaseImage extends ReportBaseElement {
21
+class ReportBaseImage extends ReportBaseElement
22
+{
22 23
 	/**
23 24
 	 * Filename of the image
24 25
 	 *
@@ -73,7 +74,8 @@  discard block
 block discarded – undo
73 74
 	 * @param string $align Placement of the image. L: left, C:center, R:right
74 75
 	 * @param string $ln    T:same line, N:next line
75 76
 	 */
76
-	public function __construct($file, $x, $y, $w, $h, $align, $ln) {
77
+	public function __construct($file, $x, $y, $w, $h, $align, $ln)
78
+	{
77 79
 		$this->file   = $file;
78 80
 		$this->width  = $w;
79 81
 		$this->height = $h;
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
 	 *
93 95
 	 * @return float
94 96
 	 */
95
-	public function getHeight($renderer) {
97
+	public function getHeight($renderer)
98
+	{
96 99
 		return $this->height;
97 100
 	}
98 101
 
@@ -103,7 +106,8 @@  discard block
 block discarded – undo
103 106
 	 *
104 107
 	 * @return float
105 108
 	 */
106
-	public function getWidth($renderer) {
109
+	public function getWidth($renderer)
110
+	{
107 111
 		return $this->width;
108 112
 	}
109 113
 }
Please login to merge, or discard this patch.
app/Report/ReportPdfFootnote.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -19,140 +19,140 @@
 block discarded – undo
19 19
  * Class ReportPdfFootnote
20 20
  */
21 21
 class ReportPdfFootnote extends ReportBaseFootnote {
22
-	/**
23
-	 * PDF Footnotes number renderer
24
-	 *
25
-	 * @param ReportTcpdf $renderer
26
-	 */
27
-	public function render($renderer) {
28
-		$renderer->setCurrentStyle("footnotenum");
29
-		$renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name
30
-	}
22
+    /**
23
+     * PDF Footnotes number renderer
24
+     *
25
+     * @param ReportTcpdf $renderer
26
+     */
27
+    public function render($renderer) {
28
+        $renderer->setCurrentStyle("footnotenum");
29
+        $renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name
30
+    }
31 31
 
32
-	/**
33
-	 * Write the Footnote text
34
-	 * Uses style name "footnote" by default
35
-	 *
36
-	 * @param ReportTcpdf $pdf
37
-	 */
38
-	public function renderFootnote($pdf) {
39
-		if ($pdf->getCurrentStyle() != $this->styleName) {
40
-			$pdf->setCurrentStyle($this->styleName);
41
-		}
42
-		$temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text);
43
-		// Set the link to this y/page position
44
-		$pdf->SetLink($this->addlink, -1, -1);
45
-		// Print first the source number
46
-		// working
47
-		if ($pdf->getRTL()) {
48
-			$pdf->writeHTML("<span> ." . $this->num . "</span>", false, false, false, false, "");
49
-		} else {
50
-			$temptext = "<span>" . $this->num . ". </span>" . $temptext;
51
-		}
52
-		// underline «title» part of Source item
53
-		$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
54
-		$pdf->writeHTML($temptext, true, false, true, false, '');
55
-	}
32
+    /**
33
+     * Write the Footnote text
34
+     * Uses style name "footnote" by default
35
+     *
36
+     * @param ReportTcpdf $pdf
37
+     */
38
+    public function renderFootnote($pdf) {
39
+        if ($pdf->getCurrentStyle() != $this->styleName) {
40
+            $pdf->setCurrentStyle($this->styleName);
41
+        }
42
+        $temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text);
43
+        // Set the link to this y/page position
44
+        $pdf->SetLink($this->addlink, -1, -1);
45
+        // Print first the source number
46
+        // working
47
+        if ($pdf->getRTL()) {
48
+            $pdf->writeHTML("<span> ." . $this->num . "</span>", false, false, false, false, "");
49
+        } else {
50
+            $temptext = "<span>" . $this->num . ". </span>" . $temptext;
51
+        }
52
+        // underline «title» part of Source item
53
+        $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
54
+        $pdf->writeHTML($temptext, true, false, true, false, '');
55
+    }
56 56
 
57
-	/**
58
-	 * Returns the height in points of the Footnote element
59
-	 *
60
-	 * @param ReportTcpdf $renderer
61
-	 *
62
-	 * @return float $h
63
-	 */
64
-	public function getFootnoteHeight($renderer) {
65
-		return 0;
66
-	}
57
+    /**
58
+     * Returns the height in points of the Footnote element
59
+     *
60
+     * @param ReportTcpdf $renderer
61
+     *
62
+     * @return float $h
63
+     */
64
+    public function getFootnoteHeight($renderer) {
65
+        return 0;
66
+    }
67 67
 
68
-	/**
69
-	 * Splits the text into lines to fit into a giving cell
70
-	 * and returns the last lines width
71
-	 *
72
-	 * @param ReportTcpdf $pdf
73
-	 *
74
-	 * @return array
75
-	 */
76
-	public function getWidth($pdf) {
77
-		// Setup the style name, a font must be selected to calculate the width
78
-		$pdf->setCurrentStyle("footnotenum");
68
+    /**
69
+     * Splits the text into lines to fit into a giving cell
70
+     * and returns the last lines width
71
+     *
72
+     * @param ReportTcpdf $pdf
73
+     *
74
+     * @return array
75
+     */
76
+    public function getWidth($pdf) {
77
+        // Setup the style name, a font must be selected to calculate the width
78
+        $pdf->setCurrentStyle("footnotenum");
79 79
 
80
-		// Check for the largest font size in the box
81
-		$fsize = $pdf->getCurrentStyleHeight();
82
-		if ($fsize > $pdf->largestFontHeight) {
83
-			$pdf->largestFontHeight = $fsize;
84
-		}
80
+        // Check for the largest font size in the box
81
+        $fsize = $pdf->getCurrentStyleHeight();
82
+        if ($fsize > $pdf->largestFontHeight) {
83
+            $pdf->largestFontHeight = $fsize;
84
+        }
85 85
 
86
-		// Returns the Object if already numbered else false
87
-		if (empty($this->num)) {
88
-			$pdf->checkFootnote($this);
89
-		}
86
+        // Returns the Object if already numbered else false
87
+        if (empty($this->num)) {
88
+            $pdf->checkFootnote($this);
89
+        }
90 90
 
91
-		// Get the line width
92
-		$lw = ceil($pdf->GetStringWidth($this->numText));
93
-		// Line Feed counter - Number of lines in the text
94
-		$lfct = substr_count($this->numText, "\n") + 1;
95
-		// If there is still remaining wrap width...
96
-		if ($this->wrapWidthRemaining > 0) {
97
-			// Check with line counter too!
98
-			// but floor the $wrapWidthRemaining first to keep it bugfree!
99
-			$wrapWidthRemaining = (int) ($this->wrapWidthRemaining);
100
-			if ($lw >= $wrapWidthRemaining || $lfct > 1) {
101
-				$newtext = '';
102
-				$lines   = explode("\n", $this->numText);
103
-				// Go throught the text line by line
104
-				foreach ($lines as $line) {
105
-					// Line width in points
106
-					$lw = ceil($pdf->GetStringWidth($line));
107
-					// If the line has to be wraped
108
-					if ($lw >= $wrapWidthRemaining) {
109
-						$words    = explode(" ", $line);
110
-						$addspace = count($words);
111
-						$lw       = 0;
112
-						foreach ($words as $word) {
113
-							$addspace--;
114
-							$lw += ceil($pdf->GetStringWidth($word . " "));
115
-							if ($lw < $wrapWidthRemaining) {
116
-								$newtext .= $word;
117
-								if ($addspace != 0) {
118
-									$newtext .= " ";
119
-								}
120
-							} else {
121
-								$lw = $pdf->GetStringWidth($word . " ");
122
-								$newtext .= "\n$word";
123
-								if ($addspace != 0) {
124
-									$newtext .= " ";
125
-								}
126
-								// Reset the wrap width to the cell width
127
-								$wrapWidthRemaining = $this->wrapWidthCell;
128
-							}
129
-						}
130
-					} else {
131
-						$newtext .= $line;
132
-					}
133
-					// Check the Line Feed counter
134
-					if ($lfct > 1) {
135
-						// Add a new line feed as long as it’s not the last line
136
-						$newtext .= "\n";
137
-						// Reset the line width
138
-						$lw = 0;
139
-						// Reset the wrap width to the cell width
140
-						$wrapWidthRemaining = $this->wrapWidthCell;
141
-					}
142
-					$lfct--;
143
-				}
144
-				$this->numText = $newtext;
145
-				$lfct          = substr_count($this->numText, "\n");
91
+        // Get the line width
92
+        $lw = ceil($pdf->GetStringWidth($this->numText));
93
+        // Line Feed counter - Number of lines in the text
94
+        $lfct = substr_count($this->numText, "\n") + 1;
95
+        // If there is still remaining wrap width...
96
+        if ($this->wrapWidthRemaining > 0) {
97
+            // Check with line counter too!
98
+            // but floor the $wrapWidthRemaining first to keep it bugfree!
99
+            $wrapWidthRemaining = (int) ($this->wrapWidthRemaining);
100
+            if ($lw >= $wrapWidthRemaining || $lfct > 1) {
101
+                $newtext = '';
102
+                $lines   = explode("\n", $this->numText);
103
+                // Go throught the text line by line
104
+                foreach ($lines as $line) {
105
+                    // Line width in points
106
+                    $lw = ceil($pdf->GetStringWidth($line));
107
+                    // If the line has to be wraped
108
+                    if ($lw >= $wrapWidthRemaining) {
109
+                        $words    = explode(" ", $line);
110
+                        $addspace = count($words);
111
+                        $lw       = 0;
112
+                        foreach ($words as $word) {
113
+                            $addspace--;
114
+                            $lw += ceil($pdf->GetStringWidth($word . " "));
115
+                            if ($lw < $wrapWidthRemaining) {
116
+                                $newtext .= $word;
117
+                                if ($addspace != 0) {
118
+                                    $newtext .= " ";
119
+                                }
120
+                            } else {
121
+                                $lw = $pdf->GetStringWidth($word . " ");
122
+                                $newtext .= "\n$word";
123
+                                if ($addspace != 0) {
124
+                                    $newtext .= " ";
125
+                                }
126
+                                // Reset the wrap width to the cell width
127
+                                $wrapWidthRemaining = $this->wrapWidthCell;
128
+                            }
129
+                        }
130
+                    } else {
131
+                        $newtext .= $line;
132
+                    }
133
+                    // Check the Line Feed counter
134
+                    if ($lfct > 1) {
135
+                        // Add a new line feed as long as it’s not the last line
136
+                        $newtext .= "\n";
137
+                        // Reset the line width
138
+                        $lw = 0;
139
+                        // Reset the wrap width to the cell width
140
+                        $wrapWidthRemaining = $this->wrapWidthCell;
141
+                    }
142
+                    $lfct--;
143
+                }
144
+                $this->numText = $newtext;
145
+                $lfct          = substr_count($this->numText, "\n");
146 146
 
147
-				return array($lw, 1, $lfct);
148
-			}
149
-		}
150
-		$l    = 0;
151
-		$lfct = substr_count($this->numText, "\n");
152
-		if ($lfct > 0) {
153
-			$l = 2;
154
-		}
147
+                return array($lw, 1, $lfct);
148
+            }
149
+        }
150
+        $l    = 0;
151
+        $lfct = substr_count($this->numText, "\n");
152
+        if ($lfct > 0) {
153
+            $l = 2;
154
+        }
155 155
 
156
-		return array($lw, $l, $lfct);
157
-	}
156
+        return array($lw, $l, $lfct);
157
+    }
158 158
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportPdfFootnote
20 20
  */
21
-class ReportPdfFootnote extends ReportBaseFootnote {
21
+class ReportPdfFootnote extends ReportBaseFootnote
22
+{
22 23
 	/**
23 24
 	 * PDF Footnotes number renderer
24 25
 	 *
25 26
 	 * @param ReportTcpdf $renderer
26 27
 	 */
27
-	public function render($renderer) {
28
+	public function render($renderer)
29
+	{
28 30
 		$renderer->setCurrentStyle("footnotenum");
29 31
 		$renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name
30 32
 	}
@@ -35,7 +37,8 @@  discard block
 block discarded – undo
35 37
 	 *
36 38
 	 * @param ReportTcpdf $pdf
37 39
 	 */
38
-	public function renderFootnote($pdf) {
40
+	public function renderFootnote($pdf)
41
+	{
39 42
 		if ($pdf->getCurrentStyle() != $this->styleName) {
40 43
 			$pdf->setCurrentStyle($this->styleName);
41 44
 		}
@@ -61,7 +64,8 @@  discard block
 block discarded – undo
61 64
 	 *
62 65
 	 * @return float $h
63 66
 	 */
64
-	public function getFootnoteHeight($renderer) {
67
+	public function getFootnoteHeight($renderer)
68
+	{
65 69
 		return 0;
66 70
 	}
67 71
 
@@ -73,7 +77,8 @@  discard block
 block discarded – undo
73 77
 	 *
74 78
 	 * @return array
75 79
 	 */
76
-	public function getWidth($pdf) {
80
+	public function getWidth($pdf)
81
+	{
77 82
 		// Setup the style name, a font must be selected to calculate the width
78 83
 		$pdf->setCurrentStyle("footnotenum");
79 84
 
Please login to merge, or discard this patch.
app/Report/ReportPdfTextbox.php 2 patches
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -19,310 +19,310 @@
 block discarded – undo
19 19
  * Class ReportPdfTextbox
20 20
  */
21 21
 class ReportPdfTextbox extends ReportBaseTextbox {
22
-	/**
23
-	 * PDF Text Box renderer
24
-	 *
25
-	 * @param ReportTcpdf $renderer
26
-	 *
27
-	 * @return bool|int
28
-	 */
29
-	public function render($renderer) {
22
+    /**
23
+     * PDF Text Box renderer
24
+     *
25
+     * @param ReportTcpdf $renderer
26
+     *
27
+     * @return bool|int
28
+     */
29
+    public function render($renderer) {
30 30
 
31
-		$newelements      = array();
32
-		$lastelement      = "";
33
-		$footnote_element = array();
34
-		// Element counter
35
-		$cE = count($this->elements);
36
-		//-- collapse duplicate elements
37
-		for ($i = 0; $i < $cE; $i++) {
38
-			$element = $this->elements[$i];
39
-			if (is_object($element)) {
40
-				if ($element instanceof ReportBaseText) {
41
-					if (!empty($footnote_element)) {
42
-						ksort($footnote_element);
43
-						foreach ($footnote_element as $links) {
44
-							$newelements[] = $links;
45
-						}
46
-						$footnote_element = array();
47
-					}
48
-					if (empty($lastelement)) {
49
-						$lastelement = $element;
50
-					} else {
51
-						// Checking if the Text has the same style
52
-						if ($element->getStyleName() == $lastelement->getStyleName()) {
53
-							$lastelement->addText(str_replace("\n", "<br>", $element->getValue()));
54
-						} elseif (!empty($lastelement)) {
55
-							$newelements[] = $lastelement;
56
-							$lastelement   = $element;
57
-						}
58
-					}
59
-				} // Collect the Footnote links
60
-				elseif ($element instanceof ReportBaseFootnote) {
61
-					// Check if the Footnote has been set with it’s link number
62
-					$renderer->checkFootnote($element);
63
-					// Save first the last element if any
64
-					if (!empty($lastelement)) {
65
-						$newelements[] = $lastelement;
66
-						$lastelement   = array();
67
-					}
68
-					// Save the Footnote with it’s link number as key for sorting later
69
-					$footnote_element[$element->num] = $element;
70
-				} //-- do not keep empty footnotes
71
-				elseif (!($element instanceof ReportBaseFootnote) || trim($element->getValue()) != "") {
72
-					if (!empty($footnote_element)) {
73
-						ksort($footnote_element);
74
-						foreach ($footnote_element as $links) {
75
-							$newelements[] = $links;
76
-						}
77
-						$footnote_element = array();
78
-					}
79
-					if (!empty($lastelement)) {
80
-						$newelements[] = $lastelement;
81
-						$lastelement   = array();
82
-					}
83
-					$newelements[] = $element;
84
-				}
85
-			} else {
86
-				if (!empty($lastelement)) {
87
-					$newelements[] = $lastelement;
88
-					$lastelement   = array();
89
-				}
90
-				if (!empty($footnote_element)) {
91
-					ksort($footnote_element);
92
-					foreach ($footnote_element as $links) {
93
-						$newelements[] = $links;
94
-					}
95
-					$footnote_element = array();
96
-				}
97
-				$newelements[] = $element;
98
-			}
99
-		}
100
-		if (!empty($lastelement)) {
101
-			$newelements[] = $lastelement;
102
-		}
103
-		if (!empty($footnote_element)) {
104
-			ksort($footnote_element);
105
-			foreach ($footnote_element as $links) {
106
-				$newelements[] = $links;
107
-			}
108
-		}
109
-		$this->elements = $newelements;
110
-		unset($footnote_element, $lastelement, $links, $newelements);
31
+        $newelements      = array();
32
+        $lastelement      = "";
33
+        $footnote_element = array();
34
+        // Element counter
35
+        $cE = count($this->elements);
36
+        //-- collapse duplicate elements
37
+        for ($i = 0; $i < $cE; $i++) {
38
+            $element = $this->elements[$i];
39
+            if (is_object($element)) {
40
+                if ($element instanceof ReportBaseText) {
41
+                    if (!empty($footnote_element)) {
42
+                        ksort($footnote_element);
43
+                        foreach ($footnote_element as $links) {
44
+                            $newelements[] = $links;
45
+                        }
46
+                        $footnote_element = array();
47
+                    }
48
+                    if (empty($lastelement)) {
49
+                        $lastelement = $element;
50
+                    } else {
51
+                        // Checking if the Text has the same style
52
+                        if ($element->getStyleName() == $lastelement->getStyleName()) {
53
+                            $lastelement->addText(str_replace("\n", "<br>", $element->getValue()));
54
+                        } elseif (!empty($lastelement)) {
55
+                            $newelements[] = $lastelement;
56
+                            $lastelement   = $element;
57
+                        }
58
+                    }
59
+                } // Collect the Footnote links
60
+                elseif ($element instanceof ReportBaseFootnote) {
61
+                    // Check if the Footnote has been set with it’s link number
62
+                    $renderer->checkFootnote($element);
63
+                    // Save first the last element if any
64
+                    if (!empty($lastelement)) {
65
+                        $newelements[] = $lastelement;
66
+                        $lastelement   = array();
67
+                    }
68
+                    // Save the Footnote with it’s link number as key for sorting later
69
+                    $footnote_element[$element->num] = $element;
70
+                } //-- do not keep empty footnotes
71
+                elseif (!($element instanceof ReportBaseFootnote) || trim($element->getValue()) != "") {
72
+                    if (!empty($footnote_element)) {
73
+                        ksort($footnote_element);
74
+                        foreach ($footnote_element as $links) {
75
+                            $newelements[] = $links;
76
+                        }
77
+                        $footnote_element = array();
78
+                    }
79
+                    if (!empty($lastelement)) {
80
+                        $newelements[] = $lastelement;
81
+                        $lastelement   = array();
82
+                    }
83
+                    $newelements[] = $element;
84
+                }
85
+            } else {
86
+                if (!empty($lastelement)) {
87
+                    $newelements[] = $lastelement;
88
+                    $lastelement   = array();
89
+                }
90
+                if (!empty($footnote_element)) {
91
+                    ksort($footnote_element);
92
+                    foreach ($footnote_element as $links) {
93
+                        $newelements[] = $links;
94
+                    }
95
+                    $footnote_element = array();
96
+                }
97
+                $newelements[] = $element;
98
+            }
99
+        }
100
+        if (!empty($lastelement)) {
101
+            $newelements[] = $lastelement;
102
+        }
103
+        if (!empty($footnote_element)) {
104
+            ksort($footnote_element);
105
+            foreach ($footnote_element as $links) {
106
+                $newelements[] = $links;
107
+            }
108
+        }
109
+        $this->elements = $newelements;
110
+        unset($footnote_element, $lastelement, $links, $newelements);
111 111
 
112
-		// Used with line breaks and cell height calculation within this box
113
-		$renderer->largestFontHeight = 0;
112
+        // Used with line breaks and cell height calculation within this box
113
+        $renderer->largestFontHeight = 0;
114 114
 
115
-		// If current position (left)
116
-		if ($this->left == ".") {
117
-			$cX = $renderer->GetX();
118
-		} else {
119
-			// For static position add margin (returns and updates X)
120
-			$cX = $renderer->addMarginX($this->left);
121
-		}
115
+        // If current position (left)
116
+        if ($this->left == ".") {
117
+            $cX = $renderer->GetX();
118
+        } else {
119
+            // For static position add margin (returns and updates X)
120
+            $cX = $renderer->addMarginX($this->left);
121
+        }
122 122
 
123
-		// If current position (top)
124
-		if ($this->top == ".") {
125
-			$cY = $renderer->GetY();
126
-		} else {
127
-			$cY = $this->top;
128
-			$renderer->SetY($cY);
129
-		}
123
+        // If current position (top)
124
+        if ($this->top == ".") {
125
+            $cY = $renderer->GetY();
126
+        } else {
127
+            $cY = $this->top;
128
+            $renderer->SetY($cY);
129
+        }
130 130
 
131
-		// Check the width if set to page wide OR set by xml to larger then page width (margin)
132
-		if ($this->width == 0 || $this->width > $renderer->getRemainingWidthPDF()) {
133
-			$cW = $renderer->getRemainingWidthPDF();
134
-		} else {
135
-			$cW = $this->width;
136
-		}
131
+        // Check the width if set to page wide OR set by xml to larger then page width (margin)
132
+        if ($this->width == 0 || $this->width > $renderer->getRemainingWidthPDF()) {
133
+            $cW = $renderer->getRemainingWidthPDF();
134
+        } else {
135
+            $cW = $this->width;
136
+        }
137 137
 
138
-		// Save the original margins
139
-		$cM = $renderer->getMargins();
140
-		// Use cell padding to wrap the width
141
-		// Temp Width with cell padding
142
-		if (is_array($cM['cell'])) {
143
-			$cWT = $cW - ($cM['padding_left'] + $cM['padding_right']);
144
-		} else {
145
-			$cWT = $cW - ($cM['cell'] * 2);
146
-		}
147
-		// Element height (exept text)
148
-		$eH = 0;
149
-		$w  = 0;
150
-		// Temp Height
151
-		$cHT = 0;
152
-		//-- $lw is an array
153
-		// 0 => last line width
154
-		// 1 => 1 if text was wrapped, 0 if text did not wrap
155
-		// 2 => number of LF
156
-		$lw = array();
157
-		// Element counter
158
-		$cE = count($this->elements);
159
-		//-- calculate the text box height + width
160
-		for ($i = 0; $i < $cE; $i++) {
161
-			if (is_object($this->elements[$i])) {
162
-				$ew = $this->elements[$i]->setWrapWidth($cWT - $w, $cWT);
163
-				if ($ew == $cWT) {
164
-					$w = 0;
165
-				}
166
-				$lw = $this->elements[$i]->getWidth($renderer);
167
-				// Text is already gets the # LF
168
-				$cHT += $lw[2];
169
-				if ($lw[1] == 1) {
170
-					$w = $lw[0];
171
-				} elseif ($lw[1] == 2) {
172
-					$w = 0;
173
-				} else {
174
-					$w += $lw[0];
175
-				}
176
-				if ($w > $cWT) {
177
-					$w = $lw[0];
178
-				}
179
-				// Footnote is at the bottom of the page. No need to calculate it’s height or wrap the text!
180
-				// We are changing the margins anyway!
181
-				// For anything else but text (images), get the height
182
-				$eH += $this->elements[$i]->getHeight($renderer);
183
-			}
184
-		}
138
+        // Save the original margins
139
+        $cM = $renderer->getMargins();
140
+        // Use cell padding to wrap the width
141
+        // Temp Width with cell padding
142
+        if (is_array($cM['cell'])) {
143
+            $cWT = $cW - ($cM['padding_left'] + $cM['padding_right']);
144
+        } else {
145
+            $cWT = $cW - ($cM['cell'] * 2);
146
+        }
147
+        // Element height (exept text)
148
+        $eH = 0;
149
+        $w  = 0;
150
+        // Temp Height
151
+        $cHT = 0;
152
+        //-- $lw is an array
153
+        // 0 => last line width
154
+        // 1 => 1 if text was wrapped, 0 if text did not wrap
155
+        // 2 => number of LF
156
+        $lw = array();
157
+        // Element counter
158
+        $cE = count($this->elements);
159
+        //-- calculate the text box height + width
160
+        for ($i = 0; $i < $cE; $i++) {
161
+            if (is_object($this->elements[$i])) {
162
+                $ew = $this->elements[$i]->setWrapWidth($cWT - $w, $cWT);
163
+                if ($ew == $cWT) {
164
+                    $w = 0;
165
+                }
166
+                $lw = $this->elements[$i]->getWidth($renderer);
167
+                // Text is already gets the # LF
168
+                $cHT += $lw[2];
169
+                if ($lw[1] == 1) {
170
+                    $w = $lw[0];
171
+                } elseif ($lw[1] == 2) {
172
+                    $w = 0;
173
+                } else {
174
+                    $w += $lw[0];
175
+                }
176
+                if ($w > $cWT) {
177
+                    $w = $lw[0];
178
+                }
179
+                // Footnote is at the bottom of the page. No need to calculate it’s height or wrap the text!
180
+                // We are changing the margins anyway!
181
+                // For anything else but text (images), get the height
182
+                $eH += $this->elements[$i]->getHeight($renderer);
183
+            }
184
+        }
185 185
 
186
-		// Add up what’s the final height
187
-		$cH = $this->height;
188
-		// If any element exist
189
-		if ($cE > 0) {
190
-			// Check if this is text or some other element, like images
191
-			if ($eH == 0) {
192
-				// This is text elements. Number of LF but at least one line
193
-				$cHT = ($cHT + 1) * $renderer->getCellHeightRatio();
194
-				// Calculate the cell hight with the largest font size used within this Box
195
-				$cHT = $cHT * $renderer->largestFontHeight;
196
-				// Add cell padding
197
-				if ($this->padding) {
198
-					if (is_array($cM['cell'])) {
199
-						$cHT += ($cM['padding_bottom'] + $cM['padding_top']);
200
-					} else {
201
-						$cHT += ($cM['cell'] * 2);
202
-					}
203
-				}
204
-				if ($cH < $cHT) {
205
-					$cH = $cHT;
206
-				}
207
-			} // This is any other element
208
-			elseif ($cH < $eH) {
209
-				$cH = $eH;
210
-			}
211
-		}
212
-		// Finaly, check the last cells height
213
-		if ($cH < $renderer->lastCellHeight) {
214
-			$cH = $renderer->lastCellHeight;
215
-		}
216
-		// Add a new page if needed
217
-		if ($this->pagecheck) {
218
-			// Reset last cell height or Header/Footer will inherit it, in case of pagebreak
219
-			$renderer->lastCellHeight = 0;
220
-			if ($renderer->checkPageBreakPDF($cH)) {
221
-				$cY = $renderer->GetY();
222
-			}
223
-		}
186
+        // Add up what’s the final height
187
+        $cH = $this->height;
188
+        // If any element exist
189
+        if ($cE > 0) {
190
+            // Check if this is text or some other element, like images
191
+            if ($eH == 0) {
192
+                // This is text elements. Number of LF but at least one line
193
+                $cHT = ($cHT + 1) * $renderer->getCellHeightRatio();
194
+                // Calculate the cell hight with the largest font size used within this Box
195
+                $cHT = $cHT * $renderer->largestFontHeight;
196
+                // Add cell padding
197
+                if ($this->padding) {
198
+                    if (is_array($cM['cell'])) {
199
+                        $cHT += ($cM['padding_bottom'] + $cM['padding_top']);
200
+                    } else {
201
+                        $cHT += ($cM['cell'] * 2);
202
+                    }
203
+                }
204
+                if ($cH < $cHT) {
205
+                    $cH = $cHT;
206
+                }
207
+            } // This is any other element
208
+            elseif ($cH < $eH) {
209
+                $cH = $eH;
210
+            }
211
+        }
212
+        // Finaly, check the last cells height
213
+        if ($cH < $renderer->lastCellHeight) {
214
+            $cH = $renderer->lastCellHeight;
215
+        }
216
+        // Add a new page if needed
217
+        if ($this->pagecheck) {
218
+            // Reset last cell height or Header/Footer will inherit it, in case of pagebreak
219
+            $renderer->lastCellHeight = 0;
220
+            if ($renderer->checkPageBreakPDF($cH)) {
221
+                $cY = $renderer->GetY();
222
+            }
223
+        }
224 224
 
225
-		// Setup the border and background color
226
-		$cS = ""; // Class Style
227
-		if ($this->border) {
228
-			$cS = "D";
229
-		} // D or empty string: Draw (default)
230
-		$match = array();
231
-		// Fill the background
232
-		if ($this->fill) {
233
-			if (!empty($this->bgcolor)) {
234
-				if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) {
235
-					$cS .= "F"; // F: Fill the background
236
-					$r = hexdec($match[1]);
237
-					$g = hexdec($match[2]);
238
-					$b = hexdec($match[3]);
239
-					$renderer->SetFillColor($r, $g, $b);
240
-				}
241
-			}
242
-		}
243
-		// Clean up a bit
244
-		unset($lw, $w, $match, $cE, $eH);
245
-		// Draw the border
246
-		if (!empty($cS)) {
247
-			if (!$renderer->getRTL()) {
248
-				$cXM = $cX;
249
-			} else {
250
-				$cXM = ($renderer->getPageWidth()) - $cX - $cW;
251
-			}
252
-			$renderer->Rect($cXM, $cY, $cW, $cH, $cS);
253
-		}
254
-		// Add cell padding if set and if any text (element) exist
255
-		if ($this->padding) {
256
-			if ($cHT > 0) {
257
-				if (is_array($cM['cell'])) {
258
-					$renderer->SetY($cY + $cM['padding_top']);
259
-				} else {
260
-					$renderer->SetY($cY + $cM['cell']);
261
-				}
262
-			}
263
-		}
264
-		// Change the margins X, Width
265
-		if (!$renderer->getRTL()) {
266
-			if ($this->padding) {
267
-				if (is_array($cM['cell'])) {
268
-					$renderer->SetLeftMargin($cX + $cM['padding_left']);
269
-				} else {
270
-					$renderer->SetLeftMargin($cX + $cM['cell']);
271
-				}
272
-				$renderer->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']);
273
-			} else {
274
-				$renderer->SetLeftMargin($cX);
275
-				$renderer->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']);
276
-			}
277
-		} else {
278
-			if ($this->padding) {
279
-				if (is_array($cM['cell'])) {
280
-					$renderer->SetRightMargin($cX + $cM['padding_right']);
281
-				} else {
282
-					$renderer->SetRightMargin($cX + $cM['cell']);
283
-				}
284
-				$renderer->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']);
285
-			} else {
286
-				$renderer->SetRightMargin($cX);
287
-				$renderer->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']);
288
-			}
289
-		}
290
-		// Save the current page number
291
-		$cPN = $renderer->getPage();
225
+        // Setup the border and background color
226
+        $cS = ""; // Class Style
227
+        if ($this->border) {
228
+            $cS = "D";
229
+        } // D or empty string: Draw (default)
230
+        $match = array();
231
+        // Fill the background
232
+        if ($this->fill) {
233
+            if (!empty($this->bgcolor)) {
234
+                if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) {
235
+                    $cS .= "F"; // F: Fill the background
236
+                    $r = hexdec($match[1]);
237
+                    $g = hexdec($match[2]);
238
+                    $b = hexdec($match[3]);
239
+                    $renderer->SetFillColor($r, $g, $b);
240
+                }
241
+            }
242
+        }
243
+        // Clean up a bit
244
+        unset($lw, $w, $match, $cE, $eH);
245
+        // Draw the border
246
+        if (!empty($cS)) {
247
+            if (!$renderer->getRTL()) {
248
+                $cXM = $cX;
249
+            } else {
250
+                $cXM = ($renderer->getPageWidth()) - $cX - $cW;
251
+            }
252
+            $renderer->Rect($cXM, $cY, $cW, $cH, $cS);
253
+        }
254
+        // Add cell padding if set and if any text (element) exist
255
+        if ($this->padding) {
256
+            if ($cHT > 0) {
257
+                if (is_array($cM['cell'])) {
258
+                    $renderer->SetY($cY + $cM['padding_top']);
259
+                } else {
260
+                    $renderer->SetY($cY + $cM['cell']);
261
+                }
262
+            }
263
+        }
264
+        // Change the margins X, Width
265
+        if (!$renderer->getRTL()) {
266
+            if ($this->padding) {
267
+                if (is_array($cM['cell'])) {
268
+                    $renderer->SetLeftMargin($cX + $cM['padding_left']);
269
+                } else {
270
+                    $renderer->SetLeftMargin($cX + $cM['cell']);
271
+                }
272
+                $renderer->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']);
273
+            } else {
274
+                $renderer->SetLeftMargin($cX);
275
+                $renderer->SetRightMargin($renderer->getRemainingWidthPDF() - $cW + $cM['right']);
276
+            }
277
+        } else {
278
+            if ($this->padding) {
279
+                if (is_array($cM['cell'])) {
280
+                    $renderer->SetRightMargin($cX + $cM['padding_right']);
281
+                } else {
282
+                    $renderer->SetRightMargin($cX + $cM['cell']);
283
+                }
284
+                $renderer->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']);
285
+            } else {
286
+                $renderer->SetRightMargin($cX);
287
+                $renderer->SetLeftMargin($renderer->getRemainingWidthPDF() - $cW + $cM['left']);
288
+            }
289
+        }
290
+        // Save the current page number
291
+        $cPN = $renderer->getPage();
292 292
 
293
-		// Render the elements (write text, print picture...)
294
-		foreach ($this->elements as $element) {
295
-			if (is_object($element)) {
296
-				$element->render($renderer);
297
-			} elseif (is_string($element) && $element == 'footnotetexts') {
298
-				$renderer->footnotes();
299
-			} elseif (is_string($element) && $element == 'addpage') {
300
-				$renderer->newPage();
301
-			}
302
-		}
303
-		// Restore the margins
304
-		$renderer->SetLeftMargin($cM['left']);
305
-		$renderer->SetRightMargin($cM['right']);
293
+        // Render the elements (write text, print picture...)
294
+        foreach ($this->elements as $element) {
295
+            if (is_object($element)) {
296
+                $element->render($renderer);
297
+            } elseif (is_string($element) && $element == 'footnotetexts') {
298
+                $renderer->footnotes();
299
+            } elseif (is_string($element) && $element == 'addpage') {
300
+                $renderer->newPage();
301
+            }
302
+        }
303
+        // Restore the margins
304
+        $renderer->SetLeftMargin($cM['left']);
305
+        $renderer->SetRightMargin($cM['right']);
306 306
 
307
-		// This will be mostly used to trick the multiple images last height
308
-		if ($this->reseth) {
309
-			$cH = 0;
310
-			// This can only happen with multiple images and with pagebreak
311
-			if ($cPN != $renderer->getPage()) {
312
-				$renderer->setPage($cPN);
313
-			}
314
-		}
315
-		// New line and some clean up
316
-		if (!$this->newline) {
317
-			$renderer->SetXY(($cX + $cW), $cY);
318
-			$renderer->lastCellHeight = $cH;
319
-		} else {
320
-			// addMarginX() also updates X
321
-			$renderer->addMarginX(0);
322
-			$renderer->SetY($cY + $cH);
323
-			$renderer->lastCellHeight = 0;
324
-		}
307
+        // This will be mostly used to trick the multiple images last height
308
+        if ($this->reseth) {
309
+            $cH = 0;
310
+            // This can only happen with multiple images and with pagebreak
311
+            if ($cPN != $renderer->getPage()) {
312
+                $renderer->setPage($cPN);
313
+            }
314
+        }
315
+        // New line and some clean up
316
+        if (!$this->newline) {
317
+            $renderer->SetXY(($cX + $cW), $cY);
318
+            $renderer->lastCellHeight = $cH;
319
+        } else {
320
+            // addMarginX() also updates X
321
+            $renderer->addMarginX(0);
322
+            $renderer->SetY($cY + $cH);
323
+            $renderer->lastCellHeight = 0;
324
+        }
325 325
 
326
-		return true;
327
-	}
326
+        return true;
327
+    }
328 328
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportPdfTextbox
20 20
  */
21
-class ReportPdfTextbox extends ReportBaseTextbox {
21
+class ReportPdfTextbox extends ReportBaseTextbox
22
+{
22 23
 	/**
23 24
 	 * PDF Text Box renderer
24 25
 	 *
@@ -26,7 +27,8 @@  discard block
 block discarded – undo
26 27
 	 *
27 28
 	 * @return bool|int
28 29
 	 */
29
-	public function render($renderer) {
30
+	public function render($renderer)
31
+	{
30 32
 
31 33
 		$newelements      = array();
32 34
 		$lastelement      = "";
Please login to merge, or discard this patch.
app/Report/ReportHtmlPageheader.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
  * Class ReportHtmlPageheader
20 20
  */
21 21
 class ReportHtmlPageheader extends ReportBasePageheader {
22
-	/**
23
-	 * Render elements.
24
-	 *
25
-	 * @param ReportHtml $renderer
26
-	 */
27
-	public function render($renderer) {
28
-		$renderer->clearPageHeader();
29
-		foreach ($this->elements as $element) {
30
-			$renderer->addPageHeader($element);
31
-		}
32
-	}
22
+    /**
23
+     * Render elements.
24
+     *
25
+     * @param ReportHtml $renderer
26
+     */
27
+    public function render($renderer) {
28
+        $renderer->clearPageHeader();
29
+        foreach ($this->elements as $element) {
30
+            $renderer->addPageHeader($element);
31
+        }
32
+    }
33 33
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@
 block discarded – undo
18 18
 /**
19 19
  * Class ReportHtmlPageheader
20 20
  */
21
-class ReportHtmlPageheader extends ReportBasePageheader {
21
+class ReportHtmlPageheader extends ReportBasePageheader
22
+{
22 23
 	/**
23 24
 	 * Render elements.
24 25
 	 *
25 26
 	 * @param ReportHtml $renderer
26 27
 	 */
27
-	public function render($renderer) {
28
+	public function render($renderer)
29
+	{
28 30
 		$renderer->clearPageHeader();
29 31
 		foreach ($this->elements as $element) {
30 32
 			$renderer->addPageHeader($element);
Please login to merge, or discard this patch.
app/Report/ReportHtmlImage.php 3 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -19,69 +19,69 @@
 block discarded – undo
19 19
  * Class ReportHtmlImage
20 20
  */
21 21
 class ReportHtmlImage extends ReportBaseImage {
22
-	/**
23
-	 * Image renderer
24
-	 *
25
-	 * @param ReportHtml $renderer
26
-	 */
27
-	public function render($renderer) {
28
-		global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
22
+    /**
23
+     * Image renderer
24
+     *
25
+     * @param ReportHtml $renderer
26
+     */
27
+    public function render($renderer) {
28
+        global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
29 29
 
30
-		// Get the current positions
31
-		if ($this->x == ".") {
32
-			$this->x = $renderer->getX();
33
-		}
34
-		if ($this->y == ".") {
35
-			//-- first check for a collision with the last picture
36
-			if (isset($lastpicbottom)) {
37
-				if (($renderer->pageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->getY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)) {
38
-					$renderer->setY($lastpicbottom + ($renderer->cPadding * 2));
39
-				}
40
-			}
41
-			$this->y = $renderer->getY();
42
-		}
30
+        // Get the current positions
31
+        if ($this->x == ".") {
32
+            $this->x = $renderer->getX();
33
+        }
34
+        if ($this->y == ".") {
35
+            //-- first check for a collision with the last picture
36
+            if (isset($lastpicbottom)) {
37
+                if (($renderer->pageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->getY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)) {
38
+                    $renderer->setY($lastpicbottom + ($renderer->cPadding * 2));
39
+                }
40
+            }
41
+            $this->y = $renderer->getY();
42
+        }
43 43
 
44
-		// Image alignment
45
-		switch ($this->align) {
46
-		case "L":
47
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
49
-			break;
50
-		case "C":
51
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
53
-			break;
54
-		case "R":
55
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
57
-			break;
58
-		default:
59
-			echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
60
-		}
44
+        // Image alignment
45
+        switch ($this->align) {
46
+        case "L":
47
+            echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
+            echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
49
+            break;
50
+        case "C":
51
+            echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
+            echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
53
+            break;
54
+        case "R":
55
+            echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
+            echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
57
+            break;
58
+        default:
59
+            echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
60
+        }
61 61
 
62
-		$lastpicpage   = $renderer->pageNo();
63
-		$lastpicleft   = $this->x;
64
-		$lastpicright  = $this->x + $this->width;
65
-		$lastpicbottom = $this->y + $this->height;
66
-		// Setup for the next line
67
-		if ($this->line == "N") {
68
-			$renderer->setY($lastpicbottom);
69
-		}
70
-		// Keep max Y updated
71
-		$renderer->addMaxY($lastpicbottom);
72
-	}
62
+        $lastpicpage   = $renderer->pageNo();
63
+        $lastpicleft   = $this->x;
64
+        $lastpicright  = $this->x + $this->width;
65
+        $lastpicbottom = $this->y + $this->height;
66
+        // Setup for the next line
67
+        if ($this->line == "N") {
68
+            $renderer->setY($lastpicbottom);
69
+        }
70
+        // Keep max Y updated
71
+        $renderer->addMaxY($lastpicbottom);
72
+    }
73 73
 
74
-	/**
75
-	 * Get the image height
76
-	 * This would be called from the TextBox only for multiple images
77
-	 * so we add a bit bottom space between the images
78
-	 *
79
-	 * @param ReportHtml $html
80
-	 *
81
-	 * @return float
82
-	 */
83
-	public function getHeight($html) {
84
-		return $this->height + ($html->cPadding * 2);
85
-	}
74
+    /**
75
+     * Get the image height
76
+     * This would be called from the TextBox only for multiple images
77
+     * so we add a bit bottom space between the images
78
+     *
79
+     * @param ReportHtml $html
80
+     *
81
+     * @return float
82
+     */
83
+    public function getHeight($html) {
84
+        return $this->height + ($html->cPadding * 2);
85
+    }
86 86
 
87 87
 }
Please login to merge, or discard this patch.
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,20 +43,20 @@
 block discarded – undo
43 43
 
44 44
 		// Image alignment
45 45
 		switch ($this->align) {
46
-		case "L":
47
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
49
-			break;
50
-		case "C":
51
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
53
-			break;
54
-		case "R":
55
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
57
-			break;
58
-		default:
59
-			echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
46
+		    case "L":
47
+			    echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
+			    echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
49
+			    break;
50
+		    case "C":
51
+			    echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
+			    echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
53
+			    break;
54
+		    case "R":
55
+			    echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
+			    echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
57
+			    break;
58
+		    default:
59
+			    echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
60 60
 		}
61 61
 
62 62
 		$lastpicpage   = $renderer->pageNo();
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportHtmlImage
20 20
  */
21
-class ReportHtmlImage extends ReportBaseImage {
21
+class ReportHtmlImage extends ReportBaseImage
22
+{
22 23
 	/**
23 24
 	 * Image renderer
24 25
 	 *
25 26
 	 * @param ReportHtml $renderer
26 27
 	 */
27
-	public function render($renderer) {
28
+	public function render($renderer)
29
+	{
28 30
 		global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
29 31
 
30 32
 		// Get the current positions
@@ -80,7 +82,8 @@  discard block
 block discarded – undo
80 82
 	 *
81 83
 	 * @return float
82 84
 	 */
83
-	public function getHeight($html) {
85
+	public function getHeight($html)
86
+	{
84 87
 		return $this->height + ($html->cPadding * 2);
85 88
 	}
86 89
 
Please login to merge, or discard this patch.
app/Report/ReportParserBase.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -19,73 +19,73 @@
 block discarded – undo
19 19
  * Class ReportParserBase
20 20
  */
21 21
 class ReportParserBase {
22
-	/** @var resource The XML parser */
23
-	protected $xml_parser;
22
+    /** @var resource The XML parser */
23
+    protected $xml_parser;
24 24
 
25
-	/** @var string Text contents of tags */
26
-	protected $text = '';
25
+    /** @var string Text contents of tags */
26
+    protected $text = '';
27 27
 
28
-	/**
29
-	 * Create a parser for a report
30
-	 *
31
-	 * @param string     $report     The XML filename
32
-	 * @param ReportBase $report_root
33
-	 * @param string[][] $vars
34
-	 */
35
-	public function __construct($report, ReportBase $report_root = null, $vars = array()) {
36
-		$this->xml_parser = xml_parser_create();
37
-		xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false);
38
-		xml_set_element_handler($this->xml_parser, array($this, 'startElement'), array($this, 'endElement'));
39
-		xml_set_character_data_handler($this->xml_parser, array($this, 'characterData'));
28
+    /**
29
+     * Create a parser for a report
30
+     *
31
+     * @param string     $report     The XML filename
32
+     * @param ReportBase $report_root
33
+     * @param string[][] $vars
34
+     */
35
+    public function __construct($report, ReportBase $report_root = null, $vars = array()) {
36
+        $this->xml_parser = xml_parser_create();
37
+        xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false);
38
+        xml_set_element_handler($this->xml_parser, array($this, 'startElement'), array($this, 'endElement'));
39
+        xml_set_character_data_handler($this->xml_parser, array($this, 'characterData'));
40 40
 
41
-		$fp = fopen($report, 'r');
42
-		while (($data = fread($fp, 4096))) {
43
-			if (!xml_parse($this->xml_parser, $data, feof($fp))) {
44
-				throw new \DomainException(sprintf(
45
-					'XML error: %s at line %d',
46
-					xml_error_string(xml_get_error_code($this->xml_parser)),
47
-					xml_get_current_line_number($this->xml_parser)
48
-				));
49
-			}
50
-		}
41
+        $fp = fopen($report, 'r');
42
+        while (($data = fread($fp, 4096))) {
43
+            if (!xml_parse($this->xml_parser, $data, feof($fp))) {
44
+                throw new \DomainException(sprintf(
45
+                    'XML error: %s at line %d',
46
+                    xml_error_string(xml_get_error_code($this->xml_parser)),
47
+                    xml_get_current_line_number($this->xml_parser)
48
+                ));
49
+            }
50
+        }
51 51
 
52
-		xml_parser_free($this->xml_parser);
53
-	}
52
+        xml_parser_free($this->xml_parser);
53
+    }
54 54
 
55
-	/**
56
-	 * XML handler for an opening (or self-closing) tag.
57
-	 *
58
-	 * @param resource $parser The resource handler for the xml parser
59
-	 * @param string   $name   The name of the xml element parsed
60
-	 * @param string[] $attrs  An array of key value pairs for the attributes
61
-	 */
62
-	protected function startElement($parser, $name, $attrs) {
63
-		$method = $name . 'StartHandler';
64
-		if (method_exists($this, $method)) {
65
-			$this->$method($attrs);
66
-		}
67
-	}
55
+    /**
56
+     * XML handler for an opening (or self-closing) tag.
57
+     *
58
+     * @param resource $parser The resource handler for the xml parser
59
+     * @param string   $name   The name of the xml element parsed
60
+     * @param string[] $attrs  An array of key value pairs for the attributes
61
+     */
62
+    protected function startElement($parser, $name, $attrs) {
63
+        $method = $name . 'StartHandler';
64
+        if (method_exists($this, $method)) {
65
+            $this->$method($attrs);
66
+        }
67
+    }
68 68
 
69
-	/**
70
-	 * XML handler for a closing tag.
71
-	 *
72
-	 * @param resource $parser the resource handler for the xml parser
73
-	 * @param string $name the name of the xml element parsed
74
-	 */
75
-	protected function endElement($parser, $name) {
76
-		$method = $name . 'EndHandler';
77
-		if (method_exists($this, $method)) {
78
-			$this->$method();
79
-		}
80
-	}
69
+    /**
70
+     * XML handler for a closing tag.
71
+     *
72
+     * @param resource $parser the resource handler for the xml parser
73
+     * @param string $name the name of the xml element parsed
74
+     */
75
+    protected function endElement($parser, $name) {
76
+        $method = $name . 'EndHandler';
77
+        if (method_exists($this, $method)) {
78
+            $this->$method();
79
+        }
80
+    }
81 81
 
82
-	/**
83
-	 * XML handler for character data.
84
-	 *
85
-	 * @param resource $parser The resource handler for the xml parser
86
-	 * @param string   $data   The name of the xml element parsed
87
-	 */
88
-	protected function characterData($parser, $data) {
89
-		$this->text .= $data;
90
-	}
82
+    /**
83
+     * XML handler for character data.
84
+     *
85
+     * @param resource $parser The resource handler for the xml parser
86
+     * @param string   $data   The name of the xml element parsed
87
+     */
88
+    protected function characterData($parser, $data) {
89
+        $this->text .= $data;
90
+    }
91 91
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportParserBase
20 20
  */
21
-class ReportParserBase {
21
+class ReportParserBase
22
+{
22 23
 	/** @var resource The XML parser */
23 24
 	protected $xml_parser;
24 25
 
@@ -32,7 +33,8 @@  discard block
 block discarded – undo
32 33
 	 * @param ReportBase $report_root
33 34
 	 * @param string[][] $vars
34 35
 	 */
35
-	public function __construct($report, ReportBase $report_root = null, $vars = array()) {
36
+	public function __construct($report, ReportBase $report_root = null, $vars = array())
37
+	{
36 38
 		$this->xml_parser = xml_parser_create();
37 39
 		xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, false);
38 40
 		xml_set_element_handler($this->xml_parser, array($this, 'startElement'), array($this, 'endElement'));
@@ -59,7 +61,8 @@  discard block
 block discarded – undo
59 61
 	 * @param string   $name   The name of the xml element parsed
60 62
 	 * @param string[] $attrs  An array of key value pairs for the attributes
61 63
 	 */
62
-	protected function startElement($parser, $name, $attrs) {
64
+	protected function startElement($parser, $name, $attrs)
65
+	{
63 66
 		$method = $name . 'StartHandler';
64 67
 		if (method_exists($this, $method)) {
65 68
 			$this->$method($attrs);
@@ -72,7 +75,8 @@  discard block
 block discarded – undo
72 75
 	 * @param resource $parser the resource handler for the xml parser
73 76
 	 * @param string $name the name of the xml element parsed
74 77
 	 */
75
-	protected function endElement($parser, $name) {
78
+	protected function endElement($parser, $name)
79
+	{
76 80
 		$method = $name . 'EndHandler';
77 81
 		if (method_exists($this, $method)) {
78 82
 			$this->$method();
@@ -85,7 +89,8 @@  discard block
 block discarded – undo
85 89
 	 * @param resource $parser The resource handler for the xml parser
86 90
 	 * @param string   $data   The name of the xml element parsed
87 91
 	 */
88
-	protected function characterData($parser, $data) {
92
+	protected function characterData($parser, $data)
93
+	{
89 94
 		$this->text .= $data;
90 95
 	}
91 96
 }
Please login to merge, or discard this patch.
app/Report/ReportHtml.php 2 patches
Indentation   +712 added lines, -712 removed lines patch added patch discarded remove patch
@@ -24,717 +24,717 @@
 block discarded – undo
24 24
  * Class ReportHtml
25 25
  */
26 26
 class ReportHtml extends ReportBase {
27
-	/**
28
-	 * Cell padding
29
-	 *
30
-	 * @var int
31
-	 */
32
-	public $cPadding = 2;
33
-
34
-	/**
35
-	 * Cell height ratio
36
-	 *
37
-	 * @var float
38
-	 */
39
-	public $cellHeightRatio = 1.8;
40
-
41
-	/**
42
-	 * Current horizontal position
43
-	 *
44
-	 * @var float
45
-	 */
46
-	public $X = 0.0;
47
-
48
-	/**
49
-	 * Current vertical position
50
-	 *
51
-	 * @var float
52
-	 */
53
-	public $Y = 0.0;
54
-
55
-	/**
56
-	 * Currently used style name
57
-	 *
58
-	 * @var string
59
-	 */
60
-	public $currentStyle = '';
61
-
62
-	/**
63
-	 * Page number counter
64
-	 *
65
-	 * @var int
66
-	 */
67
-	public $pageN = 1;
68
-
69
-	/**
70
-	 * Store the page width without left and right margins
71
-	 *
72
-	 * In HTML, we don't need this
73
-	 *
74
-	 * @var float
75
-	 */
76
-	public $noMarginWidth = 0.0;
77
-
78
-	/**
79
-	 * Last cell height
80
-	 *
81
-	 * @var float
82
-	 */
83
-	public $lastCellHeight = 0.0;
84
-
85
-	/**
86
-	 * LTR or RTL alignement; "left" on LTR, "right" on RTL
87
-	 * Used in <div>
88
-	 *
89
-	 * @var string
90
-	 */
91
-	public $alignRTL = 'left';
92
-
93
-	/**
94
-	 * LTR or RTL entity
95
-	 *
96
-	 * @var string
97
-	 */
98
-	public $entityRTL = '&lrm;';
99
-
100
-	/**
101
-	 * Largest Font Height is used by TextBox etc.
102
-	 *
103
-	 * Use this to calculate a the text height.
104
-	 * This makes sure that the text fits into the cell/box when different font sizes are used
105
-	 *
106
-	 * @var int
107
-	 */
108
-	public $largestFontHeight = 0;
109
-
110
-	/**
111
-	 * Keep track of the highest Y position
112
-	 *
113
-	 * Used with Header div / Body div / Footer div / "addpage" / The bottom of the last image etc.
114
-	 *
115
-	 * @var float
116
-	 */
117
-	public $maxY = 0;
118
-
119
-	/** @var ReportBaseElement[] Array of elements in the header */
120
-	public $headerElements = array();
121
-
122
-	/** @var ReportBaseElement[] Array of elements in the page header */
123
-	public $pageHeaderElements = array();
124
-
125
-	/** @var ReportBaseElement[] Array of elements in the footer */
126
-	public $footerElements = array();
127
-
128
-	/** @var ReportBaseElement[] Array of elements in the body */
129
-	public $bodyElements = array();
130
-
131
-	/** @var ReportBaseFootnote[] Array of elements in the footer notes */
132
-	public $printedfootnotes = array();
133
-
134
-	/**
135
-	 * HTML Setup - ReportHtml
136
-	 */
137
-	public function setup() {
138
-		parent::setup();
139
-
140
-		// Setting up the correct dimensions if Portrait (default) or Landscape
141
-		if ($this->orientation == "landscape") {
142
-			$tmpw        = $this->pagew;
143
-			$this->pagew = $this->pageh;
144
-			$this->pageh = $tmpw;
145
-		}
146
-		// Store the pagewidth without margins
147
-		$this->noMarginWidth = (int) ($this->pagew - $this->leftmargin - $this->rightmargin);
148
-		// If RTL
149
-		if ($this->rtl) {
150
-			$this->alignRTL  = "right";
151
-			$this->entityRTL = "&rlm;";
152
-		}
153
-		// Change the default HTML font name
154
-		$this->defaultFont = "Arial";
155
-
156
-		if ($this->showGenText) {
157
-			// The default style name for Generated by.... is 'genby'
158
-			$element = new ReportHtmlCell(0, 10, 0, 'C', '', 'genby', 1, '.', '.', 0, 0, '', '', true);
159
-			$element->addText($this->generatedby);
160
-			$element->setUrl(parent::WT_URL);
161
-			$this->footerElements[] = $element;
162
-		}
163
-	}
164
-
165
-	/**
166
-	 * Add an element.
167
-	 *
168
-	 * @param $element
169
-	 */
170
-	public function addElement($element) {
171
-		if ($this->processing == "B") {
172
-			$this->bodyElements[] = $element;
173
-		} elseif ($this->processing == "H") {
174
-			$this->headerElements[] = $element;
175
-		} elseif ($this->processing == "F") {
176
-			$this->footerElements[] = $element;
177
-		}
178
-	}
179
-
180
-	/**
181
-	 * Generate the page header
182
-	 */
183
-	public function runPageHeader() {
184
-		foreach ($this->pageHeaderElements as $element) {
185
-			if (is_object($element)) {
186
-				$element->render($this);
187
-			} elseif (is_string($element) && $element == "footnotetexts") {
188
-				$this->footnotes();
189
-			} elseif (is_string($element) && $element == "addpage") {
190
-				$this->addPage();
191
-			}
192
-		}
193
-	}
194
-
195
-	/**
196
-	 * Generate footnotes
197
-	 */
198
-	public function footnotes() {
199
-		$this->currentStyle = "";
200
-		if (!empty($this->printedfootnotes)) {
201
-			foreach ($this->printedfootnotes as $element) {
202
-				$element->renderFootnote($this);
203
-			}
204
-		}
205
-	}
206
-
207
-	/**
208
-	 * Run the report.
209
-	 */
210
-	public function run() {
211
-		$controller = new SimpleController;
212
-		$controller
213
-			->setPageTitle($this->title)
214
-			->pageHeader();
215
-
216
-		// Setting up the styles
217
-		echo '<style type="text/css">';
218
-		echo 'body { font: 10px sans-serif;}';
219
-		foreach ($this->Styles as $class => $style) {
220
-			echo '.', $class, ' { ';
221
-			if ($style["font"] == "dejavusans") {
222
-				$style["font"] = $this->defaultFont;
223
-			}
224
-			echo 'font-family: ', $style['font'], '; ';
225
-			echo 'font-size: ', $style['size'], 'pt; ';
226
-			// Case-insensitive
227
-			if (stripos($style['style'], 'B') !== false) {
228
-				echo 'font-weight: bold; ';
229
-			}
230
-			if (stripos($style['style'], 'I') !== false) {
231
-				echo 'font-style: italic; ';
232
-			}
233
-			if (stripos($style['style'], 'U') !== false) {
234
-				echo 'text-decoration: underline; ';
235
-			}
236
-			if (stripos($style['style'], 'D') !== false) {
237
-				echo 'text-decoration: line-through; ';
238
-			}
239
-			echo '}', PHP_EOL;
240
-		}
241
-		unset($class, $style);
242
-		//-- header divider
243
-		echo '</style>', PHP_EOL;
244
-		echo '<div id="headermargin" style="position: relative; top: auto; height: ', $this->headermargin, 'pt; width: ', $this->noMarginWidth, 'pt;"></div>';
245
-		echo '<div id="headerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;">';
246
-		foreach ($this->headerElements as $element) {
247
-			if (is_object($element)) {
248
-				$element->render($this);
249
-			} elseif (is_string($element) && $element == "footnotetexts") {
250
-				$this->footnotes();
251
-			} elseif (is_string($element) && $element == "addpage") {
252
-				$this->addPage();
253
-			}
254
-		}
255
-		//-- body
256
-		echo '</div>';
257
-		echo '<script>document.getElementById("headerdiv").style.height="', $this->topmargin - $this->headermargin - 6, 'pt";</script>';
258
-		echo '<div id="bodydiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt; height: 100%;">';
259
-		$this->Y    = 0;
260
-		$this->maxY = 0;
261
-		$this->runPageHeader();
262
-		foreach ($this->bodyElements as $element) {
263
-			if (is_object($element)) {
264
-				$element->render($this);
265
-			} elseif (is_string($element) && $element == "footnotetexts") {
266
-				$this->footnotes();
267
-			} elseif (is_string($element) && $element == "addpage") {
268
-				$this->addPage();
269
-			}
270
-		}
271
-		//-- footer
272
-		echo '</div>';
273
-		echo '<script>document.getElementById("bodydiv").style.height="', $this->maxY, 'pt";</script>';
274
-		echo '<div id="bottommargin" style="position: relative; top: auto; height: ', $this->bottommargin - $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>';
275
-		echo '<div id="footerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;height:auto;">';
276
-		$this->Y    = 0;
277
-		$this->X    = 0;
278
-		$this->maxY = 0;
279
-		foreach ($this->footerElements as $element) {
280
-			if (is_object($element)) {
281
-				$element->render($this);
282
-			} elseif (is_string($element) && $element == "footnotetexts") {
283
-				$this->footnotes();
284
-			} elseif (is_string($element) && $element == "addpage") {
285
-				$this->addPage();
286
-			}
287
-		}
288
-		echo '</div>';
289
-		echo '<script>document.getElementById("footerdiv").style.height="', $this->maxY, 'pt";</script>';
290
-		echo '<div id="footermargin" style="position: relative; top: auto; height: ', $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>';
291
-	}
292
-
293
-	/**
294
-	 * Create a new Cell object - ReportHtml
295
-	 *
296
-	 * @param int    $width   cell width (expressed in points)
297
-	 * @param int    $height  cell height (expressed in points)
298
-	 * @param mixed  $border  Border style
299
-	 * @param string $align   Text alignement
300
-	 * @param string $bgcolor Background color code
301
-	 * @param string $style   The name of the text style
302
-	 * @param int    $ln      Indicates where the current position should go after the call
303
-	 * @param mixed  $top     Y-position
304
-	 * @param mixed  $left    X-position
305
-	 * @param int    $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
306
-	 * @param int    $stretch Stretch carachter mode
307
-	 * @param string $bocolor Border color
308
-	 * @param string $tcolor  Text color
309
-	 * @param bool    $reseth
310
-	 *
311
-	 * @return object ReportHtmlCell
312
-	 */
313
-	public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth) {
314
-		return new ReportHtmlCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
315
-	}
316
-
317
-	/**
318
-	 * Create a text box.
319
-	 *
320
-	 * @param $width
321
-	 * @param $height
322
-	 * @param $border
323
-	 * @param $bgcolor
324
-	 * @param $newline
325
-	 * @param $left
326
-	 * @param $top
327
-	 * @param $pagecheck
328
-	 * @param $style
329
-	 * @param $fill
330
-	 * @param $padding
331
-	 * @param $reseth
332
-	 *
333
-	 * @return ReportHtmlTextbox
334
-	 */
335
-	public function createTextBox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth) {
336
-		return new ReportHtmlTextbox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth);
337
-	}
338
-
339
-	/**
340
-	 * Create a text element.
341
-	 *
342
-	 * @param $style
343
-	 * @param $color
344
-	 *
345
-	 * @return ReportHtmlText
346
-	 */
347
-	public function createText($style, $color) {
348
-		return new ReportHtmlText($style, $color);
349
-	}
350
-
351
-	/**
352
-	 * Create a footnote.
353
-	 *
354
-	 * @param string $style
355
-	 *
356
-	 * @return ReportHtmlFootnote
357
-	 */
358
-	public function createFootnote($style = "") {
359
-		return new ReportHtmlFootnote($style);
360
-	}
361
-
362
-	/**
363
-	 * Create a page header.
364
-	 *
365
-	 * @return ReportHtmlPageheader
366
-	 */
367
-	public function createPageHeader() {
368
-		return new ReportHtmlPageheader;
369
-	}
370
-
371
-	/**
372
-	 * Create an image.
373
-	 *
374
-	 * @param $file
375
-	 * @param $x
376
-	 * @param $y
377
-	 * @param $w
378
-	 * @param $h
379
-	 * @param $align
380
-	 * @param $ln
381
-	 *
382
-	 * @return ReportHtmlImage
383
-	 */
384
-	public function createImage($file, $x, $y, $w, $h, $align, $ln) {
385
-		return new ReportHtmlImage($file, $x, $y, $w, $h, $align, $ln);
386
-	}
387
-
388
-	/**
389
-	 * Create an image.
390
-	 *
391
-	 * @param Media $mediaobject
392
-	 * @param $x
393
-	 * @param $y
394
-	 * @param $w
395
-	 * @param $h
396
-	 * @param $align
397
-	 * @param $ln
398
-	 *
399
-	 * @return ReportHtmlImage
400
-	 */
401
-	public function createImageFromObject(Media $mediaobject, $x, $y, $w, $h, $align, $ln) {
402
-		return new ReportHtmlImage($mediaobject->getHtmlUrlDirect('thumb'), $x, $y, $w, $h, $align, $ln);
403
-	}
404
-
405
-	/**
406
-	 * Create a line.
407
-	 *
408
-	 * @param $x1
409
-	 * @param $y1
410
-	 * @param $x2
411
-	 * @param $y2
412
-	 *
413
-	 * @return ReportHtmlLine
414
-	 */
415
-	public function createLine($x1, $y1, $x2, $y2) {
416
-		return new ReportHtmlLine($x1, $y1, $x2, $y2);
417
-	}
418
-
419
-	/**
420
-	 * Create an HTML element.
421
-	 *
422
-	 * @param $tag
423
-	 * @param $attrs
424
-	 *
425
-	 * @return ReportHtmlHtml
426
-	 */
427
-	public function createHTML($tag, $attrs) {
428
-		return new ReportHtmlHtml($tag, $attrs);
429
-	}
430
-
431
-	/**
432
-	 * Clear the Header - ReportHtml
433
-	 */
434
-	public function clearHeader() {
435
-		$this->headerElements = array();
436
-	}
437
-
438
-	/**
439
-	 * Update the Page Number and set a new Y if max Y is larger - ReportHtml
440
-	 */
441
-	public function addPage() {
442
-		$this->pageN++;
443
-		// Add a little margin to max Y "between pages"
444
-		$this->maxY += 10;
445
-		// If Y is still heigher by any reason...
446
-		if ($this->maxY < $this->Y) {
447
-			// ... update max Y
448
-			$this->maxY = $this->Y;
449
-		} // else update Y so that nothing will be overwritten, like images or cells...
450
-		else {
451
-			$this->Y = $this->maxY;
452
-		}
453
-	}
454
-
455
-	/**
456
-	 * Uppdate max Y to keep track it incase of a pagebreak - ReportHtml
457
-	 *
458
-	 * @param float $y
459
-	 */
460
-	public function addMaxY($y) {
461
-		if ($this->maxY < $y) {
462
-			$this->maxY = $y;
463
-		}
464
-	}
465
-
466
-	/**
467
-	 * Add a page header.
468
-	 *
469
-	 * @param $element
470
-	 *
471
-	 * @return int
472
-	 */
473
-	public function addPageHeader($element) {
474
-		$this->pageHeaderElements[] = $element;
475
-
476
-		return count($this->headerElements) - 1;
477
-	}
478
-
479
-	/**
480
-	 * Checks the Footnote and numbers them - ReportHtml
481
-	 *
482
-	 * @param object $footnote
483
-	 *
484
-	 * @return bool false if not numbered before | object if already numbered
485
-	 */
486
-	public function checkFootnote($footnote) {
487
-		$ct  = count($this->printedfootnotes);
488
-		$i   = 0;
489
-		$val = $footnote->getValue();
490
-		while ($i < $ct) {
491
-			if ($this->printedfootnotes[$i]->getValue() == $val) {
492
-				// If this footnote already exist then set up the numbers for this object
493
-				$footnote->setNum($i + 1);
494
-				$footnote->setAddlink($i + 1);
495
-
496
-				return $this->printedfootnotes[$i];
497
-			}
498
-			$i++;
499
-		}
500
-		// If this Footnote has not been set up yet
501
-		$footnote->setNum($ct + 1);
502
-		$footnote->setAddlink($ct + 1);
503
-		$this->printedfootnotes[] = $footnote;
504
-
505
-		return false;
506
-	}
507
-
508
-	/**
509
-	 * Clear the Page Header - ReportHtml
510
-	 */
511
-	public function clearPageHeader() {
512
-		$this->pageHeaderElements = array();
513
-	}
514
-
515
-	/**
516
-	 * Count the number of lines - ReportHtml
517
-	 *
518
-	 * @param string $str
519
-	 *
520
-	 * @return int Number of lines. 0 if empty line
521
-	 */
522
-	public function countLines($str) {
523
-		if ($str == "") {
524
-			return 0;
525
-		}
526
-
527
-		return (substr_count($str, "\n") + 1);
528
-	}
529
-
530
-	/**
531
-	 * Get the current style.
532
-	 *
533
-	 * @return string
534
-	 */
535
-	public function getCurrentStyle() {
536
-		return $this->currentStyle;
537
-	}
538
-
539
-	/**
540
-	 * Get the current style height.
541
-	 *
542
-	 * @return int
543
-	 */
544
-	public function getCurrentStyleHeight() {
545
-		if (empty($this->currentStyle)) {
546
-			return $this->defaultFontSize;
547
-		}
548
-		$style = $this->getStyle($this->currentStyle);
549
-
550
-		return $style["size"];
551
-	}
552
-
553
-	/**
554
-	 * Get the current footnotes height.
555
-	 *
556
-	 * @param $cellWidth
557
-	 *
558
-	 * @return int
559
-	 */
560
-	public function getFootnotesHeight($cellWidth) {
561
-		$h = 0;
562
-		foreach ($this->printedfootnotes as $element) {
563
-			$h += $element->getFootnoteHeight($this, $cellWidth);
564
-		}
565
-
566
-		return $h;
567
-	}
568
-
569
-	/**
570
-	 * Get the maximum width from current position to the margin - ReportHtml
571
-	 *
572
-	 * @return float
573
-	 */
574
-	public function getRemainingWidth() {
575
-		return $this->noMarginWidth - $this->X;
576
-	}
577
-
578
-	/**
579
-	 * Get the page height.
580
-	 *
581
-	 * @return float
582
-	 */
583
-	public function getPageHeight() {
584
-		return $this->pageh - $this->topmargin;
585
-	}
586
-
587
-	/**
588
-	 * Get the width of a string.
589
-	 *
590
-	 * @param $text
591
-	 *
592
-	 * @return int
593
-	 */
594
-	public function getStringWidth($text) {
595
-		$style = $this->getStyle($this->currentStyle);
596
-
597
-		return mb_strlen($text) * ($style['size'] / 2);
598
-	}
599
-
600
-	/**
601
-	 * Get a text height in points - ReportHtml
602
-	 *
603
-	 * @param $str
604
-	 *
605
-	 * @return int
606
-	 */
607
-	public function getTextCellHeight($str) {
608
-		// Count the number of lines to calculate the height
609
-		$nl = $this->countLines($str);
610
-		// Calculate the cell height
611
-		return ceil(($this->getCurrentStyleHeight() * $this->cellHeightRatio) * $nl);
612
-	}
613
-
614
-	/**
615
-	 * Get the current X position - ReportHtml
616
-	 *
617
-	 * @return float
618
-	 */
619
-	public function getX() {
620
-		return $this->X;
621
-	}
622
-
623
-	/**
624
-	 * Get the current Y position - ReportHtml
625
-	 *
626
-	 * @return float
627
-	 */
628
-	public function getY() {
629
-		return $this->Y;
630
-	}
631
-
632
-	/**
633
-	 * Get the current page number - ReportHtml
634
-	 *
635
-	 * @return int
636
-	 */
637
-	public function pageNo() {
638
-		return $this->pageN;
639
-	}
640
-
641
-	/**
642
-	 * Set the current style.
643
-	 *
644
-	 * @param $s
645
-	 */
646
-	public function setCurrentStyle($s) {
647
-		$this->currentStyle = $s;
648
-	}
649
-
650
-	/**
651
-	 * Set the X position - ReportHtml
652
-	 *
653
-	 * @param float $x
654
-	 */
655
-	public function setX($x) {
656
-		$this->X = $x;
657
-	}
658
-
659
-	/**
660
-	 * Set the Y position - ReportHtml
661
-	 *
662
-	 * Also updates Max Y position
663
-	 *
664
-	 * @param float $y
665
-	 */
666
-	public function setY($y) {
667
-		$this->Y = $y;
668
-		if ($this->maxY < $y) {
669
-			$this->maxY = $y;
670
-		}
671
-	}
672
-
673
-	/**
674
-	 * Set the X and Y position - ReportHtml
675
-	 *
676
-	 * Also updates Max Y position
677
-	 *
678
-	 * @param float $x
679
-	 * @param float $y
680
-	 */
681
-	public function setXy($x, $y) {
682
-		$this->setX($x);
683
-		$this->setY($y);
684
-	}
685
-
686
-	/**
687
-	 * Wrap text - ReportHtml
688
-	 *
689
-	 * @param string $str   Text to wrap
690
-	 * @param int    $width Width in points the text has to fit into
691
-	 *
692
-	 * @return string
693
-	 */
694
-	public function textWrap($str, $width) {
695
-		// Calculate the line width
696
-		$lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
697
-		// Wordwrap each line
698
-		$lines = explode("\n", $str);
699
-		// Line Feed counter
700
-		$lfct     = count($lines);
701
-		$wraptext = '';
702
-		foreach ($lines as $line) {
703
-			$wtext = FunctionsRtl::utf8WordWrap($line, $lw, "\n", true);
704
-			$wraptext .= $wtext;
705
-			// Add a new line as long as it’s not the last line
706
-			if ($lfct > 1) {
707
-				$wraptext .= "\n";
708
-			}
709
-			$lfct--;
710
-		}
711
-
712
-		return $wraptext;
713
-	}
714
-
715
-	/**
716
-	 * Write text - ReportHtml
717
-	 *
718
-	 * @param string $text  Text to print
719
-	 * @param string $color HTML RGB color code (Ex: #001122)
720
-	 * @param bool   $useclass
721
-	 */
722
-	public function write($text, $color = '', $useclass = true) {
723
-		$style    = $this->getStyle($this->getCurrentStyle());
724
-		$htmlcode = '<span dir="' . I18N::direction() . '"';
725
-		if ($useclass) {
726
-			$htmlcode .= ' class="' . $style['name'] . '"';
727
-		}
728
-		if (!empty($color)) {
729
-			// Check if Text Color is set and if it’s valid HTML color
730
-			if (preg_match('/#?(..)(..)(..)/', $color)) {
731
-				$htmlcode .= ' style="color:' . $color . ';"';
732
-			}
733
-		}
734
-
735
-		$htmlcode .= '>' . $text . '</span>';
736
-		$htmlcode = str_replace(array("\n", '> ', ' <'), array('<br>', '>&nbsp;', '&nbsp;<'), $htmlcode);
737
-		echo $htmlcode;
738
-	}
27
+    /**
28
+     * Cell padding
29
+     *
30
+     * @var int
31
+     */
32
+    public $cPadding = 2;
33
+
34
+    /**
35
+     * Cell height ratio
36
+     *
37
+     * @var float
38
+     */
39
+    public $cellHeightRatio = 1.8;
40
+
41
+    /**
42
+     * Current horizontal position
43
+     *
44
+     * @var float
45
+     */
46
+    public $X = 0.0;
47
+
48
+    /**
49
+     * Current vertical position
50
+     *
51
+     * @var float
52
+     */
53
+    public $Y = 0.0;
54
+
55
+    /**
56
+     * Currently used style name
57
+     *
58
+     * @var string
59
+     */
60
+    public $currentStyle = '';
61
+
62
+    /**
63
+     * Page number counter
64
+     *
65
+     * @var int
66
+     */
67
+    public $pageN = 1;
68
+
69
+    /**
70
+     * Store the page width without left and right margins
71
+     *
72
+     * In HTML, we don't need this
73
+     *
74
+     * @var float
75
+     */
76
+    public $noMarginWidth = 0.0;
77
+
78
+    /**
79
+     * Last cell height
80
+     *
81
+     * @var float
82
+     */
83
+    public $lastCellHeight = 0.0;
84
+
85
+    /**
86
+     * LTR or RTL alignement; "left" on LTR, "right" on RTL
87
+     * Used in <div>
88
+     *
89
+     * @var string
90
+     */
91
+    public $alignRTL = 'left';
92
+
93
+    /**
94
+     * LTR or RTL entity
95
+     *
96
+     * @var string
97
+     */
98
+    public $entityRTL = '&lrm;';
99
+
100
+    /**
101
+     * Largest Font Height is used by TextBox etc.
102
+     *
103
+     * Use this to calculate a the text height.
104
+     * This makes sure that the text fits into the cell/box when different font sizes are used
105
+     *
106
+     * @var int
107
+     */
108
+    public $largestFontHeight = 0;
109
+
110
+    /**
111
+     * Keep track of the highest Y position
112
+     *
113
+     * Used with Header div / Body div / Footer div / "addpage" / The bottom of the last image etc.
114
+     *
115
+     * @var float
116
+     */
117
+    public $maxY = 0;
118
+
119
+    /** @var ReportBaseElement[] Array of elements in the header */
120
+    public $headerElements = array();
121
+
122
+    /** @var ReportBaseElement[] Array of elements in the page header */
123
+    public $pageHeaderElements = array();
124
+
125
+    /** @var ReportBaseElement[] Array of elements in the footer */
126
+    public $footerElements = array();
127
+
128
+    /** @var ReportBaseElement[] Array of elements in the body */
129
+    public $bodyElements = array();
130
+
131
+    /** @var ReportBaseFootnote[] Array of elements in the footer notes */
132
+    public $printedfootnotes = array();
133
+
134
+    /**
135
+     * HTML Setup - ReportHtml
136
+     */
137
+    public function setup() {
138
+        parent::setup();
139
+
140
+        // Setting up the correct dimensions if Portrait (default) or Landscape
141
+        if ($this->orientation == "landscape") {
142
+            $tmpw        = $this->pagew;
143
+            $this->pagew = $this->pageh;
144
+            $this->pageh = $tmpw;
145
+        }
146
+        // Store the pagewidth without margins
147
+        $this->noMarginWidth = (int) ($this->pagew - $this->leftmargin - $this->rightmargin);
148
+        // If RTL
149
+        if ($this->rtl) {
150
+            $this->alignRTL  = "right";
151
+            $this->entityRTL = "&rlm;";
152
+        }
153
+        // Change the default HTML font name
154
+        $this->defaultFont = "Arial";
155
+
156
+        if ($this->showGenText) {
157
+            // The default style name for Generated by.... is 'genby'
158
+            $element = new ReportHtmlCell(0, 10, 0, 'C', '', 'genby', 1, '.', '.', 0, 0, '', '', true);
159
+            $element->addText($this->generatedby);
160
+            $element->setUrl(parent::WT_URL);
161
+            $this->footerElements[] = $element;
162
+        }
163
+    }
164
+
165
+    /**
166
+     * Add an element.
167
+     *
168
+     * @param $element
169
+     */
170
+    public function addElement($element) {
171
+        if ($this->processing == "B") {
172
+            $this->bodyElements[] = $element;
173
+        } elseif ($this->processing == "H") {
174
+            $this->headerElements[] = $element;
175
+        } elseif ($this->processing == "F") {
176
+            $this->footerElements[] = $element;
177
+        }
178
+    }
179
+
180
+    /**
181
+     * Generate the page header
182
+     */
183
+    public function runPageHeader() {
184
+        foreach ($this->pageHeaderElements as $element) {
185
+            if (is_object($element)) {
186
+                $element->render($this);
187
+            } elseif (is_string($element) && $element == "footnotetexts") {
188
+                $this->footnotes();
189
+            } elseif (is_string($element) && $element == "addpage") {
190
+                $this->addPage();
191
+            }
192
+        }
193
+    }
194
+
195
+    /**
196
+     * Generate footnotes
197
+     */
198
+    public function footnotes() {
199
+        $this->currentStyle = "";
200
+        if (!empty($this->printedfootnotes)) {
201
+            foreach ($this->printedfootnotes as $element) {
202
+                $element->renderFootnote($this);
203
+            }
204
+        }
205
+    }
206
+
207
+    /**
208
+     * Run the report.
209
+     */
210
+    public function run() {
211
+        $controller = new SimpleController;
212
+        $controller
213
+            ->setPageTitle($this->title)
214
+            ->pageHeader();
215
+
216
+        // Setting up the styles
217
+        echo '<style type="text/css">';
218
+        echo 'body { font: 10px sans-serif;}';
219
+        foreach ($this->Styles as $class => $style) {
220
+            echo '.', $class, ' { ';
221
+            if ($style["font"] == "dejavusans") {
222
+                $style["font"] = $this->defaultFont;
223
+            }
224
+            echo 'font-family: ', $style['font'], '; ';
225
+            echo 'font-size: ', $style['size'], 'pt; ';
226
+            // Case-insensitive
227
+            if (stripos($style['style'], 'B') !== false) {
228
+                echo 'font-weight: bold; ';
229
+            }
230
+            if (stripos($style['style'], 'I') !== false) {
231
+                echo 'font-style: italic; ';
232
+            }
233
+            if (stripos($style['style'], 'U') !== false) {
234
+                echo 'text-decoration: underline; ';
235
+            }
236
+            if (stripos($style['style'], 'D') !== false) {
237
+                echo 'text-decoration: line-through; ';
238
+            }
239
+            echo '}', PHP_EOL;
240
+        }
241
+        unset($class, $style);
242
+        //-- header divider
243
+        echo '</style>', PHP_EOL;
244
+        echo '<div id="headermargin" style="position: relative; top: auto; height: ', $this->headermargin, 'pt; width: ', $this->noMarginWidth, 'pt;"></div>';
245
+        echo '<div id="headerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;">';
246
+        foreach ($this->headerElements as $element) {
247
+            if (is_object($element)) {
248
+                $element->render($this);
249
+            } elseif (is_string($element) && $element == "footnotetexts") {
250
+                $this->footnotes();
251
+            } elseif (is_string($element) && $element == "addpage") {
252
+                $this->addPage();
253
+            }
254
+        }
255
+        //-- body
256
+        echo '</div>';
257
+        echo '<script>document.getElementById("headerdiv").style.height="', $this->topmargin - $this->headermargin - 6, 'pt";</script>';
258
+        echo '<div id="bodydiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt; height: 100%;">';
259
+        $this->Y    = 0;
260
+        $this->maxY = 0;
261
+        $this->runPageHeader();
262
+        foreach ($this->bodyElements as $element) {
263
+            if (is_object($element)) {
264
+                $element->render($this);
265
+            } elseif (is_string($element) && $element == "footnotetexts") {
266
+                $this->footnotes();
267
+            } elseif (is_string($element) && $element == "addpage") {
268
+                $this->addPage();
269
+            }
270
+        }
271
+        //-- footer
272
+        echo '</div>';
273
+        echo '<script>document.getElementById("bodydiv").style.height="', $this->maxY, 'pt";</script>';
274
+        echo '<div id="bottommargin" style="position: relative; top: auto; height: ', $this->bottommargin - $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>';
275
+        echo '<div id="footerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;height:auto;">';
276
+        $this->Y    = 0;
277
+        $this->X    = 0;
278
+        $this->maxY = 0;
279
+        foreach ($this->footerElements as $element) {
280
+            if (is_object($element)) {
281
+                $element->render($this);
282
+            } elseif (is_string($element) && $element == "footnotetexts") {
283
+                $this->footnotes();
284
+            } elseif (is_string($element) && $element == "addpage") {
285
+                $this->addPage();
286
+            }
287
+        }
288
+        echo '</div>';
289
+        echo '<script>document.getElementById("footerdiv").style.height="', $this->maxY, 'pt";</script>';
290
+        echo '<div id="footermargin" style="position: relative; top: auto; height: ', $this->footermargin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>';
291
+    }
292
+
293
+    /**
294
+     * Create a new Cell object - ReportHtml
295
+     *
296
+     * @param int    $width   cell width (expressed in points)
297
+     * @param int    $height  cell height (expressed in points)
298
+     * @param mixed  $border  Border style
299
+     * @param string $align   Text alignement
300
+     * @param string $bgcolor Background color code
301
+     * @param string $style   The name of the text style
302
+     * @param int    $ln      Indicates where the current position should go after the call
303
+     * @param mixed  $top     Y-position
304
+     * @param mixed  $left    X-position
305
+     * @param int    $fill    Indicates if the cell background must be painted (1) or transparent (0). Default value: 0.
306
+     * @param int    $stretch Stretch carachter mode
307
+     * @param string $bocolor Border color
308
+     * @param string $tcolor  Text color
309
+     * @param bool    $reseth
310
+     *
311
+     * @return object ReportHtmlCell
312
+     */
313
+    public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth) {
314
+        return new ReportHtmlCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
315
+    }
316
+
317
+    /**
318
+     * Create a text box.
319
+     *
320
+     * @param $width
321
+     * @param $height
322
+     * @param $border
323
+     * @param $bgcolor
324
+     * @param $newline
325
+     * @param $left
326
+     * @param $top
327
+     * @param $pagecheck
328
+     * @param $style
329
+     * @param $fill
330
+     * @param $padding
331
+     * @param $reseth
332
+     *
333
+     * @return ReportHtmlTextbox
334
+     */
335
+    public function createTextBox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth) {
336
+        return new ReportHtmlTextbox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth);
337
+    }
338
+
339
+    /**
340
+     * Create a text element.
341
+     *
342
+     * @param $style
343
+     * @param $color
344
+     *
345
+     * @return ReportHtmlText
346
+     */
347
+    public function createText($style, $color) {
348
+        return new ReportHtmlText($style, $color);
349
+    }
350
+
351
+    /**
352
+     * Create a footnote.
353
+     *
354
+     * @param string $style
355
+     *
356
+     * @return ReportHtmlFootnote
357
+     */
358
+    public function createFootnote($style = "") {
359
+        return new ReportHtmlFootnote($style);
360
+    }
361
+
362
+    /**
363
+     * Create a page header.
364
+     *
365
+     * @return ReportHtmlPageheader
366
+     */
367
+    public function createPageHeader() {
368
+        return new ReportHtmlPageheader;
369
+    }
370
+
371
+    /**
372
+     * Create an image.
373
+     *
374
+     * @param $file
375
+     * @param $x
376
+     * @param $y
377
+     * @param $w
378
+     * @param $h
379
+     * @param $align
380
+     * @param $ln
381
+     *
382
+     * @return ReportHtmlImage
383
+     */
384
+    public function createImage($file, $x, $y, $w, $h, $align, $ln) {
385
+        return new ReportHtmlImage($file, $x, $y, $w, $h, $align, $ln);
386
+    }
387
+
388
+    /**
389
+     * Create an image.
390
+     *
391
+     * @param Media $mediaobject
392
+     * @param $x
393
+     * @param $y
394
+     * @param $w
395
+     * @param $h
396
+     * @param $align
397
+     * @param $ln
398
+     *
399
+     * @return ReportHtmlImage
400
+     */
401
+    public function createImageFromObject(Media $mediaobject, $x, $y, $w, $h, $align, $ln) {
402
+        return new ReportHtmlImage($mediaobject->getHtmlUrlDirect('thumb'), $x, $y, $w, $h, $align, $ln);
403
+    }
404
+
405
+    /**
406
+     * Create a line.
407
+     *
408
+     * @param $x1
409
+     * @param $y1
410
+     * @param $x2
411
+     * @param $y2
412
+     *
413
+     * @return ReportHtmlLine
414
+     */
415
+    public function createLine($x1, $y1, $x2, $y2) {
416
+        return new ReportHtmlLine($x1, $y1, $x2, $y2);
417
+    }
418
+
419
+    /**
420
+     * Create an HTML element.
421
+     *
422
+     * @param $tag
423
+     * @param $attrs
424
+     *
425
+     * @return ReportHtmlHtml
426
+     */
427
+    public function createHTML($tag, $attrs) {
428
+        return new ReportHtmlHtml($tag, $attrs);
429
+    }
430
+
431
+    /**
432
+     * Clear the Header - ReportHtml
433
+     */
434
+    public function clearHeader() {
435
+        $this->headerElements = array();
436
+    }
437
+
438
+    /**
439
+     * Update the Page Number and set a new Y if max Y is larger - ReportHtml
440
+     */
441
+    public function addPage() {
442
+        $this->pageN++;
443
+        // Add a little margin to max Y "between pages"
444
+        $this->maxY += 10;
445
+        // If Y is still heigher by any reason...
446
+        if ($this->maxY < $this->Y) {
447
+            // ... update max Y
448
+            $this->maxY = $this->Y;
449
+        } // else update Y so that nothing will be overwritten, like images or cells...
450
+        else {
451
+            $this->Y = $this->maxY;
452
+        }
453
+    }
454
+
455
+    /**
456
+     * Uppdate max Y to keep track it incase of a pagebreak - ReportHtml
457
+     *
458
+     * @param float $y
459
+     */
460
+    public function addMaxY($y) {
461
+        if ($this->maxY < $y) {
462
+            $this->maxY = $y;
463
+        }
464
+    }
465
+
466
+    /**
467
+     * Add a page header.
468
+     *
469
+     * @param $element
470
+     *
471
+     * @return int
472
+     */
473
+    public function addPageHeader($element) {
474
+        $this->pageHeaderElements[] = $element;
475
+
476
+        return count($this->headerElements) - 1;
477
+    }
478
+
479
+    /**
480
+     * Checks the Footnote and numbers them - ReportHtml
481
+     *
482
+     * @param object $footnote
483
+     *
484
+     * @return bool false if not numbered before | object if already numbered
485
+     */
486
+    public function checkFootnote($footnote) {
487
+        $ct  = count($this->printedfootnotes);
488
+        $i   = 0;
489
+        $val = $footnote->getValue();
490
+        while ($i < $ct) {
491
+            if ($this->printedfootnotes[$i]->getValue() == $val) {
492
+                // If this footnote already exist then set up the numbers for this object
493
+                $footnote->setNum($i + 1);
494
+                $footnote->setAddlink($i + 1);
495
+
496
+                return $this->printedfootnotes[$i];
497
+            }
498
+            $i++;
499
+        }
500
+        // If this Footnote has not been set up yet
501
+        $footnote->setNum($ct + 1);
502
+        $footnote->setAddlink($ct + 1);
503
+        $this->printedfootnotes[] = $footnote;
504
+
505
+        return false;
506
+    }
507
+
508
+    /**
509
+     * Clear the Page Header - ReportHtml
510
+     */
511
+    public function clearPageHeader() {
512
+        $this->pageHeaderElements = array();
513
+    }
514
+
515
+    /**
516
+     * Count the number of lines - ReportHtml
517
+     *
518
+     * @param string $str
519
+     *
520
+     * @return int Number of lines. 0 if empty line
521
+     */
522
+    public function countLines($str) {
523
+        if ($str == "") {
524
+            return 0;
525
+        }
526
+
527
+        return (substr_count($str, "\n") + 1);
528
+    }
529
+
530
+    /**
531
+     * Get the current style.
532
+     *
533
+     * @return string
534
+     */
535
+    public function getCurrentStyle() {
536
+        return $this->currentStyle;
537
+    }
538
+
539
+    /**
540
+     * Get the current style height.
541
+     *
542
+     * @return int
543
+     */
544
+    public function getCurrentStyleHeight() {
545
+        if (empty($this->currentStyle)) {
546
+            return $this->defaultFontSize;
547
+        }
548
+        $style = $this->getStyle($this->currentStyle);
549
+
550
+        return $style["size"];
551
+    }
552
+
553
+    /**
554
+     * Get the current footnotes height.
555
+     *
556
+     * @param $cellWidth
557
+     *
558
+     * @return int
559
+     */
560
+    public function getFootnotesHeight($cellWidth) {
561
+        $h = 0;
562
+        foreach ($this->printedfootnotes as $element) {
563
+            $h += $element->getFootnoteHeight($this, $cellWidth);
564
+        }
565
+
566
+        return $h;
567
+    }
568
+
569
+    /**
570
+     * Get the maximum width from current position to the margin - ReportHtml
571
+     *
572
+     * @return float
573
+     */
574
+    public function getRemainingWidth() {
575
+        return $this->noMarginWidth - $this->X;
576
+    }
577
+
578
+    /**
579
+     * Get the page height.
580
+     *
581
+     * @return float
582
+     */
583
+    public function getPageHeight() {
584
+        return $this->pageh - $this->topmargin;
585
+    }
586
+
587
+    /**
588
+     * Get the width of a string.
589
+     *
590
+     * @param $text
591
+     *
592
+     * @return int
593
+     */
594
+    public function getStringWidth($text) {
595
+        $style = $this->getStyle($this->currentStyle);
596
+
597
+        return mb_strlen($text) * ($style['size'] / 2);
598
+    }
599
+
600
+    /**
601
+     * Get a text height in points - ReportHtml
602
+     *
603
+     * @param $str
604
+     *
605
+     * @return int
606
+     */
607
+    public function getTextCellHeight($str) {
608
+        // Count the number of lines to calculate the height
609
+        $nl = $this->countLines($str);
610
+        // Calculate the cell height
611
+        return ceil(($this->getCurrentStyleHeight() * $this->cellHeightRatio) * $nl);
612
+    }
613
+
614
+    /**
615
+     * Get the current X position - ReportHtml
616
+     *
617
+     * @return float
618
+     */
619
+    public function getX() {
620
+        return $this->X;
621
+    }
622
+
623
+    /**
624
+     * Get the current Y position - ReportHtml
625
+     *
626
+     * @return float
627
+     */
628
+    public function getY() {
629
+        return $this->Y;
630
+    }
631
+
632
+    /**
633
+     * Get the current page number - ReportHtml
634
+     *
635
+     * @return int
636
+     */
637
+    public function pageNo() {
638
+        return $this->pageN;
639
+    }
640
+
641
+    /**
642
+     * Set the current style.
643
+     *
644
+     * @param $s
645
+     */
646
+    public function setCurrentStyle($s) {
647
+        $this->currentStyle = $s;
648
+    }
649
+
650
+    /**
651
+     * Set the X position - ReportHtml
652
+     *
653
+     * @param float $x
654
+     */
655
+    public function setX($x) {
656
+        $this->X = $x;
657
+    }
658
+
659
+    /**
660
+     * Set the Y position - ReportHtml
661
+     *
662
+     * Also updates Max Y position
663
+     *
664
+     * @param float $y
665
+     */
666
+    public function setY($y) {
667
+        $this->Y = $y;
668
+        if ($this->maxY < $y) {
669
+            $this->maxY = $y;
670
+        }
671
+    }
672
+
673
+    /**
674
+     * Set the X and Y position - ReportHtml
675
+     *
676
+     * Also updates Max Y position
677
+     *
678
+     * @param float $x
679
+     * @param float $y
680
+     */
681
+    public function setXy($x, $y) {
682
+        $this->setX($x);
683
+        $this->setY($y);
684
+    }
685
+
686
+    /**
687
+     * Wrap text - ReportHtml
688
+     *
689
+     * @param string $str   Text to wrap
690
+     * @param int    $width Width in points the text has to fit into
691
+     *
692
+     * @return string
693
+     */
694
+    public function textWrap($str, $width) {
695
+        // Calculate the line width
696
+        $lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
697
+        // Wordwrap each line
698
+        $lines = explode("\n", $str);
699
+        // Line Feed counter
700
+        $lfct     = count($lines);
701
+        $wraptext = '';
702
+        foreach ($lines as $line) {
703
+            $wtext = FunctionsRtl::utf8WordWrap($line, $lw, "\n", true);
704
+            $wraptext .= $wtext;
705
+            // Add a new line as long as it’s not the last line
706
+            if ($lfct > 1) {
707
+                $wraptext .= "\n";
708
+            }
709
+            $lfct--;
710
+        }
711
+
712
+        return $wraptext;
713
+    }
714
+
715
+    /**
716
+     * Write text - ReportHtml
717
+     *
718
+     * @param string $text  Text to print
719
+     * @param string $color HTML RGB color code (Ex: #001122)
720
+     * @param bool   $useclass
721
+     */
722
+    public function write($text, $color = '', $useclass = true) {
723
+        $style    = $this->getStyle($this->getCurrentStyle());
724
+        $htmlcode = '<span dir="' . I18N::direction() . '"';
725
+        if ($useclass) {
726
+            $htmlcode .= ' class="' . $style['name'] . '"';
727
+        }
728
+        if (!empty($color)) {
729
+            // Check if Text Color is set and if it’s valid HTML color
730
+            if (preg_match('/#?(..)(..)(..)/', $color)) {
731
+                $htmlcode .= ' style="color:' . $color . ';"';
732
+            }
733
+        }
734
+
735
+        $htmlcode .= '>' . $text . '</span>';
736
+        $htmlcode = str_replace(array("\n", '> ', ' <'), array('<br>', '>&nbsp;', '&nbsp;<'), $htmlcode);
737
+        echo $htmlcode;
738
+    }
739 739
 
740 740
 }
Please login to merge, or discard this patch.
Braces   +76 added lines, -38 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
 /**
24 24
  * Class ReportHtml
25 25
  */
26
-class ReportHtml extends ReportBase {
26
+class ReportHtml extends ReportBase
27
+{
27 28
 	/**
28 29
 	 * Cell padding
29 30
 	 *
@@ -134,7 +135,8 @@  discard block
 block discarded – undo
134 135
 	/**
135 136
 	 * HTML Setup - ReportHtml
136 137
 	 */
137
-	public function setup() {
138
+	public function setup()
139
+	{
138 140
 		parent::setup();
139 141
 
140 142
 		// Setting up the correct dimensions if Portrait (default) or Landscape
@@ -167,7 +169,8 @@  discard block
 block discarded – undo
167 169
 	 *
168 170
 	 * @param $element
169 171
 	 */
170
-	public function addElement($element) {
172
+	public function addElement($element)
173
+	{
171 174
 		if ($this->processing == "B") {
172 175
 			$this->bodyElements[] = $element;
173 176
 		} elseif ($this->processing == "H") {
@@ -180,7 +183,8 @@  discard block
 block discarded – undo
180 183
 	/**
181 184
 	 * Generate the page header
182 185
 	 */
183
-	public function runPageHeader() {
186
+	public function runPageHeader()
187
+	{
184 188
 		foreach ($this->pageHeaderElements as $element) {
185 189
 			if (is_object($element)) {
186 190
 				$element->render($this);
@@ -195,7 +199,8 @@  discard block
 block discarded – undo
195 199
 	/**
196 200
 	 * Generate footnotes
197 201
 	 */
198
-	public function footnotes() {
202
+	public function footnotes()
203
+	{
199 204
 		$this->currentStyle = "";
200 205
 		if (!empty($this->printedfootnotes)) {
201 206
 			foreach ($this->printedfootnotes as $element) {
@@ -207,7 +212,8 @@  discard block
 block discarded – undo
207 212
 	/**
208 213
 	 * Run the report.
209 214
 	 */
210
-	public function run() {
215
+	public function run()
216
+	{
211 217
 		$controller = new SimpleController;
212 218
 		$controller
213 219
 			->setPageTitle($this->title)
@@ -310,7 +316,8 @@  discard block
 block discarded – undo
310 316
 	 *
311 317
 	 * @return object ReportHtmlCell
312 318
 	 */
313
-	public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth) {
319
+	public function createCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth)
320
+	{
314 321
 		return new ReportHtmlCell($width, $height, $border, $align, $bgcolor, $style, $ln, $top, $left, $fill, $stretch, $bocolor, $tcolor, $reseth);
315 322
 	}
316 323
 
@@ -332,7 +339,8 @@  discard block
 block discarded – undo
332 339
 	 *
333 340
 	 * @return ReportHtmlTextbox
334 341
 	 */
335
-	public function createTextBox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth) {
342
+	public function createTextBox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth)
343
+	{
336 344
 		return new ReportHtmlTextbox($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth);
337 345
 	}
338 346
 
@@ -344,7 +352,8 @@  discard block
 block discarded – undo
344 352
 	 *
345 353
 	 * @return ReportHtmlText
346 354
 	 */
347
-	public function createText($style, $color) {
355
+	public function createText($style, $color)
356
+	{
348 357
 		return new ReportHtmlText($style, $color);
349 358
 	}
350 359
 
@@ -355,7 +364,8 @@  discard block
 block discarded – undo
355 364
 	 *
356 365
 	 * @return ReportHtmlFootnote
357 366
 	 */
358
-	public function createFootnote($style = "") {
367
+	public function createFootnote($style = "")
368
+	{
359 369
 		return new ReportHtmlFootnote($style);
360 370
 	}
361 371
 
@@ -364,7 +374,8 @@  discard block
 block discarded – undo
364 374
 	 *
365 375
 	 * @return ReportHtmlPageheader
366 376
 	 */
367
-	public function createPageHeader() {
377
+	public function createPageHeader()
378
+	{
368 379
 		return new ReportHtmlPageheader;
369 380
 	}
370 381
 
@@ -381,7 +392,8 @@  discard block
 block discarded – undo
381 392
 	 *
382 393
 	 * @return ReportHtmlImage
383 394
 	 */
384
-	public function createImage($file, $x, $y, $w, $h, $align, $ln) {
395
+	public function createImage($file, $x, $y, $w, $h, $align, $ln)
396
+	{
385 397
 		return new ReportHtmlImage($file, $x, $y, $w, $h, $align, $ln);
386 398
 	}
387 399
 
@@ -398,7 +410,8 @@  discard block
 block discarded – undo
398 410
 	 *
399 411
 	 * @return ReportHtmlImage
400 412
 	 */
401
-	public function createImageFromObject(Media $mediaobject, $x, $y, $w, $h, $align, $ln) {
413
+	public function createImageFromObject(Media $mediaobject, $x, $y, $w, $h, $align, $ln)
414
+	{
402 415
 		return new ReportHtmlImage($mediaobject->getHtmlUrlDirect('thumb'), $x, $y, $w, $h, $align, $ln);
403 416
 	}
404 417
 
@@ -412,7 +425,8 @@  discard block
 block discarded – undo
412 425
 	 *
413 426
 	 * @return ReportHtmlLine
414 427
 	 */
415
-	public function createLine($x1, $y1, $x2, $y2) {
428
+	public function createLine($x1, $y1, $x2, $y2)
429
+	{
416 430
 		return new ReportHtmlLine($x1, $y1, $x2, $y2);
417 431
 	}
418 432
 
@@ -424,21 +438,24 @@  discard block
 block discarded – undo
424 438
 	 *
425 439
 	 * @return ReportHtmlHtml
426 440
 	 */
427
-	public function createHTML($tag, $attrs) {
441
+	public function createHTML($tag, $attrs)
442
+	{
428 443
 		return new ReportHtmlHtml($tag, $attrs);
429 444
 	}
430 445
 
431 446
 	/**
432 447
 	 * Clear the Header - ReportHtml
433 448
 	 */
434
-	public function clearHeader() {
449
+	public function clearHeader()
450
+	{
435 451
 		$this->headerElements = array();
436 452
 	}
437 453
 
438 454
 	/**
439 455
 	 * Update the Page Number and set a new Y if max Y is larger - ReportHtml
440 456
 	 */
441
-	public function addPage() {
457
+	public function addPage()
458
+	{
442 459
 		$this->pageN++;
443 460
 		// Add a little margin to max Y "between pages"
444 461
 		$this->maxY += 10;
@@ -457,7 +474,8 @@  discard block
 block discarded – undo
457 474
 	 *
458 475
 	 * @param float $y
459 476
 	 */
460
-	public function addMaxY($y) {
477
+	public function addMaxY($y)
478
+	{
461 479
 		if ($this->maxY < $y) {
462 480
 			$this->maxY = $y;
463 481
 		}
@@ -470,7 +488,8 @@  discard block
 block discarded – undo
470 488
 	 *
471 489
 	 * @return int
472 490
 	 */
473
-	public function addPageHeader($element) {
491
+	public function addPageHeader($element)
492
+	{
474 493
 		$this->pageHeaderElements[] = $element;
475 494
 
476 495
 		return count($this->headerElements) - 1;
@@ -483,7 +502,8 @@  discard block
 block discarded – undo
483 502
 	 *
484 503
 	 * @return bool false if not numbered before | object if already numbered
485 504
 	 */
486
-	public function checkFootnote($footnote) {
505
+	public function checkFootnote($footnote)
506
+	{
487 507
 		$ct  = count($this->printedfootnotes);
488 508
 		$i   = 0;
489 509
 		$val = $footnote->getValue();
@@ -508,7 +528,8 @@  discard block
 block discarded – undo
508 528
 	/**
509 529
 	 * Clear the Page Header - ReportHtml
510 530
 	 */
511
-	public function clearPageHeader() {
531
+	public function clearPageHeader()
532
+	{
512 533
 		$this->pageHeaderElements = array();
513 534
 	}
514 535
 
@@ -519,7 +540,8 @@  discard block
 block discarded – undo
519 540
 	 *
520 541
 	 * @return int Number of lines. 0 if empty line
521 542
 	 */
522
-	public function countLines($str) {
543
+	public function countLines($str)
544
+	{
523 545
 		if ($str == "") {
524 546
 			return 0;
525 547
 		}
@@ -532,7 +554,8 @@  discard block
 block discarded – undo
532 554
 	 *
533 555
 	 * @return string
534 556
 	 */
535
-	public function getCurrentStyle() {
557
+	public function getCurrentStyle()
558
+	{
536 559
 		return $this->currentStyle;
537 560
 	}
538 561
 
@@ -541,7 +564,8 @@  discard block
 block discarded – undo
541 564
 	 *
542 565
 	 * @return int
543 566
 	 */
544
-	public function getCurrentStyleHeight() {
567
+	public function getCurrentStyleHeight()
568
+	{
545 569
 		if (empty($this->currentStyle)) {
546 570
 			return $this->defaultFontSize;
547 571
 		}
@@ -557,7 +581,8 @@  discard block
 block discarded – undo
557 581
 	 *
558 582
 	 * @return int
559 583
 	 */
560
-	public function getFootnotesHeight($cellWidth) {
584
+	public function getFootnotesHeight($cellWidth)
585
+	{
561 586
 		$h = 0;
562 587
 		foreach ($this->printedfootnotes as $element) {
563 588
 			$h += $element->getFootnoteHeight($this, $cellWidth);
@@ -571,7 +596,8 @@  discard block
 block discarded – undo
571 596
 	 *
572 597
 	 * @return float
573 598
 	 */
574
-	public function getRemainingWidth() {
599
+	public function getRemainingWidth()
600
+	{
575 601
 		return $this->noMarginWidth - $this->X;
576 602
 	}
577 603
 
@@ -580,7 +606,8 @@  discard block
 block discarded – undo
580 606
 	 *
581 607
 	 * @return float
582 608
 	 */
583
-	public function getPageHeight() {
609
+	public function getPageHeight()
610
+	{
584 611
 		return $this->pageh - $this->topmargin;
585 612
 	}
586 613
 
@@ -591,7 +618,8 @@  discard block
 block discarded – undo
591 618
 	 *
592 619
 	 * @return int
593 620
 	 */
594
-	public function getStringWidth($text) {
621
+	public function getStringWidth($text)
622
+	{
595 623
 		$style = $this->getStyle($this->currentStyle);
596 624
 
597 625
 		return mb_strlen($text) * ($style['size'] / 2);
@@ -604,7 +632,8 @@  discard block
 block discarded – undo
604 632
 	 *
605 633
 	 * @return int
606 634
 	 */
607
-	public function getTextCellHeight($str) {
635
+	public function getTextCellHeight($str)
636
+	{
608 637
 		// Count the number of lines to calculate the height
609 638
 		$nl = $this->countLines($str);
610 639
 		// Calculate the cell height
@@ -616,7 +645,8 @@  discard block
 block discarded – undo
616 645
 	 *
617 646
 	 * @return float
618 647
 	 */
619
-	public function getX() {
648
+	public function getX()
649
+	{
620 650
 		return $this->X;
621 651
 	}
622 652
 
@@ -625,7 +655,8 @@  discard block
 block discarded – undo
625 655
 	 *
626 656
 	 * @return float
627 657
 	 */
628
-	public function getY() {
658
+	public function getY()
659
+	{
629 660
 		return $this->Y;
630 661
 	}
631 662
 
@@ -634,7 +665,8 @@  discard block
 block discarded – undo
634 665
 	 *
635 666
 	 * @return int
636 667
 	 */
637
-	public function pageNo() {
668
+	public function pageNo()
669
+	{
638 670
 		return $this->pageN;
639 671
 	}
640 672
 
@@ -643,7 +675,8 @@  discard block
 block discarded – undo
643 675
 	 *
644 676
 	 * @param $s
645 677
 	 */
646
-	public function setCurrentStyle($s) {
678
+	public function setCurrentStyle($s)
679
+	{
647 680
 		$this->currentStyle = $s;
648 681
 	}
649 682
 
@@ -652,7 +685,8 @@  discard block
 block discarded – undo
652 685
 	 *
653 686
 	 * @param float $x
654 687
 	 */
655
-	public function setX($x) {
688
+	public function setX($x)
689
+	{
656 690
 		$this->X = $x;
657 691
 	}
658 692
 
@@ -663,7 +697,8 @@  discard block
 block discarded – undo
663 697
 	 *
664 698
 	 * @param float $y
665 699
 	 */
666
-	public function setY($y) {
700
+	public function setY($y)
701
+	{
667 702
 		$this->Y = $y;
668 703
 		if ($this->maxY < $y) {
669 704
 			$this->maxY = $y;
@@ -678,7 +713,8 @@  discard block
 block discarded – undo
678 713
 	 * @param float $x
679 714
 	 * @param float $y
680 715
 	 */
681
-	public function setXy($x, $y) {
716
+	public function setXy($x, $y)
717
+	{
682 718
 		$this->setX($x);
683 719
 		$this->setY($y);
684 720
 	}
@@ -691,7 +727,8 @@  discard block
 block discarded – undo
691 727
 	 *
692 728
 	 * @return string
693 729
 	 */
694
-	public function textWrap($str, $width) {
730
+	public function textWrap($str, $width)
731
+	{
695 732
 		// Calculate the line width
696 733
 		$lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
697 734
 		// Wordwrap each line
@@ -719,7 +756,8 @@  discard block
 block discarded – undo
719 756
 	 * @param string $color HTML RGB color code (Ex: #001122)
720 757
 	 * @param bool   $useclass
721 758
 	 */
722
-	public function write($text, $color = '', $useclass = true) {
759
+	public function write($text, $color = '', $useclass = true)
760
+	{
723 761
 		$style    = $this->getStyle($this->getCurrentStyle());
724 762
 		$htmlcode = '<span dir="' . I18N::direction() . '"';
725 763
 		if ($useclass) {
Please login to merge, or discard this patch.
app/Report/ReportPdfImage.php 2 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -19,99 +19,99 @@
 block discarded – undo
19 19
  * Class ReportPdfImage
20 20
  */
21 21
 class ReportPdfImage extends ReportBaseImage {
22
-	/**
23
-	 * PDF image renderer
24
-	 *
25
-	 * @param ReportTcpdf $renderer
26
-	 */
27
-	public function render($renderer) {
28
-		global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
22
+    /**
23
+     * PDF image renderer
24
+     *
25
+     * @param ReportTcpdf $renderer
26
+     */
27
+    public function render($renderer) {
28
+        global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
29 29
 
30
-		// Check for a pagebreak first
31
-		if ($renderer->checkPageBreakPDF($this->height + 5)) {
32
-			$this->y = $renderer->GetY();
33
-		}
30
+        // Check for a pagebreak first
31
+        if ($renderer->checkPageBreakPDF($this->height + 5)) {
32
+            $this->y = $renderer->GetY();
33
+        }
34 34
 
35
-		$curx = $renderer->GetX();
36
-		// If current position (left)set "."
37
-		if ($this->x == ".") {
38
-			$this->x = $renderer->GetX();
39
-		} // For static position add margin
40
-		else {
41
-			$this->x = $renderer->addMarginX($this->x);
42
-			$renderer->SetX($curx);
43
-		}
44
-		if ($this->y == ".") {
45
-			//-- first check for a collision with the last picture
46
-			if (isset($lastpicbottom)) {
47
-				if (($renderer->PageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->GetY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)
48
-				) {
49
-					$renderer->SetY($lastpicbottom + 5);
50
-				}
51
-			}
52
-			$this->y = $renderer->GetY();
53
-		} else {
54
-			$renderer->SetY($this->y);
55
-		}
56
-		if ($renderer->getRTL()) {
57
-			$renderer->Image(
58
-				$this->file,
59
-				$renderer->getPageWidth() - $this->x,
60
-				$this->y,
61
-				$this->width,
62
-				$this->height,
63
-				"",
64
-				"",
65
-				$this->line,
66
-				false,
67
-				72,
68
-				$this->align
69
-			);
70
-		} else {
71
-			$renderer->Image(
72
-				$this->file,
73
-				$this->x,
74
-				$this->y,
75
-				$this->width,
76
-				$this->height,
77
-				"",
78
-				"",
79
-				$this->line,
80
-				false,
81
-				72,
82
-				$this->align
83
-			);
84
-		}
85
-		$lastpicpage           = $renderer->PageNo();
86
-		$renderer->lastpicpage = $renderer->getPage();
87
-		$lastpicleft           = $this->x;
88
-		$lastpicright          = $this->x + $this->width;
89
-		$lastpicbottom         = $this->y + $this->height;
90
-		// Setup for the next line
91
-		if ($this->line == "N") {
92
-			$renderer->SetY($lastpicbottom);
93
-		}
94
-	}
35
+        $curx = $renderer->GetX();
36
+        // If current position (left)set "."
37
+        if ($this->x == ".") {
38
+            $this->x = $renderer->GetX();
39
+        } // For static position add margin
40
+        else {
41
+            $this->x = $renderer->addMarginX($this->x);
42
+            $renderer->SetX($curx);
43
+        }
44
+        if ($this->y == ".") {
45
+            //-- first check for a collision with the last picture
46
+            if (isset($lastpicbottom)) {
47
+                if (($renderer->PageNo() == $lastpicpage) && ($lastpicbottom >= $renderer->GetY()) && ($this->x >= $lastpicleft) && ($this->x <= $lastpicright)
48
+                ) {
49
+                    $renderer->SetY($lastpicbottom + 5);
50
+                }
51
+            }
52
+            $this->y = $renderer->GetY();
53
+        } else {
54
+            $renderer->SetY($this->y);
55
+        }
56
+        if ($renderer->getRTL()) {
57
+            $renderer->Image(
58
+                $this->file,
59
+                $renderer->getPageWidth() - $this->x,
60
+                $this->y,
61
+                $this->width,
62
+                $this->height,
63
+                "",
64
+                "",
65
+                $this->line,
66
+                false,
67
+                72,
68
+                $this->align
69
+            );
70
+        } else {
71
+            $renderer->Image(
72
+                $this->file,
73
+                $this->x,
74
+                $this->y,
75
+                $this->width,
76
+                $this->height,
77
+                "",
78
+                "",
79
+                $this->line,
80
+                false,
81
+                72,
82
+                $this->align
83
+            );
84
+        }
85
+        $lastpicpage           = $renderer->PageNo();
86
+        $renderer->lastpicpage = $renderer->getPage();
87
+        $lastpicleft           = $this->x;
88
+        $lastpicright          = $this->x + $this->width;
89
+        $lastpicbottom         = $this->y + $this->height;
90
+        // Setup for the next line
91
+        if ($this->line == "N") {
92
+            $renderer->SetY($lastpicbottom);
93
+        }
94
+    }
95 95
 
96
-	/**
97
-	 * Get the image height
98
-	 *
99
-	 * @param ReportTcpdf $pdf
100
-	 *
101
-	 * @return float
102
-	 */
103
-	public function getHeight($pdf) {
104
-		return $this->height;
105
-	}
96
+    /**
97
+     * Get the image height
98
+     *
99
+     * @param ReportTcpdf $pdf
100
+     *
101
+     * @return float
102
+     */
103
+    public function getHeight($pdf) {
104
+        return $this->height;
105
+    }
106 106
 
107
-	/**
108
-	 * Get the image width.
109
-	 *
110
-	 * @param $pdf
111
-	 *
112
-	 * @return float
113
-	 */
114
-	public function getWidth($pdf) {
115
-		return $this->width;
116
-	}
107
+    /**
108
+     * Get the image width.
109
+     *
110
+     * @param $pdf
111
+     *
112
+     * @return float
113
+     */
114
+    public function getWidth($pdf) {
115
+        return $this->width;
116
+    }
117 117
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportPdfImage
20 20
  */
21
-class ReportPdfImage extends ReportBaseImage {
21
+class ReportPdfImage extends ReportBaseImage
22
+{
22 23
 	/**
23 24
 	 * PDF image renderer
24 25
 	 *
25 26
 	 * @param ReportTcpdf $renderer
26 27
 	 */
27
-	public function render($renderer) {
28
+	public function render($renderer)
29
+	{
28 30
 		global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
29 31
 
30 32
 		// Check for a pagebreak first
@@ -100,7 +102,8 @@  discard block
 block discarded – undo
100 102
 	 *
101 103
 	 * @return float
102 104
 	 */
103
-	public function getHeight($pdf) {
105
+	public function getHeight($pdf)
106
+	{
104 107
 		return $this->height;
105 108
 	}
106 109
 
@@ -111,7 +114,8 @@  discard block
 block discarded – undo
111 114
 	 *
112 115
 	 * @return float
113 116
 	 */
114
-	public function getWidth($pdf) {
117
+	public function getWidth($pdf)
118
+	{
115 119
 		return $this->width;
116 120
 	}
117 121
 }
Please login to merge, or discard this patch.
app/Report/ReportHtmlHtml.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -19,51 +19,51 @@
 block discarded – undo
19 19
  * Class ReportHtmlHtml
20 20
  */
21 21
 class ReportHtmlHtml extends ReportBaseHtml {
22
-	/**
23
-	 * Render the elements.
24
-	 *
25
-	 * @param ReportHtml $renderer
26
-	 * @param bool       $sub
27
-	 * @param bool       $inat
28
-	 *
29
-	 * @return string
30
-	 */
31
-	public function render($renderer, $sub = false, $inat = true) {
32
-		if (!empty($this->attrs["wt_style"])) {
33
-			$renderer->setCurrentStyle($this->attrs["wt_style"]);
34
-		}
22
+    /**
23
+     * Render the elements.
24
+     *
25
+     * @param ReportHtml $renderer
26
+     * @param bool       $sub
27
+     * @param bool       $inat
28
+     *
29
+     * @return string
30
+     */
31
+    public function render($renderer, $sub = false, $inat = true) {
32
+        if (!empty($this->attrs["wt_style"])) {
33
+            $renderer->setCurrentStyle($this->attrs["wt_style"]);
34
+        }
35 35
 
36
-		$this->text = $this->getStart() . $this->text;
37
-		foreach ($this->elements as $element) {
38
-			if (is_string($element) && $element == "footnotetexts") {
39
-				$renderer->footnotes();
40
-			} elseif (is_string($element) && $element == "addpage") {
41
-				$renderer->addPage();
42
-			} elseif ($element instanceof ReportBaseHtml) {
43
-				$element->render($renderer, true, false);
44
-			} else {
45
-				$element->render($renderer);
46
-			}
47
-		}
48
-		$this->text .= $this->getEnd();
49
-		if ($sub) {
50
-			return $this->text;
51
-		}
36
+        $this->text = $this->getStart() . $this->text;
37
+        foreach ($this->elements as $element) {
38
+            if (is_string($element) && $element == "footnotetexts") {
39
+                $renderer->footnotes();
40
+            } elseif (is_string($element) && $element == "addpage") {
41
+                $renderer->addPage();
42
+            } elseif ($element instanceof ReportBaseHtml) {
43
+                $element->render($renderer, true, false);
44
+            } else {
45
+                $element->render($renderer);
46
+            }
47
+        }
48
+        $this->text .= $this->getEnd();
49
+        if ($sub) {
50
+            return $this->text;
51
+        }
52 52
 
53
-		// If not called by an other attribute
54
-		if ($inat) {
55
-			$startX = $renderer->getX();
56
-			$startY = $renderer->getY();
57
-			$width  = $renderer->getRemainingWidth();
58
-			echo "<div style=\"position: absolute;top: ", $startY, "pt;", $renderer->alignRTL, ": ", $startX, "pt;width: ", $width, "pt;\">";
59
-			$startY += $renderer->getCurrentStyleHeight() + 2;
60
-			$renderer->setY($startY);
61
-		}
53
+        // If not called by an other attribute
54
+        if ($inat) {
55
+            $startX = $renderer->getX();
56
+            $startY = $renderer->getY();
57
+            $width  = $renderer->getRemainingWidth();
58
+            echo "<div style=\"position: absolute;top: ", $startY, "pt;", $renderer->alignRTL, ": ", $startX, "pt;width: ", $width, "pt;\">";
59
+            $startY += $renderer->getCurrentStyleHeight() + 2;
60
+            $renderer->setY($startY);
61
+        }
62 62
 
63
-		echo $this->text;
63
+        echo $this->text;
64 64
 
65
-		if ($inat) {
66
-			echo "</div>\n";
67
-		}
68
-	}
65
+        if ($inat) {
66
+            echo "</div>\n";
67
+        }
68
+    }
69 69
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Class ReportHtmlHtml
20 20
  */
21
-class ReportHtmlHtml extends ReportBaseHtml {
21
+class ReportHtmlHtml extends ReportBaseHtml
22
+{
22 23
 	/**
23 24
 	 * Render the elements.
24 25
 	 *
@@ -28,7 +29,8 @@  discard block
 block discarded – undo
28 29
 	 *
29 30
 	 * @return string
30 31
 	 */
31
-	public function render($renderer, $sub = false, $inat = true) {
32
+	public function render($renderer, $sub = false, $inat = true)
33
+	{
32 34
 		if (!empty($this->attrs["wt_style"])) {
33 35
 			$renderer->setCurrentStyle($this->attrs["wt_style"]);
34 36
 		}
Please login to merge, or discard this patch.