Make nav tabs work, and make buttons look better.

Bug430-Eden2
Lan Hui 2023-08-07 16:39:19 +08:00
parent 9c529e0022
commit 0e4a49fb3d
6 changed files with 164 additions and 142 deletions

103
Admin.php
View File

@ -28,64 +28,62 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<div class="col-md-6"> <div class="col-md-6">
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs"> <ul class="nav nav-tabs" id="myTab">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" id="home" href="#home">Create TA account</a> <a class="nav-link active" href="#tab-student-accounts" id="batch_tab">Create student accounts</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#menu1" id="batch_tab">Batch create student accounts</a> <a class="nav-link" href="#tab-ins-accounts">Create instructor account</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="#menu2" id="existing_accounts_tab">Existing accounts</a> <a class="nav-link" href="#tab-existing-accounts" id="existing_accounts_tab">Existing accounts</a>
</li> </li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<div id="home" class="tab-pane active"><br> <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<div id="tab-student-accounts" class="tab-pane active" style="margin-top:5px">
<p class="text-muted">Copy & paste student number to the following box, and separate two student numbers with a space.</p>
<form action="batch_insert.php" method="post" id="batch_form">
<textarea cols="60" rows="16" name="users" required=""></textarea>
<button type="submit" class="btn btn-primary" id="register_btn">Register students</button>
</form>
</div>
<div id="tab-ins-accounts" class="tab-pane"><br>
<?php <?php
if ($_SESSION['user_type'] == "Lecturer") { if ($_SESSION['user_type'] == "Lecturer") {
echo "<p class=\"text-muted\">Create TA Accounts</p>";
echo "<b>Create TA Accounts </b>";
} }
else if($_SESSION['user_type'] == "Admin"){ else if($_SESSION['user_type'] == "Admin"){
echo "<b>Create Lecturer Accounts </b>"; echo "<p class=\"text-muted\">Create Lecturer Accounts</p>";
} }
?> ?>
<form method="post" action="Script.php" id="create_account_form"> <form method="post" action="Script.php" id="create_account_form">
<input type="hidden" name="frm_createlecturrer" value="true" required="" /> <input type="hidden" name="frm_createlecturrer" value="true" required="" />
Full name Full name
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <br>
Email Email
<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> <input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> <br>
Passport number/ID (used as the initial password) Passport number/ID (used as the initial password)
<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> <input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> <br>
<br> User type: User type:
<?php <?php
if ($_SESSION['user_type'] == "Lecturer") { if ($_SESSION['user_type'] == "Lecturer") {
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) '; echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) ';
} else if ($_SESSION['user_type'] == "Admin"){
}
else if($_SESSION['user_type'] == "Admin"){
echo " <input type='radio' name = 'type' value = 'Lecturer' required = '' id='role_lecturer' > Lecturer "; echo " <input type='radio' name = 'type' value = 'Lecturer' required = '' id='role_lecturer' > Lecturer ";
} }
?> ?>
<br>
<input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br> <button type="submit" class="btn btn-primary" id="create_btn">Create</button>
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
@ -107,21 +105,9 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
</div> </div>
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> <div id="tab-existing-accounts" class="tab-pane"><br>
<div id="menu1" class="tab-pane fade" style="margin-top:10px">
<b>Separate two student numbers with a space</b><br>
<form action="batch_insert.php" method="post" id="batch_form">
<p>
<textarea cols="70" rows="16" name="users" required=""></textarea>
</p>
<input type="submit" class="btn btn-primary" value="Register students" id="register_btn"><br>
</form>
</div>
<table class="table" style="font-size: 10pt;">
<div id="menu2" class="tab-pane fade"><br>
<table class="table-bordered" style="font-size: 10pt;">
<tr style="font-size:10pt;"> <tr style="font-size:10pt;">
<th>ID</th> <th>ID</th>
<th>Name</th> <th>Name</th>
@ -149,13 +135,13 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$pass = $row['Passport_Number']; $pass = $row['Passport_Number'];
$btn = "<button class='btn-warning' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; $btn = "<button class='btn btn-warning' 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')\" id=\"block_account_1\">Block</button>"; $btnBlock = "<button class='btn btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_account_1\">Block</button>";
} else { } else {
$newstatus = "Active"; $newstatus = "Active";
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>"; $btnBlock = "<button class='btn btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
} }
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>";
@ -170,23 +156,23 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<div class="col-md-6"> <div class="col-md-6">
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" id="myTab">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" href="#menu3" id="existing_courses">Existing courses</a> <a class="nav-link active" href="#tab-existing-courses" id="existing_courses">Existing courses</a>
</li> </li>
</ul> </ul>
<div id="menu3" class="container tab-pane active"><br> <div id="tab-existing-courses" class="tab-pane active"><br>
<b> Past courses </b> <p class="text-muted"> Past courses </p>
<hr>
<table class="table-bordered" style="font-size: 10pt;"> <table class="table" style="font-size: 10pt;">
<tr> <tr>
<th>Course Name</th> <th>Course name</th>
<th>Faculty</th> <th>Faculty</th>
<th>Lecturer</th> <th>Lecturer</th>
<th>TAs</th> <th>TAs</th>
<th>Assign new TA </th> <th>Assign a new TA </th>
</tr> </tr>
<?php <?php
$user_id = $_SESSION['user_id']; $user_id = $_SESSION['user_id'];
@ -207,7 +193,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
$ta = ""; $ta = "";
while ($rowTA = mysqli_fetch_assoc($resultTA)) { while ($rowTA = mysqli_fetch_assoc($resultTA)) {
$ta = $ta . " - " . $rowTA['TA_NAME']; $ta = $ta . " " . $rowTA['TA_NAME'];
} }
echo " echo "
@ -223,7 +209,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
} }
} }
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign' id='assign_btn_$counter'></form> </td></tr> echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <button class='btn btn-outline-secondary btn-sm' type='submit' id='assign_btn_$counter'>assign</button></form> </td></tr>
"; ";
} }
} ?> } ?>
@ -252,4 +238,15 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
} }
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status;
} }
/* For tabs to work */
const triggerTabList = document.querySelectorAll('#myTab a')
triggerTabList.forEach(triggerEl => {
const tabTrigger = new bootstrap.Tab(triggerEl)
triggerEl.addEventListener('click', event => {
event.preventDefault()
tabTrigger.show()
})
})
</script> </script>

