forked from qwildz/packerplan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_tempat.php
175 lines (159 loc) · 6.55 KB
/
list_tempat.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
<?php
include 'koneksi.php';
$urut = $_GET['urut'];
if ($urut == 'bintang')
{
$sql = "SELECT tempat_wisata.*, AVG(bintang) AS rating, foto
FROM tempat_wisata
LEFT JOIN foto_wisata USING (id_tempat)
LEFT JOIN review USING (id_tempat)
GROUP BY tempat_wisata.id_tempat
ORDER BY rating DESC";
$bg = 'jumbo-bintang.jpg';
$fa = 'fa-star';
$title = 'Tempat Paling Bintang';
}
else if ($urut == 'gosip')
{
$sql = "SELECT tempat_wisata.*, COUNT(bintang) AS jumlah_komentar, AVG(bintang) AS rating, foto
FROM tempat_wisata
LEFT JOIN foto_wisata USING (id_tempat)
LEFT JOIN review USING (id_tempat)
GROUP BY tempat_wisata.id_tempat
ORDER BY jumlah_komentar DESC";
$bg = 'jumbo-gosip.jpg';
$fa = 'fa-comments';
$title = 'Tempat Tergosip';
}
else if ($urut == 'heboh')
{
$sql = "SELECT tempat_wisata.*, COUNT(id_partisipan)+1 AS jumlah_pengunjung, foto,
(SELECT AVG(bintang)
FROM review
WHERE review.id_tempat = tempat_wisata.id_tempat) AS rating
FROM tempat_wisata
LEFT JOIN foto_wisata USING (id_tempat)
LEFT JOIN rute_rencana USING (id_tempat)
LEFT JOIN partisipan USING (id_rencana)
GROUP BY tempat_wisata.id_tempat
ORDER BY jumlah_pengunjung DESC";
$bg = 'jumbo-heboh.jpg';
$fa = 'fa-group';
$title = 'Tempat Paling Heboh';
}
else
{
$sql = "SELECT tempat_wisata.*, AVG(bintang) AS rating, foto
FROM tempat_wisata
LEFT JOIN review USING (id_tempat)
LEFT JOIN foto_wisata USING (id_tempat)
GROUP BY tempat_wisata.id_tempat
ORDER BY created DESC";
$bg = 'jumbo-general.jpg';
$fa = 'fa-picture-o';
$title = 'Tempat Wisata';
}
$query = mysqli_query($koneksi, $sql);
$tempat = array();
while ($row = mysqli_fetch_assoc($query))
{
$tempat[] = $row;
}
?>
<!DOCTYPE html>
<html>
<head lang="id">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $title; ?> - PackerPlan</title>
<!-- Bootstrap -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/bootstrap-nonresponsive.css" rel="stylesheet">
<link href="assets/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/css/styles.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<?php include 'includes/header.php'; ?>
<div class="bg-parallax" style="background-image:url('media/<?php echo $bg; ?>');"></div>
<div class="jumbotron small">
<h2 class="icon"><span class="fa <?php echo $fa; ?>"></span><span> <?php echo $title; ?> </span><span
class="fa <?php echo $fa; ?>"></span></h2>
<ul class="nav nav-tabs">
<li role="presentation" class="<?php if ( ! $urut) echo 'active'; ?>">
<a href="list_tempat.php" role="button">
<span class="fa fa-clock-o"></span> Terbaru
</a>
</li>
<li role="presentation" class="<?php if ($urut == 'bintang') echo 'active'; ?>">
<a href="list_tempat.php?urut=bintang" role="button">
<span class="fa fa-star"></span> Terbintang
</a>
</li>
<li role="presentation" class="<?php if ($urut == 'gosip') echo 'active'; ?>">
<a href="list_tempat.php?urut=gosip" role="button">
<span class="fa fa-comments"></span> Tergosip
</a>
</li>
<li role="presentation" class="<?php if ($urut == 'heboh') echo 'active'; ?>">
<a href="list_tempat.php?urut=heboh" role="button">
<span class="fa fa-group"></span> Terheboh
</a>
</li>
</ul>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="row">
<?php foreach ($tempat as $t)
{ ?>
<div class="col-xs-4 place-small-container">
<a href="tempat.php?id_tempat=<?php echo $t['id_tempat']; ?>">
<div class="place-small">
<div class="photo"
style="background-image:url('media/<?php echo $t['foto']; ?>');"></div>
<div class="place-details-container">
<div class="place-detail pull-left">
<div class="media">
<div class="media-body">
<h5 class="media-heading"><?php echo $t['nama_tempat']; ?></h5>
<span><?php echo $t['alamat']; ?></span>
</div>
</div>
</div>
<div class="place-rating pull-right">
<span><span class="fa fa-star"></span> <?php echo round($t['rating'], 1); ?></span>
</div>
</div>
</div>
</a>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="assets/js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="assets/js/bootstrap.min.js"></script>
<script>
$(function () {
var jumboHeight = $('.jumbotron').outerHeight();
function parallax() {
var scrolled = $(window).scrollTop();
$('.bg-parallax').css('height', (jumboHeight - scrolled) + 'px');
}
$(window).scroll(function (e) {
parallax();
});
})
</script>
</body>
</html>