|
1
|
|
|
<?php namespace Distilleries\Expendable\Helpers; |
|
2
|
|
|
|
|
3
|
|
|
class StaticLabel { |
|
4
|
|
|
|
|
5
|
|
|
const STATUS_OFFLINE = 0; |
|
6
|
|
|
const STATUS_ONLINE = 1; |
|
7
|
|
|
|
|
8
|
|
|
const BODY_TYPE_HTML = 'html'; |
|
9
|
|
|
const BODY_TYPE_TEXT = 'text'; |
|
10
|
|
|
|
|
11
|
24 |
|
public static function status($id = null) |
|
12
|
|
|
{ |
|
13
|
|
|
$items = [ |
|
14
|
24 |
|
self::STATUS_OFFLINE => trans('expendable::label.offline'), |
|
15
|
24 |
|
self::STATUS_ONLINE => trans('expendable::label.online'), |
|
16
|
|
|
]; |
|
17
|
|
|
|
|
18
|
24 |
|
return self::getLabel($items, $id); |
|
19
|
|
|
|
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
16 |
|
public static function typeExport($id = null) |
|
23
|
|
|
{ |
|
24
|
|
|
$items = [ |
|
25
|
16 |
|
'xls' => trans('expendable::label.excel'), |
|
26
|
16 |
|
'csv' => trans('expendable::label.csv') |
|
27
|
|
|
]; |
|
28
|
|
|
|
|
29
|
16 |
|
return self::getLabel($items, $id); |
|
30
|
|
|
|
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
22 |
|
public static function yesNo($id = null) |
|
35
|
|
|
{ |
|
36
|
|
|
$items = [ |
|
37
|
22 |
|
self::STATUS_OFFLINE => trans('expendable::label.no'), |
|
38
|
22 |
|
self::STATUS_ONLINE => trans('expendable::label.yes'), |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
22 |
|
return self::getLabel($items, $id); |
|
42
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
|
|
46
|
2 |
|
public static function bodyType($id = null) |
|
47
|
|
|
{ |
|
48
|
|
|
$items = [ |
|
49
|
2 |
|
self::BODY_TYPE_HTML => trans('expendable::label.html'), |
|
50
|
2 |
|
self::BODY_TYPE_TEXT => trans('expendable::label.text'), |
|
51
|
|
|
]; |
|
52
|
|
|
|
|
53
|
2 |
|
return self::getLabel($items, $id); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
2 |
|
public static function mailActions($id = null) |
|
57
|
|
|
{ |
|
58
|
2 |
|
$config = app('config')->get('expendable.mail'); |
|
59
|
2 |
|
$dataActions = $config['actions']; |
|
60
|
2 |
|
$dataResult = []; |
|
61
|
|
|
|
|
62
|
2 |
|
foreach ($dataActions as $action) |
|
63
|
|
|
{ |
|
64
|
2 |
|
$dataResult[$action] = trans('expendable::mail.'.$action); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
2 |
|
return self::getLabel($dataResult, $id); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
8 |
|
public static function states($id = null) |
|
71
|
|
|
{ |
|
72
|
8 |
|
$config = app('config')->get('expendable.state'); |
|
73
|
8 |
|
$dataActions = $config; |
|
74
|
8 |
|
$dataResult = []; |
|
75
|
|
|
|
|
76
|
8 |
|
foreach ($dataActions as $key => $action) |
|
77
|
|
|
{ |
|
78
|
8 |
|
$dataResult[$key] = trans($action['libelle']); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
8 |
|
return self::getLabel($dataResult, $id); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
|
|
85
|
66 |
|
public static function getLabel($items, $id = null) |
|
86
|
|
|
{ |
|
87
|
66 |
|
if (isset($id)) |
|
88
|
|
|
{ |
|
89
|
4 |
|
return isset($items[$id]) ? $items[$id] : trans('expendable::label.na'); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
62 |
|
return $items; |
|
93
|
|
|
} |
|
94
|
|
|
} |