|
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
|
|
|
* Enumerate cell types. |
|
29
|
|
|
* |
|
30
|
|
|
* @return string[] Returns the cell types enumeration. |
|
31
|
|
|
*/ |
|
32
|
|
|
public static function enumCellTypes(): array { |
|
33
|
|
|
|
|
34
|
|
|
return [ |
|
35
|
|
|
DataTablesColumnInterface::DATATABLES_CELL_TYPE_TD, |
|
36
|
|
|
DataTablesColumnInterface::DATATABLES_CELL_TYPE_TH, |
|
37
|
|
|
]; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Enumerate dirs. |
|
42
|
|
|
* |
|
43
|
|
|
* @return string[] Returns the dirs enumeration. |
|
44
|
|
|
*/ |
|
45
|
|
|
public static function enumDirs(): array { |
|
46
|
|
|
|
|
47
|
|
|
return [ |
|
48
|
|
|
DataTablesOrderInterface::DATATABLES_DIR_ASC, |
|
49
|
|
|
DataTablesOrderInterface::DATATABLES_DIR_DESC, |
|
50
|
|
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Enumerate order sequences. |
|
55
|
|
|
* |
|
56
|
|
|
* @return string[] Returns the order sequences enumeration. |
|
57
|
|
|
*/ |
|
58
|
|
|
public static function enumOrderSequences(): array { |
|
59
|
|
|
|
|
60
|
|
|
return [ |
|
61
|
|
|
DataTablesColumnInterface::DATATABLES_ORDER_SEQUENCE_ASC, |
|
62
|
|
|
DataTablesColumnInterface::DATATABLES_ORDER_SEQUENCE_DESC, |
|
63
|
|
|
]; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Enumerate parameters. |
|
68
|
|
|
* |
|
69
|
|
|
* @return string[] Returns the parameters enumeration. |
|
70
|
|
|
*/ |
|
71
|
|
|
public static function enumParameters(): array { |
|
72
|
|
|
|
|
73
|
|
|
return [ |
|
74
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_COLUMNS, |
|
75
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_DRAW, |
|
76
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_LENGTH, |
|
77
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_ORDER, |
|
78
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_SEARCH, |
|
79
|
|
|
DataTablesRequestInterface::DATATABLES_PARAMETER_START, |
|
80
|
|
|
]; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Enumerate rows. |
|
85
|
|
|
* |
|
86
|
|
|
* @return string[] Returns the rows enumeration. |
|
87
|
|
|
*/ |
|
88
|
|
|
public static function enumRows(): array { |
|
89
|
|
|
|
|
90
|
|
|
return [ |
|
91
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_ATTR, |
|
92
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_CLASS, |
|
93
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_DATA, |
|
94
|
|
|
DataTablesResponseInterface::DATATABLES_ROW_ID, |
|
95
|
|
|
]; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Enumerate types. |
|
100
|
|
|
* |
|
101
|
|
|
* @return string[] Returns the types enumeration. |
|
102
|
|
|
*/ |
|
103
|
|
|
public static function enumTypes(): array { |
|
104
|
|
|
|
|
105
|
|
|
return [ |
|
106
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_DATE, |
|
107
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_HTML, |
|
108
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_HTML_NUM, |
|
109
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_NUM, |
|
110
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_NUM_FMT, |
|
111
|
|
|
DataTablesColumnInterface::DATATABLES_TYPE_STRING, |
|
112
|
|
|
]; |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|