-
Notifications
You must be signed in to change notification settings - Fork 0
/
place.php
138 lines (104 loc) · 3.85 KB
/
place.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
<?php
/**
* @author Simon Hintersonnleitner <[email protected]>
* Meine Lieblingsorte ist ein MultiMediaProjekt 1 des Studiengangs MultimediaTechnology der Fachhochschule Salzburg.
*/
include 'system/php/functions.php';
checklogin();
$pagetitle = "Ortsprofil";
if(isset($_GET['id']))
{
$id = $_GET['id'];
$stm = $dbh->prepare("SELECT * FROM places WHERE id = ?");
$stm->execute(array($id));
$response = $stm->fetch();
$pagetitle = $response->name;
$id = $response->userId;
$stm = $dbh->prepare("SELECT id,firstname,lastname,isAdmin FROM user WHERE id = ?");
$stm->execute(array($id));
$response1 = $stm->fetch();
}
include 'template/beginHeader.php';
?>
<link rel="stylesheet" type="text/css" href="system/css/index.css">
<link rel="stylesheet" href="system/leaflet/leaflet.css" />
<link rel="stylesheet" href="system/leaflet/Control.OSMGeocoder.css" />
<script src="system/leaflet/leaflet.js"></script>
<script src="system/leaflet/Control.OSMGeocoder.js"></script>
<?php
include 'template/endHeader.php';
include 'template/menue.php';
?>
<div class="container">
<div class="row">
<h1><?php echo $response->name; ?> </h1><small> - eingetragen von
<a href='person.php?id=<?php echo $response1->id; ?>'>
<?php echo $response1->firstname." ".$response1->lastname;?></a></small><br><br>
<?php if($response1->id == $_SESSION['id'] || $_SESSION['isAdmin'] == 1 ): ?>
<div class="form-inline">
<form action="editPlace.php" method="post" class="form-inline">
<input type="hidden" name="id" value='<?php echo $response->id; ?>'>
<input type="submit" name="edit" class="form-control input-sm" value="Ort bearbeiten">
</form>
<form action="placeDelete.php" method="post" class="form-inline">
<input type="hidden" name="id" value='<?php echo $response->id; ?>'>
<input type="submit" name="del" class="form-control input-sm" value="Ort löschen">
</form>
<form action="crop.php" method="post" class="form-inline">
<input type="hidden" name="id" value='<?php echo $response->id; ?>'>
<input type="submit" name="cropPlace" class="form-control input-sm" value="Bildausschnitt ändern">
</form>
</div><br><br>
<?php endif; ?>
</div>
<?php $class ="c".$response->category; ?>
<?php $img = "img/icons/".$response->category.".png"; ?>
<div class="row">
<div class="col-md-10">
<div class="<?php echo $class; ?> icon ">
<img src="<?php echo $img; ?>" alt="">
</div>
<h5><?php echo getCategorieNameById($dbh,$response->category); ?></h5>
</div>
</div>
<div class="row">
<div class="col-md-11">
<p ><?php echo $response->description; ?></p>
</div>
</div>
<div class="row">
<div class="col-md-11">
<img src="img/upload/<?php echo $response1->id."/". $response->id."/".$response->cover; ?>" alt="">
</div>
</div>
<div class="row">
<div class="col-md-11">
<div id="map"></div>
<small>eingetragen am <?php echo $response->time; ?></small>
</div>
</div>
</div>
<script type="text/javascript">
// create a map in the "map" div, set the view to a given place and zoom
<?php
//remove LatLng( ) from coordinates
$toRemove = array("LatLng(", ")");
$coordinates = str_replace($toRemove,"",$response->coordinates);
?>
var map= L.map('map').setView([<?php echo $coordinates;?>], 14);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
marker = new L.Marker([<?php echo $coordinates;?>], {draggable:false});
map.addLayer(marker);
marker.bindPopup('<?php echo $response->name;?>').openPopup();
function onMapClick(e)
{
map.setView([<?php echo $coordinates; ?>], 14);
}
map.on('click', onMapClick);
</script>
<?php
include 'template/footer.php';
?>