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 callable |
||
34 | */ |
||
35 | protected $rowCallback = NULL; |
||
36 | |||
37 | /** |
||
38 | * @param DataGrid $datagrid |
||
39 | * @param array $columns |
||
40 | */ |
||
41 | public function __construct(DataGrid $datagrid, array $columns, $rowCallback = NULL) |
||
58 | |||
59 | /** |
||
60 | * Check if can add row sum into sums.. check for every summary column |
||
61 | * @param Row $row |
||
62 | * @param string $column |
||
63 | * @return bool |
||
64 | */ |
||
65 | private function canColumnAdd(Row $row, $column) |
||
73 | |||
74 | /** |
||
75 | * @param Row $row |
||
76 | */ |
||
77 | public function add(Row $row) |
||
88 | |||
89 | |||
90 | /** |
||
91 | * @param string $key |
||
92 | * @return mixed |
||
93 | */ |
||
94 | public function render($key) |
||
107 | |||
108 | |||
109 | /** |
||
110 | * Set number format |
||
111 | * @param string $key |
||
112 | * @param int $decimals |
||
113 | * @param string $dec_point |
||
114 | * @param string $thousands_sep |
||
115 | */ |
||
116 | public function setFormat($key, $decimals = 0, $dec_point = '.', $thousands_sep = ' ') |
||
122 | |||
123 | |||
124 | /** |
||
125 | * @param array $columns |
||
126 | * @return bool |
||
127 | */ |
||
128 | public function someColumnsExist(array $columns) |
||
138 | |||
139 | } |
||
140 |