From 4b278fbcd1a01710fc5d70cbb2ba2923386f9049 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Wed, 20 Oct 2021 23:12:05 +0800 Subject: [PATCH] SubmitLab.php: indent code --- SubmitLab.php | 188 ++++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 99 deletions(-) diff --git a/SubmitLab.php b/SubmitLab.php index edb9f91..5515348 100644 --- a/SubmitLab.php +++ b/SubmitLab.php @@ -3,133 +3,123 @@ include 'NoDirectPhpAcess.php'; ?>
+ '$c_date' ORDER by Lab_Report_ID DESC"); - if(mysqli_num_rows($result1) == 0) - { - echo "No active assignments for this course so far."; - - } else { - - while($row = mysqli_fetch_assoc($result1)) { - - $Course_ID = $row['Course_ID']; - $title = $row['Title']; - $ins = $row['Instructions']; - $posted = $row['Posted_Date']; - $deadline = $row['Deadline']; - $att1 = $row['Attachment_link_1']; - $att2 = $row['Attachment_link_2']; - $att3 = $row['Attachment_link_3']; - $att4 = $row['Attachment_link_4']; - $labid = $row['Lab_Report_ID']; - $type = $row['Type']; - - //----------------------------------Giving both the Group Admin and Group Members same priviledges to submit assignment-------------------------------------- - if($type=="Group"){ - $resultx1 = mysqli_query($con,"SELECT Course_Group_id FROM `course_groups_table` WHERE (Course_id=$Course_ID) and ((Group_Member=$student_id ) or (Group_Member2=$student_id ) or (Group_Member3=$student_id ) or (Group_Member4=$student_id ) or (Group_Leader=$student_id))"); - while($row = mysqli_fetch_assoc($resultx1)) { - $_SESSION["Group_ID"] = $row['Course_Group_id']; - } - - if($_SESSION["Group_ID"] < 1) - { - echo"

This Lab report can only be submitted by Group Admin

"; - return; + if (!empty($_GET["id"])) { + $id = $_GET["id"]; + $url = $_GET["url"]; + + $result1 = mysqli_query($con, " SELECT `Type`, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and Deadline > '$c_date' ORDER by Lab_Report_ID DESC"); + if (mysqli_num_rows($result1) == 0) { + echo "No active assignments for this course so far."; + } else { + + while ($row = mysqli_fetch_assoc($result1)) { + + $Course_ID = $row['Course_ID']; + $title = $row['Title']; + $ins = $row['Instructions']; + $posted = $row['Posted_Date']; + $deadline = $row['Deadline']; + $att1 = $row['Attachment_link_1']; + $att2 = $row['Attachment_link_2']; + $att3 = $row['Attachment_link_3']; + $att4 = $row['Attachment_link_4']; + $labid = $row['Lab_Report_ID']; + $type = $row['Type']; + + //----------------------------------Giving both the Group Admin and Group Members same priviledges to submit assignment-------------------------------------- + if ($type == "Group") { + $resultx1 = mysqli_query($con, "SELECT Course_Group_id FROM `course_groups_table` WHERE (Course_id=$Course_ID) and ((Group_Member=$student_id ) or (Group_Member2=$student_id ) or (Group_Member3=$student_id ) or (Group_Member4=$student_id ) or (Group_Leader=$student_id))"); + while ($row = mysqli_fetch_assoc($resultx1)) { + $_SESSION["Group_ID"] = $row['Course_Group_id']; + } + + if ($_SESSION["Group_ID"] < 1) { + echo "

This Lab report can only be submitted by Group Admin

"; + return; + } } - } - - - $full_link="$att1"; - - if($att2!=""){ - $full_link = $full_link."| $att2"; - } - if($att3!=""){ - $full_link = $full_link."| $att3"; - } - - if($att4!=""){ - $full_link = $full_link."| $att4"; - } - - echo "
+ + $full_link = "$att1"; + + if ($att2 != "") { + $full_link = $full_link . "| $att2"; + } + if ($att3 != "") { + $full_link = $full_link . "| $att3"; + } + + if ($att4 != "") { + $full_link = $full_link . "| $att4"; + } + + echo " "; - echo ""; + echo ""; + } } } -} -$Group_ID = $_SESSION["Group_ID"]; + $Group_ID = $_SESSION["Group_ID"]; -?> + ?>
- - -
-

Submit Lab Report Assignment

-
+

Submit Lab Report Assignment

+
- -
- -
- - - - - - - Title - +
- Attachment 1 - + + + + + + - Attachment 2 - + Title + -
+ Attachment 1 + -
+ Attachment 2 + - Attachment 3 - +
- Attachment 4 - -
- -
-
- -
+
-
- -
+ Attachment 3 + + + Attachment 4 + +
+ +
+ + +
+ +
+ + \ No newline at end of file