|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* ZfTable ( Module for Zend Framework 2) |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2013 Piotr Duda [email protected] |
|
6
|
|
|
* @license MIT License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
namespace ZfTable\Options; |
|
11
|
|
|
|
|
12
|
|
|
use Zend\Stdlib\AbstractOptions; |
|
13
|
|
|
|
|
14
|
|
|
class ModuleOptions extends AbstractOptions implements |
|
15
|
|
|
TableOptionsInterface, |
|
16
|
|
|
DataTableInterface, |
|
17
|
|
|
RenderInterface, |
|
18
|
|
|
PaginatorInterface |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Name of table |
|
23
|
|
|
* @var null | string |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $name = ''; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Show or hide pagination view |
|
29
|
|
|
* @var boolean |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $showPagination = true; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Show or hide quick search view |
|
35
|
|
|
* @var boolean |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $showQuickSearch = false; |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Show or hide item per page view |
|
42
|
|
|
* @var boolean |
|
43
|
|
|
*/ |
|
44
|
|
|
protected $showItemPerPage = true; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @todo item and default count per page |
|
48
|
|
|
* Default value for item count per page |
|
49
|
|
|
* @var int |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $itemCountPerPage = 10; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Flag to show row with filters (for each column) |
|
55
|
|
|
* @var boolean |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $showColumnFilters = false; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Definition of |
|
61
|
|
|
* @var string | boolean |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $rowAction = false; |
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Show or hide exporter to CSV |
|
68
|
|
|
* @var boolean |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $showExportToCSV = false; |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Value to specify items per page (pagination) |
|
76
|
|
|
* @var array |
|
77
|
|
|
*/ |
|
78
|
|
|
protected $valuesOfItemPerPage = array(5, 10, 20, 50 , 100); |
|
79
|
|
|
|
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Get maximal rows to returning. Data tables can use |
|
83
|
|
|
* pagination, but also can get data by ajax, and use |
|
84
|
|
|
* java script to pagination (and variable destiny for this case) |
|
85
|
|
|
* |
|
86
|
|
|
* @var int |
|
87
|
|
|
*/ |
|
88
|
|
|
protected $dataTablesMaxRows = 999; |
|
89
|
|
|
|
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Template Map |
|
93
|
|
|
* @var array |
|
94
|
|
|
*/ |
|
95
|
|
|
protected $templateMap = array(); |
|
96
|
|
|
|
|
97
|
|
|
|
|
98
|
|
|
|
|
99
|
|
|
public function __construct($options = null) |
|
100
|
|
|
{ |
|
101
|
|
|
$this->templateMap = array( |
|
102
|
|
|
'paginator-slide' => __DIR__ . '/../../../view/templates/slide-paginator.phtml', |
|
103
|
|
|
'default-params' => __DIR__ . '/../../../view/templates/default-params.phtml', |
|
104
|
|
|
'container' => __DIR__ . '/../../../view/templates/container-b3.phtml', |
|
105
|
|
|
'data-table-init' => __DIR__ . '/../../../view/templates/data-table-init.phtml', |
|
106
|
|
|
'custom-b2' => __DIR__ . '/../../../view/templates/custom-b2.phtml', |
|
107
|
|
|
'custom-b3' => __DIR__ . '/../../../view/templates/custom-b3.phtml', |
|
108
|
|
|
); |
|
109
|
|
|
|
|
110
|
|
|
parent::__construct($options); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
|
|
114
|
|
|
public function getShowExportToCSV() |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->showExportToCSV; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
|
|
120
|
|
|
public function setShowExportToCSV($showExportToCSV) |
|
121
|
|
|
{ |
|
122
|
|
|
$this->showExportToCSV = $showExportToCSV; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
|
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Set template map |
|
129
|
|
|
* @param array $templateMap |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setTemplateMap($templateMap) |
|
132
|
|
|
{ |
|
133
|
|
|
$this->templateMap = $templateMap; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* Set template map |
|
139
|
|
|
* |
|
140
|
|
|
* @return array |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getTemplateMap() |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->templateMap; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* Get maximal rows to returning |
|
149
|
|
|
* |
|
150
|
|
|
* @return int |
|
151
|
|
|
*/ |
|
152
|
|
|
public function getDataTablesMaxRows() |
|
153
|
|
|
{ |
|
154
|
|
|
return $this->dataTablesMaxRows; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* Set maximal rows to returning. |
|
159
|
|
|
* |
|
160
|
|
|
* @param int $dataTablesMaxRows |
|
161
|
|
|
* @return $this |
|
162
|
|
|
*/ |
|
163
|
|
|
public function setDataTablesMaxRows($dataTablesMaxRows) |
|
164
|
|
|
{ |
|
165
|
|
|
$this->dataTablesMaxRows = $dataTablesMaxRows; |
|
166
|
|
|
return $this; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* Get Array of values to set items per page |
|
171
|
|
|
* @return array |
|
172
|
|
|
*/ |
|
173
|
|
|
public function getValuesOfItemPerPage() |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->valuesOfItemPerPage; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* |
|
180
|
|
|
* Set Array of values to set items per page |
|
181
|
|
|
* |
|
182
|
|
|
* @param array $valuesOfItemPerPage |
|
183
|
|
|
* @return $this |
|
184
|
|
|
*/ |
|
185
|
|
|
public function setValuesOfItemPerPage($valuesOfItemPerPage) |
|
186
|
|
|
{ |
|
187
|
|
|
$this->valuesOfItemPerPage = $valuesOfItemPerPage; |
|
188
|
|
|
return $this; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
|
|
192
|
|
|
public function getName() |
|
193
|
|
|
{ |
|
194
|
|
|
return $this->name; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
public function getShowPagination() |
|
198
|
|
|
{ |
|
199
|
|
|
return $this->showPagination; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
public function getShowQuickSearch() |
|
203
|
|
|
{ |
|
204
|
|
|
return $this->showQuickSearch; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
public function getShowItemPerPage() |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->showItemPerPage; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getItemCountPerPage() |
|
213
|
|
|
{ |
|
214
|
|
|
return $this->itemCountPerPage; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
public function getShowColumnFilters() |
|
218
|
|
|
{ |
|
219
|
|
|
return $this->showColumnFilters; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
public function getRowAction() |
|
223
|
|
|
{ |
|
224
|
|
|
return $this->rowAction; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
public function setName($name) |
|
228
|
|
|
{ |
|
229
|
|
|
$this->name = $name; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
public function setShowPagination($showPagination) |
|
233
|
|
|
{ |
|
234
|
|
|
$this->showPagination = $showPagination; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
public function setShowQuickSearch($showQuickSearch) |
|
238
|
|
|
{ |
|
239
|
|
|
$this->showQuickSearch = $showQuickSearch; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
public function setShowItemPerPage($showItemPerPage) |
|
243
|
|
|
{ |
|
244
|
|
|
$this->showItemPerPage = $showItemPerPage; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
public function setItemCountPerPage($itemCountPerPage) |
|
248
|
|
|
{ |
|
249
|
|
|
$this->itemCountPerPage = $itemCountPerPage; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
public function setShowColumnFilters($showColumnFilters) |
|
253
|
|
|
{ |
|
254
|
|
|
$this->showColumnFilters = $showColumnFilters; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
public function setRowAction($rowAction) |
|
258
|
|
|
{ |
|
259
|
|
|
$this->rowAction = $rowAction; |
|
260
|
|
|
} |
|
261
|
|
|
} |
|
262
|
|
|
|