-
Notifications
You must be signed in to change notification settings - Fork 0
/
sports.php
333 lines (256 loc) · 11.9 KB
/
sports.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
327
328
329
330
331
332
333
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/bootstrap.min.css"></link>
<link rel="stylesheet" href="css/ideacss.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"/>
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,400italic' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</head>
<body>
<?php
include('header.php');
?>
<div class="container" style="margin-left:80px;">
<a href="postSubmission.php" class="btn btn-success button_design">Submit Idea</a>
</div>
<div class="container">
<nav class="navbar navbar">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle in active" data-toggle="dropdown" href="#">Faculty of Computing
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="view4.php">Academic</a></li>
<li><a href="studentaffairs.php">Student Affairs</a></li>
<li><a href="#">Sports and Societies</a></li>
<li><a href="external.php">External</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
<div class="container">
<div class="row">
<div class="col-md-2">
<h3>SPORTS AND SOCIETIES </h3>
</div>
<div class="col-md-2">
</div>
<div class="col-md-3">
</div>
<div class="col-md-2">
</div>
<div class="col-md-3">
<div class="row searchgroup">
<form method="post">
<div class="col-md-8 search_col">
<input type="text" class="search_text" placeholder="Search" name="searchkey3"/>
</div>
<div class="col-md-4">
<button class="search_btn" >
<i class="fa fa-search"></i>
</button>
<a href="advanced.php" data-toggle="tooltip" data-placement="bottom" title="Advanced Search"> <img src="images/advsearch.png" class="advsearch" height="24px" width="26px"
/></a>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<?php
if(isset($_POST["searchkey3"])){
$s= $_POST["searchkey3"];
$where = "WHERE category='Sports and Societies' and faculty='Faculty of Computing' and title like '%$s%'";
}else{
$where ="WHERE category='Sports and Societies' and faculty='Faculty of Computing'";
}
$sql="select * from post ".$where." order by dateTime desc"; //retrieve data from system storage
include("database_connect.php"); //provide database connection
$result=mysqli_query($con,$sql);
if (mysqli_num_rows($result)==0)
{
echo "No Submissions Found";
}
while($row = mysqli_fetch_array($result))//retrieve data one by one
{
?>
<div class="jumbotron viewblock">
<div class="container">
<div class="col-md-2 leftcolomn">
<?php
$userid=$row['userId'];
$sql5="SELECT * from register where id=$userid";
$result5=mysqli_query($con,$sql5);
if(mysqli_num_rows($result5)==0)
{
$photo="images/user2.jpg";
$GLOBALS["name"]='user';
}
else{
while($row5 = mysqli_fetch_array($result5))
{
$photo=$row5["Image"];
$GLOBALS["name"]=$row5["lname"];
$reward=$row5["reward"];
$reward2=$row5["reward2"];
$reward3=$row5["reward3"];
}
if(!file_exists($photo))
{
$photo="images/user2.jpg";
}
?>
<?php
}
?>
<div class="row">
<img src=<?= $photo ?> width="100" height="100" class="img img-thumbnail"/>
</div>
<div class="row">
<?php
$rewardimg=NULL;
$rewardimg2=NULL;
$rewardimg3=NULL;
$sql6="select img,name from reward where level='$reward' and type='submission'";
$result6=mysqli_query($con,$sql6);
while($row6 = mysqli_fetch_array($result6))
{
$rewardimg=$row6["img"];
$title=$row6["name"];
}
if($rewardimg!=NULL)
{
?>
<img src=<?= $rewardimg ?> width="40" height="30" data-toggle="tooltip" data-placement="bottom" title=<?=$title?> />
<?php
}
?>
<?php
$sql7="select img,name from reward where level='$reward2' and type='vote'";
$result7=mysqli_query($con,$sql7);
while($row7= mysqli_fetch_array($result7))
{
$rewardimg2=$row7["img"];
$title2=$row6["name"];
}
if($rewardimg2!=NULL)
{
?>
<img src=<?= $rewardimg2 ?> width="35" height="30" data-toggle="tooltip" data-placement="bottom" title=<?=$title2?> />
<?php
}
?>
<?php
$sql7="select img,name from reward where level='$reward3' and type='improvement'";
$result7=mysqli_query($con,$sql7);
while($row7= mysqli_fetch_array($result7))
{
$rewardimg3=$row7["img"];
$title3=$row6["name"];
}
if($rewardimg3!=NULL)
{
?>
<img src=<?= $rewardimg3 ?> width="35" height="30" data-toggle="tooltip" data-placement="bottom" title=<?=$title3?> />
<?php
}
?>
</div>
<div class="row">
<?php echo $GLOBALS["name"]?>
</div>
<div class="row">
<?= $row["dateTime"]?>
</div>
</div>
<div class="col-md-6 middlecolomn">
<div class="row title">
<h4><a href="viewidea.php?comt=0&id=<?=$row["postId"]?>"><?= $row["title"]?></a></h4>
</div>
<div class="row content">
<p> <?php echo $row["content"]; ?></p>
</div>
<div class="row">
<?php
$img=$row["files"];
if(file_exists($img)&&strcmp($img,"images/")!=0)
{
?>
<img src=<?= $row["files"]?> width="200" height="150" class="img img-thumbnail"/>
<?php
}
?>
</div>
<div class="row">
<div class="col-md-4 departments">
<button class="submitidea2"><?php echo $row["faculty"]; ?></button>
</div>
<div class="col-md-6 departments">
<button class="submitidea3"><?php echo $row["department"]; ?></button>
</div>
</div>
</div>
<div class="col-md-2 rightcolomn">
<?php
$id=$row["postId"];
$sql2="select COUNT(*) AS votes from votes where submissionId='$id'";//get the vote count
include("database_connect.php");
$result2=mysqli_query($con,$sql2);
while($row2= mysqli_fetch_array($result2))
{
?>
<div class="row">
<button class="submitidea"><?php echo $row2["votes"] ?> Votes</button>
</div>
<?php
}
?>
<div class="row">
<?php $sql3="select COUNT(*) AS imp from comment where submissionId='$id' and commentType='Improvement'";//get the improvement count
include("database_connect.php");
$result3=mysqli_query($con,$sql3);
while($row3= mysqli_fetch_array($result3))
{
?>
<div class="col-md-6 iconcolomn">
<div class="image">
<img src="images/Android-Messages - Copy.png" width="50" height="50" class="img-responsive"/><?php echo $row3["imp"] ?> Improvemnts
</div>
<?php
}
?>
</div>
<div class="col-md-6 iconcolomn">
<?php $sql4="select COUNT(*) AS cmt from comment where submissionId='$id' and commentType='Comment'";//get the comment count
include("database_connect.php");
$result4=mysqli_query($con,$sql4);
while($row4= mysqli_fetch_array($result4))
{
?>
<div class="image">
<img src="images/Android-Messages.png" width="50" height="50" class="img-responsive" /><?php echo $row4["cmt"] ?> Comments
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
include('footer.php');
?>
</body>
</html>