@@ -7,86 +7,86 @@ |
||
| 7 | 7 | { |
| 8 | 8 | |
| 9 | 9 | |
| 10 | - /*************** Grouping ************/ |
|
| 10 | + /*************** Grouping ************/ |
|
| 11 | 11 | |
| 12 | - /** @var boolean $grouppingActive set to true if grouping is active by query or function call */ |
|
| 13 | - protected $grouppingActive=false; |
|
| 12 | + /** @var boolean $grouppingActive set to true if grouping is active by query or function call */ |
|
| 13 | + protected $grouppingActive=false; |
|
| 14 | 14 | |
| 15 | - /** @var string $groupingColumn Name of column (can be hidden) for grouping */ |
|
| 16 | - protected $groupingColumn=''; |
|
| 15 | + /** @var string $groupingColumn Name of column (can be hidden) for grouping */ |
|
| 16 | + protected $groupingColumn=''; |
|
| 17 | 17 | |
| 18 | - /**@var string $groupingVal Current value of grouping column in row (used while rendering) */ |
|
| 19 | - protected $groupingVal=''; |
|
| 18 | + /**@var string $groupingVal Current value of grouping column in row (used while rendering) */ |
|
| 19 | + protected $groupingVal=''; |
|
| 20 | 20 | |
| 21 | - /** @var integer $groupingColSpan colspan of grouping line : set to table titles in init */ |
|
| 22 | - protected $groupingColSpan=1; |
|
| 21 | + /** @var integer $groupingColSpan colspan of grouping line : set to table titles in init */ |
|
| 22 | + protected $groupingColSpan=1; |
|
| 23 | 23 | |
| 24 | - /***************** Grouping ****************/ |
|
| 24 | + /***************** Grouping ****************/ |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Set grouping. column must be DB name |
|
| 28 | - * @param string $columnDBName |
|
| 29 | - */ |
|
| 30 | - public function setGrouping(string $columnDBName) |
|
| 31 | - { |
|
| 32 | - $this->groupingColumn = $columnDBName; |
|
| 33 | - $this->grouppingActive = TRUE; |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * Set grouping. column must be DB name |
|
| 28 | + * @param string $columnDBName |
|
| 29 | + */ |
|
| 30 | + public function setGrouping(string $columnDBName) |
|
| 31 | + { |
|
| 32 | + $this->groupingColumn = $columnDBName; |
|
| 33 | + $this->grouppingActive = TRUE; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Init of grouping before rendering |
|
| 38 | - */ |
|
| 39 | - public function initGrouping() |
|
| 40 | - { |
|
| 41 | - $this->groupingVal = ''; |
|
| 42 | - $this->groupingColSpan = count($this->titles); |
|
| 43 | - } |
|
| 36 | + /** |
|
| 37 | + * Init of grouping before rendering |
|
| 38 | + */ |
|
| 39 | + public function initGrouping() |
|
| 40 | + { |
|
| 41 | + $this->groupingVal = ''; |
|
| 42 | + $this->groupingColSpan = count($this->titles); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Function to print grouping value (for ovveride in specific tables) |
|
| 47 | - * @param string $value |
|
| 48 | - * @return string |
|
| 49 | - */ |
|
| 50 | - public function groupingPrintData( string $value ) |
|
| 51 | - { |
|
| 52 | - $html = "$value"; |
|
| 53 | - return $html; |
|
| 54 | - } |
|
| 45 | + /** |
|
| 46 | + * Function to print grouping value (for ovveride in specific tables) |
|
| 47 | + * @param string $value |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 50 | + public function groupingPrintData( string $value ) |
|
| 51 | + { |
|
| 52 | + $html = "$value"; |
|
| 53 | + return $html; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * When to display new grouping line (for ovveride in specific tables) |
|
| 58 | - * @param string $val1 Current value in grouping |
|
| 59 | - * @param string $val2 Value of current line |
|
| 60 | - * @return boolean TRUE if a new grouping line is needed. |
|
| 61 | - */ |
|
| 62 | - public function groupingEvalNext(string $val1, string $val2) |
|
| 63 | - { |
|
| 64 | - if ($val1 != $val2) |
|
| 65 | - return TRUE; |
|
| 66 | - else |
|
| 67 | - return FALSE; |
|
| 68 | - } |
|
| 56 | + /** |
|
| 57 | + * When to display new grouping line (for ovveride in specific tables) |
|
| 58 | + * @param string $val1 Current value in grouping |
|
| 59 | + * @param string $val2 Value of current line |
|
| 60 | + * @return boolean TRUE if a new grouping line is needed. |
|
| 61 | + */ |
|
| 62 | + public function groupingEvalNext(string $val1, string $val2) |
|
| 63 | + { |
|
| 64 | + if ($val1 != $val2) |
|
| 65 | + return TRUE; |
|
| 66 | + else |
|
| 67 | + return FALSE; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Called before each line to check if grouping line is needed. |
|
| 72 | - * @param mixed $values |
|
| 73 | - * @return string with line or empty. |
|
| 74 | - */ |
|
| 75 | - public function groupingNextLine( $values) |
|
| 76 | - { |
|
| 77 | - if ($this->grouppingActive === FALSE) return ''; |
|
| 70 | + /** |
|
| 71 | + * Called before each line to check if grouping line is needed. |
|
| 72 | + * @param mixed $values |
|
| 73 | + * @return string with line or empty. |
|
| 74 | + */ |
|
| 75 | + public function groupingNextLine( $values) |
|
| 76 | + { |
|
| 77 | + if ($this->grouppingActive === FALSE) return ''; |
|
| 78 | 78 | |
| 79 | - $dbcol = $this->groupingColumn; |
|
| 80 | - if ($values->$dbcol === NULL) $values->$dbcol = 0; // Set default to 0 |
|
| 81 | - if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE ) |
|
| 82 | - { |
|
| 83 | - $this->groupingVal = $values->$dbcol; |
|
| 84 | - $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>'; |
|
| 85 | - return $html; |
|
| 86 | - } |
|
| 87 | - return ''; |
|
| 79 | + $dbcol = $this->groupingColumn; |
|
| 80 | + if ($values->$dbcol === NULL) $values->$dbcol = 0; // Set default to 0 |
|
| 81 | + if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE ) |
|
| 82 | + { |
|
| 83 | + $this->groupingVal = $values->$dbcol; |
|
| 84 | + $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>'; |
|
| 85 | + return $html; |
|
| 86 | + } |
|
| 87 | + return ''; |
|
| 88 | 88 | |
| 89 | - } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | } |