From 07ba57eebbc443aebe37f52c96b19378e6350526 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Thu, 10 Oct 2024 15:35:00 +0800 Subject: [PATCH] Fix bug 195. --- Course.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Course.php b/Course.php index 05b3e1f..c469163 100644 --- a/Course.php +++ b/Course.php @@ -152,7 +152,7 @@ include 'Header.php'; $att3 = $row['Attachment_link_3']; $att4 = $row['Attachment_link_4']; $labid = $row['Lab_Report_ID']; - $days_remaining = date_diff(date_create($deadline), date_create())->format('%a days, %h hours, %i minutes'); + $days_remaining = "Days remaining: ".date_diff(date_create($deadline), date_create())->format('%a days, %h hours, %i minutes'); $full_link = "$att1"; if($att2 != "") { @@ -165,6 +165,11 @@ include 'Header.php'; $full_link = $full_link."| $att4"; } + // check if the student has already submitted the assignment + $query_result = mysqli_query($con, "SELECT * FROM lab_report_submissions WHERE Student_id=$student_id AND Lab_Report_ID=$labid"); + if (mysqli_num_rows($query_result) > 0) + $days_remaining = 'You have already submitted this assignment.'; + echo "
$title
@@ -172,7 +177,7 @@ include 'Header.php';

$ins

Attachments: $full_link

Posted: $posted    Deadline: $deadline

-
Time left: $days_remaining
+
$days_remaining

Submit

";