From e64af95eee25c71fdd5e2120c45a18cee047d037 Mon Sep 17 00:00:00 2001 From: Lan Hui Date: Mon, 18 Oct 2021 23:03:36 +0800 Subject: [PATCH] Admin.php: format code using visual studio code's PHP Intelephense. --- .vscode/extensions.json | 5 + Admin.php | 602 ++++++++++----------- Course.php | 1117 +++++++++++++++++++-------------------- 3 files changed, 823 insertions(+), 901 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..5570731 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "thamaraiselvam.remove-blank-lines" + ] +} \ No newline at end of file diff --git a/Admin.php b/Admin.php index fcbe519..0c8b4ca 100644 --- a/Admin.php +++ b/Admin.php @@ -1,367 +1,323 @@ -
-

Administration Panel

- -
+
+

Administration Panel

+
+ +
- - - - -
-

User Account Management


- - Lecturer / TA Accounts
- - - - - - -
+
+

User Account Management

+
+ Lecturer / TA Accounts
+
- - -

- - Create Lecturer/TA Accounts -
- - Full_Name - -Email - - - Passport_Number / ID (Used as Intial Password) - -
User Type : - Lecturer - T/A -
- +
-error_reporting(E_ALL); -if(isset($_SESSION['info_Admin_Users'])) { - echo '
'; - $_SESSION['info_Admin_Users']=null; -} -if(isset($_SESSION['info_Admin_Users'])) { - echo '
'; - $_SESSION['info_Admin_Users']=null; -} +

-?> + Create Lecturer/TA Accounts + + + Full_Name + + Email + - - -
+ Passport_Number / ID (Used as Intial Password) + +
User Type : + Lecturer + T/A +
+ '; + $_SESSION['info_Admin_Users'] = null; + } + if (isset($_SESSION['info_Admin_Users'])) { + echo '
'; + $_SESSION['info_Admin_Users'] = null; + } + ?> -
- - - - +
- - - - - -
-
- - -
- -
- - - -
- - - - -
- - - - - + + + + + + + +
- - -
- - - - - + +
+ +
+ +
+ + + + +
+ + + + +
+ +
+ + \ No newline at end of file diff --git a/Course.php b/Course.php index d7683ef..0dc6dbc 100644 --- a/Course.php +++ b/Course.php @@ -4,30 +4,28 @@ include 'NoDirectPhpAcess.php'; Courses > $name ($code) > Lab Reports
Faculty: $faculty | Year: $academic | Lecturer: $lecturer -
"; +
"; } else { $ta_name = ""; 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 " "; +
"; } } } @@ -54,79 +52,79 @@ if(!empty($_GET["url"])) ?>
- -'; - $_SESSION['info_ReMarking']=null; -} - -if (isset($_SESSION['info_courses'])) { - echo '
'; - $_SESSION['info_courses']=null; -} -?> - + + '; + $_SESSION['info_ReMarking'] = null; + } + + if (isset($_SESSION['info_courses'])) { + echo '
'; + $_SESSION['info_courses'] = null; + } + ?> +
+if ($_SESSION['user_type'] == "Student") { + +?>
-
- - +
-
@@ -134,523 +132,487 @@ if( $_SESSION['user_type'] == "Student")
-
- - -// Connect to MySQL database -$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); + + // Connect to MySQL database + $con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); - - - - - - - - - -
- -
- +
- +
-

Class Groups

- -Class Groups - - echo " "; - - ?> - - - -
- Create Group"; + + ?> + + + +
+ Invite Others"; - - if($status=="Invited") - { - $extra2=" Accept"; - $extra3=" Decline"; - - } - echo "
$name ($status) $extra $extra2 $extra3
"; - - $rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, + + if (mysqli_num_rows($result) == 0) { + echo "You have no Group in this Course"; + } else { + while ($row = mysqli_fetch_assoc($result)) { + $name = $row['Group_Name']; + $id = $row['Course_Group_id']; + $status = $row['Status']; + + + $extra = " - Invite Others"; + + if ($status == "Invited") { + $extra2 = " Accept"; + $extra3 = " Decline"; + } + echo "
$name ($status) $extra $extra2 $extra3
"; + + $rs2 = mysqli_query($con, "SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table` INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID where course_group_members_table.Course_Group_id=$id"); - - while($row = mysqli_fetch_assoc($rs2)) { - $name=$row['Full_Name']; - $id=$row['Course_Group_id']; - $status=$row['Status']; - $Student_ID=$row['Student_ID']; - - - echo "
  • $name-$Student_ID ($status)
  • "; - - } - - - - - - - - } - } - ?> - - - - + while ($row = mysqli_fetch_assoc($rs2)) { + $name = $row['Full_Name']; + $id = $row['Course_Group_id']; + $status = $row['Status']; + $Student_ID = $row['Student_ID']; + + + echo "
  • $name-$Student_ID ($status)
  • "; + } + } + } + ?> + + + + +
    - + - + @@ -665,67 +627,68 @@ include 'Footer.php'; - + function remarking(data) { + + var details = prompt("Please enter your remarking reasons", ""); + + window.location.href = data + "&details=" + details; + } + \ No newline at end of file