/
pin.php
123 lines (103 loc) · 4.35 KB
/
pin.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
<!DOCTYPE html>
<html>
<head>
<title>Trip Planner: Pin</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type='text/css' href="css/style.css">
<!-- JAVASCRIPT -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="js/pin.js"></script>
<!-- FONTS -->
<link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css?family=Raleway'>
</head>
<body>
<?php include 'navbar.php' ?>
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="pin-pg category"> Tourist Attractions </div>
<?php include 'php/yelp_api.php';
//counts for ALL objects! This determines the temporary id for the objects!
$counter = 0;
$json_tourist = search('tourist','Dallas');
$tourist_attractions = json_decode($json_tourist,true);
for ($x=0; $x < $SEARCH_LIMIT; $x++) {
$id = $tourist_attractions['businesses'][$x]['id'];
$name = $tourist_attractions['businesses'][$x]['name'];
$image = $tourist_attractions['businesses'][$x]['image_url'];
$address = $tourist_attractions['businesses'][$x]['location']['address'][0];
$city = $tourist_attractions['businesses'][$x]['location']['city'];
$country = $tourist_attractions['businesses'][$x]['location']['country_code'];
$rating = $tourist_attractions['businesses'][$x]['rating'];
echo "<div class='pin-pg pin-box text-center'>";
//name
echo "<div id='pin-".$id."' class='pin-pg pin-name text-center' data-category='tourist' data-pinid=$id data-city=$city data-address='$address' data-country=$country> $name </div>";
//image
echo "<img class='pin-pg pin-img' src=$image>";
//button
echo "<input id=$id type='button'
class='btn btn-default pin-pg pin-btn pull-right' value='Pin Me!'>";
echo "</div>";
$counter = $counter + 1;
}
?>
</div>
<div class="col-md-4">
<div class="pin-pg category"> Restaurants </div>
<?php
$json_restaurants = search('restaurants','Dallas');
$restaurants = json_decode($json_restaurants,true);
for ($x=0; $x < $SEARCH_LIMIT; $x++) {
$id = $restaurants['businesses'][$x]['id'];
$name = $restaurants['businesses'][$x]['name'];
$image = $restaurants['businesses'][$x]['image_url'];
$address = $restaurants['businesses'][$x]['location.address'];
$city = $restaurants['businesses'][$x]['location.city'];
$country = $restaurants['businesses'][$x]['location.country_code'];
$rating = $restaurants['businesses'][$x]['rating'];
echo "<div class='pin-pg pin-box text-center'>";
//name
echo "<div id='pin-".$id."' class='pin-pg pin-name text-center' data-category='restaurant' data-id=$id data-city=$city data-country=$country> $name </div>";
//image
echo "<img class='pin-pg pin-img' src=$image>";
//button
echo "<input id=$id type='button'
class='btn btn-default pin-pg pin-btn pull-right' value='Pin Me!'>";
echo "</div>";
$counter = $counter + 1;
}
?>
</div>
<div class="col-md-4">
<div class="pin-pg category"> Hotels </div>
<?php
$json_hotels = search('hotels','Dallas');
$hotels = json_decode($json_hotels,true);
for ($x=0; $x < $SEARCH_LIMIT; $x++) {
$id = $hotels['businesses'][$x]['id'];
$name = $hotels['businesses'][$x]['name'];
$image = $hotels['businesses'][$x]['image_url'];
$address = $hotels['businesses'][$x]['location.address'];
$city = $hotels['businesses'][$x]['location.city'];
$country = $hotels['businesses'][$x]['location.country_code'];
$rating = $hotels['businesses'][$x]['rating'];
echo "<div class='pin-pg pin-box text-center'>";
//name
echo "<div id='pin-".$id."' class='pin-pg pin-name text-center' data-category='hotel' data-id=$id data-city=$city data-country=$country> $name </div>";
//image
echo "<img class='pin-pg pin-img' src=$image>";
//button
echo "<input id=$id type='button'
class='btn btn-default pin-pg pin-btn pull-right' value='Pin Me!'>";
echo "</div>";
$counter = $counter + 1;
}
?>
</div>
</div> <!-- /row -->
</div> <!-- /container -->
</body>
</html>