1
|
|
|
<?php namespace VojtaSvoboda\Reservations\Classes; |
2
|
|
|
|
3
|
|
|
use Config; |
4
|
|
|
use VojtaSvoboda\Reservations\Models\Settings; |
5
|
|
|
|
6
|
|
|
class Variables |
7
|
|
|
{ |
8
|
10 |
|
public static function getDateTimeFormat() |
9
|
|
|
{ |
10
|
10 |
|
return self::getDateFormat().' '.self::getTimeFormat(); |
11
|
|
|
} |
12
|
|
|
|
13
|
10 |
|
public static function getDateFormat() |
14
|
|
|
{ |
15
|
10 |
|
$default = Config::get('vojtasvoboda.reservations::config.formats.date', 'd/m/Y'); |
16
|
|
|
|
17
|
10 |
|
return Settings::get('formats_date', $default); |
18
|
|
|
} |
19
|
|
|
|
20
|
10 |
|
public static function getTimeFormat() |
21
|
|
|
{ |
22
|
10 |
|
$default = Config::get('vojtasvoboda.reservations::config.formats.time', 'H:i'); |
23
|
|
|
|
24
|
10 |
|
return Settings::get('formats_time', $default); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public static function getReservationInterval() |
28
|
|
|
{ |
29
|
|
|
$default = Config::get('vojtasvoboda.reservations::config.reservation.interval', 15); |
30
|
|
|
|
31
|
|
|
return (int) Settings::get('reservation_interval', $default); |
32
|
|
|
} |
33
|
|
|
|
34
|
14 |
|
public static function getReservationLength() |
35
|
|
|
{ |
36
|
14 |
|
$default = Config::get('vojtasvoboda.reservations::config.reservation.length', '2 hours'); |
37
|
|
|
|
38
|
14 |
|
$length = Settings::get('reservation_length'); |
39
|
14 |
|
$unit = Settings::get('reservation_length_unit'); |
40
|
|
|
|
41
|
14 |
|
if (empty($length) || empty($unit)) { |
42
|
1 |
|
return $default; |
43
|
|
|
} |
44
|
|
|
|
45
|
13 |
|
return $length . ' ' . $unit; |
46
|
|
|
} |
47
|
|
|
|
48
|
8 |
|
public static function getWorkingDays() |
49
|
|
|
{ |
50
|
8 |
|
$default = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']; |
51
|
|
|
|
52
|
8 |
|
return Settings::get('work_days', $default); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public static function getFirstWeekday() |
56
|
|
|
{ |
57
|
|
|
return (int) Settings::get('first_weekday', false); |
58
|
|
|
} |
59
|
|
|
|
60
|
7 |
|
public static function getWorkTimeFrom() |
61
|
|
|
{ |
62
|
7 |
|
return Settings::get('work_time_from', '10:00'); |
63
|
|
|
} |
64
|
|
|
|
65
|
7 |
|
public static function getWorkTimeTo() |
66
|
|
|
{ |
67
|
7 |
|
return Settings::get('work_time_to', '18:00'); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|