-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow.php
More file actions
94 lines (85 loc) · 3.73 KB
/
Copy pathshow.php
File metadata and controls
94 lines (85 loc) · 3.73 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
<?php
include_once 'header.php';
require_once 'include.php';
$pid = $_GET['pid'];
$projid = $_GET['projid'];
$written = $_GET['written'];
echo "Here shows the following project:\n";
$query = "SELECT * FROM project WHERE p_id='$pid' AND proj_id='$projid'";
$result = mysqli_query($link,$query);
$proj = mysqli_fetch_assoc($result);
$query = "SELECT * FROM professor WHERE p_id='$pid'";
$result = mysqli_query($link,$query);
$prof = mysqli_fetch_assoc($result);
$query = "SELECT c_teacher, c_project, c_workload, FROM_UNIXTIME(time), u_id FROM comments WHERE p_id='$pid' AND proj_id='$projid' ORDER BY time DESC";
$result = mysqli_query($link,$query);
$com = mysqli_fetch_all($result);
?>
<div class="urop-page show">
<div class="container">
<h3></h3>
<h3 id="showTitle" style="margin-top: 150px; margin-bottom: 2em;">
<?php echo "$proj[proj_name]"; ?>
</h3>
<label for="info-table">Detailed Information</label>
<table class="table table-sm" id="info-table">
<tr>
<th>Department:</th>
<td>
<?php echo "$prof[department]"; ?>
</td>
</tr>
<tr>
<th>Supervisor Name:</th>
<td>
<?php echo "<a href=\"professor.php?pid=$pid\">$prof[name]</a>"; ?>
</td>
</tr>
<tr>
<th>Supervisor Email:</th>
<td>
<?php echo "$prof[email]"; ?>
</td>
</tr>
<tr>
<th>Project Description:</th>
<td>
<?php echo "$proj[description]"; ?>
</td>
</tr>
</table>
<div class="row" style="width: 100%; position: relative; margin-bottom: 10px; margin-left: 0;">
<h4 style="left: 0">Comments</h4>
<!--<label for="show-write-button">Comments</label>-->
<button class="btn btn-info" id="show-write-button" style="margin-top: -2.5em;">
<?php
if ($written=="true")
echo "<a href=\"newComment.php?pid=$pid&projid=$projid&written=true\" style=\"color: white;\">Modify Comment</a>";
else
echo "<a href=\"newComment.php?pid=$pid&projid=$projid&written=false\" style=\"color: white;\">Write Comment</a>";
?>
</button>
</div>
<?php
if (empty($com)) {
echo "<div class=\"alert alert-danger\">";
echo "<strong>No comment for now! </strong>Click the button to write your comment on it.</div>"; }
foreach ($com as $cur)
{
$query = "SELECT username FROM user WHERE u_id=$cur[4]";
$username = mysqli_query($link,$query);
$username = mysqli_fetch_assoc($username);
$username = implode("",$username);
echo "<ul style=\"margin: 0 0 0 0;\">";
echo "<li class=\"list-group-item list-group-item-info\" style=\"width: 50%; float: left; clear: left;\"><strong>Author: </strong>$username</li>";
echo "<li class=\"list-group-item list-group-item-info\" style=\"width: 50%; float: right; clear: right;\"><strong>Time: </strong>$cur[3]</li>";
echo "<li class=\"list-group-item\" style=\"width: 100%; float: left;\"><strong>Supervisor: </strong><br /><br />$cur[0]</li>";
echo "<li class=\"list-group-item\" style=\"width: 100%; float: left;\"><strong>Project: </strong><br /><br />$cur[1]</li>";
echo "<li class=\"list-group-item\" style=\"width: 100%; float: left; margin-bottom: 3em;\"><strong>Workload: </strong><br /><br />$cur[2]</li></ul>";
}
?>
</div>
</div>
<?php
include_once 'footer.php';
?>