Course.php: better code spacing.

Bug430-Eden2
Lan Hui 2023-08-23 20:43:37 +08:00
parent 3270817a4b
commit 027c4fada6
1 changed files with 62 additions and 65 deletions

View File

@ -68,12 +68,12 @@ include 'Header.php';
if (isset($_SESSION['info_general'])) { if (isset($_SESSION['info_general'])) {
echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_general'] . '</div>'; echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_general'] . '</div>';
$_SESSION['info_general']=null; $_SESSION['info_general'] = null;
} }
if (isset($_SESSION['info_courses'])) { if (isset($_SESSION['info_courses'])) {
echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_courses'] . '</div>'; echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_courses'] . '</div>';
$_SESSION['info_courses']=null; $_SESSION['info_courses'] = null;
} }
?> ?>
@ -100,8 +100,8 @@ include 'Header.php';
<?php <?php
// Get groups of this students // Get groups of this student
$sql="SELECT course_group_members_table.Course_Group_id FROM course_group_members_table INNER JOIN course_groups_table ON course_group_members_table.Course_Group_id = course_groups_table.Course_Group_id WHERE course_group_members_table.Student_ID=$student_id and course_groups_table.Course_id=$course_id"; $sql = "SELECT course_group_members_table.Course_Group_id FROM course_group_members_table INNER JOIN course_groups_table ON course_group_members_table.Course_Group_id = course_groups_table.Course_Group_id WHERE course_group_members_table.Student_ID=$student_id and course_groups_table.Course_id=$course_id";
$resultx1 = mysqli_query($con, $sql); $resultx1 = mysqli_query($con, $sql);
while($row = mysqli_fetch_assoc($resultx1)) while($row = mysqli_fetch_assoc($resultx1))
@ -111,7 +111,7 @@ include 'Header.php';
$group_id = $_SESSION['group_id']; $group_id = $_SESSION['group_id'];
if($group_id == "") if ($group_id == "")
{ {
$group_id = 0; // no group. If the student has a group, the group number should be greater than 0. $group_id = 0; // no group. If the student has a group, the group number should be greater than 0.
} }
@ -130,11 +130,9 @@ include 'Header.php';
$result1 = mysqli_query($con, $sql_stmt); $result1 = mysqli_query($con, $sql_stmt);
if(mysqli_num_rows($result1)==0) if(mysqli_num_rows($result1) == 0) {
{
echo "<div class='alert alert-info'>No active assignments now.</div>"; echo "<div class='alert alert-info'>No active assignments now.</div>";
} else { } else {
while($row = mysqli_fetch_assoc($result1)) { while($row = mysqli_fetch_assoc($result1)) {
$title=$row['Title']; $title=$row['Title'];
$type=$row['Type']; $type=$row['Type'];
@ -168,7 +166,8 @@ include 'Header.php';
<p><a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn btn-primary'>Submit</a></p> <p><a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn btn-primary'>Submit</a></p>
</div></div>"; </div></div>";
}} }
}
echo ""; echo "";
?> ?>
@ -238,9 +237,10 @@ include 'Header.php';
<div id="menu3" class="tab-pane"> <div id="menu3" class="tab-pane">
<?php <?php
$group_id = $_SESSION['group_id']; $group_id = $_SESSION['group_id'];
if($group_id==""){$group_id=-1;} // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176 if($group_id == "") {
$group_id = -1;
} // 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`
@ -249,12 +249,8 @@ include 'Header.php';
. " 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"; . " 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 '<div class="alert alert-info">You have no unmarked submissions. Check the Marked tab for your marked submissions (if any).</div>'; echo '<div class="alert alert-info">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'];
@ -268,21 +264,21 @@ include 'Header.php';
$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!=""){ if($att3!="") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
} }
if($att4!=""){ if($att4!="") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
} }
@ -300,10 +296,8 @@ Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_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')"); 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']; $at1=$row['Attachment1'];
@ -335,8 +329,8 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
} }
echo "</span></div>"; echo "</span></div>";
}
}} }
echo ""; echo "";
?> ?>
@ -344,19 +338,21 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
<?php <?php
$sqli=mysqli_query($con, "SELECT * from course_groups_table WHERE Course_Group_id=$group_id and Course_id=$course_id");
while($row = mysqli_fetch_assoc($sqli)) { $Group_Leader=$row['Group_Leader']; $sqli = mysqli_query($con, "SELECT * from course_groups_table WHERE Course_Group_id=$group_id and Course_id=$course_id");
$Group_Member=$row['Group_Member']; while ($row = mysqli_fetch_assoc($sqli)) {
$Group_Member2=$row['Group_Member2']; $Group_Leader = $row['Group_Leader'];
$Group_Member3=$row['Group_Member3']; $Group_Member = $row['Group_Member'];
$Group_Member4=$row['Group_Member4']; $Group_Member2 = $row['Group_Member2'];
$Group_Member3 = $row['Group_Member3'];
$Group_Member4 = $row['Group_Member4'];
} }
?> ?>
<div id="menu4" class="tab-pane"> <div id="menu4" class="tab-pane">
<?php <?php
$resultx = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, " $resultx = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, "
. "`Course_Group_id`, `Notes`, lab_report_submissions.`Marks`, . "`Course_Group_id`, `Notes`, lab_report_submissions.`Marks`,
lab_report_submissions.Remarking_Reason, lab_report_submissions.Remarking_Reason,
@ -375,36 +371,35 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
. " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions" . " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions"
. " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC"); . " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC");
if(mysqli_num_rows($resultx)==0) { if (mysqli_num_rows($resultx) == 0) {
echo '<div class="alert alert-info">You have no marked submissions.</div>'; echo '<div class="alert alert-info">You have no marked submissions.</div>';
} else { } else {
while($row = mysqli_fetch_assoc($resultx)) { while($row = mysqli_fetch_assoc($resultx)) {
$title=$row['Lab_Title']; $title = $row['Lab_Title'];
$marks=$row['Marks']; $marks = $row['Marks'];
$Originalmarks=$row['Original_marks']; $Originalmarks = $row['Original_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'];
$Submission_ID=$row['Submission_ID']; $Submission_ID = $row['Submission_ID'];
$notes=$row['Notes']; $notes = $row['Notes'];
$status= $row['Status']; $status = $row['Status'];
$remarking_reason=$row['Remarking_Reason']; $remarking_reason = $row['Remarking_Reason'];
if($status=='Marked') { if ($status == 'Marked') {
$rm_data="\Script.php?remarking=yes&id=$Submission_ID&url=$url&status=Remarking"; $rm_data = "\Script.php?remarking=yes&id=$Submission_ID&url=$url&status=Remarking";
$remarking="<button onclick='remarking(\"$rm_data\")' class='btn btn-sm btn-light'>Request remarking</button>"; $remarking = "<button onclick='remarking(\"$rm_data\")' class='btn btn-sm btn-light'>Request remarking</button>";
} }
if($status=='Remarking') { if ($status=='Remarking') {
$remarking="<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking request sent </span> <br> Reasons for remarking: <i>$remarking_reason </i> <br>"; $remarking = "<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking request sent </span> <br> Reasons for remarking: <i>$remarking_reason </i> <br>";
} }
echo "<div class='card mt-md-2' style='word-wrap:break-word;'> <div class='card-body'> echo "<div class='card mt-md-2' style='word-wrap:break-word;'> <div class='card-body'>
<h5 class='card-title'>$title</h5> <h5 class='card-subtitle'>($marks marks out of $Originalmarks)</h6><br> <p class='card-text'>Lecturer feedback $notes &nbsp;&nbsp; $remarking</p> <small>Submitted files: "; <h5 class='card-title'>$title</h5> <h5 class='card-subtitle'>($marks marks out of $Originalmarks)</h6><br> <p class='card-text'>Lecturer feedback $notes &nbsp;&nbsp; $remarking</p> <small>Submitted files: ";
$Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
@ -416,25 +411,25 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_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=$id and lab_report_submissions.Student_id='$student_id'"); where Lab_Report_ID=$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']; $at1 = $row['Attachment1'];
$at2=$row['Attachment2']; $at2 = $row['Attachment2'];
$at3=$row['Attachment3']; $at3 = $row['Attachment3'];
$at4=$row['Attachment4']; $at4 = $row['Attachment4'];
$full_link="<a href='~\..\Lab_Report_Submisions\\$at1'>$at1</a>"; $full_link = "<a href='~\..\Lab_Report_Submisions\\$at1'>$at1</a>";
if($at2!="") { if($at2 != "") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at2'>$at2</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at2'>$at2</a>";
} }
if($at3!="") { if($at3 != "") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at3'>$at3</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at3'>$at3</a>";
} }
if($at4!="") { if($at4 != "") {
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at4'>$at4</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$at4'>$at4</a>";
} }
@ -458,7 +453,9 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
<?php <?php
$resultx1 = mysqli_query($con,"SELECT `Course_Group_id` FROM `course_groups_table` WHERE Course_id=$course_id"); $resultx1 = mysqli_query($con,"SELECT `Course_Group_id` FROM `course_groups_table` WHERE Course_id=$course_id");
while($row = mysqli_fetch_assoc($resultx1)) {$count_groups=$row['Course_Group_id'];} while ($row = mysqli_fetch_assoc($resultx1)) {
$count_groups = $row['Course_Group_id'];
}
echo " <button onclick='createGroup()' class='btn btn-primary'>Create group</button>"; echo " <button onclick='createGroup()' class='btn btn-primary'>Create group</button>";
?> ?>