| @@ -7,10 +7,12 @@ | ||
| 7 | 7 | private /** @var array */ $columnNames = []; |
| 8 | 8 | private /** @var array */ $columnCss = []; |
| 9 | 9 | private /** @var array */ $percentBar = null; // [$colDisplay, $colSource] |
| 10 | 10 | private /** @var array */ $data = []; |
| 11 | + private /** @var array */ $vbarChart = []; | |
| 12 | + private ?Pagination $pagination = null; | |
| 11 | 13 | |
| 12 | - public function __construct(string $headline, array $columnNames = null, array $columnCss = null) | |
| 14 | + public function __construct(string $headline, array $columnNames = [], array $columnCss = []) | |
| 13 | 15 | { |
| 14 | 16 | $this->headline = $headline; |
| 15 | 17 | if ($columnNames !== null) { |
| 16 | 18 | $this->columnNames = $columnNames; |
| @@ -27,13 +29,30 @@ | ||
| 27 | 29 | } |
| 28 | 30 | |
| 29 | 31 | public function output() { |
| 30 | 32 | $table = $this->data; |
| 33 | + $pagination = $this->pagination; | |
| 31 | 34 | include __DIR__ . '/../../views/blocks/table.php'; |
| 32 | 35 | } |
| 33 | 36 | |
| 34 | 37 | public function withPercentBar(int $colDisplay, int $colSource): self { |
| 35 | 38 | $this->percentBar = [$colDisplay, $colSource]; |
| 39 | + | |
| 40 | + return $this; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public function withVbarChart(int $colSource): self { | |
| 44 | + // vbar chart | |
| 45 | + $this->vbarChart = []; | |
| 46 | + foreach ($this->data as $row) { | |
| 47 | + $this->vbarChart[] = floatval($row[$colSource]); | |
| 48 | + } | |
| 49 | + | |
| 50 | + return $this; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public function withPagination(Pagination $pagination): self { | |
| 54 | + $this->pagination = $pagination; | |
| 36 | 55 | |
| 37 | 56 | return $this; |
| 38 | 57 | } |
| 39 | 58 | |