Course.php: better indent HTML code.

Bug430-Eden2
Lan Hui 2023-08-28 21:19:30 +08:00
parent 26bf3ec359
commit d0781cde08
1 changed files with 12 additions and 7 deletions

View File

@ -16,8 +16,7 @@ include 'Header.php';
$c_date = date("Y-m-d H:i"); $c_date = date("Y-m-d H:i");
if(!empty($_GET["url"])) if(!empty($_GET["url"])) {
{
$course_url = mysqli_real_escape_string($con, $_GET["url"]); $course_url = mysqli_real_escape_string($con, $_GET["url"]);
$result = mysqli_query($con,"SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name $result = mysqli_query($con,"SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name
FROM courses_table FROM courses_table
@ -29,7 +28,7 @@ include 'Header.php';
echo "No course matching the given course URL: ".$course_url; echo "No course matching the given course URL: ".$course_url;
} else { } else {
while($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name']; $name = $row['Course_Name'];
$code = $row['Course_Code']; $code = $row['Course_Code'];
$faculty = $row['Faculty']; $faculty = $row['Faculty'];
@ -38,16 +37,22 @@ include 'Header.php';
$url = $row['URL']; $url = $row['URL'];
$course_id = $row['Course_ID']; $course_id = $row['Course_ID'];
// also get teaching assistant names (if any) // also get teaching assistant names (if any)
$ta_result = mysqli_query($con, "SELECT Full_Name FROM users_table where User_ID in (select TA from course_ta where Course_ID='$course_id');"); $ta_result = mysqli_query($con, "SELECT Full_Name FROM users_table WHERE User_ID IN (SELECT TA FROM course_ta WHERE Course_ID='$course_id');");
if (mysqli_num_rows($ta_result) == 0) { if (mysqli_num_rows($ta_result) == 0) {
echo " <div class='alert' style='border-bottom:2px solid #eee;'> Courses > ($code) $name > Assignments <br> <span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer </span></div> "; echo "<div class='alert' style='border-bottom:2px solid #eee;'>
Courses > ($code) $name > Assignments <br>
<span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer</span>
</div>";
} else { } else {
$ta_name = ""; $ta_name = "";
while ($row = mysqli_fetch_assoc($ta_result)) { while ($row = mysqli_fetch_assoc($ta_result)) {
$ta_name = $ta_name.$row['Full_Name']." "; $ta_name = $ta_name.$row['Full_Name']." ";
} }
$ta_name = trim ($ta_name); $ta_name = trim($ta_name);
echo " <div class='alert' style='border-bottom:2px solid #eee;'> Courses > ($code) $name > Assignments <br> <span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer &nbsp; Teaching Assistant: $ta_name </span></div> "; echo "<div class='alert' style='border-bottom:2px solid #eee;'>
Courses > ($code) $name > Assignments <br>
<span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer &nbsp; Teaching Assistant: $ta_name</span>
</div>";
} }
} }
} }