2020-10-02 17:02:20 +08:00
|
|
|
<?php
|
2021-10-18 23:03:36 +08:00
|
|
|
include 'NoDirectPhpAcess.php';
|
2020-10-02 17:02:20 +08:00
|
|
|
?>
|
|
|
|
|
2020-09-26 20:08:39 +08:00
|
|
|
<?php
|
2021-10-18 23:03:36 +08:00
|
|
|
$page = "admin";
|
2020-09-26 20:08:39 +08:00
|
|
|
include 'Header.php';
|
|
|
|
?>
|
|
|
|
|
2022-11-19 21:48:07 +08:00
|
|
|
<!-- <?php
|
|
|
|
// if ($_SESSION['user_type'] != "Lecturer") {
|
|
|
|
// $_SESSION["info_login"] = "You must log in first.";
|
|
|
|
// echo $_SESSION["info_login"];
|
|
|
|
// header("Location: index.php");
|
|
|
|
// }
|
|
|
|
?> -->
|
2020-09-26 20:08:39 +08:00
|
|
|
|
|
|
|
<style>
|
2021-10-18 23:03:36 +08:00
|
|
|
.col-md-4 {
|
|
|
|
border-right: 1px solid skyblue;
|
|
|
|
}
|
2020-09-26 20:08:39 +08:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<br>
|
2021-10-18 23:03:36 +08:00
|
|
|
<div style="width: 80%;margin: auto;">
|
|
|
|
<h2> Administration Panel </h2>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<hr>
|
2020-09-26 20:08:39 +08:00
|
|
|
<div class="row" style="width: 80%;margin: auto;">
|
2021-10-18 23:03:36 +08:00
|
|
|
|
|
|
|
<!--<h4>General system Settings</h4><hr>
|
2020-09-26 20:08:39 +08:00
|
|
|
<a href="" class="btn btn-lg btn-primary">View System Log </a>
|
|
|
|
<hr>
|
|
|
|
Lab Privacy Mode: (STUDENT VERIFICATION)
|
|
|
|
<hr>
|
|
|
|
-->
|
2021-10-18 23:03:36 +08:00
|
|
|
<div class="col-md-6">
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2022-11-19 21:48:07 +08:00
|
|
|
<?php
|
|
|
|
if ($_SESSION['user_type'] == "Lecturer") {
|
|
|
|
|
|
|
|
echo " <h4> TA Account Management </h4>
|
|
|
|
<hr> " ;
|
|
|
|
echo "<b>TA Accounts </b><br>" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(($_SESSION['user_type'] == "Admin")){
|
|
|
|
|
|
|
|
echo " <h4> Lecturer Account Management </h4>
|
|
|
|
<hr> ";
|
|
|
|
echo "<b>Lecturer Accounts </b><br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<div class="container">
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<!-- Nav tabs -->
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a>
|
|
|
|
</li>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<li class="nav-item">
|
2021-11-27 23:02:44 +08:00
|
|
|
<a class="nav-link" data-toggle="tab" href="#menu2" id="batch_tab">Batch Create New Student Accounts</a>
|
2021-10-18 23:03:36 +08:00
|
|
|
</li>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<li class="nav-item">
|
2021-11-30 21:49:51 +08:00
|
|
|
<a class="nav-link" data-toggle="tab" href="#menu1" id="existing_accounts_tab">Existing Accounts</a>
|
2021-10-18 23:03:36 +08:00
|
|
|
</li>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
</ul>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<!-- Tab panes -->
|
|
|
|
<div class="tab-content">
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<div id="home" class="container tab-pane active"><br>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2022-11-19 21:48:07 +08:00
|
|
|
<?php
|
|
|
|
if ($_SESSION['user_type'] == "Lecturer") {
|
|
|
|
|
|
|
|
echo "<b>Create TA Accounts </b>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(($_SESSION['user_type'] == "Admin")){
|
|
|
|
|
|
|
|
echo "<b>Create Lecturer Accounts </b>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2021-12-03 10:58:07 +08:00
|
|
|
<form method="post" action="Script.php" id="create_account_form">
|
2021-10-18 23:03:36 +08:00
|
|
|
<input type="hidden" name="frm_createlecturrer" value="true" required="" />
|
|
|
|
Full_Name
|
|
|
|
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required="">
|
|
|
|
Email
|
|
|
|
<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required="">
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
Passport_Number / ID (Used as Intial Password)
|
|
|
|
<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required="">
|
|
|
|
<br> User Type :
|
2022-11-19 21:48:07 +08:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
if ($_SESSION['user_type'] == "Lecturer") {
|
|
|
|
|
|
|
|
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> T/A ';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(($_SESSION['user_type'] == "Admin")){
|
|
|
|
|
|
|
|
echo " <input type='radio' name = 'type' value = 'Lecturer' required = '' id='role_lecturer' > Lecturer ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
2021-11-27 23:02:44 +08:00
|
|
|
<input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br>
|
2022-11-19 21:48:07 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<?php
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
error_reporting(E_ALL);
|
|
|
|
if (isset($_SESSION['info_Admin_Users'])) {
|
|
|
|
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>';
|
|
|
|
$_SESSION['info_Admin_Users'] = null;
|
|
|
|
}
|
|
|
|
if (isset($_SESSION['info_Admin_Users'])) {
|
|
|
|
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>';
|
|
|
|
$_SESSION['info_Admin_Users'] = null;
|
|
|
|
}
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
?>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
</form>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<hr>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
</div>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<div id="menu1" class="container tab-pane fade"><br>
|
|
|
|
|
|
|
|
<table class="table-bordered" style="font-size: 10pt;">
|
|
|
|
<tr style="font-size:10pt;">
|
|
|
|
<th>ID</th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Email</th>
|
|
|
|
<th>Passport / ID </th>
|
|
|
|
<th>Reset Password </th>
|
|
|
|
<th>Block/Activate </th>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
|
2022-11-19 21:48:07 +08:00
|
|
|
if ($_SESSION['user_type'] == "Lecturer") {
|
|
|
|
|
|
|
|
$result = mysqli_query(
|
|
|
|
$con,
|
|
|
|
"SELECT * FROM Users_Table WHERE UserType in ('TA')"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(($_SESSION['user_type'] == "Admin")){
|
|
|
|
|
|
|
|
$result = mysqli_query(
|
|
|
|
$con,
|
|
|
|
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer')"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$pass = $row['Passport_Number'];
|
|
|
|
$btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>";
|
|
|
|
if ($row['Status'] == "Active") {
|
|
|
|
$newstatus = "Blocked";
|
2021-12-03 10:58:07 +08:00
|
|
|
$btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_account_1\">Block</button>";
|
2021-10-18 23:03:36 +08:00
|
|
|
} else {
|
|
|
|
$newstatus = "Active";
|
2021-12-03 10:58:07 +08:00
|
|
|
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
|
2021-10-18 23:03:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
</div>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
<div id="menu2" class="container tab-pane fade" style="margin-top:10px">
|
|
|
|
<b>Separate two student numbers with a space.</b><br>
|
2021-12-03 10:58:07 +08:00
|
|
|
<form action="batch_insert.php" method="post" id="batch_form">
|
2021-10-18 23:03:36 +08:00
|
|
|
<p>
|
|
|
|
<textarea cols="80" rows="16" name="users" required=""></textarea>
|
|
|
|
</p>
|
2021-12-03 10:58:07 +08:00
|
|
|
<input type="submit" class="btn btn-primary" value="Register Students" id="register_btn"><br>
|
2021-10-18 23:03:36 +08:00
|
|
|
</form>
|
|
|
|
</div>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
<!-- Nav tabs -->
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
|
|
<li class="nav-item">
|
2021-12-05 00:59:43 +08:00
|
|
|
<a class="nav-link active" data-toggle="tab" href="#menub" id="existing_courses">Existing Courses</a>
|
2021-10-18 23:03:36 +08:00
|
|
|
</li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- Tab panes -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2021-11-11 23:03:03 +08:00
|
|
|
<div id="menub" class="container tab-pane active"><br>
|
2021-10-18 23:03:36 +08:00
|
|
|
|
|
|
|
<b> Existing Course Portals </b>
|
|
|
|
<hr>
|
|
|
|
<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>
|
|
|
|
<?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");
|
|
|
|
if (mysqli_num_rows($result) == 0) {
|
|
|
|
} else {
|
2021-12-05 00:59:43 +08:00
|
|
|
$counter = 0;
|
2021-10-18 23:03:36 +08:00
|
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
|
|
$name = $row['Course_Name'];
|
|
|
|
$code = $row['Course_Code'];
|
|
|
|
$faculty = $row['Faculty'];
|
|
|
|
$lecturer = $row['Full_Name'];
|
|
|
|
$academic = $row['Academic_Year'];
|
|
|
|
$c_id = $row['Course_ID'];
|
2021-12-05 00:59:43 +08:00
|
|
|
$counter += 1;
|
2021-10-18 23:03:36 +08:00
|
|
|
|
|
|
|
$resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
|
2020-09-26 20:08:39 +08:00
|
|
|
INNER JOIN users_table on users_table.User_ID=course_ta.TA
|
2021-10-18 23:03:36 +08:00
|
|
|
where course_ta.Course_ID=$c_id");
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
$ta = "";
|
|
|
|
while ($rowTA = mysqli_fetch_assoc($resultTA)) {
|
|
|
|
$ta = $ta . " - " . $rowTA['TA_NAME'];
|
|
|
|
}
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
echo "
|
2021-12-05 00:59:43 +08:00
|
|
|
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php' id='drop_menu_form_$counter'> <select name='ta' class=''>";
|
2020-09-26 20:08:39 +08:00
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
$resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
|
|
|
|
if (mysqli_num_rows($resultx) == 0) {
|
|
|
|
} else {
|
|
|
|
while ($row = mysqli_fetch_assoc($resultx)) {
|
|
|
|
$id = $row['User_ID'];
|
|
|
|
$name = $row['Full_Name'];
|
|
|
|
echo "<option value='$id'> $name </option>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-05 00:59:43 +08:00
|
|
|
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>
|
2020-09-26 20:08:39 +08:00
|
|
|
";
|
2021-10-18 23:03:36 +08:00
|
|
|
}
|
|
|
|
} ?>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
2020-09-26 20:08:39 +08:00
|
|
|
</div>
|
2021-10-18 23:03:36 +08:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2020-09-26 20:08:39 +08:00
|
|
|
</div>
|
2021-10-18 23:03:36 +08:00
|
|
|
|
2020-09-26 20:08:39 +08:00
|
|
|
<script>
|
2021-10-18 23:03:36 +08:00
|
|
|
function updatePass(id, pass) {
|
|
|
|
if (!confirm('Are you to Reset User Password')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
window.location.href = "\Script.php\?action=passchange&uid=" + id + "&pass=" + pass;
|
2020-09-26 20:08:39 +08:00
|
|
|
}
|
|
|
|
|
2021-10-18 23:03:36 +08:00
|
|
|
function blockUser(id, status) {
|
|
|
|
if (!confirm('Are you to change User Status')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status;
|
2020-09-26 20:08:39 +08:00
|
|
|
}
|
2021-10-18 23:03:36 +08:00
|
|
|
</script>
|