Admin.php: format code using visual studio code's PHP Intelephense.

Hui-CodeIndentation
Lan Hui 2021-10-18 23:03:36 +08:00
parent 679aff4cc2
commit e64af95eee
3 changed files with 823 additions and 901 deletions

5
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"recommendations": [
"thamaraiselvam.remove-blank-lines"
]
}

132
Admin.php
View File

@ -2,7 +2,6 @@
include 'NoDirectPhpAcess.php'; include 'NoDirectPhpAcess.php';
?> ?>
<?php <?php
$page = "admin"; $page = "admin";
include 'Header.php'; include 'Header.php';
@ -23,13 +22,13 @@ if ($_SESSION['user_type'] != "Lecturer") {
</style> </style>
<br> <br>
<div style="width: 80%;margin: auto;"> <h2> Administration Panel </h2> </div> <div style="width: 80%;margin: auto;">
<h2> Administration Panel </h2>
</div>
<hr> <hr>
<div class="row" style="width: 80%;margin: auto;"> <div class="row" style="width: 80%;margin: auto;">
<!--<h4>General system Settings</h4><hr> <!--<h4>General system Settings</h4><hr>
<a href="" class="btn btn-lg btn-primary">View System Log </a> <a href="" class="btn btn-lg btn-primary">View System Log </a>
<hr> <hr>
@ -37,19 +36,13 @@ if ($_SESSION['user_type'] != "Lecturer") {
<hr> <hr>
--> -->
<div class="col-md-6"> <div class="col-md-6">
<h4> User Account Management </h4><hr> <h4> User Account Management </h4>
<hr>
<b>Lecturer / TA Accounts </b><br> <b>Lecturer / TA Accounts </b><br>
<div class="container"> <div class="container">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
@ -104,11 +97,8 @@ if(isset($_SESSION['info_Admin_Users'])) {
<hr> <hr>
</div> </div>
<div id="menu1" class="container tab-pane fade"><br> <div id="menu1" class="container tab-pane fade"><br>
<table class="table-bordered" style="font-size: 10pt;"> <table class="table-bordered" style="font-size: 10pt;">
@ -122,13 +112,15 @@ if(isset($_SESSION['info_Admin_Users'])) {
</tr> </tr>
<?php <?php
$result = mysqli_query($con, $result = mysqli_query(
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer','TA')"); $con,
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer','TA')"
);
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$pass = $row['Passport_Number']; $pass = $row['Passport_Number'];
$btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; $btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>";
if($row['Status']=="Active") if ($row['Status'] == "Active") {
{ $newstatus="Blocked"; $newstatus = "Blocked";
$btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Block</button>"; $btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Block</button>";
} else { } else {
$newstatus = "Active"; $newstatus = "Active";
@ -137,12 +129,11 @@ if(isset($_SESSION['info_Admin_Users'])) {
echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>"; echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>";
} }
?></table> ?>
</table>
</div> </div>
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<div id="menu2" class="container tab-pane fade" style="margin-top:10px"> <div id="menu2" class="container tab-pane fade" style="margin-top:10px">
@ -155,17 +146,13 @@ if(isset($_SESSION['info_Admin_Users'])) {
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="container"> <div class="container">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
@ -182,15 +169,9 @@ if(isset($_SESSION['info_Admin_Users'])) {
<div class="tab-content"> <div class="tab-content">
<div id="menua" class="container tab-pane active"><br> <div id="menua" class="container tab-pane active"><br>
<hr> <hr>
<b>Create new Portal </b> <b>Create new Portal </b>
<form method="post" action="Script.php"> <form method="post" action="Script.php">
<input type="hidden" name="frm_createCourse" value="true" required="" /> <input type="hidden" name="frm_createCourse" value="true" required="" />
Course Name Course Name
@ -214,34 +195,29 @@ Academic Year
<select name="lecturer" class="form-control"> <select name="lecturer" class="form-control">
<?php <?php
$result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='Lecturer'"); $result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='Lecturer'");
if(mysqli_num_rows($result)==0) if (mysqli_num_rows($result) == 0) {
{} else { while($row = mysqli_fetch_assoc($result)) { } else {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['User_ID']; $id = $row['User_ID'];
$name = $row['Full_Name']; $name = $row['Full_Name'];
echo "<option value='$id'> $name </option>"; echo "<option value='$id'> $name </option>";
}}?> }
} ?>
</select> </select>
Assigned T/A <br> Assigned T/A <br>
<select name="ta" class="form-control"> <select name="ta" class="form-control">
<?php <?php
$result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'"); $result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
if(mysqli_num_rows($result)==0) if (mysqli_num_rows($result) == 0) {
{} else { while($row = mysqli_fetch_assoc($result)) { } else {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['User_ID']; $id = $row['User_ID'];
$name = $row['Full_Name']; $name = $row['Full_Name'];
echo "<option value='$id'> $name </option>"; echo "<option value='$id'> $name </option>";
}}?> }
} ?>
</select> </select>
@ -254,8 +230,6 @@ Verify Joining Students
</form> </form>
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
@ -270,25 +244,25 @@ if(isset($_SESSION['info_Admin_Courses'])) {
?> ?>
</div> </div>
<div id="menub" class="container tab-pane fade"><br> <div id="menub" class="container tab-pane fade"><br>
<b> Existing Course Portals </b> <b> Existing Course Portals </b>
<hr> <hr>
<table class="table-bordered" style="font-size: 10pt;"> <table class="table-bordered" style="font-size: 10pt;">
<tr> <th>Course Name </th> <th> Faculty </th> <th>Lecturer </th> <th>TAs</th> <th>Assign new TA </th> </tr> <tr>
<th>Course Name </th>
<th> Faculty </th>
<th>Lecturer </th>
<th>TAs</th>
<th>Assign new TA </th>
</tr>
<?php <?php
$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` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID"); $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` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID");
if(mysqli_num_rows($result)==0) if (mysqli_num_rows($result) == 0) {
{} else { while($row = mysqli_fetch_assoc($result)) { } else {
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'];
@ -296,8 +270,6 @@ if(isset($_SESSION['info_Admin_Courses'])) {
$academic = $row['Academic_Year']; $academic = $row['Academic_Year'];
$c_id = $row['Course_ID']; $c_id = $row['Course_ID'];
$resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta` $resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
INNER JOIN users_table on users_table.User_ID=course_ta.TA INNER JOIN users_table on users_table.User_ID=course_ta.TA
where course_ta.Course_ID=$c_id"); where course_ta.Course_ID=$c_id");
@ -307,30 +279,23 @@ where course_ta.Course_ID=$c_id");
$ta = $ta . " - " . $rowTA['TA_NAME']; $ta = $ta . " - " . $rowTA['TA_NAME'];
} }
echo " echo "
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php'> <select name='ta' class=''>"; <tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php'> <select name='ta' class=''>";
$resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'"); $resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
if(mysqli_num_rows($resultx)==0) if (mysqli_num_rows($resultx) == 0) {
{} else { while($row = mysqli_fetch_assoc($resultx)) { } else {
while ($row = mysqli_fetch_assoc($resultx)) {
$id = $row['User_ID']; $id = $row['User_ID'];
$name = $row['Full_Name']; $name = $row['Full_Name'];
echo "<option value='$id'> $name </option>"; echo "<option value='$id'> $name </option>";
}} }
}
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign'></form> </td></tr> echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign'></form> </td></tr>
"; ";
}
} ?>
}}?>
</table> </table>
@ -338,28 +303,19 @@ echo "</select> <input type='hidden' name='assignTA' value='true'> <input type=
</div> </div>
</div> </div>
<script> <script>
function updatePass(id,pass) function updatePass(id, pass) {
{ if (!confirm('Are you to Reset User Password')) {
if(!confirm('Are you to Reset User Password'))
{
return; return;
} }
window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass; window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass;
} }
function blockUser(id,status) function blockUser(id, status) {
{ if (!confirm('Are you to change User Status')) {
if(!confirm('Are you to change User Status'))
{
return; return;
} }
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status;

View File

@ -11,8 +11,7 @@ $group_id = $_SESSION["user_group_id"];
$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 = $_GET["url"]; $course_url = $_GET["url"];
$result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`," $result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,"
. " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` " . " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` "
@ -22,7 +21,6 @@ if(!empty($_GET["url"]))
if (mysqli_num_rows($result) == 0) { if (mysqli_num_rows($result) == 0) {
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'];
@ -74,8 +72,7 @@ if (isset($_SESSION['info_courses'])) {
<?php <?php
if( $_SESSION['user_type'] == "Student") if ($_SESSION['user_type'] == "Student") {
{
?> ?>
<hr> <hr>
@ -103,6 +100,7 @@ if( $_SESSION['user_type'] == "Student")
<!----------Delete Course Button-----------> <!----------Delete Course Button----------->
<li> <li>
<html> <html>
<body> <body>
<div class="modal fade" id="delcourse"> <div class="modal fade" id="delcourse">
@ -142,28 +140,19 @@ if( $_SESSION['user_type'] == "Student")
$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr"); $con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr");
// Check connection // Check connection
if (mysqli_connect_errno()) if (mysqli_connect_errno()) {
{
echo "Failed to connect to MySQL: " . mysqli_connect_error(); echo "Failed to connect to MySQL: " . mysqli_connect_error();
} }
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
header("Location: Courses.php"); header("Location: Courses.php");
$result = mysqli_query($con, "DELETE FROM course_students_table WHERE Course_ID='$course_id'"); $result = mysqli_query($con, "DELETE FROM course_students_table WHERE Course_ID='$course_id'");
} }
?> ?>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<style> <style>
/*--------------------[ Delete Course Button ]*/ /*--------------------[ Delete Course Button ]*/
.action-button { .action-button {
font-family: 'Pacifico', cursive; font-family: 'Pacifico', cursive;
@ -171,11 +160,13 @@ if(isset($_POST['submit'])){
color: #FFF; color: #FFF;
text-decoration: none; text-decoration: none;
} }
.red { .red {
background-color: #E74C3C; background-color: #E74C3C;
border-bottom: 5px solid #BD3E31; border-bottom: 5px solid #BD3E31;
text-shadow: 0px -2px #BD3E31; text-shadow: 0px -2px #BD3E31;
} }
.blue { .blue {
background-color: #4d4dff; background-color: #4d4dff;
border-bottom: 5px solid #4d4dff; border-bottom: 5px solid #4d4dff;
@ -183,6 +174,7 @@ if(isset($_POST['submit'])){
} }
</style> </style>
</body> </body>
</html> </html>
</li> </li>
</ul> </ul>
@ -196,15 +188,13 @@ if(isset($_POST['submit'])){
$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)) {
{
$_SESSION['group_id'] = $row['Course_Group_id']; $_SESSION['group_id'] = $row['Course_Group_id'];
} }
$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.
} }
@ -222,8 +212,7 @@ if(isset($_POST['submit'])){
$result1 = mysqli_query($con, $var); $result1 = mysqli_query($con, $var);
if(mysqli_num_rows($result1)==0) if (mysqli_num_rows($result1) == 0) {
{
echo "No active assignments for this course so far."; echo "No active assignments for this course so far.";
} else { } else {
@ -256,8 +245,8 @@ if(isset($_POST['submit'])){
$title ($type) <br> <span style='font-size:8pt'> $ins</span> $title ($type) <br> <span style='font-size:8pt'> $ins</span>
<br> <span style='font-size:8pt'>Posted : $posted &nbsp;&nbsp;&nbsp;&nbsp; Deadline : $deadline &nbsp;&nbsp;&nbsp;&nbsp;($Marks Marks) &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'> Submit Lab Report</a><br> Attachments : $full_link </span> <br> <span style='font-size:8pt'>Posted : $posted &nbsp;&nbsp;&nbsp;&nbsp; Deadline : $deadline &nbsp;&nbsp;&nbsp;&nbsp;($Marks Marks) &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'> Submit Lab Report</a><br> Attachments : $full_link </span>
</div></k>"; </div></k>";
}
}} }
echo ""; echo "";
?> ?>
@ -270,7 +259,9 @@ if(isset($_POST['submit'])){
<?php <?php
$group_id = $_SESSION['group_id']; $group_id = $_SESSION['group_id'];
if($group_id == ""){$group_id = -1;} // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1. if ($group_id == "") {
$group_id = -1;
} // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1.
$result = mysqli_query($con, "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` $result = mysqli_query($con, "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`
FROM `lab_reports_table` FROM `lab_reports_table`
WHERE WHERE
@ -285,10 +276,8 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
if(mysqli_num_rows($result)==0) if (mysqli_num_rows($result) == 0) {
{
echo "You missed no lab reports in this course."; echo "You missed no lab reports in this course.";
} else { } else {
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$title = $row['Title']; $title = $row['Title'];
@ -316,14 +305,13 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
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>";
} };
;
echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'><span class='btn-sm btn-warning' style='margin-left:0px;'>MISSED</span> $title ($marks Marks) <br> <span style='font-size:8pt'> $ins</span> echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'><span class='btn-sm btn-warning' style='margin-left:0px;'>MISSED</span> $title ($marks Marks) <br> <span style='font-size:8pt'> $ins</span>
<br> <span style='font-size:8pt'>Posted: $posted<br> Deadline: $deadline &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> Attachments : $full_link </span> <br> <span style='font-size:8pt'>Posted: $posted<br> Deadline: $deadline &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> Attachments : $full_link </span>
</div>"; </div>";
}
}} }
echo ""; echo "";
?> ?>
@ -336,7 +324,9 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
$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`
@ -347,10 +337,8 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
$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 "You have no lab report submissions in this course."; echo "You have no lab report submissions in this course.";
} 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'];
@ -364,8 +352,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
$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-sm btn-default'><i class='fa fa-check-circle'></i> Re-Submit </a>"; $submittedx = "<a href='~\..\SubmitLab.php?id=$id&url=$url' class='btn-sm btn-default'><i class='fa fa-check-circle'></i> Re-Submit </a>";
} }
@ -397,10 +384,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'];
@ -427,7 +412,6 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
} }
echo $full_link; echo $full_link;
} }
} }
@ -436,10 +420,8 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
echo "</span></div></k>"; echo "</span></div></k>";
}
}
}}
echo ""; echo "";
?> ?>
@ -451,8 +433,8 @@ 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)) while ($row = mysqli_fetch_assoc($sqli)) {
{ $Group_Leader=$row['Group_Leader']; $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'];
@ -485,11 +467,10 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
if(mysqli_num_rows($resultx)==0) if (mysqli_num_rows($resultx) == 0) {
{
echo "You have no marked submissions in this course"; echo "You have no marked submissions in this course";
} 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'];
@ -505,15 +486,12 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
$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-sm btn-success'> Request Remarking </button>"; $remarking = "<button onclick='remarking(\"$rm_data\")' class='btn-sm btn-success'> 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> Remarking Reason:<i>$remarking_reason </i> <br>"; $remarking = "<span style='color:orange'><i class='fa fa-info-circle'></i> Remarking Request sent </span> <br> Remarking Reason:<i>$remarking_reason </i> <br>";
} }
@ -531,11 +509,10 @@ 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'];
@ -555,17 +532,10 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
} }
echo $full_link; echo $full_link;
} }
} }
}
}
}}
echo "</div></k>"; echo "</div></k>";
?> ?>
@ -581,7 +551,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>";
@ -598,10 +570,10 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
FROM `course_group_members_table` INNER JOIN course_groups_table on FROM `course_group_members_table` INNER JOIN course_groups_table on
course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id WHERE Student_id=$student_id and course_groups_table.Course_id=$course_id"); course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id WHERE Student_id=$student_id and course_groups_table.Course_id=$course_id");
if(mysqli_num_rows($result)==0) if (mysqli_num_rows($result) == 0) {
{
echo "You have no Group in this Course"; echo "You have no Group in this Course";
} else { while($row = mysqli_fetch_assoc($result)) { } else {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Group_Name']; $name = $row['Group_Name'];
$id = $row['Course_Group_id']; $id = $row['Course_Group_id'];
$status = $row['Status']; $status = $row['Status'];
@ -609,11 +581,9 @@ course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id W
$extra = " - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>"; $extra = " - <a href='#' class='' onclick='invite($id)'> Invite Others</a></small>";
if($status=="Invited") if ($status == "Invited") {
{
$extra2 = " <a href='#' class='' onclick='accept($id,1)'>Accept</a></small>"; $extra2 = " <a href='#' class='' onclick='accept($id,1)'>Accept</a></small>";
$extra3 = " <a href='#' class='' onclick='accept($id,0)'>Decline</a></small>"; $extra3 = " <a href='#' class='' onclick='accept($id,0)'>Decline</a></small>";
} }
echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3</small></div>"; echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3</small></div>";
@ -630,15 +600,7 @@ where course_group_members_table.Course_Group_id=$id");
echo "<li><small> $name-$Student_ID ($status)</small></li>"; echo "<li><small> $name-$Student_ID ($status)</small></li>";
} }
} }
} }
?> ?>
@ -665,12 +627,10 @@ include 'Footer.php';
<link rel="stylesheet" href="./css/jquery-ui.css" /> <link rel="stylesheet" href="./css/jquery-ui.css" />
<script> <script>
function CreateGroup() { function CreateGroup() {
try try {
{
$('<form id="frm" method="get" action="Script.php"><input type="hidden" name="creategroup" value="true">\n\ $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="creategroup" value="true">\n\
@ -692,7 +652,9 @@ function CreateGroup() {
} }
}); });
} catch(e){ alert(e); } } catch (e) {
alert(e);
}
} }
@ -701,8 +663,7 @@ function CreateGroup() {
function invite(id) { function invite(id) {
try try {
{
$('<form id="frm" method="get" action="Script.php"><input type="hidden" name="groupinvite" value="true">\n\ $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="groupinvite" value="true">\n\
@ -724,7 +685,9 @@ function invite(id) {
} }
}); });
} catch(e){ alert(e); } } catch (e) {
alert(e);
}
} }
@ -736,8 +699,7 @@ function invite(id) {
function accept(id, val) { function accept(id, val) {
try try {
{
$('<form id="frm" method="get" action="Script.php"><input type="hidden" name="acceptinvite" value="true">\n\ $('<form id="frm" method="get" action="Script.php"><input type="hidden" name="acceptinvite" value="true">\n\
@ -761,18 +723,17 @@ function accept(id,val) {
} }
}); });
} catch(e){ alert(e); } } catch (e) {
alert(e);
}
} }
function remarking(data) function remarking(data) {
{
var details = prompt("Please enter your remarking reasons", ""); var details = prompt("Please enter your remarking reasons", "");
window.location.href = data + "&details=" + details; window.location.href = data + "&details=" + details;
} }
</script> </script>