-
Notifications
You must be signed in to change notification settings - Fork 0
/
organization_view.php
326 lines (246 loc) · 13.6 KB
/
organization_view.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<?php
// include ("connection.php");
// $res = $conn->query("SELECT DISTINCT
// organizations.name AS organization_name,drives.name AS drive_name,SUM(donations.amount) AS amount,
// category.type AS type, drives.goal AS goal, drives.image AS image, drives.date_created, drives.description
// FROM organizations
// JOIN drives ON drives.organization_id = organizations.organization_id
// JOIN donations ON donations.drive_id = drives.drive_id
// JOIN category ON category.type_id = organizations.type_id
// WHERE organizations.organization_id='".$_GET['id']."'
// GROUP BY drives.drive_id");
// // var_dump($res->fetch_array());
// // $row_id= $res->fetch_array();
// // while () {
// $row = $res->fetch_all(MYSQLI_ASSOC);
// die(print_r($row));
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello World</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- FontAwesome CSS -->
<link rel="stylesheet" href="css/font-awesome.min.css">
<!-- ElegantFonts CSS -->
<link rel="stylesheet" href="css/elegant-fonts.css">
<!-- themify-icons CSS -->
<link rel="stylesheet" href="css/themify-icons.css">
<!-- Swiper CSS -->
<link rel="stylesheet" href="css/swiper.min.css">
<!-- Styles -->
<link rel="stylesheet" href="style.css">
</head>
<body class="single-page causes-page">
<?php
include ("connection.php");
include ("services.php"); ?>
<header class="site-header">
<div class="top-header-bar">
<div class="container">
<div class="row flex-wrap justify-content-center justify-content-lg-between align-items-lg-center">
<div class="col-12 col-lg-8 d-none d-md-flex flex-wrap justify-content-center justify-content-lg-start mb-3 mb-lg-0">
<div class="header-bar-email">
</div><!-- .header-bar-email -->
<div class="header-bar-text">
</div><!-- .header-bar-text -->
</div><!-- .col -->
<div class="col-12 col-lg-4 d-flex flex-wrap justify-content-center justify-content-lg-end align-items-center">
<div class="donate-btn">
<a style="float: right;" href="dash.php"><?php
if (isset($_SESSION['user'])) {
echo "Logged in : ".$_SESSION['user'];
}
else{
echo "No User Logged in";
}
?></a>
</div><!-- .donate-btn -->
</div><!-- .col -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .top-header-bar -->
<div class="nav-bar">
<div class="container">
<div class="row">
<div class="col-12 d-flex flex-wrap justify-content-between align-items-center">
<div class="site-branding d-flex align-items-center">
<a class="d-block" href="index.html" rel="home"><img class="d-block" src="images/logo.png" alt="logo"></a>
</div><!-- .site-branding -->
<nav class="site-navigation d-flex justify-content-end align-items-center">
<ul class="d-flex flex-column flex-lg-row justify-content-lg-end align-content-center">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About us</a></li>
<li class="current-menu-item"><a href="organizations.php">Organizations</a></li>
<li><a href="causes.php">Causes</a></li>
<li><a href="events.php">Events</a></li>
</ul>
</nav><!-- .site-navigation -->
<div class="hamburger-menu d-lg-none">
<span></span>
<span></span>
<span></span>
<span></span>
</div><!-- .hamburger-menu -->
</div><!-- .col -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .nav-bar -->
</header><!-- .site-header -->
<!--picks up the organization session and displays drives of that session -->
<div class="page-header">
<div class="container">
<div class="row">
<div class="col-12">
<h1>
<?php
// echo $row['organization_name'];
$grab = $conn->query("SELECT * FROM drives WHERE organization_id = '".$_GET['id']."'");
// echo $row['organization_name'];
?>
</h1>
</div><!-- .col -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .page-header -->
<div class="featured-cause">
<div class="container">
<div class="row">
<?php
$res = $conn->query("SELECT DISTINCT
organizations.name AS organization_name,drives.name AS drive_name,SUM(donations.amount) AS amount,
category.type AS type, drives.goal AS goal, drives.image AS image, drives.date_created, drives.description
FROM organizations
JOIN drives ON drives.organization_id = organizations.organization_id
JOIN donations ON donations.drive_id = drives.drive_id
JOIN category ON category.type_id = organizations.type_id
WHERE organizations.organization_id='".$_GET['id']."'
GROUP BY drives.drive_id");
// var_dump($res->fetch_array());
// $row_id= $res->fetch_array();
// while () {
$row = $res->fetch_all(MYSQLI_ASSOC);
foreach ($row as $key => $value) {
// $grabb = $conn->query("SELECT SUM(amount) as amount FROM donations WHERE drive_id = '".$_GET['id']."'");
// while ($don = $grabb->fetch_assoc()) {
$total=0;
$total = $total+ $row['amount'];
$perc = round(($row['amount'] / $row["goal"]) * 100);
echo '
<div class="col-12 col-lg-6">
<div class="cause-wrap d-flex flex-wrap justify-content-between">
<figure class="m-0">
<img height="200" width="200" src="http://localhost/thecharity/uploads/'.$row['image'].'"/>
</figure>
<div class="cause-content-wrap">
<header class="entry-header d-flex flex-wrap align-items-center">
<h3 class="entry-title w-100 m-0"><a >'.$row["drive_name"].'</a></h3>
<div class="posted-date">
<a >Active from: '.$row["date_created"].'</a>
</div><!-- .posted-date -->
<div class="cats-links">
<a >Category:
<!--display name of organization in session -->
'.$row['type'].'
</a>
</div><!-- .cats-links -->
</header><!-- .entry-header -->
<div class="entry-content">
<p class="m-0">'.$row["description"].'</p>
</div><!-- .entry-content -->
<div class="entry-footer mt-5">
<a href="donation.php" class="btn gradient-bg mr-2">Donate Now</a>
</div><!-- .entry-footer -->
</div><!-- .cause-content-wrap -->
<div class="fund-raised w-100">
<div class="featured-fund-raised-bar barfiller">
<div class="tipWrap">
<span class="tip"></span>
</div><!-- .tipWrap -->
<span class="fill" data-percentage="'.$perc.'">
</span>
</div><!-- .fund-raised-bar -->
<div class="fund-raised-details d-flex flex-wrap justify-content-between align-items-center">
<div class="fund-raised-total mt-4">
echo $total;
</div><!-- .fund-raised-total -->
<div class="fund-raised-goal mt-4">
Goal: Ksh '.$row["goal"].'
</div><!-- .fund-raised-goal -->
</div><!-- .fund-raised-details -->
</div><!-- .fund-raised -->
</div><!-- .cause-wrap -->
</div><!-- .col -->
';
}
// }
?>
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .featured-cause -->
<?php
$conn->close();
?>
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .featured-cause -->
</div><!-- .highlighted-cause -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .our-causes -->
<footer class="site-footer">
<div class="footer-widgets">
<div class="container">
<div class="row">
<div class="col-12 col-md-6 col-lg-3">
<div class="foot-about">
<h2><a class="foot-logo" href="#"><img src="images/foot-logo.png" alt=""></a></h2>
<p>You can contact us any time from Mon-Sat. Feel free to make any donations,share your stories, take part in charity
activities and sharing our causes with others.</p>
<ul class="d-flex flex-wrap align-items-center">
<li><a href="#"><i class="fa fa-pinterest-p"></i></a></li>
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-dribbble"></i></a></li>
<li><a href="#"><i class="fa fa-behance"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin"></i></a></li>
</ul>
</div><!-- .foot-about -->
</div><!-- .col -->
<div class="col-12 col-md-6 col-lg-3 mt-5 mt-md-0">
<h2>Useful Links</h2>
<ul>
<li><a href="organizations.php">Learn about different organizations</a></li>
<li><a href="events.php">Become a Volunteer</a></li>
<li><a href="causes.php">Donate to a cause</a></li>
<li><a href="account.php">Manage your account</a></li>
</ul>
</div><!-- .col -->
<div class="col-12 col-md-6 col-lg-3 mt-5 mt-md-0">
<div class="foot-contact">
<h2>Contact</h2>
<ul>
<li><i class="fa fa-phone"></i><span>+254 720633085</span></li>
<li><i class="fa fa-envelope"></i><span>global_Aid@gmail.com</span></li>
<li><i class="fa fa-map-marker"></i><span>Nairobi Kenya.</span></li>
</ul>
</div><!-- .foot-contact -->
</div><!-- .col -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .footer-widgets -->
</footer><!-- .site-footer -->
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery.collapsible.min.js'></script>
<script type='text/javascript' src='js/swiper.min.js'></script>
<script type='text/javascript' src='js/jquery.countdown.min.js'></script>
<script type='text/javascript' src='js/circle-progress.min.js'></script>
<script type='text/javascript' src='js/jquery.countTo.min.js'></script>
<script type='text/javascript' src='js/jquery.barfiller.js'></script>
<script type='text/javascript' src='js/custom.js'></script>
</body>
</html>