-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallNearbyCommunities.php
More file actions
159 lines (150 loc) · 6 KB
/
allNearbyCommunities.php
File metadata and controls
159 lines (150 loc) · 6 KB
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
<?php
include_once('classes/Community.php');
include_once('classes/Nudge.php');
include_once('classes/User.php');
session_start();
if (!isset($_SESSION["user"])) {
header("Location: login.php");
}
$community = new Community();
$community->setId($_SESSION['id']);
$nearbyCommunities = $community->getNearbyCommunities();
if (!empty($_GET['nudge'])) {
$nudge = new Nudge();
$nudge->setMyid($_SESSION['id']);
$nudgeCollection = $nudge->showNudges();
if (!empty($_GET['nid'])) {
$nudge->setPostId($_GET['nid']);
$nudge->markAsRead();
$nudgeCollection = $nudge->showNudges();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All my communities</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:300,400,500,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css" />
</head>
<body>
<?php include_once('nav.inc.php'); ?>
<div class="community__container community__container--all">
<div class="community__title__container">
<h2>Nearby Communities</h2>
</div>
<?php foreach ($nearbyCommunities as $community): ?>
<div class="community__data__container community__data__container--all">
<a href="community.php?com=<?php echo $community['id'] ?>"
class="community__data__container__a"></a>
<div class="label <?php if (empty($community['userId1']) || empty($community['userId2']) || empty($community['userId3']) || empty($community['userId4'])) {
echo "label--green";
} ?>">
<p><?php if (empty($community['userId1']) || empty($community['userId2']) || empty($community['userId3']) || empty($community['userId4'])) {
echo "Looking for members";
} else {
echo "currently full";
} ?>
</div>
<div class="community__img">
<img src="images/<?php echo $community['img']; ?>"
alt="farming resource picture">
</div>
<div class="community__info">
<h3><?php echo $community['name']?>
</h3>
<div class="crop__container">
<?php if (!empty($community['crop1'])): ?>
<a class="anchortag"
href="taggedCommunities.php?tag=<?php echo $community['crop1']; ?>">
<div class=" farming">
<p><?php echo $community['crop1'] ?>
</p>
</div>
</a>
<?php endif; ?>
<?php if (!empty($community['crop2'])): ?>
<a class="anchortag"
href="taggedCommunities.php?tag=<?php echo $community['crop2']; ?>">
<div class="farming">
<p><?php echo $community['crop2'] ?>
</p>
</div>
</a>
<?php endif; ?>
</div>
</div>
<p class=community__adress><?php echo $community['address'] ?>
</p>
</div>
<?php endforeach; ?>
</div>
<?php if (isset($nudgeCollection)): ?>
<div class="blur blur--active"></div>
<div class="nudgeList">
<div class="line nudgeLine"></div>
<div class="nudgeFolder">
<?php foreach ($nudgeCollection as $nudgeItem): ?>
<?php
$nudger = new User();
$nudger->setId($nudgeItem["userId1"]);
$nudgeData = $nudger->getAllUserData();
?>
<div class="nudgeItem">
<a class="avatarlink"
href="profile.php?u=<?php echo $nudgeData['activationToken'] ?>">
<div class="member--avatar nudge--avatar"><?php if (!empty($nudgeData["avatar"])): ?>
<img src="<?php echo "uploads/" . $nudgeData["avatar"]; ?>"
alt="profile picture"><?php endif; ?>
</div>
</a>
<div class="nudge--name">
<p class="p__member--name"><?php echo $nudgeData['name']; ?>
<span>nudged you</span>
</p>
</div>
<div class="nudge--text">
<p><?php echo $nudgeItem['text']; ?>
</p>
</div>
<a href="?nudge=true&nid=<?php echo $nudgeItem['id'] ?>"
class="nudgeLink">X</a>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php include_once("footer.inc.php"); ?>
<script src="js/nudgeBlur.js"></script>
<?php if (isset($nudgeCollection)): ?>
<script>
const queryString = window.location.search;
topcss = 100
opacitycss = 0
if (queryString.includes("nudge")) {
if (queryString.includes('nid')) {
document.querySelector('.blur--active').style.opacity = 1
document.querySelector('.nudgeList').style.top = "46vh"
} else {
let animation = setInterval(myMethod, 2);
function myMethod() {
if (topcss <= 45) {
clearInterval(animation)
}
if (topcss >= 45) {
document.querySelector('.blur--active').style.opacity = opacitycss
document.querySelector('.nudgeList').style.top = topcss + "vh"
topcss -= 3
opacitycss += 0.1
}
}
}
}
</script>
<?php endif; ?>
</body>
</html>