質問編集履歴

3

修正

2018/03/21 13:53

投稿

vowd1
vowd1

スコア53

test CHANGED
File without changes
test CHANGED
@@ -6,71 +6,71 @@
6
6
 
7
7
  ```json
8
8
 
9
- 1
9
+
10
10
 
11
- 2 {"res":
11
+ {"res":
12
12
 
13
- 3 {"ScheduleData":[
13
+ {"ScheduleData":[
14
14
 
15
- 4 {
15
+ {
16
16
 
17
- 5 "id":"0001",
17
+ "id":"0001",
18
18
 
19
- 6 "title":"サンプル01",
19
+ "title":"サンプル01",
20
20
 
21
- 7 "day":[
21
+ "day":[
22
22
 
23
- 8 {
23
+ {
24
24
 
25
- 9 "year":"2018",
25
+ "year":"2018",
26
26
 
27
- 10 "month":"03",
27
+ "month":"03",
28
28
 
29
- 11 "_day":"31"
29
+ "_day":"31"
30
30
 
31
- 12 }
31
+ }
32
32
 
33
- 13 ],
33
+ ],
34
34
 
35
- 14 "appoint_1":"単体テスト",
35
+ "appoint_1":"単体テスト",
36
36
 
37
- 15 "appoint_2":"javascript勉強会",
37
+ "appoint_2":"javascript勉強会",
38
38
 
39
- 16 "appoint_3":"新規プロジェクトキックオフ",
39
+ "appoint_3":"新規プロジェクトキックオフ",
40
40
 
41
- 17 },
41
+ },
42
42
 
43
- 18 {
43
+ {
44
44
 
45
- 19 "id":"0002",
45
+ "id":"0002",
46
46
 
47
- 20 "title":"サンプル02",
47
+ "title":"サンプル02",
48
48
 
49
- 21 "day":[
49
+ "day":[
50
50
 
51
- 22 {
51
+ {
52
52
 
53
- 23 "year":"2018",
53
+ "year":"2018",
54
54
 
55
- 24 "month":"04",
55
+ "month":"04",
56
56
 
57
- 25 "_day":"01"
57
+ "_day":"01"
58
58
 
59
- 26 }
59
+ }
60
60
 
61
- 27 ],
61
+ ],
62
62
 
63
- 28 "appoint_1":"会議",
63
+ "appoint_1":"会議",
64
64
 
65
- 29 "appoint_2":"要件定義",
65
+ "appoint_2":"要件定義",
66
66
 
67
- 30 "appoint_3":"ログ収集機能改修",
67
+ "appoint_3":"ログ収集機能改修",
68
68
 
69
- 31 }
69
+ }
70
70
 
71
- 32 ]}
71
+ ]}
72
72
 
73
- 33 }
73
+ }
74
74
 
75
75
 
76
76
 
@@ -80,48 +80,48 @@
80
80
 
81
81
  ```php
82
82
 
83
- 42 private function _getTail() {
83
+ private function _getTail() {
84
84
 
85
- 43
85
+
86
86
 
87
- 44 $url = "jsondata.json";
87
+ $url = "jsondata.json";
88
88
 
89
- 45 $json = file_get_contents($url);
89
+ $json = file_get_contents($url);
90
90
 
91
- 46 $arr = json_decode($json, true);
91
+ $arr = json_decode($json, true);
92
92
 
93
- 47
93
+
94
94
 
95
- 48
95
+
96
96
 
97
- 49 $tail = '';
97
+ $tail = '';
98
98
 
99
- 50 $lastDayOfPrevMonth = new \DateTime('last day of ' . $this->yearMonth . ' -1 month');
99
+ $lastDayOfPrevMonth = new \DateTime('last day of ' . $this->yearMonth . ' -1 month');
100
100
 
101
- 51 while ($lastDayOfPrevMonth->format('w') < 6) {
101
+ while ($lastDayOfPrevMonth->format('w') < 6) {
102
102
 
103
- 52 $tail_pre = sprintf('<td class="gray">%d', $lastDayOfPrevMonth->format('d'));
103
+ $tail_pre = sprintf('<td class="gray">%d', $lastDayOfPrevMonth->format('d'));
104
104
 
105
- 53
105
+
106
106
 
107
- 54 $tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["ScheduleData"][0]["appoint_1"]);
107
+ $tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["ScheduleData"][0]["appoint_1"]); ←※1
108
108
 
109
- 55 $tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["ScheduleData"][0]["appoint_2"]);
109
+ $tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["ScheduleData"][0]["appoint_2"]);
110
110
 
111
- 56 $tail = $tail_pre . $tail_appoint_1 . $tail_appoint_2 . $tail;
111
+ $tail = $tail_pre . $tail_appoint_1 . $tail_appoint_2 . $tail;
112
112
 
113
- 57
113
+
114
114
 
115
- 58 $lastDayOfPrevMonth->sub(new \DateInterval('P1D'));
115
+ $lastDayOfPrevMonth->sub(new \DateInterval('P1D'));
116
116
 
117
- 59 }
117
+ }
118
118
 
119
- 60 return $tail;
119
+ return $tail;
120
120
 
121
- 61 }
121
+ }
122
122
 
123
123
 
124
124
 
125
125
  ```
126
126
 
127
- 上記のphpの54行目のところをforeachで回してid:0001とid:0002もそしてさらに増えても取得してカレンダーに表示できるようにしたいのですが、どのように書き換えるべきでしょうか。
127
+ 上記のphpの※1のところをforeachで回してid:0001とid:0002もそしてさらに増えても取得してカレンダーに表示できるようにしたいのですが、どのように書き換えるべきでしょうか。

2

改修

2018/03/21 13:53

投稿

vowd1
vowd1

スコア53

test CHANGED
File without changes
test CHANGED
@@ -32,11 +32,11 @@
32
32
 
33
33
  13 ],
34
34
 
35
- 14 "appoint_1":"エコ配取材",
35
+ 14 "appoint_1":"単体テスト",
36
36
 
37
- 15 "appoint_2":"scala勉強会",
37
+ 15 "appoint_2":"javascript勉強会",
38
38
 
39
- 16 "appoint_3":"talknoteキックオフ",
39
+ 16 "appoint_3":"新規プロジェクトキックオフ",
40
40
 
41
41
  17 },
42
42
 

1

改修

2018/03/21 13:49

投稿

vowd1
vowd1

スコア53

test CHANGED
File without changes
test CHANGED
@@ -104,9 +104,9 @@
104
104
 
105
105
  53
106
106
 
107
- 54 $tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["blogData"][0]["appoint_1"]);
107
+ 54 $tail_appoint_1 = sprintf('<ul><li>%s</li>', $arr["res"]["ScheduleData"][0]["appoint_1"]);
108
108
 
109
- 55 $tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["blogData"][0]["appoint_2"]);
109
+ 55 $tail_appoint_2 = sprintf('<li>%s</li></td>', $arr["res"]["ScheduleData"][0]["appoint_2"]);
110
110
 
111
111
  56 $tail = $tail_pre . $tail_appoint_1 . $tail_appoint_2 . $tail;
112
112