質問編集履歴
1
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,21 +16,39 @@
|
|
16
16
|
|
17
17
|
```PHP
|
18
18
|
|
19
|
+
public function get_background_class() {
|
20
|
+
|
19
|
-
$hour = date("H");
|
21
|
+
$hour = date("H");
|
20
22
|
|
21
23
|
|
22
24
|
|
23
|
-
if ($hour >= 22) {
|
25
|
+
if ($hour >= 22) {
|
24
26
|
|
25
|
-
return "midnight";
|
27
|
+
return "midnight";
|
26
28
|
|
27
|
-
} else if ($hour >= 18) {
|
29
|
+
} else if ($hour >= 18) {
|
28
30
|
|
29
|
-
return "night";
|
31
|
+
return "night";
|
30
32
|
|
31
|
-
} else if ($hour >= 16) {
|
33
|
+
} else if ($hour >= 16) {
|
32
34
|
|
35
|
+
return "evening";
|
36
|
+
|
37
|
+
} else if ($hour >= 10) {
|
38
|
+
|
39
|
+
return "noon";
|
40
|
+
|
41
|
+
} else if ($hour >= 7) {
|
42
|
+
|
43
|
+
return "morning";
|
44
|
+
|
33
|
-
|
45
|
+
} else {
|
46
|
+
|
47
|
+
return "midnight";
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
34
52
|
|
35
53
|
|
36
54
|
|
@@ -38,19 +56,39 @@
|
|
38
56
|
|
39
57
|
|
40
58
|
|
41
|
-
|
59
|
+
public function get_background_class() {
|
42
60
|
|
43
|
-
|
61
|
+
$hour = date("H");
|
44
62
|
|
45
|
-
return "midnight";
|
46
63
|
|
47
|
-
case $hour >= 18:
|
48
64
|
|
49
|
-
|
65
|
+
switch(true) {
|
50
66
|
|
51
|
-
case $hour >=
|
67
|
+
case $hour >= 22:
|
52
68
|
|
69
|
+
return "midnight";
|
70
|
+
|
71
|
+
case $hour >= 18:
|
72
|
+
|
73
|
+
return "night";
|
74
|
+
|
75
|
+
case $hour >= 16:
|
76
|
+
|
77
|
+
return "evening";
|
78
|
+
|
79
|
+
case $hour >= 10:
|
80
|
+
|
81
|
+
return "noon";
|
82
|
+
|
83
|
+
case $hour >= 7:
|
84
|
+
|
85
|
+
return "morning";
|
86
|
+
|
53
|
-
|
87
|
+
default:
|
88
|
+
|
89
|
+
return "midnight";
|
90
|
+
|
91
|
+
}
|
54
92
|
|
55
93
|
}
|
56
94
|
|