-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrips4.php
198 lines (162 loc) · 4.81 KB
/
trips4.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
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
#right-panel {
font-family: 'Roboto','sans-serif';
line-height: 30px;
padding-left: 10px;
}
#right-panel select, #right-panel input {
font-size: 15px;
}
#right-panel select {
width: 100%;
}
#right-panel i {
font-size: 12px;
}
</style>
<style>
#right-panel {
font-family: Arial, Helvetica, sans-serif;
position: absolute;
right: 5px;
top: 60%;
margin-top: -195px;
height: 330px;
width: 200px;
padding: 5px;
z-index: 5;
border: 1px solid #999;
background: #fff;
}
h2 {
font-size: 22px;
margin: 0 0 5px 0;
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
height: 271px;
width: 200px;
overflow-y: scroll;
}
li {
background-color: #f1f1f1;
padding: 10px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
li:nth-child(odd) {
background-color: #fcfcfc;
}
#more {
width: 100%;
margin: 5px 0 0 0;
}
</style>
</head>
<?php
session_start();
include_once("server.php");
include_once("functions.php");
$smile = $_SESSION['smiling'];
$sql = "SELECT * from trips WHERE smile >= '$smile'";
$result = mysql_query($sql);
while ($data = mysql_fetch_object($result)){
$posts[] = array( 'place_name' =>$data->place_name,
'place_expense' => $data->place_expense,
'id' => $data->id);
}
echo "<div class='jumbotron'>";
echo "<center><h3>";
echo "Recommended Places for you";
echo "</h3></center>";
echo "</div>";
echo "<div class='list-group'>";
foreach ($posts as $key => $value){
echo "<a class='list-group-item'href='tripdetail.php?id=$key'".">".$value['place_name']."</a>";
}
echo "</div>";
?>
<body>
<script>
var map;
var x = document.getElementById('latss').value;
var y = document.getElementById('lngss').value;
function initMap() {
var pyrmont = new google.maps.LatLng(12.9667,77.5667);
map = new google.maps.Map(document.getElementById('map'));
map.setZoom(13); // This will trigger a zoom_changed on the map
map.setCenter(new google.maps.LatLng(12.9667,77.5667));
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
location: pyrmont,
radius: 500,
types: ['resturants']
}, processResults);
}
function processResults(results, status, pagination) {
if (status !== google.maps.places.PlacesServiceStatus.OK) {
return;
} else {
createMarkers(results);
if (pagination.hasNextPage) {
var moreButton = document.getElementById('more');
moreButton.disabled = false;
moreButton.addEventListener('click', function() {
moreButton.disabled = true;
pagination.nextPage();
});
}
}
}
function createMarkers(places) {
var bounds = new google.maps.LatLngBounds();
var placesList = document.getElementById('places');
for (var i = 0, place; place = places[i]; i++) {
var image = {
url: place.icon,
size: new google.maps.Size(71, 71),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(17, 34),
scaledSize: new google.maps.Size(25, 25)
};
var marker = new google.maps.Marker({
map: map,
icon: image,
title: place.name,
position: place.geometry.location
});
placesList.innerHTML += '<li>' + place.name + '</li>';
bounds.extend(place.geometry.location);
}
map.fitBounds(bounds);
}
</script>
<div id="map"></div>
<div id="right-panel">
<h2>Results</h2>
<ul id="places"></ul>
<button id="more">More results</button>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAvHdLqVJday8_qQiWMl-9-4hvuztjAhOw&signed_in=true&libraries=places&callback=initMap" async defer></script>
</body>
</html>