Submissions.php: better display course groups.

Bug430-Eden2
Lan Hui 2023-08-25 21:37:57 +08:00
parent 32b1e81500
commit 5ac8062175
1 changed files with 18 additions and 17 deletions

View File

@ -369,44 +369,45 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
<div id="menu4" class="tab-pane"><br> <div id="menu4" class="tab-pane"><br>
<h3>Course groups</h3> <div class="col-md-7">
<hr>
<?php <?php
$result = mysqli_query($con, " SELECT `Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`,users_table.Full_Name $result = mysqli_query($con, "SELECT Course_Group_id, Group_Name, Group_Leader, Course_id, users_table.Full_Name
FROM `course_groups_table` FROM course_groups_table
INNER JOIN users_table on users_table.Student_ID=course_groups_table.Group_Leader INNER JOIN users_table ON users_table.Student_ID=course_groups_table.Group_Leader
WHERE Course_id=$c_id"); WHERE Course_id=$c_id");
if (mysqli_num_rows($result) == 0) { if (mysqli_num_rows($result) == 0) {
echo "No student groups."; echo "No student groups.";
} else { } else {
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Group_Name']; $name = $row['Group_Name'];
$leader = $row['Full_Name'] . " (" . $row['Group_Leader'] . ")"; $leader_student_no = $row['Group_Leader'];
$id = $row['Course_Group_id']; $id = $row['Course_Group_id'];
echo "<ul class='list-group'>$name, Leader: $leader"; echo "<ul class='list-group'>";
echo " <li class='list-group-item disabled'>Group $name</li>";
$rs2 = mysqli_query($con, "SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, $rs2 = mysqli_query($con, "SELECT ID, Course_Group_id, course_group_members_table.Student_ID, course_group_members_table.Status, users_table.Full_Name
course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table` FROM course_group_members_table
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID INNER JOIN users_table ON users_table.Student_ID=course_group_members_table.Student_ID
where course_group_members_table.Course_Group_id=$id"); WHERE course_group_members_table.Course_Group_id=$id");
while ($row = mysqli_fetch_assoc($rs2)) { while ($row = mysqli_fetch_assoc($rs2)) {
$name = $row['Full_Name']; $name = $row['Full_Name'];
$id = $row['Course_Group_id']; $id = $row['Course_Group_id'];
$status = $row['Status']; $status = $row['Status'];
$Student_ID = $row['Student_ID']; $Student_ID = $row['Student_ID'];
if ($leader_student_no == $Student_ID) {
echo "<li class='list-group-item'>$name ($Student_ID) - $status</li>"; echo "<li class='list-group-item'>$name ($Student_ID) - $status - Leader</li>";
} else {
echo "<li class='list-group-item'>$name ($Student_ID) - $status</li>";
}
} }
echo "</ul><br>"; echo "</ul><br>";
} }
} }
?> ?>
</div>
</div> </div>
</div> </div>