-
Notifications
You must be signed in to change notification settings - Fork 1
/
forecast.php
264 lines (235 loc) · 11.2 KB
/
forecast.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Weather4U</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div class="container-fluid" id="holder">
<div class="row">
<h1 class="text-center">Weather For <?php echo $_SESSION['cityName']; ?></h1>
<h2 class="text-center">Your 7 Day Forecast</h2>
</div>
<!-- day 1 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date1']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp1'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic1">
<h3 class="text-center main-weather" id="day1"><?php echo $_SESSION['weather1']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp1'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity1'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp1'] . '°'; ?></div></h3>
</div>
</div><!--end of panel body -->
</div><!--end of panel-->
</div>
<!--day 2 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date2']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp2'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic2">
<h3 class="text-center main-weather" id="day2"><?php echo $_SESSION['weather2']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp2'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity2'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp2'] . '°'; ?></div></h3>
</div>
</div><!-- end of panel body -->
</div><!-- end of panel -->
</div>
<!--day 3 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date3']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp3'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic3">
<h3 class="text-center main-weather" id="day3"><?php echo $_SESSION['weather3']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp3'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity3'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp3'] . '°'; ?></div></h3>
</div>
</div><!-- end of panel body -->
</div><!-- end of panel -->
</div>
<!--day 4 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date4']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp4'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic4">
<h3 class="text-center main-weather" id="day4"><?php echo $_SESSION['weather4']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp4'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity4'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp4'] . '°'; ?></div></h3>
</div>
</div><!-- end of panel body -->
</div><!-- end of panel -->
</div>
<!-- day 5 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date5']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp5'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic5">
<h3 class="text-center main-weather" id="day5"><?php echo $_SESSION['weather5']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp5'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity5'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp5'] . '°'; ?></div></h3>
</div>
</div><!-- end of panel body -->
</div><!-- end of panel -->
</div>
<!-- day 6 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date6']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp6'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic6">
<h3 class="text-center main-weather" id="day6"><?php echo $_SESSION['weather6']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp6'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity6'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp6'] . '°'; ?></div></h3>
</div>
</div><!-- end of panel body -->
</div><!-- end of panel -->
</div>
<!-- day 7 -->
<div class="row">
<div class="panel panel-default col-md-4 col-md-offset-4 plate">
<div class="panel-heading">
<h3 class="panel-title text-center"><?php echo $_SESSION['date7']; ?></h3>
</div>
<div class="panel-body">
<h1 class="main-temp text-center"><div class="fix"><?php echo $_SESSION['dayTemp7'] . '°'; ?></div></h1>
<img class="img-responsive center-block" src="" id="pic7">
<h3 class="text-center main-weather" id="day7"><?php echo $_SESSION['weather7']; ?></h3>
<div class="row">
<h3 class="col-md-4 text-center main-min">Min</h3>
<h4 class="col-md-4 text-center main-humidity">Humidity</h4>
<h3 class="col-md-4 text-center main-max">Max</h3>
</div>
<div class="row">
<h3 class="col-md-4 text-center main-min-value"><div class="fix1"><?php echo $_SESSION['minTemp7'] . '°'; ?></div></h3>
<h4 class="col-md-4 text-center main-humidity-value"><div class="fix2"><?php echo $_SESSION['humidity7'] . '%'; ?></div></h4>
<h3 class="col-md-4 text-center main-max-value"><div class="fix3"><?php echo $_SESSION['maxTemp7'] . '°'; ?></div></h3>
</div>
</div><!-- end of panel body -->
</div><!-- end of panel -->
</div>
</div><!-- end of container -->
<script>
for(var i = 1; i <= 7; i++){
var day = document.getElementById('day' + i).innerHTML;
switch(day){
case 'Rain':
document.getElementById("pic" + i).src="img/rain.png";
break;
case 'Clouds':
document.getElementById("pic" + i).src="img/clouds.png";
break;
case 'Thunderstorm':
document.getElementById("pic" + i).src="img/thunderstorm.png";
break;
case 'Drizzle':
document.getElementById("pic" + i).src="img/drizzle.png";
break;
case 'Snow':
document.getElementById("pic" + i).src="img/snow.png";
break;
case 'Atmosphere':
document.getElementById("pic" + i).src="img/clouds.png";
break;
case 'Clear':
document.getElementById("pic" + i).src="img/clear.png";
break;
case 'Extreme':
document.getElementById("pic" + i).src="img/extreme.png";
break;
default:
console.log("we hit default!");
}
}
var day = document.getElementById('day1').innerHTML;
var holder = document.getElementById('holder');
holder.setAttribute('class', 'container-fluid rain-background');
if(day == 'Rain'){
holder.setAttribute('class', 'container-fluid rain-background');
}else if(day == 'Clouds'){
holder.setAttribute('class', 'container-fluid cloudy-background');
}else if(day == 'Thunderstorm'){
holder.setAttribute('class', 'container-fluid thunderstorm-background');
}else if(day == 'Drizzle'){
holder.setAttribute('class', 'container-fluid drizzle-background');
}else if(day == 'Snow'){
holder.setAttribute('class', 'container-fluid snow-background');
}else if(day == 'Atmosphere'){
holder.setAttribute('class', 'container-fluid cloudy-background');
}else if(day == 'Clear'){
holder.setAttribute('class', 'container-fluid clear-background');
}else if(day == 'Extreme'){
holder.setAttribute('class', 'container-fluid extreme-background');
}else{
holder.setAttribute('class', 'container-fluid clear-background');
}
</script>
</body>
</html>