Course.php: give the code better format; show None if there is no attachment.
parent
5ba25e7294
commit
0bf58fc282
24
Course.php
24
Course.php
|
@ -183,18 +183,12 @@ include 'Header.php';
|
|||
|
||||
<?php
|
||||
$group_id = $_SESSION['group_id'];
|
||||
if($group_id == ""){$group_id = -1;} // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1.
|
||||
$result = mysqli_query($con,"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`
|
||||
WHERE
|
||||
Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (Student_id=$student_id or Course_Group_id=$group_id)) and Course_ID=$course_id and Deadline < '$c_date'"
|
||||
. ""
|
||||
. ""
|
||||
. ""
|
||||
. ""
|
||||
. ""
|
||||
. ""
|
||||
. "ORDER by Lab_Report_ID DESC");
|
||||
|
||||
if ($group_id == "") { // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1.
|
||||
$group_id = -1;
|
||||
}
|
||||
|
||||
$result = mysqli_query($con,"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` WHERE Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (Student_id=$student_id or Course_Group_id=$group_id)) and Course_ID=$course_id and Deadline < '$c_date' ORDER by Lab_Report_ID DESC");
|
||||
|
||||
if(mysqli_num_rows($result) == 0)
|
||||
{
|
||||
|
@ -213,11 +207,16 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
|
|||
$att4 = $row['Attachment_link_4'];
|
||||
$id = $row['Lab_Report_ID'];
|
||||
|
||||
$full_link = "None";
|
||||
|
||||
if ($att1 != "") {
|
||||
$full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
||||
}
|
||||
|
||||
if($att2 != "") {
|
||||
$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>";
|
||||
}
|
||||
|
@ -226,6 +225,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
|
|||
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
|
||||
}
|
||||
|
||||
|
||||
echo "<div class='card mt-md-2' style='word-wrap: break-word;'> <div class='card-body'> <span class='btn btn-sm btn-outline-danger'>MISSED</span> <h5 class='card-title'>$title</h5> <h6 class='card-subtitle'>($marks Marks)</h6> <br/> <p class='card-text'> $ins</p>
|
||||
<br> <p class='card-text'> <small> Posted: $posted Deadline: $deadline <br> Attachments: $full_link </small></p>
|
||||
</div></div><br>";
|
||||
|
|
Loading…
Reference in New Issue