View File

@ -86,23 +86,23 @@ if( $_SESSION['user_type'] == "Student")
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" id="myTab">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">New</a> <a class="nav-link active" href="#menu1">New</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Missed</a> <a class="nav-link" href="#menu2">Missed</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Submitted</a> <a class="nav-link" href="#menu3">Submitted</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4">Marked</a> <a class="nav-link" href="#menu4">Marked</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="menu1" class="container tab-pane active"><br> <div id="menu1" class="tab-pane active"><br>
<?php <?php
@ -138,7 +138,7 @@ if( $_SESSION['user_type'] == "Student")
if(mysqli_num_rows($result1)==0) if(mysqli_num_rows($result1)==0)
{ {
echo "No active assignments for this course now."; 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)) {
@ -169,7 +169,7 @@ if( $_SESSION['user_type'] == "Student")
echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border-left:4px solid #e6f2ff;'> echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border-left:4px solid #e6f2ff;'>
<div class='alert alert-warning'>Time left: $days_remaining</div> <div class='alert alert-warning'>Time left: $days_remaining</div>
$title ($Marks Marks, $type) <br> <span style='font-size:8pt'> $ins</span> $title ($Marks Marks, $type) <br> <span style='font-size:8pt'> $ins</span>
<br> <span style='font-size:10pt'>Posted:$posted &nbsp; Deadline:$deadline &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn-sm btn-info' style='margin-left:50px;'>Submit</a><br> Attachments : $full_link </span> <br> <span style='font-size:10pt'>Posted:$posted &nbsp; Deadline:$deadline &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<a href='~\..\SubmitLab.php?id=$labid&url=$url' class='btn btn-sm btn-primary' style='margin-left:50px;'>Submit</a><br> Attachments : $full_link </span>
</div>"; </div>";
}} }}
@ -180,7 +180,7 @@ if( $_SESSION['user_type'] == "Student")
<div id="menu2" class="container tab-pane"><br> <div id="menu2" class="tab-pane"><br>
<?php <?php
$group_id=$_SESSION['group_id']; $group_id=$_SESSION['group_id'];
@ -228,7 +228,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
} }
; ;
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 btn-sm btn-outline-danger' 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>";
@ -240,7 +240,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
<div id="menu3" class="container tab-pane"><br> <div id="menu3" class="tab-pane"><br>
<?php <?php
@ -275,7 +275,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
$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-info'>Re-submit</a>"; $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>"; $full_link = "<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
@ -360,7 +360,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
?> ?>
<div id="menu4" class="container tab-pane"><br> <div id="menu4" class="tab-pane"><br>
<?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`,
@ -403,7 +403,7 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
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-light'>Request remarking</button>"; $remarking="<button onclick='remarking(\"$rm_data\")' class='btn btn-sm btn-light'>Request remarking</button>";
} }
if($status=='Remarking') if($status=='Remarking')
{ {
@ -502,7 +502,7 @@ course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id W
} }
# Add "delete group" button and allow only group creator to delete it # Add "delete group" button and allow only group creator to delete it
$extra4 = "<button onclick='deleteGroup($id)' class='btn btn-danger' style='height: 25px; width: 95px; line-height: 12px; font-size: 12px'>Delete group</button>"; $extra4 = "<button onclick='deleteGroup($id)' class='btn btn-sm btn-danger'>Delete group</button>";
echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3" . echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3" .
(($status == "Created")? "$extra4": "") (($status == "Created")? "$extra4": "")
@ -526,7 +526,7 @@ where course_group_members_table.Course_Group_id=$id");
#Show group members + remove button next to each member except the creator of the group #Show group members + remove button next to each member except the creator of the group
if($flag){ if($flag){
echo "<li>$name - $Student_ID ($status)&nbsp;".(($status != "Created")?"<button onclick='removeMember($Student_ID, $id)' echo "<li>$name - $Student_ID ($status)&nbsp;".(($status != "Created")?"<button onclick='removeMember($Student_ID, $id)'
class='btn btn-warning' style='line-height: 12px; font-size: 12px'>Kick out</button>":"")."</li>"; class='btn btn-sm btn-warning'>Kick out</button>":"")."</li>";
}else{ }else{
echo "<li><small> $name - $Student_ID ($status)</small>"; echo "<li><small> $name - $Student_ID ($status)</small>";
} }
@ -689,4 +689,15 @@ where course_group_members_table.Course_Group_id=$id");
} catch(e){ alert(e); } } catch(e){ alert(e); }
} }
/* For tabs to work */
const triggerTabList = document.querySelectorAll('#myTab a')
triggerTabList.forEach(triggerEl => {
const tabTrigger = new bootstrap.Tab(triggerEl)
triggerEl.addEventListener('click', event => {
event.preventDefault()
tabTrigger.show()
})
})
</script> </script>

View File

@ -427,8 +427,8 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
$academic=$row['Academic_Year']; $academic=$row['Academic_Year'];
echo "<div class='btn btn-default'> echo "<div class='btn btn-default'>
$std_name is Requesting to join <br> [($code) - $name ] &nbsp;&nbsp;&nbsp;&nbsp; <br><a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=yes' class='btn-sm btn-success' onclick=return confirm(\"are you sure to join this course?\")' > Accept </a> $std_name is Requesting to join <br> [($code) - $name ] &nbsp;&nbsp;&nbsp;&nbsp; <br><a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=yes' class='btn btn-sm btn-success' onclick=return confirm(\"are you sure to join this course?\")' > Accept </a>
&nbsp;&nbsp;<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=no' class='btn-sm btn-danger' onclick=return confirm(\"are you sure to join this course?\")' > Decline </a> &nbsp;&nbsp;<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=no' class='btn btn-sm btn-danger' onclick=return confirm(\"are you sure to join this course?\")' > Decline </a>
</div>"; </div>";
} }
@ -566,7 +566,7 @@ if( $_SESSION['user_type']=="Student")
} }
echo "<div class='btn btn-default' style='word-wrap:break-word'> echo "<div class='btn btn-default' style='word-wrap:break-word'>
($code) $name <br>($url) <br> <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' >Join</a> ($code) $name <br>($url) <br> <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' >Join</a>
<br> <span style='font-size:10pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer </span><br>$msg</div> <br> <span style='font-size:10pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer </span><br>$msg</div>
"; ";
} }
@ -606,7 +606,7 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
else else
{ {
echo "<div class='btn btn-default'> echo "<div class='btn btn-default'>
($code) - $name <i class='btn-sm btn-danger'> $Status</i> ($code) - $name <i class='btn btn-sm btn-danger'> $Status</i>
<br> <span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer </span></div> <br> <span style='font-size:8pt'>Faculty: $faculty &nbsp; Year: $academic &nbsp; Lecturer: $lecturer </span></div>
"; ";
} }

View File

@ -17,10 +17,13 @@ if (mysqli_connect_errno()) {
<html lang="en-US"> <html lang="en-US">
<head> <head>
<meta charset="UTF-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lab Report Repository</title> <title>Lab Report Repository</title>
<link href=" https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- *this css file can be used across all the websites <!-- *this css file can be used across all the websites
and any new css class can be added there. and any new css class can be added there.
@ -29,11 +32,8 @@ if (mysqli_connect_errno()) {
--> -->
<link href = "./css/main.css" rel="stylesheet" type="text/css" /> <link href = "./css/main.css" rel="stylesheet" type="text/css" />
<script src="./css/jquery.min.js" type="text/javascript"></script> <script src="./css/jquery.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.1/js/bootstrap.min.js"></script>
<script src=">https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.1/js/bootstrap.bundle.min.js"></script>
<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script> <script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script>
<style> <style>
.nav-item { .nav-item {
border-color: #00ff66; border-color: #00ff66;
@ -130,56 +130,60 @@ if (mysqli_connect_errno()) {
<body> <body>
<nav class="navbar navbar-expand-lg" style="padding-left:150px;padding-right:150px;margin:auto;"> <nav class="navbar navbar-expand-lg bg-body-tertiary" style="padding-left:180px;padding-right:150px;margin:auto;">
<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;height:30px;" alt="LRR Logo"> LRR </a> <div class="container-fluid">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarColor02"> <a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;height:30px;" alt="LRR Logo"> LRR </a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link" href="#">
<?php
if (isset($_SESSION["user_fullname"])) {
echo $_SESSION['user_fullname'];
}
?>
&nbsp;
<?php
$c_date = date("Y-m-d H:i");
if (isset($_SESSION['user_student_id']))
echo "(" . $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] . ") ";
elseif (isset($_SESSION['user_type']))
echo "(" . $_SESSION['user_type'] . ") ";
?>
</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<?php <?php
if (isset($_SESSION["user_fullname"])) { if (isset($_SESSION["user_fullname"])) {
echo " <a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses <span class='sr-only'>(current)</span></a>"; echo "<a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> My courses </a>";
?> ?>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
Welcome &nbsp;
<b> <?php echo $_SESSION['user_fullname']; ?> </b>
&nbsp;
<?php
$c_date = date("Y-m-d H:i");
if (isset($_SESSION['user_student_id']))
echo "(" . $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] . ") ";
else
echo "(" . $_SESSION['user_type'] . ") ";
?>
<?php
if ($_SESSION['user_type'] == "Lecturer") { // Show Admin link
echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\"> </i>";
echo "&nbsp;<a href=\"~\..\Admin.php\" id=\"admin_tab\">Admin</a>";
}
?>
&nbsp;&nbsp;&nbsp; <i class="fa fa-user"> </i>
&nbsp;<a href="#" onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)">Update password</a>
&nbsp;&nbsp;&nbsp; <i class="fa fa-lock"> </i>
&nbsp;<a href="~\..\logout.php">Logout </a>
<?php <?php
} // Confusing. What is this for? if ($_SESSION['user_type'] == "Lecturer") { // Show Admin link
echo "&nbsp;&nbsp;&nbsp;&nbsp;<a class='nav-link' href=\"~\..\Admin.php\" id=\"admin_tab\"><i class='fa fa-cog'></i>Admin</a>";
}
?> ?>
</form>
&nbsp;&nbsp;&nbsp;&nbsp;
<a class="nav-link" href="#" onclick="updatePass(<?php echo $_SESSION['user_id']; ?>)"><i class="fa fa-user"> </i> Update password</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a class="nav-link" href="~\..\logout.php"><i class="fa fa-lock"> </i> Logout</a>
<?php
} // Closing this conditional test block: if (isset($_SESSION["user_fullname"])) { ...
?>
</div>
</div>
</div> </div>
</nav> </nav>

View File

@ -93,26 +93,26 @@ echo "<div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF
?> ?>
<b>Assignment submissions (<?php echo $count_subs; ?>)</b> <p class="text-muted">Assignment submissions (<?php echo $count_subs; ?>)</p>
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" id="myTab">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">Unmarked submissions<b> (<?php echo $count_unmarked; ?>)</b></a> <a class="nav-link active" href="#menu1">Unmarked submissions<b> (<?php echo $count_unmarked; ?>)</b></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Marked submissions <b>(<?php echo $count_marked; ?>)</b></a> <a class="nav-link" href="#menu2">Marked submissions <b>(<?php echo $count_marked; ?>)</b></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Remarking requests <b>(<?php echo $count_remark; ?>)</b></a> <a class="nav-link" href="#menu3">Remarking requests <b>(<?php echo $count_remark; ?>)</b></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4">Course groups</a> <a class="nav-link" href="#menu4">Course groups</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="menu1" class="container tab-pane active"><br> <div id="menu1" class="tab-pane active"><br>
<?php <?php
@ -182,10 +182,10 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
$full_link = $full_link . " | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>"; $full_link = $full_link . " | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>";
} }
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> echo "<div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by: <b> <span class = 'text-selectable'>$submitted_by </span> </b> $title <br> by: <b> <span class = 'text-selectable'>$submitted_by </span> </b>
<br> <span style='font-size:8pt'>Submitted : $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark</button><br> Attachments : $full_link </span> <br> <span style='font-size:8pt'>Submitted : $posted <button class='btn btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark</button><br> Attachments : $full_link </span>
</div></k>"; </div>";
} }
} }
echo ""; echo "";
@ -193,7 +193,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
</div> </div>
<div id="menu2" class="container tab-pane"><br> <div id="menu2" class="tab-pane"><br>
<?php <?php
@ -217,7 +217,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
} }
if (mysqli_num_rows($result) == 0) { if (mysqli_num_rows($result) == 0) {
echo "No Marked submissions for this lab"; echo "No marked submissions.";
} else { } else {
echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export grades</a></h3>"; echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export grades</a></h3>";
@ -267,10 +267,10 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
// if you want to use text-selectable class on whole div, just call the css class // if you want to use text-selectable class on whole div, just call the css class
echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> echo "<div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marks: $Marks ] </b> &nbsp; $title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marks: $Marks ] </b> &nbsp;
<hr> Marking notes: $notes<br> <span style='font-size:8pt'>Submitted : $posted <b> </b> <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'>Remark</button><br> Attachments : $full_link </span> <hr> Marking notes: $notes<br> <span style='font-size:8pt'>Submitted : $posted <b> </b> <button class='btn btn-light btn-sm' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'>Remark</button><br> Attachments : $full_link </span>
</div></k>"; </div>";
} }
} }
echo ""; echo "";
@ -278,7 +278,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
</div> </div>
<div id="menu3" class="container tab-pane"><br> <div id="menu3" class="tab-pane"><br>
<?php <?php
@ -349,8 +349,8 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b> $title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b>
<hr> <span style='font-size:8pt'>Submitted : $posted <b> </b> " <hr> <span style='font-size:8pt'>Submitted : $posted <b> </b> "
. "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'>Remark</button>" . "<button class='btn btn-secondary btn-sm' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'>Remark</button>"
. " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-secondary'>Ignore request</a>" . " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn btn-sm btn-light'>Ignore request</a>"
. "<br> Attachments : $full_link </span> . "<br> Attachments : $full_link </span>
</div></k>"; </div></k>";
} }
@ -360,7 +360,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
</div> </div>
<div id="menu4" class="container tab-pane"><br> <div id="menu4" class="tab-pane"><br>
<h3>Course groups</h3> <h3>Course groups</h3>
@ -377,10 +377,10 @@ WHERE Course_id=$c_id");
} else { } else {
while ($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Group_Name']; $name = $row['Group_Name'];
$leader = $row['Full_Name'] . "(" . $row['Group_Leader'] . ")"; $leader = $row['Full_Name'] . " (" . $row['Group_Leader'] . ")";
$id = $row['Course_Group_id']; $id = $row['Course_Group_id'];
echo "<div class='btn-default'><small> $name - Leader : $leader </small></div>"; echo "<ul class='list-group'>$name, Leader: $leader";
$rs2 = mysqli_query($con, "SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, $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` course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table`
@ -393,8 +393,9 @@ where course_group_members_table.Course_Group_id=$id");
$status = $row['Status']; $status = $row['Status'];
$Student_ID = $row['Student_ID']; $Student_ID = $row['Student_ID'];
echo "<li><small> $name-$Student_ID ($status)</small></li>"; echo "<li class='list-group-item'>$name ($Student_ID) - $status</li>";
} }
echo "</ul><br>";
} }
} }
?> ?>
@ -450,4 +451,14 @@ where course_group_members_table.Course_Group_id=$id");
} }
} }
/* For tabs to work */
const triggerTabList = document.querySelectorAll('#myTab a')
triggerTabList.forEach(triggerEl => {
const tabTrigger = new bootstrap.Tab(triggerEl)
triggerEl.addEventListener('click', event => {
event.preventDefault()
tabTrigger.show()
})
})
</script> </script>

View File

@ -7,8 +7,7 @@ session_start();
<?php <?php
// if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php). // if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php).
if (isset($_SESSION["user_fullname"])) { if (isset($_SESSION["user_fullname"])) {
echo '<div class="alert alert-info"> You\'ve already logged in.</div>'; echo '<div class="container alert alert-info"> You\'ve already logged in.</div>';
header("Location: Courses.php");
exit(); exit();
} }
?> ?>