-
Notifications
You must be signed in to change notification settings - Fork 22
/
ExampleTimelineItem.php
54 lines (46 loc) · 1.11 KB
/
ExampleTimelineItem.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Created by PhpStorm.
* User: Insolita
* Date: 11.11.14
* Time: 4:53
*/
namespace insolita\wgadminlte;
/**
* It`s Example Customization TimelineItem Object
**/
class ExampleTimelineItem extends TimelineItem
{
public $type = '';
public function init()
{
if (!$this->iconClass) {
$this->setIconClass();
}
if (!$this->iconBg) {
$this->setIconBg();
}
$this->setTime();
}
public function setTime()
{
$this->time = date('H:i', $this->time);
}
public function setIconClass()
{
$this->iconClass = $this->type == 1 ? 'fa fa-bomb' : 'fa fa-cloud';
}
public function setIconBg()
{
$m = date('n', $this->time);
if ($m == 12 or ($m >= 1 && $m < 3)) {
$this->iconBg = Timeline::TYPE_AQUA;
} elseif ($m <= 3 && $m < 6) {
$this->iconBg = Timeline::TYPE_LIME;
} elseif ($m <= 6 && $m < 9) {
$this->iconBg = Timeline::TYPE_GREEN;
} else {
$this->iconBg = Timeline::TYPE_ORANGE;
}
}
}