|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Hosting Plugin for HiPanel |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://github.com/hiqdev/hipanel-module-hosting |
|
6
|
|
|
* @package hipanel-module-hosting |
|
7
|
|
|
* @license BSD-3-Clause |
|
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace hipanel\modules\hosting\grid; |
|
12
|
|
|
|
|
13
|
|
|
use DateTime; |
|
14
|
|
|
use hipanel\widgets\gridLegend\BaseGridLegend; |
|
15
|
|
|
use hipanel\widgets\gridLegend\GridLegendInterface; |
|
16
|
|
|
|
|
17
|
|
|
class RequestGridLegend extends BaseGridLegend implements GridLegendInterface |
|
18
|
|
|
{ |
|
19
|
|
|
public function items() |
|
20
|
|
|
{ |
|
21
|
|
|
return [ |
|
22
|
|
|
[ |
|
23
|
|
|
'label' => ['hipanel:hosting', 'Scheduled time:'], |
|
24
|
|
|
'tag' => 'h4', |
|
25
|
|
|
], |
|
26
|
|
|
[ |
|
27
|
|
|
'label' => ['hipanel:hosting', 'Already'], |
|
28
|
|
|
'color' => '#E0E0E0', |
|
29
|
|
|
'rule' => ((new DateTime($this->model->time)) < (new DateTime())), |
|
|
|
|
|
|
30
|
|
|
'columns' => ['time'], |
|
31
|
|
|
], |
|
32
|
|
|
[ |
|
33
|
|
|
'label' => ['hipanel:hosting', 'Deferred'], |
|
34
|
|
|
'color' => '#AAAAFF', |
|
35
|
|
|
'rule' => ((new DateTime($this->model->time)) > (new DateTime())), |
|
|
|
|
|
|
36
|
|
|
'columns' => ['time'], |
|
37
|
|
|
], |
|
38
|
|
|
[ |
|
39
|
|
|
'label' => ['hipanel:hosting', 'State:'], |
|
40
|
|
|
'tag' => 'h4', |
|
41
|
|
|
], |
|
42
|
|
|
[ |
|
43
|
|
|
'label' => ['hipanel:hosting', 'New'], |
|
44
|
|
|
'color' => '#FFFF99', |
|
45
|
|
|
'rule' => $this->model->state === 'new', |
|
|
|
|
|
|
46
|
|
|
'columns' => ['state'], |
|
47
|
|
|
], |
|
48
|
|
|
[ |
|
49
|
|
|
'label' => ['hipanel:hosting', 'In progress'], |
|
50
|
|
|
'color' => '#AAFFAA', |
|
51
|
|
|
'rule' => $this->model->state === 'progress', |
|
|
|
|
|
|
52
|
|
|
'columns' => ['state'], |
|
53
|
|
|
], |
|
54
|
|
|
[ |
|
55
|
|
|
'label' => ['hipanel:hosting', 'Done'], |
|
56
|
|
|
'columns' => ['state'], |
|
57
|
|
|
], |
|
58
|
|
|
[ |
|
59
|
|
|
'label' => ['hipanel:hosting', 'Error'], |
|
60
|
|
|
'color' => '#FFCCCC', |
|
61
|
|
|
'rule' => $this->model->state === 'error', |
|
|
|
|
|
|
62
|
|
|
'columns' => ['state'], |
|
63
|
|
|
], |
|
64
|
|
|
[ |
|
65
|
|
|
'label' => ['hipanel:hosting', 'Buzzed'], |
|
66
|
|
|
'color' => '#FFCCCC', |
|
67
|
|
|
'rule' => $this->model->state === 'buzzed', |
|
|
|
|
|
|
68
|
|
|
'columns' => ['state'], |
|
69
|
|
|
], |
|
70
|
|
|
]; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: