1 | <?php |
||
14 | class ColumnsSummary |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var DataGrid |
||
19 | */ |
||
20 | protected $datagrid; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $summary; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $format = []; |
||
31 | |||
32 | /** |
||
33 | * @var NULL|callable |
||
34 | */ |
||
35 | protected $rowCallback; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @param DataGrid $datagrid |
||
40 | * @param array $columns |
||
41 | */ |
||
42 | public function __construct(DataGrid $datagrid, array $columns, $rowCallback) |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Get value from column using Row::getValue() or custom callback |
||
63 | * @param Row $row |
||
64 | * @param Column\Column $column |
||
65 | * @return bool |
||
66 | */ |
||
67 | private function getValue(Row $row, $column) |
||
75 | |||
76 | |||
77 | /** |
||
78 | * @param Row $row |
||
79 | */ |
||
80 | public function add(Row $row) |
||
89 | |||
90 | |||
91 | /** |
||
92 | * @param string $key |
||
93 | * @return mixed |
||
94 | */ |
||
95 | public function render($key) |
||
108 | |||
109 | |||
110 | /** |
||
111 | * Set number format |
||
112 | * @param string $key |
||
113 | * @param int $decimals |
||
114 | * @param string $dec_point |
||
115 | * @param string $thousands_sep |
||
116 | */ |
||
117 | public function setFormat($key, $decimals = 0, $dec_point = '.', $thousands_sep = ' ') |
||
123 | |||
124 | |||
125 | /** |
||
126 | * @param array $columns |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function someColumnsExist(array $columns) |
||
139 | |||
140 | } |
||
141 |