質問編集履歴
3
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,63 +2,63 @@
|
|
2
2
|
|
3
3
|
下記jsonです。
|
4
4
|
```json
|
5
|
-
|
5
|
+
|
6
|
-
|
6
|
+
{"res":
|
7
|
-
|
7
|
+
{"ScheduleData":[
|
8
|
-
|
8
|
+
{
|
9
|
-
|
9
|
+
"id":"0001",
|
10
|
-
|
10
|
+
"title":"サンプル01",
|
11
|
-
|
11
|
+
"day":[
|
12
|
-
|
12
|
+
{
|
13
|
-
|
13
|
+
"year":"2018",
|
14
|
-
|
14
|
+
"month":"03",
|
15
|
-
|
15
|
+
"_day":"31"
|
16
|
-
|
16
|
+
}
|
17
|
-
|
17
|
+
],
|
18
|
-
|
18
|
+
"appoint_1":"単体テスト",
|
19
|
-
|
19
|
+
"appoint_2":"javascript勉強会",
|
20
|
-
|
20
|
+
"appoint_3":"新規プロジェクトキックオフ",
|
21
|
-
|
21
|
+
},
|
22
|
-
|
22
|
+
{
|
23
|
-
|
23
|
+
"id":"0002",
|
24
|
-
|
24
|
+
"title":"サンプル02",
|
25
|
-
|
25
|
+
"day":[
|
26
|
-
|
26
|
+
{
|
27
|
-
|
27
|
+
"year":"2018",
|
28
|
-
|
28
|
+
"month":"04",
|
29
|
-
|
29
|
+
"_day":"01"
|
30
|
-
|
30
|
+
}
|
31
|
-
|
31
|
+
],
|
32
|
-
|
32
|
+
"appoint_1":"会議",
|
33
|
-
|
33
|
+
"appoint_2":"要件定義",
|
34
|
-
|
34
|
+
"appoint_3":"ログ収集機能改修",
|
35
|
-
31 }
|
36
|
-
|
35
|
+
}
|
37
|
-
|
36
|
+
]}
|
37
|
+
}
|
38
38
|
|
39
39
|
```
|
40
40
|
|
41
41
|
```php
|
42
|
-
|
42
|
+
private function _getTail() {
|
43
|
-
|
43
|
+
|
44
|
-
|
44
|
+
$url = "jsondata.json";
|
45
|
-
|
45
|
+
$json = file_get_contents($url);
|
46
|
-
|
46
|
+
$arr = json_decode($json, true);
|
47
|
-
|
47
|
+
|
48
|
-
|
48
|
+
|
49
|
-
|
49
|
+
$tail = '';
|
50
|
-
|
50
|
+
$lastDayOfPrevMonth = new \DateTime('last day of ' . $this->yearMonth . ' -1 month');
|
51
|
-
|
51
|
+
while ($lastDayOfPrevMonth->format('w') < 6) {
|
52
|
-
|
52
|
+
$tail_pre = sprintf('<td class="gray">%d', $lastDayOfPrevMonth->format('d'));
|
53
|
-
|
53
|
+
|
54
|
-
|
54
|
+
$tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["ScheduleData"][0]["appoint_1"]); ←※1
|
55
|
-
|
55
|
+
$tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["ScheduleData"][0]["appoint_2"]);
|
56
|
-
|
56
|
+
$tail = $tail_pre . $tail_appoint_1 . $tail_appoint_2 . $tail;
|
57
|
-
|
57
|
+
|
58
|
-
|
58
|
+
$lastDayOfPrevMonth->sub(new \DateInterval('P1D'));
|
59
|
-
|
59
|
+
}
|
60
|
-
|
60
|
+
return $tail;
|
61
|
-
|
61
|
+
}
|
62
62
|
|
63
63
|
```
|
64
|
-
上記のphpの
|
64
|
+
上記のphpの※1のところをforeachで回してid:0001とid:0002もそしてさらに増えても取得してカレンダーに表示できるようにしたいのですが、どのように書き換えるべきでしょうか。
|
2
改修
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,9 +15,9 @@
|
|
15
15
|
11 "_day":"31"
|
16
16
|
12 }
|
17
17
|
13 ],
|
18
|
-
14 "appoint_1":"
|
18
|
+
14 "appoint_1":"単体テスト",
|
19
|
-
15 "appoint_2":"
|
19
|
+
15 "appoint_2":"javascript勉強会",
|
20
|
-
16 "appoint_3":"
|
20
|
+
16 "appoint_3":"新規プロジェクトキックオフ",
|
21
21
|
17 },
|
22
22
|
18 {
|
23
23
|
19 "id":"0002",
|
1
改修
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,8 +51,8 @@
|
|
51
51
|
51 while ($lastDayOfPrevMonth->format('w') < 6) {
|
52
52
|
52 $tail_pre = sprintf('<td class="gray">%d', $lastDayOfPrevMonth->format('d'));
|
53
53
|
53
|
54
|
-
54 $tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["
|
54
|
+
54 $tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["ScheduleData"][0]["appoint_1"]);
|
55
|
-
55 $tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["
|
55
|
+
55 $tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["ScheduleData"][0]["appoint_2"]);
|
56
56
|
56 $tail = $tail_pre . $tail_appoint_1 . $tail_appoint_2 . $tail;
|
57
57
|
57
|
58
58
|
58 $lastDayOfPrevMonth->sub(new \DateInterval('P1D'));
|