-
Notifications
You must be signed in to change notification settings - Fork 2
/
getReview.php
344 lines (305 loc) · 13.8 KB
/
getReview.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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<!DOCTYPE html>
<?php
include 'Controller.php';
$controller = new Controller;
$id = $_GET['id'];
$review = $controller->getReview($id);
?>
<!--[if IE 9]>
<html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<title><?php echo $review['topic']; ?></title>
<meta name="description" content="Worthy a Bootstrap-based, Responsive HTML5 Template">
<meta name="author" content="htmlcoder.me">
<!-- Mobile Meta -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Favicon -->
<link rel="shortcut icon" href="images/favicon.ico">
<!-- Web Fonts -->
<link
href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,300&subset=latin,latin-ext'
rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Raleway:700,400,300' rel='stylesheet' type='text/css'>
<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<!-- Font Awesome CSS -->
<link href="fonts/font-awesome/css/font-awesome.css" rel="stylesheet">
<!-- Plugins -->
<link href="css/animations.css" rel="stylesheet">
<!-- Worthy core CSS file -->
<link href="css/style.css" rel="stylesheet">
<!-- Custom css -->
<link href="css/custom.css" rel="stylesheet">
</head>
<style>
.col-md-offset-3 {
margin-top: 20px;
z-index: 3;
}
.bg-image-1 {
background-repeat: no-repeat;
background-position: center center;
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
min-height: 100%;
box-shadow: 2px 2px 10px #000000;
}
.bg {
background-color: whitesmoke;
-webkit-border-radius: 25px;
z-index: 2;
min-height: 100%;
margin-top: 100px;
background-size: cover;
box-shadow: 2px 2px 10px #000000;
margin-bottom: 50px;
}
/*.col-md-10 {*/
/*-webkit-border-radius: 25px;*/
/*margin-top: 0px;*/
/*z-index: 2;*/
/*}*/
img.weather {
margin-left: auto;
margin-right: auto;
}
</style>
<body class="no-trans">
<!-- scrollToTop -->
<div class="scrollToTop"><i class="icon-up-open-big"></i></div>
<!-- header start -->
<header class="header fixed clearfix navbar navbar-fixed-top" style="background-color:black;">
<div class="container">
<div class="row">
<div class="col-md-4">
<!-- header-left start -->
<div class="header-left clearfix">
<!-- logo -->
<div class="logo smooth-scroll">
<a href="index.html"><img id="logo" src="images/favicon.ico" alt="Worthy"></a>
</div>
<div class="site-name-and-slogan smooth-scroll">
<div class="site-name"><a href="index.html">GoDude</a></div>
<!-- <!–<div class="site-slogan">Free Bootstrap Theme by <a target="_blank" href="http://htmlcoder.me">HtmlCoder</a></div>–>-->
</div>
</div>
<!-- header-left end -->
</div>
<div class="col-md-8">
<!-- header-right start -->
<!-- ================ -->
<div class="header-right clearfix">
<!-- main-navigation start -->
<!-- ================ -->
<div class="main-navigation animated">
<!-- navbar start -->
<!-- ================ -->
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse scrollspy smooth-scroll" id="navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html">Home</a></li>
<li><a href="Topic.php">Review</a></li>
</ul>
</div>
</div>
</nav>
<!-- navbar end -->
</div>
<!-- main-navigation end -->
</div>
<!-- header-right end -->
</div>
</div>
</div>
</header>
<!-- header end -->
<div class="container-fluid bg-image-1 "> <!--main bg-->
<div class="bg col-md-10 col-lg-offset-1 " style="background-color:#FFFFFF;"> <!-- bg's topic-->
<div class="col-md-6 col-md-offset-3" style="padding-top: 10%;padding-bottom: 3%; align-content: center;"> <!--topic again-->
<!-------------- Show Topic -------------->
<?php
echo "<h1 class='text-center'>" . $review['topic'] . "</h1>";
?>
<!-------------- Show Image -------------->
<div>
<img src="<?php echo $review['image']; ?>" class="img-thumbnail">
</div>
<!---------------- Content ------------------>
<div style="padding-top: 5%">
<?php
echo $review['detail'] . "<br>";
?>
</div>
</div>
<!--------------- Show Weather -------------->
<div class="col-md-8 col-md-offset-2">
<?php
$allWeather = $controller->getWeather($review['la'], $review['long'], $review['tag']);
$weather = json_decode($allWeather);
$arrWeather = array();
$descriptionD = "";
$descriptionN = "";
$maxD = 0;
$maxN = 0;
if (is_array($weather) || is_object($weather)) {
foreach ($weather as $allContent) {
$content = json_decode($allContent, true);
if((int)$content['percent'] > $max && $content['period'] == 'day'){
$maxD = (int)$content['percent'];
$descriptionD = $content['description'];
}
elseif((int)$content['percent'] > $max && $content['period'] == 'night'){
$maxN = (int)$content['percent'];
$descriptionN = $content['description'];
}
array_push($arrWeather, $content);
}
}
?>
<div class="container" style="padding-bottom: 10%">
<h3> Trip Suggestions Average within 10 Days</h3>
<h4> @Day </h4>
<p> <?php echo $descriptionD; ?></p>
<h4> @Night </h4>
<p> <?php echo $descriptionN; ?> </p>
</div>
<h3> Weather Average within 10 Days </h3>
<div class="container">
<h4> Day Weather </h4>
<?php
foreach ($arrWeather as $content) {
if ($content['period'] == 'day') {
?>
<div class="col-md-2 text-center">
<?php
if ($content['temp'] == 'sun') {
?>
<img class="weather" src="images/day.png" width="60" height="60">
<h5>SUNNY</h5>
<?php echo $content['percent'] ?><br>
<?php
} elseif ($content['temp'] == 'clear') {
?>
<img class="weather" src="images/dayclear.png" width="60" height="60">
<h5>CLEAR</h5>
<?php echo $content['percent'] ?><br>
<?php
} else {
?>
<img class="weather" src="images/dayrain.png" width="60" height="60">
<h5>RAINY</h5>
<?php echo $content['percent'] ?><br>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button"
data-toggle="dropdown">
Rainy Day<span class="caret"></span></button>
<ul class="dropdown-menu">
<?php
$i = 0;
$j = 0;
$arr = array();
for ($i = 0; $i < strlen($content['date']); $i += 25) {
$time = substr($content['date'], $i + 1, 24);
$unixTime = date("U", strtotime($time));
$date = gmdate("d/m/y", $unixTime);
?>
<li><a href="#"><?php echo $date ?></a></li>
<?php
}
?>
</ul>
</div>
<?php }
?>
</div>
<?php
}
} ?>
</div>
<div class="container" style="padding-bottom: 10%">
<?php
echo '<h4>Night Weather</h4>';
foreach ($arrWeather as $content) {
if ($content['period'] == 'night') {
?>
<div class="col-md-2 text-center">
<?php
if ($content['temp'] == 'clear') {
?>
<img class="weather" src="images/nightclear.png" width="60" height="60">
<h5>CLEAR NIGHT</h5>
<?php echo $content['percent'] ?><br>
<?php
} else {
?>
<img class="weather" src="images/nightrain.png" width="60" height="60">
<h5>RAINY</h5>
<?php echo $content['percent'] ?><br>
<div class="dropup">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" >
Rainy Day
<span class="caret"></span></button>
<ul class="dropdown-menu">
<?php
$i = 0;
$j = 0;
$arr = array();
for ($i = 0; $i < strlen($content['date']); $i += 25) {
$time = substr($content['date'], $i + 1, 24);
$unixTime = date("U", strtotime($time));
$date = gmdate("d/m/y", $unixTime);
?>
<li><a href="#"><?php echo $date ?></a></li>
<?php
}
?>
</ul>
</div>
<?php
} ?>
</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<!-- JavaScript files placed at the end of the document so the pages load faster
<!-- Jquery and Bootstap core js files -->
<script type="text/javascript" src="plugins/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<!-- Modernizr javascript -->
<script type="text/javascript" src="plugins/modernizr.js"></script>
<!-- Isotope javascript -->
<script type="text/javascript" src="plugins/isotope/isotope.pkgd.min.js"></script>
<!-- Backstretch javascript -->
<script type="text/javascript" src="plugins/jquery.backstretch.min.js"></script>
<!-- Appear javascript -->
<script type="text/javascript" src="plugins/jquery.appear.js"></script>
<!-- Initialization of Plugins -->
<script type="text/javascript" src="js/template.js"></script>
<!-- Custom Scripts -->
<script type="text/javascript" src="js/custom.js"></script>
</body>
</html>