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

@ -100,7 +100,7 @@ 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);
@ -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,8 +264,8 @@ 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>";
} }
@ -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"); $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']; while ($row = mysqli_fetch_assoc($sqli)) {
$Group_Leader = $row['Group_Leader'];
$Group_Member = $row['Group_Member']; $Group_Member = $row['Group_Member'];
$Group_Member2 = $row['Group_Member2']; $Group_Member2 = $row['Group_Member2'];
$Group_Member3 = $row['Group_Member3']; $Group_Member3 = $row['Group_Member3'];
$Group_Member4 = $row['Group_Member4']; $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,
@ -404,7 +400,6 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
$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,
@ -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>";
?> ?>