1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the O2System Reactor package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @author Steeve Andrian Salim |
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------ |
13
|
|
|
|
14
|
|
|
namespace O2System\Reactor\Models; |
15
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------ |
17
|
|
|
|
18
|
|
|
use O2System\Reactor\Models\Files\Model; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class Options |
22
|
|
|
* @package O2System\Reactor\Models |
23
|
|
|
*/ |
24
|
|
|
class Options extends Model |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Options constructor. |
28
|
|
|
*/ |
29
|
|
|
public function __construct() |
30
|
|
|
{ |
31
|
|
|
parent::__construct(); |
32
|
|
|
$this->language->loadFile('options'); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @return array |
37
|
|
|
*/ |
38
|
|
|
public function religions() |
39
|
|
|
{ |
40
|
|
|
$religions = []; |
41
|
|
|
|
42
|
|
|
foreach (['ATHEIST', 'HINDU', 'BUDDHA', 'MOSLEM', 'CHRISTIAN', 'CATHOLIC', 'UNDEFINED'] as $religion) { |
43
|
|
|
$religions[ $religion ] = $this->language->getLine($religion); |
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
return $religions; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return array |
51
|
|
|
*/ |
52
|
|
|
public function genders() |
53
|
|
|
{ |
54
|
|
|
$genders = []; |
55
|
|
|
|
56
|
|
|
foreach (['MALE', 'FEMALE', 'UNDEFINED'] as $gender) { |
57
|
|
|
$genders[ $gender ] = $this->language->getLine($gender); |
|
|
|
|
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
return $genders; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return array |
65
|
|
|
*/ |
66
|
|
|
public function maritals() |
67
|
|
|
{ |
68
|
|
|
$maritals = []; |
69
|
|
|
|
70
|
|
|
foreach (['SINGLE', 'MARRIED', 'DIVORCED', 'UNDEFINED'] as $marital) { |
71
|
|
|
$maritals[ $marital ] = $this->language->getLine($marital); |
|
|
|
|
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
return $maritals; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return array |
79
|
|
|
*/ |
80
|
|
|
public function bloodTypes() |
81
|
|
|
{ |
82
|
|
|
$bloodTypes = []; |
83
|
|
|
|
84
|
|
|
foreach (['A', 'B', 'AB', 'O', 'UNDEFINED'] as $bloodType) { |
85
|
|
|
$bloodTypes[ $bloodType ] = $this->language->getLine($bloodType); |
|
|
|
|
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
return $bloodTypes; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param int $start |
93
|
|
|
* @param int $end |
94
|
|
|
* @param string $labelFormat |
95
|
|
|
* @return array |
96
|
|
|
*/ |
97
|
|
|
public function days($start = 1, $end = 7, $labelFormat = 'l') |
98
|
|
|
{ |
99
|
|
|
$this->language->loadFile('calendar'); |
|
|
|
|
100
|
|
|
|
101
|
|
|
$year = date('o'); |
102
|
|
|
$week = date('W'); |
103
|
|
|
|
104
|
|
|
$days = []; |
105
|
|
|
|
106
|
|
|
for ($i = $start; $i <= $end; $i++) { |
107
|
|
|
$time = strtotime($year . 'W' . $week . $i); |
108
|
|
|
$days[ strtoupper(date('D', $time)) ] = $this->language->getLine( |
109
|
|
|
'CAL_' . strtoupper(date($labelFormat, $time))); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
return $days; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @param int $start |
117
|
|
|
* @param int $end |
118
|
|
|
* @param bool $leading |
119
|
|
|
* @return array |
120
|
|
|
*/ |
121
|
|
|
public function dates($start = 1, $end = 31, $leading = true) |
122
|
|
|
{ |
123
|
|
|
$dates = []; |
124
|
|
|
|
125
|
|
|
foreach (range($start, $end) as $date) { |
126
|
|
|
if ($leading) { |
127
|
|
|
$date = strlen($date) == 1 ? '0' . $date : $date; |
128
|
|
|
} |
129
|
|
|
$dates[ $date ] = $date; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
return $dates; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @param int $start |
137
|
|
|
* @param int $end |
138
|
|
|
* @param bool $leading |
139
|
|
|
* @return array |
140
|
|
|
*/ |
141
|
|
|
public function months($start = 1, $end = 12, $leading = true) |
142
|
|
|
{ |
143
|
|
|
$this->language->loadFile('calendar'); |
|
|
|
|
144
|
|
|
|
145
|
|
|
$months = []; |
146
|
|
|
|
147
|
|
|
foreach (range($start, $end) as $month) { |
148
|
|
|
if ($leading) { |
149
|
|
|
$month = strlen($month) == 1 ? '0' . $month : $month; |
150
|
|
|
} |
151
|
|
|
$months[ $month ] = $this->language->getLine(strtoupper('CAL_' . date('F', |
152
|
|
|
strtotime('1-' . $month . '-2000')))); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
return $months; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param int $start |
160
|
|
|
* @param null $end |
|
|
|
|
161
|
|
|
* @return array |
162
|
|
|
*/ |
163
|
|
|
public function years($start = 1900, $end = null) |
164
|
|
|
{ |
165
|
|
|
$end = empty($end) ? date('Y') : $end; |
166
|
|
|
$years = []; |
167
|
|
|
|
168
|
|
|
foreach (range($start, $end) as $year) { |
169
|
|
|
$years[ $year ] = $year; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
return $years; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return array |
177
|
|
|
*/ |
178
|
|
|
public function identities() |
179
|
|
|
{ |
180
|
|
|
$identities = []; |
181
|
|
|
|
182
|
|
|
foreach (['UNDEFINED', 'IDENTITY_CARD', 'STUDENT_CARD', 'DRIVER_LICENSE', 'PASSPORT'] as $identity) { |
183
|
|
|
$identities[ $identity ] = $this->language->getLine($identity); |
|
|
|
|
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
return $identities; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @return array |
191
|
|
|
*/ |
192
|
|
|
public function sizes() |
193
|
|
|
{ |
194
|
|
|
$sizes = []; |
195
|
|
|
foreach (['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'] as $size) { |
196
|
|
|
$sizes[ $size ] = $size; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
return $sizes; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return array |
204
|
|
|
*/ |
205
|
|
|
public function boolean() |
206
|
|
|
{ |
207
|
|
|
$boolean = []; |
208
|
|
|
foreach (['YES', 'NO'] as $bool) { |
209
|
|
|
$boolean[ $bool ] = $this->language->getLine('BOOL_' . $bool); |
|
|
|
|
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
return $boolean; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return array |
217
|
|
|
*/ |
218
|
|
|
public function familyRelationships() |
219
|
|
|
{ |
220
|
|
|
$familyRelationships = []; |
221
|
|
|
|
222
|
|
|
foreach ([ |
223
|
|
|
'PARENT', |
224
|
|
|
'CHILD', |
225
|
|
|
'SPOUSE', |
226
|
|
|
'SIBLING', |
227
|
|
|
'GRANDPARENTS', |
228
|
|
|
'GRANDCHILD', |
229
|
|
|
'PARENTS_SIBLING', |
230
|
|
|
'SIBLINGS_CHILD', |
231
|
|
|
'AUNTS_UNCLES_CHILD', |
232
|
|
|
] as $relationship |
233
|
|
|
) { |
234
|
|
|
$familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
|
|
|
|
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
return $familyRelationships; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @return array |
242
|
|
|
*/ |
243
|
|
|
public function status() |
244
|
|
|
{ |
245
|
|
|
$statuses = []; |
246
|
|
|
|
247
|
|
|
foreach ([ |
248
|
|
|
'PUBLISH', |
249
|
|
|
'UNPUBLISH', |
250
|
|
|
'DRAFT', |
251
|
|
|
'ARCHIVED', |
252
|
|
|
'TRASH', |
253
|
|
|
] as $status |
254
|
|
|
) { |
255
|
|
|
$statuses[ $status ] = $this->language->getLine($status); |
|
|
|
|
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
return $statuses; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
// ------------------------------------------------------------------------ |
262
|
|
|
|
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @return array |
266
|
|
|
*/ |
267
|
|
|
public function visibilities() |
268
|
|
|
{ |
269
|
|
|
$visibilities = []; |
270
|
|
|
|
271
|
|
|
foreach ([ |
272
|
|
|
'PUBLIC', |
273
|
|
|
'PRIVATE', |
274
|
|
|
'MEMBER', |
275
|
|
|
] as $visibility |
276
|
|
|
) { |
277
|
|
|
$visibilities[ $visibility ] = $this->language->getLine($visibility); |
|
|
|
|
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
return $visibilities; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
// ------------------------------------------------------------------------ |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* Options::languages |
287
|
|
|
* |
288
|
|
|
* @return array |
289
|
|
|
*/ |
290
|
|
|
public function languages() |
291
|
|
|
{ |
292
|
|
|
$languages = []; |
293
|
|
|
|
294
|
|
|
foreach ($this->language->getRegistry() as $language) { |
|
|
|
|
295
|
|
|
$languages[ $language->getParameter() ] = $language->getProperties()->name; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
return $languages; |
299
|
|
|
} |
300
|
|
|
} |