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'])) {
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'])) {
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
// Get groups of this students
$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";
// 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";
$resultx1 = mysqli_query($con, $sql);
while($row = mysqli_fetch_assoc($resultx1))
@ -111,7 +111,7 @@ include 'Header.php';
$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.
}
@ -130,11 +130,9 @@ include 'Header.php';
$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>";
} else {
while($row = mysqli_fetch_assoc($result1)) {
$title=$row['Title'];
$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>
</div></div>";
}}
}
}
echo "";
?>
@ -238,9 +237,10 @@ include 'Header.php';
<div id="menu3" class="tab-pane">
<?php
$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`
@ -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";
$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>';
} else {
while($row = mysqli_fetch_assoc($resultx)) {
$lab_repo_id=$row['Lab_Report_ID'];
@ -268,21 +264,21 @@ include 'Header.php';
$att3=$row['Attachment_link_3'];
$att4=$row['Attachment_link_4'];
$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>";
}
$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>";
}
if($att3!=""){
if($att3!="") {
$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>";
}
@ -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
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.";
} else {
while($row = mysqli_fetch_assoc($Sub_result)) {
$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 "";
?>
@ -344,19 +338,21 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
<?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'];
$Group_Member=$row['Group_Member'];
$Group_Member2=$row['Group_Member2'];
$Group_Member3=$row['Group_Member3'];
$Group_Member4=$row['Group_Member4'];
$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'];
$Group_Member = $row['Group_Member'];
$Group_Member2 = $row['Group_Member2'];
$Group_Member3 = $row['Group_Member3'];
$Group_Member4 = $row['Group_Member4'];
}
?>
<div id="menu4" class="tab-pane">
<?php
$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`,
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"
. " 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>';
} else {
while($row = mysqli_fetch_assoc($resultx)) {
$title=$row['Lab_Title'];
$marks=$row['Marks'];
$Originalmarks=$row['Original_marks'];
$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'];
$id=$row['Lab_Report_ID'];
$Submission_ID=$row['Submission_ID'];
$notes=$row['Notes'];
$status= $row['Status'];
$remarking_reason=$row['Remarking_Reason'];
$title = $row['Lab_Title'];
$marks = $row['Marks'];
$Originalmarks = $row['Original_marks'];
$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'];
$id = $row['Lab_Report_ID'];
$Submission_ID = $row['Submission_ID'];
$notes = $row['Notes'];
$status = $row['Status'];
$remarking_reason = $row['Remarking_Reason'];
if($status=='Marked') {
$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>";
if ($status == 'Marked') {
$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>";
}
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>";
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>";
}
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: ";
$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
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.";
} else {
while($row = mysqli_fetch_assoc($Sub_result)) {
$at1=$row['Attachment1'];
$at2=$row['Attachment2'];
$at3=$row['Attachment3'];
$at4=$row['Attachment4'];
$at1 = $row['Attachment1'];
$at2 = $row['Attachment2'];
$at3 = $row['Attachment3'];
$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>";
}
if($at3!="") {
if($at3 != "") {
$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>";
}
@ -458,7 +453,9 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
<?php
$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>";
?>