-
Notifications
You must be signed in to change notification settings - Fork 0
/
places.php
94 lines (79 loc) · 3.22 KB
/
places.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
<?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 = "Meine Lieblingsorte";
if(isset($_GET['view']))
{
$view = $_GET['view'];
}
else
{
$view = 1;
}
if(isset($_GET['userId']))
{
$id = $_GET['userId'];
$response = getAllPlacesByUserID($id,$dbh);
}
else
{
$response = getAllPublicPlaces($dbh);
}
$response1 = getUserData($_SESSION['id'],$dbh);
include 'template/beginHeader.php'; ?>
<link rel="stylesheet" type="text/css" href="system/css/index.css">
<?php
include 'template/endHeader.php';
include 'template/menue.php';
?>
<div class="container">
<?php if(isset($_GET['userId'])):?>
<h3><?php echo getFirstnameById($dbh,$_GET['userId'])?>'s Lieblingsorte</h3>
<a href="places.php?view=1&userId=<?php echo $_GET['userId'] ?>" class="btn btn-default btn-sm">Gitteransicht</a>
<a href="places.php?view=2&userId=<?php echo $_GET['userId'] ?>" class="btn btn-default btn-sm">Tabellenansicht</a>
<a href="map.php?userId=<?php echo $_GET['userId'] ?>" class="btn btn-default btn-sm">Mapansicht</a>
<?php else:?>
<h3>Alle Lieblingsorte</h3>
<a href="places.php?view=1" class="btn btn-default btn-sm">Gitteransicht</a>
<a href="places.php?view=2" class="btn btn-default btn-sm">Tabellenansicht</a>
<a href="map.php" class="btn btn-default btn-sm">Mapansicht</a>
<?php endif;?>
<a href="newPlace.php" class="btn btn-default btn-sm">neuen Ort eintragen</a>
</div>
<div class="container">
<?php if($view == 1): /*Gridview*/?>
<?php foreach ($response as $place):?>
<div class='col-md-3'>
<h3><?php echo $place->name; ?></h3>
<?php $class ="c".$place->category; ?>
<?php $img = "img/icons/".$place->category.".png"; ?>
<small>von <a href="person.php?id=<?php echo $place->userId; ?>"><?php echo getUserNameById($dbh,$place->userId); ?></a></small>
<div class="<?php echo$class; ?> icon "><img src="<?php echo $img; ?>" alt=""></div>
<a href="place.php?id=<?php echo $place->id; ?>"><img class="<?php echo $class; ?>" src= <?php echo getCroppedPlaceImageNameById($place->id,$dbh); ?> alt=""></a>
</div>
<?php endforeach; ?>
<?php endif;?>
<?php if($view == 2):/*ListView*/?>
<div class="list-group">
<?php foreach ($response as $place):?>
<a href="place.php?id=<?php echo $place->id; ?>" class="list-group-item"><?php echo $place->name;?>
<?php if($response1->isAdmin != 0 || $place->userId == $_SESSION['id']):?>
<form action="placeDelete.php" method="post" class="form-inline">
<input type="hidden" name="id" value='<?php echo $place->id; ?>'>
<input type="submit" name="del" class="btn btn-default btn-xs" value="löschen">
</form>
<form action="editPlace.php" method="post" class="form-inline">
<input type="hidden" name="id" value='<?php echo $place->id; ?>'>
<input type="submit" name="edit" class="btn btn-default btn-xs" value="bearbeiten">
</form>
<?php endif; ?>
</a>
<?php endforeach; ?>
</div>
<?php endif;?>
</div>
<?php include 'template/footer.php';?>