Course.php: give the code better format; show None if there is no attachment.
parent
5ba25e7294
commit
0bf58fc282
64
Course.php
64
Course.php
|
@ -182,50 +182,50 @@ include 'Header.php';
|
||||||
<div id="menu2" class="tab-pane">
|
<div id="menu2" class="tab-pane">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$group_id=$_SESSION['group_id'];
|
$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(mysqli_num_rows($result)==0)
|
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)
|
||||||
{
|
{
|
||||||
echo '<div class="alert alert-info">You missed no lab reports.</div>';
|
echo '<div class="alert alert-info">You missed no lab reports.</div>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
while($row = mysqli_fetch_assoc($result)) {
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
$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'];
|
||||||
|
|
||||||
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
$full_link = "None";
|
||||||
|
|
||||||
if($att2!=""){
|
if ($att1 != "") {
|
||||||
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
|
$full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
||||||
}
|
|
||||||
if($att3!=""){
|
|
||||||
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($att4!=""){
|
if($att2 != "") {
|
||||||
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</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 != "") {
|
||||||
|
$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>
|
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>
|
<br> <p class='card-text'> <small> Posted: $posted Deadline: $deadline <br> Attachments: $full_link </small></p>
|
||||||
</div></div><br>";
|
</div></div><br>";
|
||||||
|
|
Loading…
Reference in New Issue