1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the jquery-datatables-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\JQuery\DataTablesBundle\Model; |
13
|
|
|
|
14
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\API\DataTablesColumnInterface; |
15
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\API\DataTablesOrderInterface; |
16
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\API\DataTablesRequestInterface; |
17
|
|
|
use WBW\Bundle\JQuery\DataTablesBundle\API\DataTablesResponseInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* DataTables enumerator. |
21
|
|
|
* |
22
|
|
|
* @author webeweb <https://github.com/webeweb/> |
23
|
|
|
* @package WBW\Bundle\JQuery\DataTablesBundle\Model |
24
|
|
|
*/ |
25
|
|
|
class DataTablesEnumerator { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Enumerates cell types. |
29
|
|
|
* |
30
|
|
|
* @return string[] Returns the cell types enumeration. |
31
|
|
|
*/ |
32
|
|
|
public static function enumCellTypes(): array { |
33
|
|
|
return [ |
34
|
|
|
DataTablesColumnInterface::DATATABLES_CELL_TYPE_TD, |
35
|
|
|
DataTablesColumnInterface::DATATABLES_CELL_TYPE_TH, |
36
|
|
|
]; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Enumerates dirs. |
41
|
|
|
* |
42
|
|
|
* @return string[] Returns the dirs enumeration. |
43
|
|
|
*/ |
44
|
|
|
public static function enumDirs(): array { |
45
|
|
|
return [ |
46
|
|
|
DataTablesOrderInterface::DATATABLES_DIR_ASC, |
47
|
|
|
DataTablesOrderInterface::DATATABLES_DIR_DESC, |
48
|
|
|
]; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Enumerates order sequences. |
53
|
|
|
* |
54
|
|
|
* @return string[] Returns the order sequences enumeration. |
55
|
|
|
*/ |
56
|
|
|
public static function enumOrderSequences(): array { |
57
|
|
|
return [ |
58
|
|
|
DataTablesColumnInterface::DATATABLES_ORDER_SEQUENCE_ASC, |
59
|
|
|
DataTablesColumnInterface::DATATABLES_ORDER_SEQUENCE_DESC, |
60
|
|
|
]; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Enumerates parameters. |
65
|
|
|
* |
66
|
|
|
* @return string[] Returns the parameters enumeration. |
67
|
|
|
*/ |
68
|
|
|
public static function enumParameters(): array { |
69
|
|
|
return [ |
70
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_COLUMNS, |
71
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_DRAW, |
72
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_LENGTH, |
73
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_ORDER, |
74
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_SEARCH, |
75
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_START, |
76
|
|
|
]; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Enumerates rows. |
81
|
|
|
* |
82
|
|
|
* @return string[] Returns the rows enumeration. |
83
|
|
|
*/ |
84
|
|
|
public static function enumRows(): array { |
85
|
|
|
return [ |
86
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_ATTR, |
87
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_CLASS, |
88
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_DATA, |
89
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_ID, |
90
|
|
|
]; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Enumerates types. |
95
|
|
|
* |
96
|
|
|
* @return string[] Returns the types enumeration. |
97
|
|
|
*/ |
98
|
|
|
public static function enumTypes(): array { |
99
|
|
|
return [ |
100
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_DATE, |
101
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_HTML, |
102
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_HTML_NUM, |
103
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_NUM, |
104
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_NUM_FMT, |
105
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_STRING, |
106
|
|
|
]; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|