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 | * Get value from column.. (with callback or classic getValue from row) |
||
61 | * @param Row $row |
||
62 | * @param Column\Column $column |
||
63 | * @return bool |
||
64 | */ |
||
65 | private function getValue(Row $row, $column) |
||
73 | |||
74 | /** |
||
75 | * @param Row $row |
||
76 | */ |
||
77 | public function add(Row $row) |
||
86 | |||
87 | |||
88 | /** |
||
89 | * @param string $key |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public function render($key) |
||
105 | |||
106 | |||
107 | /** |
||
108 | * Set number format |
||
109 | * @param string $key |
||
110 | * @param int $decimals |
||
111 | * @param string $dec_point |
||
112 | * @param string $thousands_sep |
||
113 | */ |
||
114 | public function setFormat($key, $decimals = 0, $dec_point = '.', $thousands_sep = ' ') |
||
120 | |||
121 | |||
122 | /** |
||
123 | * @param array $columns |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function someColumnsExist(array $columns) |
||
136 | |||
137 | } |
||
138 |