SubmitLab.php: improve student's tab 'Submitted'

Bug430-Eden2
Lan Hui 2023-09-01 19:11:11 +08:00
parent bef3f1ac39
commit 64c625ae58
1 changed files with 57 additions and 54 deletions

View File

@ -259,85 +259,88 @@ include 'Header.php';
$group_id = -1; $group_id = -1;
} // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176 } // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176
$sql_stmt = "SELECT Lab_Report_ID, Marks, Course_ID, Posted_Date, Deadline, Instructions, lab_reports_table.Title, Attachment_link_1, Attachment_link_2, Attachment_link_3, Attachment_link_4
$sql_stmt = "SELECT Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM lab_reports_table
FROM `lab_reports_table` WHERE Lab_Report_ID IN
WHERE Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" (
. " where Status='Pending' and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Lab_Report_ID DESC"; SELECT Lab_Report_ID
FROM lab_report_submissions
WHERE Status='Pending' AND (Student_id=$student_id OR Course_Group_id=$group_id) AND Course_ID=$course_id
)
ORDER BY Lab_Report_ID DESC";
$resultx = mysqli_query($con, $sql_stmt); $resultx = mysqli_query($con, $sql_stmt);
if(mysqli_num_rows($resultx) == 0) { if(mysqli_num_rows($resultx) == 0) {
echo '<br><div class="alert alert-warning">You have no unmarked submissions. Check the Marked tab for your marked submissions (if any).</div>'; echo '<br><div class="alert alert-warning">You have no unmarked submissions. Check the Marked tab for your marked submissions (if any).</div>';
} else { } else {
while($row = mysqli_fetch_assoc($resultx)) { while($row = mysqli_fetch_assoc($resultx)) {
$lab_repo_id=$row['Lab_Report_ID']; $lab_repo_id = $row['Lab_Report_ID'];
$title=$row['Title']; $title = $row['Title'];
$marks=$row['Marks']; $marks = $row['Marks'];
$ins=$row['Instructions']; $ins = $row['Instructions'];
$posted=$row['Posted_Date']; $posted = $row['Posted_Date'];
$deadline=$row['Deadline']; $deadline = $row['Deadline'];
$att1=$row['Attachment_link_1']; $att1 = $row['Attachment_link_1'];
$att2=$row['Attachment_link_2']; $att2 = $row['Attachment_link_2'];
$att3=$row['Attachment_link_3']; $att3 = $row['Attachment_link_3'];
$att4=$row['Attachment_link_4']; $att4 = $row['Attachment_link_4'];
$id = $row['Lab_Report_ID']; $id = $row['Lab_Report_ID'];
if( $c_date < $deadline) { if ($c_date < $deadline) {
$submittedx="<a href='~\..\SubmitLab.php?id=$id&url=$url' class='btn btn-sm btn-light'>Re-submit</a>"; $submittedx = "<a href='~\..\SubmitLab.php?id=$id&url=$url' class='btn btn-sm btn-light'>Re-submit</a>";
} }
$full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
if($att2!="") { if ($att2 != "") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
}
if($att3!="") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
} }
if($att4!="") { if ($att3 != "") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
} }
echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> if ($att4 != "") {
$title ($marks Marks) <i class='fa fa-check-circle'></i> Submitted <br> <span style='font-size:8pt'> $ins</span> $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
<br> <span style='font-size:9pt'>Posted: $posted &nbsp; Deadline: $deadline</span> &nbsp; &nbsp; &nbsp; $submittedx &nbsp; }
<br> <span style='font-size:9pt'>Submitted files: ";
$Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap:break-word; border:1px solid #F0F0F0; border-left:1px solid #eee;'>
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, $title ($marks Marks) &nbsp; <i class='fa fa-check-circle'></i>SUBMITTED<br>
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, <span style='font-size:8pt'> $ins </span> <br>
`Title`,users_table.Full_Name,course_group_members_table.Student_ID <small>Posted: $posted &nbsp; Deadline: $deadline</small> &nbsp;&nbsp;&nbsp; $submittedx &nbsp; <br>
FROM `lab_report_submissions` <small>Submitted files: ";
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id $Sub_result = mysqli_query($con,"SELECT Submission_ID, Submission_Date, lab_report_submissions.Lab_Report_ID, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, Attachment1, Notes, Attachment2, Attachment3, Attachment4, Marks, lab_report_submissions.Status, Title,users_table.Full_Name, course_group_members_table.Student_ID
where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$student_id')"); FROM lab_report_submissions
LEFT JOIN users_table ON users_table.Student_ID=lab_report_submissions.Student_id
LEFT JOIN course_group_members_table ON course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Lab_Report_ID=$lab_repo_id AND lab_report_submissions.Student_id='$student_id'");
if(mysqli_num_rows($Sub_result) == 0) { if(mysqli_num_rows($Sub_result) == 0) {
echo "No Attachments found."; echo "No Attachments found.";
} else { } else {
while($row = mysqli_fetch_assoc($Sub_result)) { while($row = mysqli_fetch_assoc($Sub_result)) {
$at1=$row['Attachment1']; $att1 = $row['Attachment1'];
$at2=$row['Attachment2']; $att2 = $row['Attachment2'];
$at3=$row['Attachment3']; $att3 = $row['Attachment3'];
$at4=$row['Attachment4']; $att4 = $row['Attachment4'];
$base_att1 = basename($att1);
$base_att2 = basename($att2);
$base_att3 = basename($att3);
$base_att4 = basename($att4);
$base_at1 = basename($at1); $full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>"; // prevent students from directly accessing their classmates' submissions
$base_at2 = basename($at2);
$base_at3 = basename($at3);
$base_at4 = basename($at4);
$full_link = "<a href='~\..\Download.php?file=$at1&attachment=1'>$base_at1</a>"; // prevent students from directly accessing their classmates' submissions if ($att2 != "") {
$full_link= $full_link." | <a href='~\..\Download.php?file=$att2&attachment=2'>$base_att2</a>";
if($at2!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$at2&attachment=2'>$base_at2</a>";
}
if($at3!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$at3&attachment=3'>$base_at3</a>";
} }
if($at4!=""){ if ($att3 != "") {
$full_link= $full_link." | <a href='~\..\Download.php?file=$at4&attachment=4'>$base_at4</a>"; $full_link= $full_link." | <a href='~\..\Download.php?file=$att3&attachment=3'>$base_att3</a>";
}
if ($att4 != "") {
$full_link= $full_link." | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>";
} }
echo $full_link; echo $full_link;
@ -345,7 +348,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
} }
} }
echo "</span></div>"; echo "</small></div>";
} }
} }
echo ""; echo "";