Compare commits
61 Commits
bug312-Gol
...
master
Author | SHA1 | Date |
---|---|---|
|
244af4c11b | |
|
0539b7053a | |
|
f4c373611b | |
|
d94421a160 | |
|
a02b3bec4b | |
|
3214b26d5d | |
|
f76cc2eb49 | |
|
f7f9558721 | |
|
1e8533090f | |
|
74a8a68ee9 | |
|
e9a7af1059 | |
|
6831fdcd0f | |
|
868f5854a2 | |
|
8a47d3733c | |
|
0065489fcb | |
|
3bff64f400 | |
|
423010d225 | |
|
4dc9efc7b9 | |
|
fa1932c95c | |
|
f004756f3d | |
|
69a2da76c7 | |
|
b0f1f313d6 | |
|
dd87db0c3c | |
|
f0109db692 | |
|
38d398a693 | |
|
1fc6061e19 | |
|
8ecab98e21 | |
|
4624186f50 | |
|
5c34bde3ca | |
|
a9d9f4a345 | |
|
1c479d525b | |
|
639695bfb9 | |
|
3f302822e2 | |
|
bd8062502b | |
|
ded10c1ff8 | |
|
eee1a5e8ad | |
|
035b92a053 | |
|
60471610a2 | |
|
ff1384f341 | |
|
a4dce34b92 | |
|
6860d7618f | |
|
c4f4dec22e | |
|
15a96c1b68 | |
|
eb532d10af | |
|
5fa0c1e040 | |
|
8b91a8ed7f | |
|
3f81266852 | |
|
dd75c24a30 | |
|
ef6e79f31c | |
|
f4ffcdd47b | |
|
cf11ed40ad | |
|
93a7661103 | |
|
6c6e60aac2 | |
|
a64a4e1053 | |
|
eea3e14c8f | |
|
54ac24b073 | |
|
5fcc897c55 | |
|
4b51cd7fdf | |
|
fae269d963 | |
|
efb2f68472 | |
|
8863de3714 |
180
Admin.php
180
Admin.php
|
@ -7,14 +7,15 @@ $page = "admin";
|
||||||
include 'Header.php';
|
include 'Header.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($_SESSION['user_type'] != "Lecturer") {
|
// Only Lecturer or Admin could access this page
|
||||||
$_SESSION["info_login"] = "You must log in first.";
|
if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
|
||||||
echo $_SESSION["info_login"];
|
die("Sorry. Nothing to see here.");
|
||||||
header("Location: index.php");
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.col-md-4 {
|
.col-md-4 {
|
||||||
border-right: 1px solid skyblue;
|
border-right: 1px solid skyblue;
|
||||||
|
@ -36,10 +37,21 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
<hr>
|
<hr>
|
||||||
-->
|
-->
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h4> User Account Management </h4>
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<b>Lecturer / TA Accounts </b><br>
|
<?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>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
|
@ -51,11 +63,11 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#menu2">Batch Create New Student Accounts</a>
|
<a class="nav-link" data-toggle="tab" href="#menu2" id="batch_tab">Batch Create New Student Accounts</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#menu1">Existing Accounts</a>
|
<a class="nav-link" data-toggle="tab" href="#menu1" id="existing_accounts_tab">Existing Accounts</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -65,20 +77,45 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
|
|
||||||
<div id="home" class="container tab-pane active"><br>
|
<div id="home" class="container tab-pane active"><br>
|
||||||
|
|
||||||
<b>Create Lecturer/TA Accounts </b>
|
<?php
|
||||||
<form method="post" action="Script.php">
|
if ($_SESSION['user_type'] == "Lecturer") {
|
||||||
|
|
||||||
|
echo "<b>Create TA Accounts </b>";
|
||||||
|
|
||||||
|
}
|
||||||
|
else if($_SESSION['user_type'] == "Admin"){
|
||||||
|
echo "<b>Create Lecturer Accounts </b>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<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="">
|
||||||
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="">
|
||||||
|
|
||||||
Passport_Number / ID (Used as Intial Password)
|
Passport Number / ID (Used as 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> User Type :
|
<br> User Type :
|
||||||
<input type="radio" name="type" value="Lecturer" required=""> Lecturer
|
|
||||||
<input type="radio" name="type" value="TA" required=""> T/A
|
<?php
|
||||||
<input type="submit" class="btn btn-primary" value="Create"><br>
|
|
||||||
|
if ($_SESSION['user_type'] == "Lecturer") {
|
||||||
|
|
||||||
|
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) ';
|
||||||
|
|
||||||
|
}
|
||||||
|
else if($_SESSION['user_type'] == "Admin"){
|
||||||
|
|
||||||
|
echo " <input type='radio' name = 'type' value = 'Lecturer' required = '' id='role_lecturer' > Lecturer ";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
@ -112,19 +149,30 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if ($_SESSION['user_type'] == "Lecturer") {
|
||||||
|
|
||||||
$result = mysqli_query(
|
$result = mysqli_query(
|
||||||
$con,
|
$con,
|
||||||
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer','TA')"
|
"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')"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
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')\" id=\"block_account_1\">Block</button>";
|
||||||
} else {
|
} else {
|
||||||
$newstatus = "Active";
|
$newstatus = "Active";
|
||||||
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Activate</button>";
|
$btnBlock = "<button class='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>";
|
||||||
|
@ -138,11 +186,11 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
|
|
||||||
<div id="menu2" class="container tab-pane fade" style="margin-top:10px">
|
<div id="menu2" class="container tab-pane fade" style="margin-top:10px">
|
||||||
<b>Separate two student numbers with a space.</b><br>
|
<b>Separate two student numbers with a space.</b><br>
|
||||||
<form action="batch_insert.php" method="post">
|
<form action="batch_insert.php" method="post" id="batch_form">
|
||||||
<p>
|
<p>
|
||||||
<textarea cols="80" rows="16" name="users" required=""></textarea>
|
<textarea cols="80" rows="16" name="users" required=""></textarea>
|
||||||
</p>
|
</p>
|
||||||
<input type="submit" class="btn btn-primary" value="Register Students"><br>
|
<input type="submit" class="btn btn-primary" value="Register Students" id="register_btn"><br>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -157,96 +205,16 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#menua"> Course Portal </a>
|
<a class="nav-link active" data-toggle="tab" href="#menub" id="existing_courses">Existing Courses</a>
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-toggle="tab" href="#menub">Existing Courses</a>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- Tab panes -->
|
<!-- Tab panes -->
|
||||||
<div class="tab-content">
|
|
||||||
<div id="menua" class="container tab-pane active"><br>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<b>Create new Portal </b>
|
|
||||||
|
|
||||||
<form method="post" action="Script.php">
|
|
||||||
<input type="hidden" name="frm_createCourse" value="true" required="" />
|
|
||||||
Course Name
|
|
||||||
<input type="text" name="name" placeholder="Course Name" class="form-control" required="">
|
|
||||||
|
|
||||||
Course Code
|
|
||||||
<input type="text" name="code" placeholder="Course Code" class="form-control" required="">
|
|
||||||
|
|
||||||
URL (Leave blank to use Course Name)
|
|
||||||
<input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required="">
|
|
||||||
|
|
||||||
Academic Year
|
|
||||||
<input type="text" name="academic" placeholder="Academic Year" class="form-control" required="">
|
|
||||||
|
|
||||||
Faculty <br>
|
|
||||||
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required="">
|
|
||||||
|
|
||||||
Assign Lecturer
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<select name="lecturer" class="form-control">
|
|
||||||
<?php
|
|
||||||
$result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='Lecturer'");
|
|
||||||
if (mysqli_num_rows($result) == 0) {
|
|
||||||
} else {
|
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
|
||||||
$id = $row['User_ID'];
|
|
||||||
$name = $row['Full_Name'];
|
|
||||||
echo "<option value='$id'> $name </option>";
|
|
||||||
}
|
|
||||||
} ?>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
Assigned T/A <br>
|
|
||||||
<select name="ta" class="form-control">
|
|
||||||
<?php
|
|
||||||
$result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
|
|
||||||
if (mysqli_num_rows($result) == 0) {
|
|
||||||
} else {
|
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
|
||||||
$id = $row['User_ID'];
|
|
||||||
$name = $row['Full_Name'];
|
|
||||||
echo "<option value='$id'> $name </option>";
|
|
||||||
}
|
|
||||||
} ?>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
Verify Joining Students
|
|
||||||
<input type="radio" name="verify" value="1"> Yes
|
|
||||||
<input type="radio" name="verify" value="0" checked=""> No
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<input type="submit" class="btn btn-primary" value="Create Portal"><br>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
if (isset($_SESSION['info_Admin_Courses'])) {
|
|
||||||
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>';
|
|
||||||
$_SESSION['info_Admin_Courses'] = null;
|
|
||||||
}
|
|
||||||
if (isset($_SESSION['info_Admin_Courses'])) {
|
|
||||||
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>';
|
|
||||||
$_SESSION['info_Admin_Courses'] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menub" class="container tab-pane fade"><br>
|
<div id="menub" class="container tab-pane active"><br>
|
||||||
|
|
||||||
<b> Existing Course Portals </b>
|
<b> Existing Course Portals </b>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -262,6 +230,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
$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 {
|
} else {
|
||||||
|
$counter = 0;
|
||||||
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'];
|
||||||
|
@ -269,6 +238,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
|
||||||
$lecturer = $row['Full_Name'];
|
$lecturer = $row['Full_Name'];
|
||||||
$academic = $row['Academic_Year'];
|
$academic = $row['Academic_Year'];
|
||||||
$c_id = $row['Course_ID'];
|
$c_id = $row['Course_ID'];
|
||||||
|
$counter += 1;
|
||||||
|
|
||||||
$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
|
||||||
|
@ -280,7 +250,7 @@ where course_ta.Course_ID=$c_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
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' id='drop_menu_form_$counter'> <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) {
|
||||||
|
@ -292,7 +262,7 @@ where course_ta.Course_ID=$c_id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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' id='assign_btn_$counter'></form> </td></tr>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
} ?>
|
} ?>
|
||||||
|
|
377
Course.php
377
Course.php
|
@ -2,6 +2,7 @@
|
||||||
include 'NoDirectPhpAcess.php';
|
include 'NoDirectPhpAcess.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$page='Courses+';
|
$page='Courses+';
|
||||||
include 'Header.php';
|
include 'Header.php';
|
||||||
|
@ -9,8 +10,10 @@ $student_id = $_SESSION["user_student_id"];
|
||||||
$group_id = $_SESSION["user_group_id"];
|
$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"])) {
|
|
||||||
$course_url = $_GET["url"];
|
if(!empty($_GET["url"]))
|
||||||
|
{
|
||||||
|
$course_url = mysqli_real_escape_string($con, $_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` "
|
||||||
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
|
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
|
||||||
|
@ -19,6 +22,7 @@ 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'];
|
||||||
|
@ -53,9 +57,9 @@ if (!empty($_GET["url"])) {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (isset($_SESSION['info_ReMarking'])) {
|
if (isset($_SESSION['info_general'])) {
|
||||||
echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_ReMarking'] . '</div>';
|
echo '<hr><div class="alert alert-info" role="alert" style="float:left;">' . $_SESSION['info_general'] . '</div>';
|
||||||
$_SESSION['info_ReMarking'] = null;
|
$_SESSION['info_general']=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_SESSION['info_courses'])) {
|
if (isset($_SESSION['info_courses'])) {
|
||||||
|
@ -66,9 +70,12 @@ if (!empty($_GET["url"])) {
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ($_SESSION['user_type'] == "Student") {
|
if( $_SESSION['user_type'] == "Student")
|
||||||
|
{
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -92,87 +99,6 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#menu4">Marked</a>
|
<a class="nav-link" data-toggle="tab" href="#menu4">Marked</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!----------Delete Course Button----------->
|
|
||||||
<li>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="modal fade" id="delcourse">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h2 class="modal-title">Please confirm!</h2>
|
|
||||||
<button type="button" class="close red" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>Are you sure about deleting this course? This action can not be reversed!</p>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<form method="POST" action="">
|
|
||||||
<button type="button" class="btn action-button blue" data-dismiss="modal">Cancel</button>
|
|
||||||
<input type="submit" name="submit" class="btn action-button red" value="Delete" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<button type="button" class="btn action-button red" data-toggle="modal" data-target="#delcourse">Delete Course</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Connect to MySQL database
|
|
||||||
$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr");
|
|
||||||
|
|
||||||
// Check connection
|
|
||||||
if (mysqli_connect_errno()) {
|
|
||||||
echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
|
||||||
}
|
|
||||||
if (isset($_POST['submit'])) {
|
|
||||||
header("Location: Courses.php");
|
|
||||||
$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" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" 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>
|
|
||||||
/*--------------------[ Delete Course Button ]*/
|
|
||||||
.action-button {
|
|
||||||
font-family: 'Pacifico', cursive;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #FFF;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.red {
|
|
||||||
background-color: #E74C3C;
|
|
||||||
border-bottom: 5px solid #BD3E31;
|
|
||||||
text-shadow: 0px -2px #BD3E31;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blue {
|
|
||||||
background-color: #4d4dff;
|
|
||||||
border-bottom: 5px solid #4d4dff;
|
|
||||||
text-shadow: 0px -2px #4d4dff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
@ -184,13 +110,15 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
$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.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,16 +127,17 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
// (3) none of the student's group members have already submitted
|
// (3) none of the student's group members have already submitted
|
||||||
// the assignment.
|
// the assignment.
|
||||||
|
|
||||||
$var = "SELECT Type, 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 Type, 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 Course_ID=$course_id".
|
" WHERE Course_ID=$course_id".
|
||||||
" AND (Deadline > '$c_date' OR Lab_Report_ID IN (SELECT `Lab_Report_ID` FROM `extended_deadlines_table` WHERE Student_ID=$student_id AND Extended_Deadline_Date > '$c_date' AND Lab_Report_ID IN (SELECT Lab_Report_ID FROM lab_reports_table WHERE Course_ID=$course_id)))".
|
" AND (Deadline > '$c_date' OR Lab_Report_ID IN (SELECT `Lab_Report_ID` FROM `extended_deadlines_table` WHERE Student_ID=$student_id AND Extended_Deadline_Date > '$c_date' AND Lab_Report_ID IN (SELECT Lab_Report_ID FROM lab_reports_table WHERE Course_ID=$course_id)))".
|
||||||
" AND Lab_Report_ID NOT IN (SELECT Lab_Report_ID FROM lab_report_submissions WHERE Course_Group_id IN (SELECT Course_Group_id FROM course_group_members_table WHERE Student_ID=$student_id))".
|
" AND Lab_Report_ID NOT IN (SELECT Lab_Report_ID FROM lab_report_submissions WHERE Course_Group_id IN (SELECT Course_Group_id FROM course_group_members_table WHERE Student_ID=$student_id))".
|
||||||
" ORDER BY Lab_Report_ID DESC";
|
" ORDER BY Lab_Report_ID DESC";
|
||||||
|
|
||||||
$result1 = mysqli_query($con, $var);
|
$result1 = mysqli_query($con, $sql_stmt);
|
||||||
|
|
||||||
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 {
|
||||||
|
|
||||||
|
@ -241,20 +170,21 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
$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 Deadline : $deadline ($Marks Marks) <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 Deadline : $deadline ($Marks Marks) <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 "";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="menu2" class="container tab-pane"><br>
|
<div id="menu2" class="container tab-pane"><br>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$group_id=$_SESSION['group_id'];
|
$group_id=$_SESSION['group_id'];
|
||||||
if ($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.
|
||||||
$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
|
||||||
|
@ -267,8 +197,12 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
|
||||||
. ""
|
. ""
|
||||||
. "ORDER by Lab_Report_ID DESC");
|
. "ORDER by Lab_Report_ID DESC");
|
||||||
|
|
||||||
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'];
|
||||||
|
@ -282,6 +216,9 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
|
||||||
$att4=$row['Attachment_link_4'];
|
$att4=$row['Attachment_link_4'];
|
||||||
$id=$row['Lab_Report_ID'];
|
$id=$row['Lab_Report_ID'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
||||||
|
|
||||||
if($att2!=""){
|
if($att2!=""){
|
||||||
|
@ -293,25 +230,28 @@ 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 <br> Attachments : $full_link </span>
|
<br> <span style='font-size:8pt'>Posted: $posted<br> Deadline: $deadline <br> Attachments : $full_link </span>
|
||||||
</div>";
|
</div>";
|
||||||
}
|
|
||||||
}
|
}}
|
||||||
echo "";
|
echo "";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="menu3" class="container tab-pane"><br>
|
<div id="menu3" class="container tab-pane"><br>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
$group_id = $_SESSION['group_id'];
|
$group_id = $_SESSION['group_id'];
|
||||||
if ($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
|
||||||
$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`
|
||||||
FROM `lab_reports_table`
|
FROM `lab_reports_table`
|
||||||
|
@ -320,8 +260,11 @@ 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'];
|
||||||
|
@ -335,7 +278,8 @@ 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>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,6 +301,7 @@ Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (St
|
||||||
<br> <span style='font-size:8pt'>Posted : $posted Deadline : $deadline ($marks Marks) $submittedx <span class='btn-sm btn-success' style='margin-left:50px;'><i class='fa fa-Edit-circle'></i> Submitted </span>
|
<br> <span style='font-size:8pt'>Posted : $posted Deadline : $deadline ($marks Marks) $submittedx <span class='btn-sm btn-success' style='margin-left:50px;'><i class='fa fa-Edit-circle'></i> Submitted </span>
|
||||||
<br> Submitted files: ";
|
<br> Submitted files: ";
|
||||||
|
|
||||||
|
|
||||||
$Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
|
$Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
|
||||||
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
|
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
|
||||||
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
|
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
|
||||||
|
@ -366,8 +311,10 @@ 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'];
|
||||||
|
@ -394,21 +341,32 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $full_link;
|
echo $full_link;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "</span></div></k>";
|
echo "</span></div></k>";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}}
|
||||||
echo "";
|
echo "";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?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'];
|
||||||
|
@ -416,6 +374,8 @@ 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="container 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`, "
|
||||||
|
@ -436,10 +396,14 @@ where Lab_Report_ID=$lab_repo_id and (lab_report_submissions.Student_id='$studen
|
||||||
. " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions"
|
. " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions"
|
||||||
. " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC");
|
. " where (Status='Marked' or Status='Remarking') and (Student_id=$student_id or Course_Group_id=$group_id) and Course_ID=$course_id) ORDER by Submission_ID DESC");
|
||||||
|
|
||||||
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 {
|
|
||||||
while ($row = mysqli_fetch_assoc($resultx)) {
|
} else { 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'];
|
||||||
|
@ -455,17 +419,23 @@ 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>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 <b> ($marks Marks out of $Originalmarks)</b><br><small> Lecturer Feedback : $notes </small> $remarking <br> Submission files :";
|
$title <b> ($marks Marks out of $Originalmarks)</b><br><small> Lecturer Feedback : $notes </small> $remarking <br> Submission files :";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
|
$Sub_result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
|
||||||
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
|
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
|
||||||
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
|
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
|
||||||
|
@ -475,10 +445,11 @@ 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 {
|
|
||||||
while ($row = mysqli_fetch_assoc($Sub_result)) {
|
} else { 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'];
|
||||||
|
@ -498,13 +469,21 @@ 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>";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -516,14 +495,15 @@ 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)) {
|
while($row = mysqli_fetch_assoc($resultx1)) {$count_groups=$row['Course_Group_id'];}
|
||||||
$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>";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@ -532,56 +512,96 @@ 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 {
|
} else { while($row = mysqli_fetch_assoc($result)) {
|
||||||
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'];
|
||||||
|
|
||||||
|
|
||||||
$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>";
|
|
||||||
|
# Add "delete group" button and allow only group creator to delete it
|
||||||
|
$extra4 = "<button onclick='delete_group($id)' class='btn btn-danger' style='height: 25px; width: 90px;
|
||||||
|
line-height: 10px; font-size: 10px'>DELETE GROUP</button>";
|
||||||
|
|
||||||
|
echo "<div class='btn-default'><small> $name ($status) $extra $extra2 $extra3" .
|
||||||
|
(($status == "Created")? "$extra4": "")
|
||||||
|
."</small></div>";
|
||||||
|
|
||||||
$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`
|
||||||
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
|
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
|
||||||
where course_group_members_table.Course_Group_id=$id");
|
where course_group_members_table.Course_Group_id=$id");
|
||||||
|
|
||||||
|
#Check whether the current user in session is the creator of the group
|
||||||
|
$rs3 = mysqli_query($con, "SELECT `Status` from course_group_members_table where Student_ID = $student_id");
|
||||||
|
$flag = mysqli_fetch_assoc($rs3)['Status'] == "Created";
|
||||||
|
|
||||||
while($row = mysqli_fetch_assoc($rs2)) {
|
while($row = mysqli_fetch_assoc($rs2)) {
|
||||||
$name=$row['Full_Name'];
|
$name=$row['Full_Name'];
|
||||||
$id=$row['Course_Group_id'];
|
$id=$row['Course_Group_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>";
|
#Show group members + remove button next to each member except the creator of the group
|
||||||
|
if($flag){
|
||||||
|
echo "<li><small> $name-$Student_ID ($status)</small>".(($status != "Created")?"<button onclick='remove_member($Student_ID, $id)'
|
||||||
|
class='btn btn-danger' style='height: 25px; width: 80px; line-height: 10px;'>remove</button>":"")."</li>";
|
||||||
|
}else{
|
||||||
|
echo "<li><small> $name-$Student_ID ($status)</small>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
include 'Footer.php';
|
include 'Footer.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<script src="./css/jquery-1.11.1.min.js"></script>
|
<script src="./css/jquery-1.11.1.min.js"></script>
|
||||||
<script src="./css/jquery-ui.min.js"></script>
|
<script src="./css/jquery-ui.min.js"></script>
|
||||||
<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\
|
||||||
<input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > Group Name <input type="text" name="name">\n\
|
<input type="hidden" name="student_id" value="<?php echo $student_id; ?>" > Group Name <input type="text" name="name">\n\
|
||||||
|
@ -602,14 +622,18 @@ include 'Footer.php';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch(e){ alert(e); }
|
||||||
alert(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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\
|
||||||
<input type="hidden" name="groupid" value="'+id+'" > Enter Student_ID to Invite <input type="text" name="student_id">\n\
|
<input type="hidden" name="groupid" value="'+id+'" > Enter Student_ID to Invite <input type="text" name="student_id">\n\
|
||||||
|
@ -630,14 +654,21 @@ include 'Footer.php';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch(e){ alert(e); }
|
||||||
alert(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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\
|
||||||
<input type="hidden" name="groupid" value="'+id+'" > \n\ <input type="hidden" name="action" value="'+val+'" > \n\
|
<input type="hidden" name="groupid" value="'+id+'" > \n\ <input type="hidden" name="action" value="'+val+'" > \n\
|
||||||
|
@ -660,15 +691,75 @@ include 'Footer.php';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch(e){ alert(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remove_member(student_id, group_id) {
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$('<form id="frm" method="get" action="Script.php"><input type="hidden" name="removemember" value="true">\n\
|
||||||
|
<input type="hidden" name="student_id" value="'+student_id+'" > \n\
|
||||||
|
<input type="hidden" name="group_id" value="'+group_id+'">\n\
|
||||||
|
<input type="hidden" name="url" value="<?php echo $url; ?>"></form>').dialog({
|
||||||
|
modal: true,
|
||||||
|
title:'Remove '+student_id+'?',
|
||||||
|
buttons: {
|
||||||
|
'Confirm': function () {
|
||||||
|
$('#frm').submit();
|
||||||
|
|
||||||
|
$(this).dialog('close');
|
||||||
|
},
|
||||||
|
'X': function () {
|
||||||
|
|
||||||
|
$(this).dialog('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch(e){ alert(e); }
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_group(id) {
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$('<form id="frm" method="get" action="Script.php"><input type="hidden" name="deletegroup" value="true">\n\
|
||||||
|
<input type="hidden" name="group_id" value="'+id+'" > \n\
|
||||||
|
<input type="hidden" name="url" value="<?php echo $url; ?>"></form>').dialog({
|
||||||
|
modal: true,
|
||||||
|
title:'Delete this group?',
|
||||||
|
buttons: {
|
||||||
|
'Confirm': function () {
|
||||||
|
$('#frm').submit();
|
||||||
|
|
||||||
|
$(this).dialog('close');
|
||||||
|
},
|
||||||
|
'X': function () {
|
||||||
|
|
||||||
|
$(this).dialog('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch(e){ alert(e); }
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
318
Courses.php
318
Courses.php
|
@ -2,30 +2,42 @@
|
||||||
include 'NoDirectPhpAcess.php';
|
include 'NoDirectPhpAcess.php';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
$page='Courses';
|
$page='Courses';
|
||||||
include 'Header.php';
|
include 'Header.php';
|
||||||
|
|
||||||
$user_d = $_SESSION['user_id'];
|
$user_d = $_SESSION['user_id'];
|
||||||
|
|
||||||
if ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
|
if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA")
|
||||||
|
{
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- FOR LECTURER-->
|
<!-- FOR LECTURER-->
|
||||||
|
|
||||||
|
|
||||||
<div class="row" style="width:80%;margin:auto; text-align:left;">
|
<div class="row" style="width:80%;margin:auto; text-align:left;">
|
||||||
|
|
||||||
|
|
||||||
<script src="./css/jquery-1.11.1.min.js"></script>
|
<script src="./css/jquery-1.11.1.min.js"></script>
|
||||||
<script src="./css/jquery-ui.min.js"></script>
|
<script src="./css/jquery-ui.min.js"></script>
|
||||||
<link rel="stylesheet" href="./css/jquery-ui.css" />
|
<link rel="stylesheet" href="./css/jquery-ui.css" />
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
function extend_deadline(id) {
|
function extend_deadline(id) {
|
||||||
|
|
||||||
var dropstudents=$("#dropstudents").html();
|
var dropstudents=$("#dropstudents").html();
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
$('<form id="frm" method="get" action="Script.php">\n\
|
$('<form id="frm" method="get" action="Script.php">\n\
|
||||||
<input type="hidden" name="extenddeadline" value="true" >\n\
|
<input type="hidden" name="extenddeadline" value="true" >\n\
|
||||||
|
@ -52,23 +64,23 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (e) {
|
}catch(e){ alert(e); }
|
||||||
alert(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (!empty($_GET["course"])) {
|
if(!empty($_GET["course"]))
|
||||||
$course_url = $_GET["course"];
|
{
|
||||||
|
$course_url = mysqli_real_escape_string($con, $_GET["course"]);
|
||||||
$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` "
|
||||||
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
|
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
|
||||||
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where URL='$course_url' ");
|
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where URL='$course_url' ");
|
||||||
|
|
||||||
if (mysqli_num_rows($result) == 0) {
|
if(mysqli_num_rows($result)==0)
|
||||||
} 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'];
|
||||||
|
@ -91,8 +103,9 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
|
|
||||||
// ------------------------------Editing Lab Assignment by Lecturer ------------------------------------
|
// ------------------------------Editing Lab Assignment by Lecturer ------------------------------------
|
||||||
|
|
||||||
|
|
||||||
if($_GET['act']=="edit"){
|
if($_GET['act']=="edit"){
|
||||||
$getid = $_GET["cid"];
|
$getid = mysqli_real_escape_string($con, $_GET["cid"]);
|
||||||
$result1 = mysqli_query($con, "SELECT * from lab_reports_table WHERE Lab_Report_ID = '$getid'");
|
$result1 = mysqli_query($con, "SELECT * from lab_reports_table WHERE Lab_Report_ID = '$getid'");
|
||||||
|
|
||||||
while($row1 = mysqli_fetch_assoc($result1)) {
|
while($row1 = mysqli_fetch_assoc($result1)) {
|
||||||
|
@ -106,18 +119,19 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['frm_uploadlab'])){
|
if(isset($_POST['frm_uploadlab'])){
|
||||||
$deadlinedate = trim($_POST["deadlinedate"]); // remove spaces
|
$deadlinedate = trim(mysqli_real_escape_string($con, $_POST["deadlinedate"])); // remove spaces
|
||||||
$deadlinetime = trim($_POST["deadlinetime"]); // remove spaces
|
$deadlinetime = trim(mysqli_real_escape_string($con, $_POST["deadlinetime"])); // remove spaces
|
||||||
$instructions = $_POST["instructions"];
|
$instructions = mysqli_real_escape_string($con, $_POST["instructions"]);
|
||||||
$title = $_POST["title"];
|
$title = mysqli_real_escape_string($con, $_POST["title"]);
|
||||||
$marks = $_POST["marks"];
|
$marks = mysqli_real_escape_string($con, $_POST["marks"]);
|
||||||
$type = $_POST["type"];
|
$type = mysqli_real_escape_string($con, $_POST["type"]);
|
||||||
$Deadline = $deadlinedate." ".$deadlinetime;
|
$Deadline = $deadlinedate." ".$deadlinetime;
|
||||||
$date = date("Y-m-d H:i");
|
$date = date("Y-m-d H:i");
|
||||||
|
|
||||||
$sql = "UPDATE `lab_reports_table` SET `Deadline` = ('" . $Deadline . "'), `Instructions` = ('" . $instructions . "'), `Title` = ('" . $title . "'), `Marks` = ('" . $marks . "'), `Type` = ('" . $type . "') WHERE `lab_reports_table`.`Lab_Report_ID` = '$getid'";
|
$sql = "UPDATE `lab_reports_table` SET `Deadline` = ('" . $Deadline . "'), `Instructions` = ('" . $instructions . "'), `Title` = ('" . $title . "'), `Marks` = ('" . $marks . "'), `Type` = ('" . $type . "') WHERE `lab_reports_table`.`Lab_Report_ID` = '$getid'";
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
$_SESSION["info_Updated"]="Assignment information updated successfully.";
|
$_SESSION["info_Updated"]="Assignment information updated successfully.";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// echo "Error: " . $sql . "<br>" . $con->error;
|
// echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
echo "Serious error happened whiling updating assignment information.";
|
echo "Serious error happened whiling updating assignment information.";
|
||||||
|
@ -139,14 +153,14 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
|
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
|
||||||
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
|
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
|
||||||
|
|
||||||
Dealine Date/Time
|
Deadline Date/Time
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Date : ""; ?>"> </div>
|
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Date : ""; ?>"> </div>
|
||||||
<div class='col-md-5'> <input type='text' id='time' class='form-control' name='deadlinetime' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Time : ""; ?>"> </div>
|
<div class='col-md-5'> <input type='text' id='time' class='form-control' name='deadlinetime' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Time : ""; ?>"> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Title
|
Title
|
||||||
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act'] == "edit" ? $Title : ""; ?>">
|
<input type='text' name='title' placeholder='Title' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Title : ""; ?>">
|
||||||
Instructions
|
Instructions
|
||||||
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' ><?php echo isset($_GET['act']) && $_GET['act']=='edit' ? $Instructions : ''; ?></textarea>
|
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' ><?php echo isset($_GET['act']) && $_GET['act']=='edit' ? $Instructions : ''; ?></textarea>
|
||||||
Marks
|
Marks
|
||||||
|
@ -160,6 +174,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
Attachment 3
|
Attachment 3
|
||||||
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
|
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
|
||||||
|
|
||||||
|
|
||||||
Attachment 4
|
Attachment 4
|
||||||
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
|
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
|
||||||
<br>
|
<br>
|
||||||
|
@ -172,12 +187,12 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<input type='submit' class='btn btn-primary' value='Post Lab Assignment'><br>
|
<input type='submit' class='btn btn-primary' value='Post Lab Assignment'><br>
|
||||||
</form><br><br><br><br>
|
</form><br><br><br><br>
|
||||||
<?php
|
<?php
|
||||||
}
|
}}else{
|
||||||
} else {
|
|
||||||
|
|
||||||
// ------------------------------Posting New Lab Assignment------------------------------------
|
// ------------------------------Posting New Lab Assignment------------------------------------
|
||||||
|
|
||||||
|
@ -198,14 +213,14 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
|
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
|
||||||
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
|
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
|
||||||
|
|
||||||
Dealine Date/Time
|
Deadline Date/Time
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value=""> </div>
|
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value=""> </div>
|
||||||
<div class='col-md-5'> <input type='time' class='form-control' name='deadlinetime' value=""> </div>
|
<div class='col-md-5'> <input type='time' class='form-control' name='deadlinetime' value=""> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Title
|
Title
|
||||||
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="">
|
<input type='text' name='title' placeholder='Title' class='form-control' required='' value="">
|
||||||
Instructions
|
Instructions
|
||||||
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value=""></textarea>
|
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value=""></textarea>
|
||||||
Marks
|
Marks
|
||||||
|
@ -219,6 +234,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
Attachment 3
|
Attachment 3
|
||||||
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
|
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
|
||||||
|
|
||||||
|
|
||||||
Attachment 4
|
Attachment 4
|
||||||
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
|
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
|
||||||
<br>
|
<br>
|
||||||
|
@ -231,6 +247,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
|
@ -250,16 +267,22 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
$_SESSION['info_courses']=null;
|
$_SESSION['info_courses']=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$result = mysqli_query($con," SELECT `Lab_Report_ID`,Type,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, "
|
$result = mysqli_query($con," SELECT `Lab_Report_ID`,Type,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, "
|
||||||
. "`Attachment_link_4` FROM `lab_reports_table` WHERE Course_ID=$id ORDER by Lab_Report_ID DESC");
|
. "`Attachment_link_4` FROM `lab_reports_table` WHERE Course_ID=$id ORDER by Lab_Report_ID DESC");
|
||||||
|
|
||||||
if ($_SESSION['user_type'] == "TA") {
|
|
||||||
|
if( $_SESSION['user_type']=="TA")
|
||||||
|
{
|
||||||
echo "<b style='color:gray'>*Only Lecturer can post a new lab report assignment</b><br>";
|
echo "<b style='color:gray'>*Only Lecturer can post a new lab report assignment</b><br>";
|
||||||
}
|
}
|
||||||
if (mysqli_num_rows($result) == 0) {
|
if(mysqli_num_rows($result)==0)
|
||||||
|
{
|
||||||
echo "No assignments posted so far.";
|
echo "No assignments posted so far.";
|
||||||
} else {
|
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
} else { while($row = mysqli_fetch_assoc($result)) {
|
||||||
$marks=$row['Marks'];
|
$marks=$row['Marks'];
|
||||||
$title=$row['Title'];
|
$title=$row['Title'];
|
||||||
$ins=$row['Instructions'];
|
$ins=$row['Instructions'];
|
||||||
|
@ -285,19 +308,15 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
$full_link= $full_link." |   <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
|
$full_link= $full_link." |   <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$resultx1 = mysqli_query($con,"Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
|
$resultx1 = mysqli_query($con,"Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
|
||||||
while ($row = mysqli_fetch_assoc($resultx1)) {
|
while($row = mysqli_fetch_assoc($resultx1)) {$count_subs=$row['cnt'];}
|
||||||
$count_subs = $row['cnt'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$resultx2 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Marks is not null");
|
$resultx2 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Marks is not null");
|
||||||
if (mysqli_num_rows($resultx2) == 0) {
|
if(mysqli_num_rows($resultx2)==0){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}}
|
||||||
$count_marked = 0;
|
|
||||||
} else {
|
|
||||||
while ($row = mysqli_fetch_assoc($resultx2)) {
|
|
||||||
$count_marked = $row['cnt'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$header="Courses > ".$name."($code) > Assignments > ".$title;
|
$header="Courses > ".$name."($code) > Assignments > ".$title;
|
||||||
|
|
||||||
|
@ -310,17 +329,25 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
|
||||||
. "<span class='btn-default'> $count_subs Submissions ( $count_marked Marked ) <a href='Courses.php?course=".$url."&act=edit&cid=".$id."'>Edit</a> | <a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a> | <a href='#' onclick='extend_deadline($id)'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>"
|
. "<span class='btn-default'> $count_subs Submissions ( $count_marked Marked ) <a href='Courses.php?course=".$url."&act=edit&cid=".$id."'>Edit</a> | <a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a> | <a href='#' onclick='extend_deadline($id)'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>"
|
||||||
. " </div>
|
. " </div>
|
||||||
";
|
";
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}}
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$resultx1 = mysqli_query($con,"SELECT course_students_table.Student_ID,users_table.Full_Name FROM
|
$resultx1 = mysqli_query($con,"SELECT course_students_table.Student_ID,users_table.Full_Name FROM
|
||||||
`course_students_table`
|
`course_students_table`
|
||||||
INNER JOIN users_table on users_table.Student_ID=course_students_table.Student_ID
|
INNER JOIN users_table on users_table.Student_ID=course_students_table.Student_ID
|
||||||
WHERE Course_ID=$course_id");
|
WHERE Course_ID=$course_id");
|
||||||
|
|
||||||
|
|
||||||
echo "<span id='dropstudents' style='display:none;'> <select name='stdid'>";
|
echo "<span id='dropstudents' style='display:none;'> <select name='stdid'>";
|
||||||
while ($row = mysqli_fetch_assoc($resultx1)) {
|
while($row = mysqli_fetch_assoc($resultx1))
|
||||||
|
{
|
||||||
$stdid=$row['Student_ID'];
|
$stdid=$row['Student_ID'];
|
||||||
$stdname=$row['Full_Name'];
|
$stdname=$row['Full_Name'];
|
||||||
|
|
||||||
|
@ -330,11 +357,17 @@ WHERE Course_ID=$course_id");
|
||||||
. "<input type='hidden' name='url' value='$course_url'>"
|
. "<input type='hidden' name='url' value='$course_url'>"
|
||||||
. " </span>";
|
. " </span>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -346,20 +379,23 @@ WHERE Course_ID=$course_id");
|
||||||
</a></div>
|
</a></div>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
|
||||||
$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` , users_table.Full_Name FROM `courses_table` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID where courses_table.Lecturer_User_ID=$user_d");
|
. "`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 where courses_table.Lecturer_User_ID=$user_d");
|
||||||
|
|
||||||
if ($_SESSION['user_type'] == "TA") {
|
if($_SESSION['user_type']=="TA")
|
||||||
|
{
|
||||||
$result = mysqli_query($con,"SELECT course_ta.Course_ID, `Course_Name`,
|
$result = mysqli_query($con,"SELECT course_ta.Course_ID, `Course_Name`,
|
||||||
`Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
|
`Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
|
||||||
INNER JOIN
|
INNER JOIN
|
||||||
course_ta ON course_ta.Course_ID=courses_table.Course_ID where course_ta.TA=$user_d");
|
course_ta ON course_ta.Course_ID=courses_table.Course_ID where course_ta.TA=$user_d");
|
||||||
|
|
||||||
}
|
}
|
||||||
// $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) {
|
|
||||||
} else {
|
if(mysqli_num_rows($result)==0)
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
{} else { while($row = mysqli_fetch_assoc($result)) {
|
||||||
$id=$row['Course_ID'];
|
$id=$row['Course_ID'];
|
||||||
$name=$row['Course_Name'];
|
$name=$row['Course_Name'];
|
||||||
$code=$row['Course_Code'];
|
$code=$row['Course_Code'];
|
||||||
|
@ -377,6 +413,8 @@ where course_ta.Course_ID=$id");
|
||||||
$ta=$ta." - ".$rowTA['TA_NAME'];
|
$ta=$ta." - ".$rowTA['TA_NAME'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo"
|
echo"
|
||||||
|
|
||||||
<a href='~\..\Courses.php?course=$url'> <div class='btn btn-default'>
|
<a href='~\..\Courses.php?course=$url'> <div class='btn btn-default'>
|
||||||
|
@ -384,13 +422,15 @@ where course_ta.Course_ID=$id");
|
||||||
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer TA:$ta </span>
|
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer TA:$ta </span>
|
||||||
</div></a>
|
</div></a>
|
||||||
";
|
";
|
||||||
}
|
|
||||||
} ?>
|
}}?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<br>
|
<br>
|
||||||
<b> Course Joining Requests </b>
|
<b> Course Joining Requests </b>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$lecturer_id= $_SESSION['user_id'];
|
$lecturer_id= $_SESSION['user_id'];
|
||||||
$result = mysqli_query($con,"SELECT course_students_table.ID,users_table.Full_Name, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
|
$result = mysqli_query($con,"SELECT course_students_table.ID,users_table.Full_Name, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
|
||||||
|
@ -398,11 +438,11 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tab
|
||||||
INNER JOIN users_table on users_table.Student_ID=course_students_table.Student_ID
|
INNER JOIN users_table on users_table.Student_ID=course_students_table.Student_ID
|
||||||
WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'");
|
WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'");
|
||||||
|
|
||||||
if (mysqli_num_rows($result) == 0) {
|
if(mysqli_num_rows($result)==0)
|
||||||
|
{
|
||||||
|
|
||||||
echo "<br> <i class='fa fa-info-circle'></i> No Course joining request so far for all your courses <hr>";
|
echo "<br> <i class='fa fa-info-circle'></i> No Course joining request so far for all your courses <hr>";
|
||||||
} else {
|
} else { while($row = mysqli_fetch_assoc($result)) {
|
||||||
while ($row = mysqli_fetch_assoc($result)) {
|
|
||||||
$id=$row['ID'];
|
$id=$row['ID'];
|
||||||
|
|
||||||
$name=$row['Course_Name'];
|
$name=$row['Course_Name'];
|
||||||
|
@ -415,12 +455,21 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
|
||||||
$std_name is Requesting to join <br> [($code) - $name ] <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 ] <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>
|
||||||
<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>
|
<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>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($_SESSION['user_type'] == "TA") {
|
if( $_SESSION['user_type']=="TA")
|
||||||
|
{
|
||||||
echo "<center>Only Lecturers can Post new Lab report Assignments</center>";
|
echo "<center>Only Lecturers can Post new Lab report Assignments</center>";
|
||||||
}
|
}
|
||||||
if( $_SESSION['user_type']=="Lecturer"){ ?>
|
if( $_SESSION['user_type']=="Lecturer"){ ?>
|
||||||
|
@ -445,8 +494,10 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
|
||||||
Faculty <br>
|
Faculty <br>
|
||||||
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required="">
|
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required="">
|
||||||
|
|
||||||
|
|
||||||
<input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>">
|
<input type="hidden" name="lecturer" value="<?php echo $_SESSION['user_id']; ?>">
|
||||||
|
|
||||||
|
|
||||||
Verify Joining Students
|
Verify Joining Students
|
||||||
<input type="radio" name="verify" value="1"> Yes
|
<input type="radio" name="verify" value="1"> Yes
|
||||||
<input type="radio" name="verify" value="0" checked=""> No
|
<input type="radio" name="verify" value="0" checked=""> No
|
||||||
|
@ -460,12 +511,16 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- END LECTURER -->
|
<!-- END LECTURER -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_SESSION['user_type'] == "Student") {
|
|
||||||
|
|
||||||
|
if( $_SESSION['user_type']=="Student")
|
||||||
|
{
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!--STUDENT CODE-->
|
<!--STUDENT CODE-->
|
||||||
|
@ -485,32 +540,51 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
<div class="col-md-6"></div>
|
<div class="col-md-6"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row" style="width:80%;margin:auto; text-align:left;">
|
<div class="row" style="width:80%;margin:auto; text-align:left;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
$student_id= $_SESSION['user_student_id'];
|
$student_id= $_SESSION['user_student_id'];
|
||||||
if (!empty($_GET["search"]) || !empty($_GET["faculty"])) {
|
// current academic year - i.e 2021 - 2022 , so we will show in search result:
|
||||||
$search = trim($_GET["search"]);
|
// course containing either 2021 or 2022 as academic year.
|
||||||
$faculty = $_GET["faculty"];
|
$oldest_academic_year = date('Y') - 1;
|
||||||
|
if(!empty($_GET["search"]) || !empty($_GET["faculty"]))
|
||||||
|
{
|
||||||
|
$search = trim(mysqli_real_escape_string($con, $_GET["search"]));
|
||||||
|
$search = strtoupper($_GET['search']);
|
||||||
|
$faculty = mysqli_real_escape_string($con, $_GET["faculty"]);
|
||||||
|
|
||||||
if ($faculty == "") {
|
// the user has not entered something under "Find course by Code"
|
||||||
|
if($faculty=="")
|
||||||
|
{
|
||||||
echo "<h4> Search Results for Course Code $search</h4><hr>";
|
echo "<h4> Search Results for Course Code $search</h4><hr>";
|
||||||
$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` "
|
||||||
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
|
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
|
||||||
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id)");
|
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
|
||||||
} else {
|
}
|
||||||
|
// the user has entered something under "Find course by Code"
|
||||||
|
else
|
||||||
|
{
|
||||||
echo "<h3> Find Courses under faculty $faculty</h3>";
|
echo "<h3> Find Courses under faculty $faculty</h3>";
|
||||||
$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`
|
||||||
, users_table.Full_Name FROM `courses_table` INNER JOIN users_table
|
, users_table.Full_Name FROM `courses_table` INNER JOIN users_table
|
||||||
ON users_table.User_ID=courses_table.Lecturer_User_ID where Faculty='$faculty' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id)");
|
ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Faculty='$faculty' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysqli_num_rows($result) == 0) {
|
|
||||||
|
if(mysqli_num_rows($result)==0)
|
||||||
|
{
|
||||||
echo "No results found for your Search <hr>";
|
echo "No results found for your Search <hr>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
while($row = mysqli_fetch_assoc($result)) {
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
|
@ -523,7 +597,8 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
$id=$row['Course_ID'];
|
$id=$row['Course_ID'];
|
||||||
$v=$row['Verify_New_Members'];
|
$v=$row['Verify_New_Members'];
|
||||||
$msg2="Join Course";
|
$msg2="Join Course";
|
||||||
if ($v > 0) {
|
if($v>0)
|
||||||
|
{
|
||||||
$msg="<i class='fa fa-exclamation-circle'></i> Lecturer verification required";
|
$msg="<i class='fa fa-exclamation-circle'></i> Lecturer verification required";
|
||||||
$msg2="Send Joining Request";
|
$msg2="Send Joining Request";
|
||||||
}
|
}
|
||||||
|
@ -535,7 +610,7 @@ if ($_SESSION['user_type'] == "Student") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Otherwise, list the student's joined courses (already done), in reverse chronological order
|
||||||
echo "<h4> My Courses </h4>";
|
echo "<h4> My Courses </h4>";
|
||||||
$result = mysqli_query($con,"SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
|
$result = mysqli_query($con,"SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
|
||||||
INNER JOIN users_table
|
INNER JOIN users_table
|
||||||
|
@ -543,9 +618,10 @@ INNER JOIN users_table
|
||||||
|
|
||||||
INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID
|
INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID
|
||||||
|
|
||||||
where course_students_table.Student_ID=$student_id");
|
where course_students_table.Student_ID=$student_id order by Academic_Year desc");
|
||||||
|
|
||||||
if (mysqli_num_rows($result) == 0) {
|
if(mysqli_num_rows($result)==0)
|
||||||
|
{
|
||||||
echo "<i class='fa fa-exclamation-circle'></i> You are not Enrolled in any Course";
|
echo "<i class='fa fa-exclamation-circle'></i> You are not Enrolled in any Course";
|
||||||
} else {
|
} else {
|
||||||
while($row = mysqli_fetch_assoc($result)) {
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
|
@ -558,12 +634,15 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
|
||||||
$id=$row['Course_ID'];
|
$id=$row['Course_ID'];
|
||||||
$Status=$row['Status'];
|
$Status=$row['Status'];
|
||||||
|
|
||||||
if ($Status == "Joined") {
|
if($Status=="Joined")
|
||||||
|
{
|
||||||
echo "<a href='~\..\Course.php?url=$url'> <div class='btn btn-default' style='word-wrap:break-word'>
|
echo "<a href='~\..\Course.php?url=$url'> <div class='btn btn-default' style='word-wrap:break-word'>
|
||||||
($code) - $name <br>($url) <i class='fa fa-check-circle'></i> $Status <a href='~\..\Course.php?url=$url' class='btn-sm btn-primary'> Open</a>
|
($code) - $name <br>($url) <i class='fa fa-check-circle'></i> $Status <a href='~\..\Course.php?url=$url' class='btn-sm btn-primary'> Open</a>
|
||||||
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div></a>
|
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div></a>
|
||||||
";
|
";
|
||||||
} 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-sm btn-danger'> $Status</i>
|
||||||
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div>
|
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div>
|
||||||
|
@ -572,26 +651,52 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "</div><div class='col-md-6'>
|
echo "</div><div class='col-md-6'>
|
||||||
|
|
||||||
<form method='get' action='Courses.php'>
|
<form method='get' action='Courses.php'>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-10'>
|
<div class='col-md-10'>
|
||||||
<div class='row'><div class='col-md-6'> Find course by Code
|
<div class='row'><div class='col-md-6'> Find course by Code
|
||||||
<input type='text' class='form-control' name='search' placeholder='Enter Course Code'>
|
<input type='text' class='form-control' name='search' maxlength='11' placeholder='Enter Course Code'>
|
||||||
</div><div class='col-md-6'>
|
</div><div class='col-md-6'>
|
||||||
List courses by faculty
|
List courses by faculty
|
||||||
|
|
||||||
<select name='faculty' class='form-control'>";
|
<select name='faculty' class='form-control'>";
|
||||||
$result = mysqli_query($con,"SELECT DISTINCT(Faculty) as Faculty FROM `courses_table`");
|
$result = mysqli_query($con,"SELECT DISTINCT(Faculty) as Faculty FROM `courses_table`");
|
||||||
if(mysqli_num_rows($result)==0){
|
if(mysqli_num_rows($result)==0){
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
echo"<option value=''> Search by faculty </option>";
|
||||||
while($row = mysqli_fetch_assoc($result)) {
|
while($row = mysqli_fetch_assoc($result)) {
|
||||||
$fname=$row['Faculty'];
|
$fname=$row['Faculty'];
|
||||||
|
echo " <option value='$fname'> $fname </option>";
|
||||||
echo "<option value=''> Search by faculty </option> <option value='$fname'> $fname </option>";
|
}}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</select></div></div>
|
echo "</select></div></div>
|
||||||
|
|
||||||
|
@ -603,14 +708,87 @@ List courses by faculty
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div></div>";
|
</div></div>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.form-control{
|
.form-control{
|
||||||
padding-top: 1px;
|
padding-top: 1px;
|
||||||
padding-bottom:1px;
|
padding-bottom:1px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,11 @@ session_start();
|
||||||
|
|
||||||
|
|
||||||
// 修改这一行设置你的文件下载目录
|
// 修改这一行设置你的文件下载目录
|
||||||
|
// IMPORTANT: Do not delete the following conditional test
|
||||||
|
if (strpos($_GET['file'], "../") !== false) { // 检查是否有 ../,防止用户构造路径,访问某个他不应该访问的目录
|
||||||
|
die("Sorry. Nothing to download.");
|
||||||
|
}
|
||||||
|
|
||||||
$file = "./../../lrr_submission".$_GET['file'];
|
$file = "./../../lrr_submission".$_GET['file'];
|
||||||
$filename = basename($file);
|
$filename = basename($file);
|
||||||
|
|
||||||
|
@ -20,7 +25,7 @@ $type = filetype($file);
|
||||||
$today = date("F j, Y, g:i a");
|
$today = date("F j, Y, g:i a");
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
if ( (isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"])) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
|
if ((isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"]) > 0) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA" ) {
|
||||||
// 发送文件头部
|
// 发送文件头部
|
||||||
header("Content-type: $type");
|
header("Content-type: $type");
|
||||||
header('Content-Disposition: attachment;filename="'.urldecode($filename).'"');
|
header('Content-Disposition: attachment;filename="'.urldecode($filename).'"');
|
||||||
|
|
|
@ -22,6 +22,12 @@ if (mysqli_connect_errno()) {
|
||||||
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||||
<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" />
|
||||||
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
||||||
|
<!-- *this css file can be used across all the websites
|
||||||
|
and any new css class can be added there.
|
||||||
|
* The reason is to make the css code reusable.
|
||||||
|
* the css file is used by submissions.php
|
||||||
|
-->
|
||||||
|
<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="./css/bootsrap.min.js" type="text/javascript"></script>
|
<script src="./css/bootsrap.min.js" type="text/javascript"></script>
|
||||||
|
@ -64,7 +70,7 @@ if (mysqli_connect_errno()) {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($_SESSION['user_type'] == "Lecturer") {
|
if ($_SESSION['user_type'] == "Lecturer") {
|
||||||
echo " <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> <a style='color:#fff !important' href=\"~\..\Admin.php\">Admin </a>";
|
echo " <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> <a style='color:#fff !important' href=\"~\..\Admin.php\" id=\"admin_tab\">Admin </a>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
// https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file
|
// https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file
|
||||||
if (!isset($_SERVER['HTTP_REFERER']) ) {
|
if (!isset($_SERVER['HTTP_REFERER']) ) {
|
||||||
/* choose the appropriate page to redirect users */
|
/* choose the appropriate page to redirect users */
|
||||||
die( header( 'location: index.php' ) );
|
die( header( 'location: logout.php' ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
56
README.md
56
README.md
|
@ -18,15 +18,17 @@ Our mission is to make the experience of submitting assignments great for tens o
|
||||||
# Installation Instructions
|
# Installation Instructions
|
||||||
|
|
||||||
|
|
||||||
## Hui's steps
|
## Hui steps
|
||||||
|
|
||||||
I spent about two hours installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS).
|
I spent about two hours installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS).
|
||||||
|
|
||||||
LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications.
|
LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications. [How to install and configure PHP](https://ubuntu.com/server/docs/programming-php) is also a good guide.
|
||||||
|
|
||||||
LRR uses a database called `lrr`. I need to export the existing `lrr` to a plain text file (including many sql commands) and import that text file to the newly created `lrr` database on the new server.
|
LRR uses a database called `lrr`. So create this database using MySQL root account. Open MySQL's prompt using `sudo mysql`. Create the database using command `CREATE DATABASE lrr;`, and grant all privileges to MySQL user `lrr` using command `GRANT ALL PRIVILEGES ON lrr.* TO 'mnc'@'localhost' WITH GRANT OPTION;`. If MySQL user mnc does not exist, create it using command `CREATE USER 'mnc'@'localhost' IDENTIFIED BY 'password'`.
|
||||||
The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.txt`.
|
|
||||||
The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail.
|
To facilitate data migration, I need to export the existing `lrr` to a plain text file (including many sql commands) and import that text file to the newly created `lrr` database on the new server.
|
||||||
|
The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.txt`, where mnc after -u is MySQL's username, and lrr after -p is the database name.
|
||||||
|
The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail. Do not have lrr_database_dump.txt? You can use lrr_database.sql in this repo instead.
|
||||||
|
|
||||||
LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files reside). I copied this folder from the existing one. I think it is also OK if you create an empty folder.
|
LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files reside). I copied this folder from the existing one. I think it is also OK if you create an empty folder.
|
||||||
We need to set a proper owner and accessibility for `lrr_submission` using the following two commands:
|
We need to set a proper owner and accessibility for `lrr_submission` using the following two commands:
|
||||||
|
@ -49,7 +51,7 @@ Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo syst
|
||||||
Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/.
|
Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/.
|
||||||
|
|
||||||
|
|
||||||
## Enock's steps
|
## Enock steps
|
||||||
|
|
||||||
Enock, a graduate student here, has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt).
|
Enock, a graduate student here, has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt).
|
||||||
|
|
||||||
|
@ -171,49 +173,49 @@ We can also communicate through pull requests. You make a pull request, I revie
|
||||||
|
|
||||||
GitHub Account - Full Name - Student number
|
GitHub Account - Full Name - Student number
|
||||||
|
|
||||||
CODEwithZAKI - Omar Mohamud Mohamed - 202025800041
|
CODEwithZAKI - Omar Mohamud Mohamed - 2020041
|
||||||
|
|
||||||
BloudYoussef - Khayat Youssef - 202025800042
|
BloudYoussef - Khayat Youssef - 2020042
|
||||||
|
|
||||||
TanakaMichelle - Tanaka Michelle Sandati - 201732120134
|
TanakaMichelle - Tanaka Michelle Sandati - 2017134
|
||||||
|
|
||||||
WhyteAsamoah - Yeboah Martha Asamoah - 201732120135
|
WhyteAsamoah - Yeboah Martha Asamoah - 2017135
|
||||||
|
|
||||||
xiaoyusoil - ZhengXiaoyu - 201732120110
|
xiaoyusoil - ZhengXiaoyu - 2017110
|
||||||
|
|
||||||
Benny123-cell - ZhangBin - 201732120127
|
Benny123-cell - ZhangBin - 2017127
|
||||||
|
|
||||||
421281726 - LiJiaxing - 201732120118
|
421281726 - LiJiaxing - 2017118
|
||||||
|
|
||||||
zhenghongyu-david - ZhengHongyu - 201732120128
|
zhenghongyu-david - ZhengHongyu - 2017128
|
||||||
|
|
||||||
wkytz - YeHantao - 201732120125
|
wkytz - YeHantao - 2017125
|
||||||
|
|
||||||
zego000 - GaoZeng - 201732120117
|
zego000 - GaoZeng - 2017117
|
||||||
|
|
||||||
Richard1427 - XieJiacong - 201732120123
|
Richard1427 - XieJiacong - 2017123
|
||||||
|
|
||||||
yutengYing - YingYuteng - 201732120126
|
yutengYing - YingYuteng - 2017126
|
||||||
|
|
||||||
Samrusike - Samantha Rusike - 201632120140
|
Samrusike - Samantha Rusike - 2016140
|
||||||
|
|
||||||
*enockkays* <enockkhondowe94@yahoo.com>
|
*enockkays* <enockkhondowe94@yahoo.com>
|
||||||
|
|
||||||
*Teecloudy* - Ashly Tafadzwa Dhani - 201632120150
|
*Teecloudy* - Ashly Tafadzwa Dhani - 201150
|
||||||
|
|
||||||
GuedaliaBonheurSPM - Guedalia Youma - 201925800221
|
GuedaliaBonheurSPM - Guedalia Youma - 2019221
|
||||||
|
|
||||||
ACorneille - Alimasi Corneille - 201925800168
|
ACorneille - Alimasi Corneille - 2019168
|
||||||
|
|
||||||
Tabithakipanga - Kipanga Dorcas - 201925800170
|
Tabithakipanga - Kipanga Dorcas - 2019170
|
||||||
|
|
||||||
Mary-AK - Mary Akussah Doe - 201925800173
|
Mary-AK - Mary Akussah Doe - 2019173
|
||||||
|
|
||||||
pkkumson - Kumson Princewill Kum - 201925800166
|
pkkumson - Kumson Princewill Kum - 2019166
|
||||||
|
|
||||||
Twizere - Twizere Pacifique - 201925800174
|
Twizere - Twizere Pacifique - 2019174
|
||||||
|
|
||||||
Nicole-Rutagengwa - Nicole Rutagengwa - 201925800169
|
Nicole-Rutagengwa - Nicole Rutagengwa - 2019169
|
||||||
|
|
||||||
*hema-001* - Ibrahim Mohamed Ibrahim Ismail - omitted
|
*hema-001* - Ibrahim Mohamed Ibrahim Ismail - omitted
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
|
|
||||||
include 'Header.php';
|
include 'Header.php';
|
||||||
$token=$_GET['token'];
|
$token = htmlspecialchars($_GET['token']);
|
||||||
$email=$_GET['email'];
|
$email = htmlspecialchars($_GET['email']);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
271
Script.php
271
Script.php
|
@ -34,39 +34,37 @@ function is_valid_student_number($student_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ############################### SIGN UP ##################################
|
// ############################### SIGN UP ##################################
|
||||||
if (!empty($_POST["frm_signup_1"])) {
|
if (!empty($_POST["form_signup"])) {
|
||||||
|
$student_id = trim(mysqli_real_escape_string($con, $_POST["user_student_id"]));
|
||||||
$student_id = trim(mysqli_real_escape_string($con, $_POST["student_id"]));
|
|
||||||
|
|
||||||
// validate student number
|
// validate student number
|
||||||
if (!is_valid_student_number($student_id)) {
|
if (!is_valid_student_number($student_id)) {
|
||||||
$_SESSION["info_signup1"] = "Invalid student number.";
|
$_SESSION["info_signup"] = "Invalid student number.";
|
||||||
header("Location: index.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this student number is a legal one
|
// Check if this student number is a legal one
|
||||||
$result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'");
|
$result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'");
|
||||||
if (mysqli_num_rows($result) == 0) {
|
if (mysqli_num_rows($result) == 0) {
|
||||||
$_SESSION["info_signup1"] = "Your entered student number could not be verified. Please contact Student Management Office <lanhui at zjnu.edu.cn>. Thanks.";
|
$_SESSION["info_signup"] = "Your entered student number could not be verified. Please contact Student Management Office <lanhui at zjnu.edu.cn>. Thanks.";
|
||||||
header("Location: index.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result98 = mysqli_query($con, "SELECT * FROM `users_table` WHERE Student_ID='$student_id'");
|
|
||||||
if (mysqli_num_rows($result98) == 0) {
|
// Check if the student number isn't already registered
|
||||||
$_SESSION['user_student_id'] = $student_id;
|
|
||||||
|
$student_result = mysqli_query($con, "SELECT * FROM `users_table` WHERE Student_ID='$student_id'");
|
||||||
|
if (mysqli_num_rows($student_result) > 0) {
|
||||||
|
$_SESSION["info_signup"] = "This Student ID is already in use! Please contact Student Management Office <lanhui at zjnu.edu.cn> for help.";
|
||||||
header("Location: signup.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
$_SESSION["info_signup1"] = "This Student ID is already in use! Please contact Student Management Office <lanhui at zjnu.edu.cn> for help.";
|
|
||||||
header("Location: index.php");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ############################### CREATE STUDENT USER ##################################
|
// ############################### CREATE STUDENT USER ##################################
|
||||||
if (!empty($_POST["frm_signup_2"])) {
|
if (!empty($_POST["form_signup"])) {
|
||||||
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
|
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
|
||||||
$student_id = mysqli_real_escape_string($con, $_POST["user_student_id"]);
|
$student_id = mysqli_real_escape_string($con, $_POST["user_student_id"]);
|
||||||
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
||||||
|
@ -79,7 +77,7 @@ if (!empty($_POST["frm_signup_2"])) {
|
||||||
|
|
||||||
// check confirmed password
|
// check confirmed password
|
||||||
if (strcasecmp($password, $confirmpassword) != 0) {
|
if (strcasecmp($password, $confirmpassword) != 0) {
|
||||||
$_SESSION['info_signup2'] = "Password confirmation failed.";
|
$_SESSION['info_signup'] = "Password confirmation failed.";
|
||||||
$_SESSION['user_fullname'] = null; // such that Header.php do not show the header information.
|
$_SESSION['user_fullname'] = null; // such that Header.php do not show the header information.
|
||||||
header("Location: signup.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
|
@ -87,7 +85,7 @@ if (!empty($_POST["frm_signup_2"])) {
|
||||||
|
|
||||||
// validate email
|
// validate email
|
||||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
$_SESSION['info_signup2'] = "Invalid email address.";
|
$_SESSION['info_signup'] = "Invalid email address.";
|
||||||
header("Location: signup.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -100,16 +98,15 @@ if (!empty($_POST["frm_signup_2"])) {
|
||||||
|
|
||||||
// check for strong password
|
// check for strong password
|
||||||
if (!$containsAll) {
|
if (!$containsAll) {
|
||||||
$_SESSION['info_signup2'] = "Password must have at least characters that include lowercase letters, uppercase letters, numbers and sepcial characters (e.g., !?.,*^).";
|
$_SESSION['info_signup'] = "Password must have at least characters that include lowercase letters, uppercase letters, numbers and special characters (e.g., !?.,*^).";
|
||||||
header("Location: signup.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if email is taken
|
// check if email is taken
|
||||||
$result = mysqli_query($con, "SELECT * FROM users_table WHERE email='$email'");
|
$result = mysqli_query($con, "SELECT * FROM users_table WHERE email='$email'");
|
||||||
if(mysqli_num_rows($result) != 0)
|
if (mysqli_num_rows($result) != 0) {
|
||||||
{
|
$_SESSION["info_signup"] = "Email address " . $email . " is already in use.";
|
||||||
$_SESSION["info_signup2"]="Email address ".$email." is already in use.";
|
|
||||||
$_SESSION['user_fullname'] = null;
|
$_SESSION['user_fullname'] = null;
|
||||||
header("Location: signup.php");
|
header("Location: signup.php");
|
||||||
return;
|
return;
|
||||||
|
@ -149,7 +146,7 @@ if (!empty($_POST["frm_login"])) {
|
||||||
$password = mysqli_real_escape_string($con, $_POST["password"]);
|
$password = mysqli_real_escape_string($con, $_POST["password"]);
|
||||||
$result = mysqli_query($con, "SELECT * FROM users_table WHERE (Student_ID='$user') OR (Email='$user')");
|
$result = mysqli_query($con, "SELECT * FROM users_table WHERE (Student_ID='$user') OR (Email='$user')");
|
||||||
if (mysqli_num_rows($result) == 0) {
|
if (mysqli_num_rows($result) == 0) {
|
||||||
$_SESSION["info_login"] = "Inavlid user name information.";
|
$_SESSION["info_login"] = "Invalid user name information.";
|
||||||
echo $_SESSION["info_login"];
|
echo $_SESSION["info_login"];
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
} else {
|
} else {
|
||||||
|
@ -198,7 +195,6 @@ if (!empty($_POST["frm_recover_password"])) {
|
||||||
// validate student number
|
// validate student number
|
||||||
if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) {
|
if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) {
|
||||||
$_SESSION["info_recover_password"] = "Invalid student number.";
|
$_SESSION["info_recover_password"] = "Invalid student number.";
|
||||||
#echo "Invalid student number.";
|
|
||||||
header("Location: recover_password.php");
|
header("Location: recover_password.php");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +246,7 @@ if (!empty($_POST["frm_reset_password"])) {
|
||||||
|
|
||||||
// Password Update
|
// Password Update
|
||||||
$hashed_password = hash('sha512', $password);
|
$hashed_password = hash('sha512', $password);
|
||||||
$sql = "UPDATE users_table set HashPassword='$hashed_password' where User_ID=$userid;";
|
$sql = "UPDATE users_table set HashPassword='$hashed_password' where User_ID='$userid';";
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -272,20 +268,22 @@ if (!empty($_POST["frm_createlecturrer"])) {
|
||||||
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
$email = mysqli_real_escape_string($con, $_POST["email"]);
|
||||||
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
|
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
|
||||||
$type = mysqli_real_escape_string($con, $_POST["type"]);
|
$type = mysqli_real_escape_string($con, $_POST["type"]);
|
||||||
$password = $passport;
|
$password = mysqli_real_escape_string($con, $_POST["passport"]);
|
||||||
// check if email is taken
|
// check if email is taken
|
||||||
$result = mysqli_query($con,
|
$result = mysqli_query(
|
||||||
"SELECT * FROM Users_Table WHERE email='$email'");
|
$con,
|
||||||
if(mysqli_num_rows($result)!=0)
|
"SELECT * FROM Users_Table WHERE email='$email'"
|
||||||
{
|
);
|
||||||
|
if (mysqli_num_rows($result) != 0) {
|
||||||
$_SESSION["info_Admin_Users"] = "Email address : " . $email . " is already in use.";
|
$_SESSION["info_Admin_Users"] = "Email address : " . $email . " is already in use.";
|
||||||
header("Location: Admin.php");
|
header("Location: Admin.php");
|
||||||
}
|
}
|
||||||
|
$password_hash = password_hash("$password", PASSWORD_DEFAULT);
|
||||||
$sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
|
$sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
|
||||||
. "('$email','$password','$fullname','$type')";
|
. "('$email','$password_hash','$fullname','$type')";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
$_SESSION["info_Admin_Users"] = $type . " user Created successfully : email " . $email . " and $password as Password.";
|
$_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and $password as password.";
|
||||||
header("Location: Admin.php");
|
header("Location: Admin.php");
|
||||||
} else {
|
} else {
|
||||||
echo "Error: " . $sql . "<br>" . $con->error;
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
@ -432,7 +430,7 @@ if (!empty($_POST["frm_uploadlab"])) {
|
||||||
|
|
||||||
$sql = "INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`,
|
$sql = "INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`,
|
||||||
`Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`,Marks,Type)
|
`Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`,Marks,Type)
|
||||||
VALUES ('$course_id','$date','$deadline','$instructions','$title','$targetfile','$targetfile2','$targetfile3','$targetfile3',$marks,'$type')";
|
VALUES ('$course_id','$date','$deadline','$instructions','$title','$targetfile','$targetfile2','$targetfile3','$targetfile3','$marks','$type')";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
|
||||||
|
@ -469,7 +467,7 @@ if (!empty($_POST["frm_submitlab"])) {
|
||||||
$date = date("Y-m-d H:i:s");
|
$date = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
// GET UPLOADED FILES
|
// GET UPLOADED FILES
|
||||||
$labName = mysqli_query($con, "SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID=$lab_id");
|
$labName = mysqli_query($con, "SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID='$lab_id'");
|
||||||
while ($row = mysqli_fetch_assoc($labName)) {
|
while ($row = mysqli_fetch_assoc($labName)) {
|
||||||
$lab_name = $row['Title'];
|
$lab_name = $row['Title'];
|
||||||
$_SESSION['Sub_Type'] = $row['Type']; // submission type, either Individual or Group
|
$_SESSION['Sub_Type'] = $row['Type']; // submission type, either Individual or Group
|
||||||
|
@ -573,13 +571,13 @@ if (!empty($_POST["frm_submitlab"])) {
|
||||||
$group_id = 0; // FIXME
|
$group_id = 0; // FIXME
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql1 = "DELETE FROM lab_report_submissions where Lab_Report_ID=$lab_id and Student_id=$student_id and Course_Group_id=$group_id";
|
$sql1 = "DELETE FROM lab_report_submissions where Lab_Report_ID='$lab_id' and Student_id='$student_id' and Course_Group_id='$group_id'";
|
||||||
if ($con->query($sql1) === TRUE) {
|
if ($con->query($sql1) === TRUE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO `lab_report_submissions`(`Submission_Date`, `Lab_Report_ID`, `Student_id`,"
|
$sql = "INSERT INTO `lab_report_submissions`(`Submission_Date`, `Lab_Report_ID`, `Student_id`,"
|
||||||
. " `Course_Group_id`, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Status`, `Title`,`Remarking_Reason`)"
|
. " `Course_Group_id`, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Status`, `Title`,`Remarking_Reason`)"
|
||||||
. " VALUES ('$date',$lab_id,$student_id,$group_id,'$targetfile','$instructions','$targetfile2','$targetfile3','$targetfile4',"
|
. " VALUES ('$date','$lab_id','$student_id','$group_id','$targetfile','$instructions','$targetfile2','$targetfile3','$targetfile4',"
|
||||||
. "'Pending','$title','')";
|
. "'Pending','$title','')";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
@ -597,9 +595,9 @@ if (!empty($_POST["frm_submitlab"])) {
|
||||||
// JOIN COURSE
|
// JOIN COURSE
|
||||||
if (!empty($_GET["JoinCourse"])) {
|
if (!empty($_GET["JoinCourse"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$student_id = $_GET["std"];
|
$student_id = mysqli_real_escape_string($con, $_GET["std"]);
|
||||||
$joining = $_GET["joining"];
|
$joining = mysqli_real_escape_string($con, $_GET["joining"]);
|
||||||
$status = "Pending";
|
$status = "Pending";
|
||||||
|
|
||||||
if ($joining == 0) {
|
if ($joining == 0) {
|
||||||
|
@ -626,12 +624,12 @@ if (!empty($_GET["JoinCourse"])) {
|
||||||
|
|
||||||
if (!empty($_GET["savemarks"])) {
|
if (!empty($_GET["savemarks"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$marks = $_GET["marks"];
|
$marks = mysqli_real_escape_string($con, $_GET["marks"]);
|
||||||
$total = $_GET["total"];
|
$total = mysqli_real_escape_string($con, $_GET["total"]);
|
||||||
$feedback = $_GET["feedback"];
|
$feedback = mysqli_real_escape_string($con, $_GET["feedback"]);
|
||||||
$header = $_GET["header"];
|
$header = mysqli_real_escape_string($con, $_GET["header"]);
|
||||||
$labid = $_GET["labid"];
|
$labid = mysqli_real_escape_string($con, $_GET["labid"]);
|
||||||
$status = "Marked";
|
$status = "Marked";
|
||||||
|
|
||||||
if ($marks > $total) {
|
if ($marks > $total) {
|
||||||
|
@ -660,14 +658,14 @@ if (!empty($_GET["savemarks"])) {
|
||||||
#Update Report Visibility
|
#Update Report Visibility
|
||||||
if (!empty($_GET["updatevisibility"])) {
|
if (!empty($_GET["updatevisibility"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$marks = $_GET["marks"];
|
$marks = mysqli_real_escape_string($con, $_GET["marks"]);
|
||||||
$total = $_GET["total"];
|
$total = mysqli_real_escape_string($con, $_GET["total"]);
|
||||||
$status = $_GET["status"];
|
$status = mysqli_real_escape_string($con, $_GET["status"]);
|
||||||
$header = $_GET["header"];
|
$header = mysqli_real_escape_string($con, $_GET["header"]);
|
||||||
$labid = $_GET["labid"];
|
$labid = mysqli_real_escape_string($con, $_GET["labid"]);
|
||||||
|
|
||||||
$sql = "UPDATE `lab_report_submissions` SET `Visibility`='$status' WHERE Submission_ID=$id
|
$sql = "UPDATE `lab_report_submissions` SET `Visibility`='$status' WHERE Submission_ID='$id'
|
||||||
";
|
";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
@ -683,18 +681,18 @@ if (!empty($_GET["updatevisibility"])) {
|
||||||
|
|
||||||
if (!empty($_GET["remarking"])) {
|
if (!empty($_GET["remarking"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = htmlspecialchars(mysqli_real_escape_string($con, $_GET["id"]));
|
||||||
$url = $_GET["url"];
|
$url = htmlspecialchars(mysqli_real_escape_string($con, $_GET["url"]));
|
||||||
|
|
||||||
$status = $_GET["status"];
|
$status = htmlspecialchars(mysqli_real_escape_string($con, $_GET["status"]));
|
||||||
$details = $_GET["details"];
|
$details = htmlspecialchars(mysqli_real_escape_string($con, $_GET["details"]));
|
||||||
|
|
||||||
$sql = "UPDATE `lab_report_submissions` SET `Status`='Remarking',Remarking_Reason='$details' WHERE Submission_ID=$id
|
$sql = "UPDATE `lab_report_submissions` SET `Status`='Remarking',Remarking_Reason='$details' WHERE Submission_ID='$id'
|
||||||
";
|
";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
|
||||||
$_SESSION["info_ReMarking"] = "Remarking Request Sent";
|
$_SESSION["info_general"] = "Remarking Request Sent";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} else {
|
} else {
|
||||||
echo "Error: " . $sql . "<br>" . $con->error;
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
@ -705,13 +703,13 @@ if (!empty($_GET["remarking"])) {
|
||||||
|
|
||||||
if (!empty($_GET["creategroup"])) {
|
if (!empty($_GET["creategroup"])) {
|
||||||
|
|
||||||
$student_id = $_GET["student_id"];
|
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
|
||||||
$url = $_GET["url"];
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$name = $_GET["name"];
|
$name = mysqli_real_escape_string($con, $_GET["name"]);
|
||||||
|
|
||||||
$sql = "INSERT INTO `course_groups_table`(`Group_Name`,
|
$sql = "INSERT INTO `course_groups_table`(`Group_Name`,
|
||||||
`Group_Leader`, `Course_id`) VALUES ('$name',$student_id,$id)";
|
`Group_Leader`, `Course_id`) VALUES ('$name','$student_id','$id')";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
|
||||||
|
@ -721,9 +719,9 @@ if (!empty($_GET["creategroup"])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
|
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
|
||||||
VALUES ($gid,$student_id,'Created')";
|
VALUES ('$gid','$student_id','Created')";
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
$_SESSION["info_ReMarking"] = "Course group Created";
|
$_SESSION["info_general"] = "Course group Created";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} else {
|
} else {
|
||||||
echo "Error: " . $sql . "<br>" . $con->error;
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
@ -737,18 +735,25 @@ if (!empty($_GET["creategroup"])) {
|
||||||
|
|
||||||
if (!empty($_GET["groupinvite"])) {
|
if (!empty($_GET["groupinvite"])) {
|
||||||
|
|
||||||
$student_id = $_GET["student_id"];
|
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
|
||||||
$url = $_GET["url"];
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
$courseid = $_GET["courseid"];
|
$courseid = mysqli_real_escape_string($con, $_GET["courseid"]);
|
||||||
$groupid = $_GET["groupid"];
|
$groupid = mysqli_real_escape_string($con, $_GET["groupid"]);
|
||||||
|
$student = mysqli_query($con, "SELECT * FROM students_data WHERE Student_ID = '$student_id' ");
|
||||||
|
|
||||||
|
if (mysqli_num_rows($student) > 0) {
|
||||||
|
|
||||||
$result = mysqli_query($con, "SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'");
|
$result = mysqli_query($con, "SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'");
|
||||||
if (mysqli_num_rows($result) > 0) {
|
if (mysqli_num_rows($result) > 0) {
|
||||||
$_SESSION["info_ReMarking"] = $student_id . " has already been invited";
|
$_SESSION["info_general"] = $student_id . " has already been invited.";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
|
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
|
||||||
VALUES ($groupid,$student_id,'Invited')";
|
VALUES ('$groupid','$student_id','Invited')";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$_SESSION["info_general"] = $student_id . " is an invalid student number.";
|
||||||
|
header("Location: Course.php?url=" . $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
@ -766,26 +771,26 @@ if (!empty($_GET["groupinvite"])) {
|
||||||
|
|
||||||
if ($Group_Member == '0') {
|
if ($Group_Member == '0') {
|
||||||
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
||||||
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
|
$_SESSION["info_general"] = $student_id . " was invited to the group.";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} elseif ($Group_Member2 == '0') {
|
} elseif ($Group_Member2 == '0') {
|
||||||
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member2` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member2` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
||||||
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
|
$_SESSION["info_general"] = $student_id . " was invited to the group.";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} elseif ($Group_Member3 == '0') {
|
} elseif ($Group_Member3 == '0') {
|
||||||
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member3` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member3` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
||||||
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
|
$_SESSION["info_general"] = $student_id . " was invited to the group.";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} elseif ($Group_Member4 == '0') {
|
} elseif ($Group_Member4 == '0') {
|
||||||
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member4` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member4` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
|
||||||
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
|
$_SESSION["info_general"] = $student_id . " was invited to the group.";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} else {
|
} else {
|
||||||
$_SESSION["info_ReMarking"] = " You cant add any more members";
|
$_SESSION["info_general"] = " You cannot add any more members";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
|
$_SESSION["info_general"] = $student_id . " was invited to the group.";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} else {
|
} else {
|
||||||
echo "Error: " . $sql . "<br>" . $con->error;
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
@ -796,21 +801,57 @@ if (!empty($_GET["groupinvite"])) {
|
||||||
|
|
||||||
if (!empty($_GET["acceptinvite"])) {
|
if (!empty($_GET["acceptinvite"])) {
|
||||||
|
|
||||||
$student_id = $_GET["student_id"];
|
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
|
||||||
$url = $_GET["url"];
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
$action = $_GET["action"];
|
$action = mysqli_real_escape_string($con, $_GET["action"]);
|
||||||
$groupid = $_GET["groupid"];
|
$groupid = mysqli_real_escape_string($con, $_GET["groupid"]);
|
||||||
|
|
||||||
if ($action == 1) {
|
if ($action == 1) {
|
||||||
$sql = "Update `course_group_members_table` set Status='Joined' where Course_Group_id =$groupid and student_id=$student_id
|
$sql = "Update `course_group_members_table` set Status='Joined' where Course_Group_id ='$groupid' and student_id='$student_id'
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$sql = "Delete from `course_group_members_table` where Course_Group_id =$groupid and student_id=$student_id
|
$sql = "Delete from `course_group_members_table` where Course_Group_id ='$groupid' and student_id='$student_id'
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
$_SESSION["info_ReMarking"] = " Group Invite Updated";
|
$_SESSION["info_general"] = " Group Invite Updated";
|
||||||
|
header("Location: Course.php?url=" . $url);
|
||||||
|
} else {
|
||||||
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Remove a member from group
|
||||||
|
|
||||||
|
if (!empty($_GET["removemember"])) {
|
||||||
|
|
||||||
|
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
|
||||||
|
$group_id = mysqli_real_escape_string($con, $_GET["group_id"]);
|
||||||
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
|
|
||||||
|
$sql = "Delete from `course_group_members_table` where student_id=$student_id and Course_Group_id=$group_id";
|
||||||
|
|
||||||
|
if ($con->query($sql) === TRUE) {
|
||||||
|
$_SESSION["info_general"] = " Member " . $student_id . " removed from the group";
|
||||||
|
header("Location: Course.php?url=" . $url);
|
||||||
|
} else {
|
||||||
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Delete a whole group
|
||||||
|
|
||||||
|
if (!empty($_GET["deletegroup"])) {
|
||||||
|
|
||||||
|
$group_id = mysqli_real_escape_string($con, $_GET["group_id"]);
|
||||||
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
|
|
||||||
|
$sql1 = "Delete from `course_group_members_table` where Course_Group_id=$group_id";
|
||||||
|
$sql2 = "Delete from `course_groups_table` where Course_Group_id=$group_id";
|
||||||
|
|
||||||
|
if ($con->query($sql1) === TRUE && $con->query($sql2) === TRUE) {
|
||||||
|
$_SESSION["info_general"] = " Group has been deleted successfully. ";
|
||||||
header("Location: Course.php?url=" . $url);
|
header("Location: Course.php?url=" . $url);
|
||||||
} else {
|
} else {
|
||||||
echo "Error: " . $sql . "<br>" . $con->error;
|
echo "Error: " . $sql . "<br>" . $con->error;
|
||||||
|
@ -821,22 +862,22 @@ if (!empty($_GET["acceptinvite"])) {
|
||||||
|
|
||||||
if (!empty($_GET["extenddeadline"])) {
|
if (!empty($_GET["extenddeadline"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$date = $_GET["date"];
|
$date = mysqli_real_escape_string($con, $_GET["date"]);
|
||||||
$time = $_GET["time"];
|
$time = mysqli_real_escape_string($con, $_GET["time"]);
|
||||||
$type = $_GET["type"];
|
$type = mysqli_real_escape_string($con, $_GET["type"]);
|
||||||
|
|
||||||
$stdid = $_GET["stdid"];
|
$stdid = mysqli_real_escape_string($con, $_GET["stdid"]);
|
||||||
$reason = $_GET["reason"];
|
$reason = mysqli_real_escape_string($con, $_GET["reason"]);
|
||||||
$url = $_GET["url"];
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
$deadline = $date . " " . $time;
|
$deadline = $date . " " . $time;
|
||||||
|
|
||||||
if ($type == 1) {
|
if ($type == 1) {
|
||||||
$sql = "UPDATE `lab_reports_table` SET `Deadline`='$deadline' WHERE Lab_Report_ID=$id";
|
$sql = "UPDATE `lab_reports_table` SET `Deadline`='$deadline' WHERE Lab_Report_ID='$id'";
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO `extended_deadlines_table`(`Student_ID`, "
|
$sql = "INSERT INTO `extended_deadlines_table`(`Student_ID`, "
|
||||||
. "`Lab_Report_ID`, `Extended_Deadline_Date`,"
|
. "`Lab_Report_ID`, `Extended_Deadline_Date`,"
|
||||||
. " `ReasonsForExtension`) VALUES ($stdid,$id,'$deadline','$reason')";
|
. " `ReasonsForExtension`) VALUES ('$stdid','$id','$deadline','$reason')";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
@ -852,13 +893,13 @@ if (!empty($_GET["extenddeadline"])) {
|
||||||
|
|
||||||
if (!empty($_GET["ignoreremarking"])) {
|
if (!empty($_GET["ignoreremarking"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$total = $_GET["total"];
|
$total = mysqli_real_escape_string($con, $_GET["total"]);
|
||||||
$header = $_GET["header"];
|
$header = mysqli_real_escape_string($con, $_GET["header"]);
|
||||||
|
|
||||||
$subid = $_GET["subid"];
|
$subid = mysqli_real_escape_string($con, $_GET["subid"]);
|
||||||
|
|
||||||
$sql = "UPDATE lab_report_submissions SET Status='Marked' WHERE Submission_ID=$subid";
|
$sql = "UPDATE lab_report_submissions SET Status='Marked' WHERE Submission_ID='$subid'";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
|
||||||
|
@ -873,10 +914,10 @@ if (!empty($_GET["ignoreremarking"])) {
|
||||||
|
|
||||||
if (!empty($_GET["assignTA"])) {
|
if (!empty($_GET["assignTA"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$ta = $_GET["ta"];
|
$ta = mysqli_real_escape_string($con, $_GET["ta"]);
|
||||||
|
|
||||||
$sql = "INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ($id,$ta)";
|
$sql = "INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ('$id','$ta')";
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
|
||||||
|
@ -891,13 +932,13 @@ if (!empty($_GET["assignTA"])) {
|
||||||
|
|
||||||
if (!empty($_GET["AcceptStudent"])) {
|
if (!empty($_GET["AcceptStudent"])) {
|
||||||
|
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$rs = $_GET["rs"];
|
$rs = mysqli_real_escape_string($con, $_GET["rs"]);
|
||||||
|
|
||||||
if ($rs == "yes") {
|
if ($rs == "yes") {
|
||||||
$sql = "Update course_students_table set Status='Joined' Where ID=$id";
|
$sql = "Update course_students_table set Status='Joined' Where ID='$id'";
|
||||||
} else {
|
} else {
|
||||||
$sql = "Delete FROM course_students_table Where ID=$id";
|
$sql = "Delete FROM course_students_table Where ID='$id'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
|
@ -919,12 +960,12 @@ if (!empty($_GET["AcceptStudent"])) {
|
||||||
if (!empty($_GET["action"])) {
|
if (!empty($_GET["action"])) {
|
||||||
|
|
||||||
$action = $_GET["action"];
|
$action = $_GET["action"];
|
||||||
$uid = $_GET["uid"];
|
$uid = mysqli_real_escape_string($con, $_GET["uid"]);
|
||||||
|
|
||||||
$pass = $_GET["pass"];
|
$pass = mysqli_real_escape_string($con, $_GET["pass"]);
|
||||||
$pass = password_hash($pass, PASSWORD_DEFAULT);
|
$pass = password_hash($pass, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
$status = $_GET["status"];
|
$status = mysqli_real_escape_string($con, $_GET["status"]);
|
||||||
|
|
||||||
// validate uid
|
// validate uid
|
||||||
if (intval($uid) < 0) {
|
if (intval($uid) < 0) {
|
||||||
|
@ -932,8 +973,8 @@ if (!empty($_GET["action"])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "passchange") {
|
if ($action == "passchange" && $_SESSION['user_id'] == $uid) {
|
||||||
$sql = "UPDATE users_table set Password='$pass' where User_ID=$uid;";
|
$sql = "UPDATE users_table set Password='$pass' where User_ID='$uid';";
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
echo "Password has been changed";
|
echo "Password has been changed";
|
||||||
|
@ -946,8 +987,8 @@ if (!empty($_GET["action"])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "statuschange") {
|
if ($action == "statuschange" && $_SESSION['user_id'] == $uid && ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "Admin")) {
|
||||||
$sql = "UPDATE users_table set Status='$status' where User_ID=$uid;";
|
$sql = "UPDATE users_table set Status='$status' where User_ID='$uid';";
|
||||||
if ($con->query($sql) === TRUE) {
|
if ($con->query($sql) === TRUE) {
|
||||||
$_SESSION["info_Admin_Users"] = $type . " user Status updated successfully ";
|
$_SESSION["info_Admin_Users"] = $type . " user Status updated successfully ";
|
||||||
header("Location: Admin.php");
|
header("Location: Admin.php");
|
||||||
|
@ -1007,8 +1048,8 @@ if (!empty($_POST["frm_createCourse"])) {
|
||||||
|
|
||||||
if (!empty($_GET["exportgrade"])) {
|
if (!empty($_GET["exportgrade"])) {
|
||||||
|
|
||||||
$lab = $_GET["lab"];
|
$lab = mysqli_real_escape_string($con, $_GET["lab"]);
|
||||||
$lab_name = $_GET["lab_name"];
|
$lab_name = mysqli_real_escape_string($con, $_GET["lab_name"]);
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
|
||||||
|
@ -1020,7 +1061,7 @@ INNER JOIN lab_reports_table on lab_reports_table.Lab_Report_ID=lab_report_submi
|
||||||
|
|
||||||
INNER JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
|
INNER JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
|
||||||
|
|
||||||
WHERE lab_report_submissions.Lab_Report_ID=$lab";
|
WHERE lab_report_submissions.Lab_Report_ID='$lab'";
|
||||||
|
|
||||||
$export = mysqli_query($con, $select);
|
$export = mysqli_query($con, $select);
|
||||||
|
|
||||||
|
@ -1050,7 +1091,7 @@ WHERE lab_report_submissions.Lab_Report_ID=$lab";
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-type: application/octet-stream");
|
header("Content-type: application/octet-stream");
|
||||||
header("Content-Disposition: attachment; filename=$lab_name Garde Sheet.xls");
|
header("Content-Disposition: attachment; filename=$lab_name Grade Sheet.xls");
|
||||||
header("Pragma: no-cache");
|
header("Pragma: no-cache");
|
||||||
header("Expires: 0");
|
header("Expires: 0");
|
||||||
print "$header\n$data";
|
print "$header\n$data";
|
||||||
|
|
|
@ -9,7 +9,7 @@ include 'Header.php';
|
||||||
<div class="row" style="width:80%;margin:auto;">
|
<div class="row" style="width:80%;margin:auto;">
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h1> STUEDNT Account Created , Now you can Browse Course Portals </h1>
|
<h1> Student Account Created. Now you can Browse Course Portals </h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
|
@ -10,7 +10,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["id"])) {
|
if (!empty($_GET["id"])) {
|
||||||
$id = $_GET["id"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
$course_id = $id;
|
$course_id = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Sub
|
||||||
}
|
}
|
||||||
|
|
||||||
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> $submitted_by </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 Submission</button><br> Attachments : $full_link </span>
|
<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 Submission</button><br> Attachments : $full_link </span>
|
||||||
</div></k>";
|
</div></k>";
|
||||||
}
|
}
|
||||||
|
@ -262,8 +262,13 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
|
||||||
if ($att4 != "") {
|
if ($att4 != "") {
|
||||||
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
|
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
|
||||||
}
|
}
|
||||||
|
// you will notice why i used span here to wrap the $submitted_by variable
|
||||||
|
// because if we wrap with span , the css class text-selectable can be used only by the submittedBy variable
|
||||||
|
// 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 " <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> $submitted_by [ Marked $Marks ] </b> Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button>
|
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> [ Marked $Marks ] </b> Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button>
|
||||||
<hr> Lecturer/TA 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)'> Re-Mark Submission</button><br> Attachments : $full_link </span>
|
<hr> Lecturer/TA 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)'> Re-Mark Submission</button><br> Attachments : $full_link </span>
|
||||||
</div></k>";
|
</div></k>";
|
||||||
}
|
}
|
||||||
|
@ -342,7 +347,7 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
|
||||||
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
|
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$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 " <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> $submitted_by [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b>
|
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> [ 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)'> Re-Mark Submission</button>"
|
. "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button>"
|
||||||
. " <a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>"
|
. " <a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>"
|
||||||
|
|
|
@ -9,18 +9,22 @@ include 'Header.php';
|
||||||
|
|
||||||
<div class='row' style='width:80%;margin:auto;'>
|
<div class='row' style='width:80%;margin:auto;'>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$c_date = date("Y-m-d H:i");
|
$c_date = date("Y-m-d H:i");
|
||||||
$student_id = $_SESSION["user_student_id"];
|
$student_id = $_SESSION["user_student_id"];
|
||||||
|
|
||||||
if (!empty($_GET["id"])) {
|
if(!empty($_GET["id"]))
|
||||||
$id = $_GET["id"];
|
{
|
||||||
$url = $_GET["url"];
|
$id = mysqli_real_escape_string($con, $_GET["id"]);
|
||||||
|
$url = mysqli_real_escape_string($con, $_GET["url"]);
|
||||||
|
|
||||||
$result1 = mysqli_query($con," SELECT `Type`, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and Deadline > '$c_date' ORDER by Lab_Report_ID DESC");
|
$result1 = mysqli_query($con," SELECT `Type`, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and Deadline > '$c_date' ORDER by Lab_Report_ID DESC");
|
||||||
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 {
|
||||||
|
|
||||||
while($row = mysqli_fetch_assoc($result1)) {
|
while($row = mysqli_fetch_assoc($result1)) {
|
||||||
|
@ -44,12 +48,14 @@ include 'Header.php';
|
||||||
$_SESSION["Group_ID"] = $row['Course_Group_id'];
|
$_SESSION["Group_ID"] = $row['Course_Group_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_SESSION["Group_ID"] < 1) {
|
if($_SESSION["Group_ID"] < 1)
|
||||||
|
{
|
||||||
echo" <center><h3> This Lab report can only be submitted by Group Admin </h3> </center> ";
|
echo" <center><h3> This Lab report can only be submitted by Group Admin </h3> </center> ";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
|
||||||
|
|
||||||
if($att2!=""){
|
if($att2!=""){
|
||||||
|
@ -80,6 +86,9 @@ include 'Header.php';
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style="width:80%;margin:auto;">
|
<div style="width:80%;margin:auto;">
|
||||||
|
|
||||||
<h3> Submit Lab Report Assignment </h3>
|
<h3> Submit Lab Report Assignment </h3>
|
||||||
|
@ -88,6 +97,7 @@ include 'Header.php';
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
|
||||||
<form method='post' enctype='multipart/form-data' action='Script.php'>
|
<form method='post' enctype='multipart/form-data' action='Script.php'>
|
||||||
<input type='hidden' name='frm_submitlab' value='true' required=''/>
|
<input type='hidden' name='frm_submitlab' value='true' required=''/>
|
||||||
<input type='hidden' name='lab_id' value='<?php echo $id; ?>' required=''/>
|
<input type='hidden' name='lab_id' value='<?php echo $id; ?>' required=''/>
|
||||||
|
|
|
@ -19,7 +19,7 @@ if (!$conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//获得用户名数据
|
//获得用户名数据
|
||||||
$source = $_POST['users'];
|
$source = mysqli_real_escape_string($conn,$_POST['users']);
|
||||||
|
|
||||||
//如有多个空格,删除剩一个空格
|
//如有多个空格,删除剩一个空格
|
||||||
$source1 = preg_replace('/\s\s+/', ' ', $source);
|
$source1 = preg_replace('/\s\s+/', ' ', $source);
|
||||||
|
@ -31,13 +31,12 @@ $source2 = trim($source1);
|
||||||
//根据空格拆分
|
//根据空格拆分
|
||||||
$user = explode(' ', $source2);
|
$user = explode(' ', $source2);
|
||||||
|
|
||||||
|
|
||||||
//插入数据
|
//插入数据
|
||||||
for($index=0; $index < count($user); $index++) {
|
for($index=0; $index < count($user); $index++) {
|
||||||
$result = mysqli_query($conn, "SELECT * FROM `students_data` WHERE Student_ID='$user[$index]'");
|
$result = mysqli_query($conn, "SELECT * FROM `students_data` WHERE Student_ID='$user[$index]'");
|
||||||
if (mysqli_num_rows($result) < 1) {
|
if (mysqli_num_rows($result) < 1) {
|
||||||
if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) {
|
if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) {
|
||||||
echo "SQL Error: " . $sql_stmt . "<br>" . mysqli_error($conn);
|
echo "SQL Error: " . $sql_stmt . "<br>" .htmlspecialchars(mysqli_error($conn));
|
||||||
} else {
|
} else {
|
||||||
echo "<p>Student number $user[$index] added.</p>";
|
echo "<p>Student number $user[$index] added.</p>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
/* this css class is used to enable copying in text with the mouse. */
|
||||||
|
.text-selectable {
|
||||||
|
|
||||||
|
-webkit-user-select: text;
|
||||||
|
-moz-user-select: text;
|
||||||
|
-ms-user-select: text;
|
||||||
|
user-select: text;
|
||||||
|
cursor:auto
|
||||||
|
|
||||||
|
}
|
|
@ -17,5 +17,10 @@ After that, issue the following commands in the mysql prompt.
|
||||||
|
|
||||||
The first one uses a database called lrr in MySQL. The second one deletes a record from `users_table` where the student number is 201131129138.
|
The first one uses a database called lrr in MySQL. The second one deletes a record from `users_table` where the student number is 201131129138.
|
||||||
|
|
||||||
|
Increasing session duration
|
||||||
|
-------------------
|
||||||
|
|
||||||
*Last modified on 1 June 2020 by Hui*
|
By default, the session duration in PHP is set to 1,440 seconds (24 minutes). However, this is not convenient in most software systems. Therefore, we may need to increase the duration to allow users to have more session time. To increase the session duration, we need to edit the variable *session.gc_maxlifetime* in **php.ini**. We can increase its default value to whatever we want (e.g., 7200).
|
||||||
|
On Ubuntu, the file is located at */etc/php/7.2/apache2/php.ini*. On XAMPP, the file is located at */xampp/php/php.ini*.
|
||||||
|
|
||||||
|
*Last modified on 20 April 2022 by Umar*
|
||||||
|
|
10
index.php
10
index.php
|
@ -33,18 +33,18 @@ if (isset($_SESSION["user_fullname"])) {
|
||||||
<form method="post" action="Script.php" name="frm_login">
|
<form method="post" action="Script.php" name="frm_login">
|
||||||
<input type="hidden" name="frm_login" value="true"/>
|
<input type="hidden" name="frm_login" value="true"/>
|
||||||
Student ID / Instructor Email
|
Student ID / Instructor Email
|
||||||
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" />
|
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" id="user_name" />
|
||||||
<br>
|
<br>
|
||||||
Password
|
Password
|
||||||
<input type="password" class="form-control" name="password" placeholder="password" required="required" />
|
<input type="password" class="form-control" name="password" placeholder="password" required="required" id="user_password" />
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<br><input type="submit" class="btn-primary" value="Login">
|
<br><input type="submit" class="btn-primary" value="Login" id="login_btn">
|
||||||
</div>
|
</div>
|
||||||
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular;
|
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular;
|
||||||
font-size: 17px;">Reset my password</a>
|
font-size: 17px;">Reset my password</a>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<br><span class="txt1">Don't have an account?</span>
|
<br><span class="txt1">Don't have an account?</span>
|
||||||
<a class="txt2" href="signup.php" style="font-weight:normal">Sign Up</a>
|
<a class="txt2" href="signup.php" style="font-weight:normal" id="signup_link">Sign Up</a>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ if (isset($_SESSION["user_fullname"])) {
|
||||||
|
|
||||||
|
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
|
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Destory sessions & redirect to index
|
|
||||||
|
|
||||||
session_destroy();
|
|
||||||
session_unset();
|
|
||||||
// Start a new session
|
// Start a new session
|
||||||
session_start();
|
session_start();
|
||||||
|
// Destory sessions & redirect to index
|
||||||
|
session_destroy();
|
||||||
|
session_unset();
|
||||||
|
|
||||||
|
|
||||||
// Generate a new session ID
|
// Generate a new session ID
|
||||||
session_regenerate_id(true);
|
session_regenerate_id(true);
|
||||||
|
|
|
@ -27,9 +27,9 @@ include 'Header.php';
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form method="post" action="Script.php">
|
<form method="post" action="Script.php">
|
||||||
<input type="hidden" name="frm_recover_password" value="true"/>
|
<input type="hidden" name="frm_recover_password" value="true"/>
|
||||||
Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo $_SESSION['student_number']; ?>">
|
Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['student_number']); ?>">
|
||||||
<br/>
|
<br/>
|
||||||
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo $_SESSION['user_email']; ?>">
|
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>">
|
||||||
<br/>
|
<br/>
|
||||||
<input type="submit" class="btn-primary" value="Recover">
|
<input type="submit" class="btn-primary" value="Recover">
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ include 'Header.php';
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(isset($_SESSION['info_recover_password'])) {
|
if(isset($_SESSION['info_recover_password'])) {
|
||||||
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_recover_password'].'</div>';
|
echo '<hr><div class="alert alert-danger" role="alert">'.htmlspecialchars($_SESSION['info_recover_password']).'</div>';
|
||||||
$_SESSION['info_recover_password']=null;
|
$_SESSION['info_recover_password']=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
signup.php
22
signup.php
|
@ -17,29 +17,29 @@ include 'Header.php';
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
<form method="post" action="Script.php">
|
<form method="post" action="Script.php" id="signup_form">
|
||||||
<input type="hidden" name="frm_signup_2" value="true" />
|
<input type="hidden" name="form_signup" value="true" />
|
||||||
Full Name
|
Full Name
|
||||||
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" />
|
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" id="full_name"/>
|
||||||
|
|
||||||
Student ID
|
Student ID
|
||||||
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required">
|
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required" id="student_id">
|
||||||
|
|
||||||
Email
|
Email
|
||||||
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" />
|
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" id="email" />
|
||||||
|
|
||||||
Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
|
Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
|
||||||
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" />
|
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="password1" />
|
||||||
|
|
||||||
Confirm Password
|
Confirm Password
|
||||||
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" />
|
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="password2" />
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" class="btn-primary" value="Sign up">
|
<input type="submit" class="btn-primary" value="Sign up" id="signup_btn">
|
||||||
<?php
|
<?php
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
if (isset($_SESSION['info_signup2'])) {
|
if (isset($_SESSION['info_signup'])) {
|
||||||
echo '<hr><div class="alert alert-danger" role="alert">' . $_SESSION['info_signup2'] . '</div>';
|
echo '<hr><div class="alert alert-danger" role="alert">' . $_SESSION['info_signup'] . '</div>';
|
||||||
$_SESSION['info_signup2'] = null;
|
$_SESSION['info_signup'] = null;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -32,12 +32,12 @@ class Admin(Actor):
|
||||||
|
|
||||||
#Locate "Admin" tab.
|
#Locate "Admin" tab.
|
||||||
wait = WebDriverWait(driver, 10)
|
wait = WebDriverWait(driver, 10)
|
||||||
admin = wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/nav/div/form/a[1]")))
|
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
|
||||||
admin.click()
|
admin.click()
|
||||||
|
|
||||||
#Locate "Create Lecturer/TA account" form
|
#Locate "Create Lecturer/TA account" form
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
new_account_form = wait2.until(EC.presence_of_element_located((By.ID, "frm_create_acc")))
|
new_account_form = wait2.until(EC.presence_of_element_located((By.ID, "create_account_form")))
|
||||||
|
|
||||||
#Fill in the form fields
|
#Fill in the form fields
|
||||||
name_field = new_account_form.find_element(By.XPATH, "//input[@name='fullname']")
|
name_field = new_account_form.find_element(By.XPATH, "//input[@name='fullname']")
|
||||||
|
@ -53,13 +53,13 @@ class Admin(Actor):
|
||||||
|
|
||||||
#If "Lecturer" is specified in type parameter, select Lecturer account type, else use default
|
#If "Lecturer" is specified in type parameter, select Lecturer account type, else use default
|
||||||
if type == "Lecturer":
|
if type == "Lecturer":
|
||||||
type_radio = new_account_form.find_element(By.XPATH, "//input[@value='Lecturer']")
|
type_radio = new_account_form.find_element(By.ID, "role_lecturer")
|
||||||
else:
|
else:
|
||||||
type_radio = new_account_form.find_element(By.XPATH, "//input[@value='TA']")
|
type_radio = new_account_form.find_element(By.ID, "role_TA")
|
||||||
|
|
||||||
type_radio.click()
|
type_radio.click()
|
||||||
|
|
||||||
submit_btn = new_account_form.find_element(By.XPATH, "//input[@type='submit'][@value='Create']")
|
submit_btn = new_account_form.find_element(By.ID, "create_btn")
|
||||||
submit_btn.click()
|
submit_btn.click()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -92,23 +92,23 @@ class Admin(Actor):
|
||||||
|
|
||||||
#Locate the "Admin" tab.
|
#Locate the "Admin" tab.
|
||||||
wait = WebDriverWait(driver, 10)
|
wait = WebDriverWait(driver, 10)
|
||||||
admin = wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/nav/div/form/a[1]")))
|
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
|
||||||
admin.click()
|
admin.click()
|
||||||
|
|
||||||
#Navigate to "Batch create form"
|
#Navigate to "Batch create form"
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
batch_tab = wait2.until(EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[1]/div/ul/li[2]/a")))
|
batch_tab = wait2.until(EC.presence_of_element_located((By.ID, "batch_tab")))
|
||||||
batch_tab.click()
|
batch_tab.click()
|
||||||
|
|
||||||
#Fill in the form
|
#Fill in the form
|
||||||
wait3 = WebDriverWait(driver, 10)
|
wait3 = WebDriverWait(driver, 10)
|
||||||
batch_form = wait3.until(EC.presence_of_element_located((By.ID, "frm_batch_acc")))
|
batch_form = wait3.until(EC.presence_of_element_located((By.ID, "batch_form")))
|
||||||
|
|
||||||
text_area = batch_form.find_element(By.XPATH, "//textarea[@name='users']")
|
text_area = batch_form.find_element(By.XPATH, "//textarea[@name='users']")
|
||||||
for i in range(len(lst)):
|
for i in range(len(lst)):
|
||||||
text_area.send_keys(lst[i]+" ")
|
text_area.send_keys(lst[i]+" ")
|
||||||
|
|
||||||
submit_btn = batch_form.find_element(By.XPATH, "//input[@type='submit'][@value='Create All']")
|
submit_btn = batch_form.find_element(By.ID, "register_btn")
|
||||||
submit_btn.click()
|
submit_btn.click()
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
@ -139,22 +139,22 @@ class Admin(Actor):
|
||||||
|
|
||||||
#Locate the "Admin" tab.
|
#Locate the "Admin" tab.
|
||||||
wait = WebDriverWait(driver, 10)
|
wait = WebDriverWait(driver, 10)
|
||||||
admin = wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/nav/div/form/a[1]")))
|
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
|
||||||
admin.click()
|
admin.click()
|
||||||
|
|
||||||
#Navigate to "Exisitin Accounts" table
|
#Navigate to "Exisitin Accounts" table
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
exist_acc_tab = wait2.until(EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[1]/div/ul/li[3]/a")))
|
exist_acc_tab = wait2.until(EC.presence_of_element_located((By.ID, "existing_accounts_tab")))
|
||||||
exist_acc_tab.click()
|
exist_acc_tab.click()
|
||||||
|
|
||||||
#Alternate between block and activate
|
#Alternate between block and activate
|
||||||
if op == "block":
|
if op == "block":
|
||||||
#Locate first account and block it on existing account table
|
#Locate first account and block it on existing account table
|
||||||
wait3 = WebDriverWait(driver, 10)
|
wait3 = WebDriverWait(driver, 10)
|
||||||
button = driver.find_element_by_id("block_acc_1")
|
button = driver.find_element(By.ID, "block_account_1")
|
||||||
elif op == "activate":
|
elif op == "activate":
|
||||||
wait3 = WebDriverWait(driver, 10)
|
wait3 = WebDriverWait(driver, 10)
|
||||||
button = driver.find_element_by_id("activate_acc_1")
|
button = driver.find_element(By.ID, "activate_account_1")
|
||||||
|
|
||||||
driver.execute_script("arguments[0].click();", button)
|
driver.execute_script("arguments[0].click();", button)
|
||||||
|
|
||||||
|
@ -188,18 +188,18 @@ class Admin(Actor):
|
||||||
|
|
||||||
#Locate the "Admin" tab.
|
#Locate the "Admin" tab.
|
||||||
wait = WebDriverWait(driver, 10)
|
wait = WebDriverWait(driver, 10)
|
||||||
admin = wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/nav/div/form/a[1]")))
|
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
|
||||||
admin.click()
|
admin.click()
|
||||||
|
|
||||||
#Navigate to "Existing Courses" table.
|
#Navigate to "Existing Courses" table.
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
courses_table = wait2.until(EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[2]/div/ul/li[2]/a")))
|
courses_table = wait2.until(EC.presence_of_element_located((By.ID, "existing_courses")))
|
||||||
courses_table.click()
|
courses_table.click()
|
||||||
|
|
||||||
#Assign TA to the first course in "Existing Courses" table
|
#Assign TA to the first course in "Existing Courses" table
|
||||||
wait3 = WebDriverWait(driver, 10)
|
wait3 = WebDriverWait(driver, 10)
|
||||||
drop_menu_form = wait3.until(EC.presence_of_element_located((By.XPATH, "//*[@id='menub']/table/tbody/tr[2]/td[5]/form")))
|
drop_menu_form = wait3.until(EC.presence_of_element_located((By.ID, "drop_menu_form_1")))
|
||||||
assign_btn = drop_menu_form.find_element(By.XPATH, "//input[@type='submit'][@value='assign']")
|
assign_btn = drop_menu_form.find_element(By.ID, "assign_btn_1")
|
||||||
assign_btn.click()
|
assign_btn.click()
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -60,26 +60,25 @@ class Instructor(Actor):
|
||||||
|
|
||||||
#wait until the lab submission form shows up
|
#wait until the lab submission form shows up
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.XPATH, "//form[@id='nlaf']")))
|
new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.ID, "newlab_form")))
|
||||||
|
|
||||||
#Fill the required form fields and submit.
|
#Fill the required form fields and submit.
|
||||||
lab_date = new_lab_assignment_form.find_element(By.XPATH, "//input[@id='date'][@name='deadlinedate']")
|
lab_date = new_lab_assignment_form.find_element(By.ID, "date")
|
||||||
timeStr = self.utility.getTodayDate()
|
lab_date.send_keys(dateStr)
|
||||||
lab_date.send_keys(timeStr)
|
lab_title = new_lab_assignment_form.find_element(By.ID, "lab_title")
|
||||||
lab_title = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='ltitle']")
|
|
||||||
lab_title.send_keys("TESTASSIGNMENT"+str(dateStr))
|
lab_title.send_keys("TESTASSIGNMENT"+str(dateStr))
|
||||||
lab_instructions = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/textarea[@id='linstruct']")
|
lab_instructions = new_lab_assignment_form.find_element(By.ID, "lab_instructor")
|
||||||
lab_instructions.send_keys("TESTINSTRUCTIONS"+str(dateStr))
|
lab_instructions.send_keys("TESTINSTRUCTIONS"+str(dateStr))
|
||||||
lab_marks = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lmark']")
|
lab_marks = new_lab_assignment_form.find_element(By.ID, "lab_mark")
|
||||||
lab_marks.send_keys("4")
|
lab_marks.send_keys("4")
|
||||||
|
|
||||||
#if group == 0 select individual submission, if group == 1 select group submission
|
#if group == 0 select individual submission, if group == 1 select group submission
|
||||||
if group == 0:
|
if group == 0:
|
||||||
submission_type = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lindi']")
|
submission_type = new_lab_assignment_form.find_element(By.ID, "lab_individual")
|
||||||
elif group == 1:
|
elif group == 1:
|
||||||
submission_type = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lgrp']")
|
submission_type = new_lab_assignment_form.find_element(By.ID, "lab_group")
|
||||||
submission_type.click()
|
submission_type.click()
|
||||||
submit = new_lab_assignment_form.find_element(By.XPATH, "//form[@id='nlaf']/input[@id='lbtn']")
|
submit = new_lab_assignment_form.find_element(By.ID, "submit_btn")
|
||||||
submit.click()
|
submit.click()
|
||||||
return 0
|
return 0
|
||||||
except:
|
except:
|
||||||
|
@ -115,25 +114,25 @@ class Instructor(Actor):
|
||||||
timeStr = self.utility.getTime()
|
timeStr = self.utility.getTime()
|
||||||
|
|
||||||
#Fill the required form fields and submit
|
#Fill the required form fields and submit
|
||||||
course_name = driver.find_element(By.ID, "cname")
|
course_name = driver.find_element(By.ID, "course_name")
|
||||||
course_name.send_keys("TESTCOURSE"+str(dateStr)+str(timeStr))
|
course_name.send_keys("TESTCOURSE"+str(dateStr)+str(timeStr))
|
||||||
|
|
||||||
#This URL is needed to access the same created course via its link in post_lab_report() method.
|
#This URL is needed to access the same created course via its link in post_lab_report() method.
|
||||||
global courseURL
|
global courseURL
|
||||||
courseURL = "TESTCOURSE"+str(dateStr)+str(timeStr)
|
courseURL = "TESTCOURSE"+str(dateStr)+str(timeStr)
|
||||||
course_code = driver.find_element(By.ID, "ccode")
|
course_code = driver.find_element(By.ID, "course_code")
|
||||||
course_code.send_keys("TC"+str(dateStr)+str(timeStr))
|
course_code.send_keys("TC"+str(dateStr)+str(timeStr))
|
||||||
self.utility.storeCourseCode("TC"+str(dateStr)+str(timeStr))#Store course code to be used
|
self.utility.storeCourseCode("TC"+str(dateStr)+str(timeStr))#Store course code to be used
|
||||||
academic_year = driver.find_element(By.ID, "ayear") #later by student.
|
academic_year = driver.find_element(By.ID, "academic_year") #later by student.
|
||||||
academic_year.send_keys("2021")
|
academic_year.send_keys("2021")
|
||||||
faculty = driver.find_element(By.ID, "fac")
|
faculty = driver.find_element(By.ID, "faculty")
|
||||||
faculty.send_keys("TESTING DEPARTMENT")
|
faculty.send_keys("TESTING DEPARTMENT")
|
||||||
|
|
||||||
#If joining == 0 does not require join approval, if joining == 1 requires join approval
|
#If joining == 0 does not require join approval, if joining == 1 requires join approval
|
||||||
if joining == 0 :
|
if joining == 0 :
|
||||||
joining_students = driver.find_element(By.ID, "jno")
|
joining_students = driver.find_element(By.ID, "join_no")
|
||||||
elif group == 1:
|
elif group == 1:
|
||||||
joining_students = driver.find_element(By.ID, "jyes")
|
joining_students = driver.find_element(By.ID, "join_yes")
|
||||||
joining_students.click()
|
joining_students.click()
|
||||||
submit = driver.find_element(By.ID, "portal_btn")
|
submit = driver.find_element(By.ID, "portal_btn")
|
||||||
submit.click()
|
submit.click()
|
||||||
|
@ -165,12 +164,12 @@ class Instructor(Actor):
|
||||||
|
|
||||||
#Wait until the submission portal card appears
|
#Wait until the submission portal card appears
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
view = wait2.until(EC.presence_of_element_located((By.ID, "view_btn")))
|
view = wait2.until(EC.presence_of_element_located((By.ID, "view_submissions_link_1")))
|
||||||
view.click()
|
view.click()
|
||||||
|
|
||||||
#Locate and click the 'Mark Submission' btn
|
#Locate and click the 'Mark Submission' btn
|
||||||
wait3 = WebDriverWait(driver, 10)
|
wait3 = WebDriverWait(driver, 10)
|
||||||
mark_submission = wait3.until(EC.presence_of_element_located((By.ID, "mark_btn")))
|
mark_submission = wait3.until(EC.presence_of_element_located((By.ID, "mark_submission_btn_1")))
|
||||||
mark_submission.click()
|
mark_submission.click()
|
||||||
|
|
||||||
#Fill and submit marking descision
|
#Fill and submit marking descision
|
||||||
|
@ -211,7 +210,7 @@ class Instructor(Actor):
|
||||||
|
|
||||||
#Wait until lab report assignment list appears.
|
#Wait until lab report assignment list appears.
|
||||||
wait = WebDriverWait(driver, 10)
|
wait = WebDriverWait(driver, 10)
|
||||||
extend_deadline = wait.until(EC.presence_of_element_located((By.ID, "ext_btn")))
|
extend_deadline = wait.until(EC.presence_of_element_located((By.ID, "extend_deadline_link")))
|
||||||
extend_deadline.click()
|
extend_deadline.click()
|
||||||
|
|
||||||
#Wait until the extend deadline popup window shows up.
|
#Wait until the extend deadline popup window shows up.
|
||||||
|
@ -219,10 +218,10 @@ class Instructor(Actor):
|
||||||
extend_deadline_form = wait2.until(EC.presence_of_element_located((By.ID, "frm")))
|
extend_deadline_form = wait2.until(EC.presence_of_element_located((By.ID, "frm")))
|
||||||
|
|
||||||
#Insert the new deadline and submit for all.
|
#Insert the new deadline and submit for all.
|
||||||
new_date = extend_deadline_form.find_element(By.XPATH, "//form[@id='frm']/input[3]")
|
new_date = extend_deadline_form.find_element(By.ID, "new_date")
|
||||||
dateStr = self.utility.getTomorrowDate()
|
dateStr = self.utility.getTomorrowDate()
|
||||||
new_date.send_keys(str(dateStr))
|
new_date.send_keys(str(dateStr))
|
||||||
target = extend_deadline_form.find_element(By.XPATH, "//form[@id='frm']/input[5]")
|
target = extend_deadline_form.find_element(By.ID, "extend_for_all")
|
||||||
target.click()
|
target.click()
|
||||||
submit = extend_deadline_form.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/button[1]")
|
submit = extend_deadline_form.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/button[1]")
|
||||||
submit.click()
|
submit.click()
|
||||||
|
|
|
@ -55,10 +55,10 @@ class Student(Actor):
|
||||||
|
|
||||||
#Wait until the course is found, and join.
|
#Wait until the course is found, and join.
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
course_card = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, str("Join Course"))))
|
join_btn = wait2.until(EC.element_to_be_clickable((By.ID, "join_btn")))
|
||||||
course_card.click()
|
join_btn.click()
|
||||||
|
|
||||||
#If the joined course successfully, proceed.
|
#If joined course successfully, proceed.
|
||||||
wait3 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/div[1]/span")))
|
wait3 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/div[1]/span")))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -89,19 +89,19 @@ class Student(Actor):
|
||||||
|
|
||||||
#Locate and click assignment submission button.
|
#Locate and click assignment submission button.
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
assignment_card = wait2.until(EC.element_to_be_clickable((By.LINK_TEXT, "Submit Lab Report")))
|
assignment_card = wait2.until(EC.element_to_be_clickable((By.ID, "submit_lab_report_btn")))
|
||||||
assignment_card.click()
|
assignment_card.click()
|
||||||
|
|
||||||
#Locate the assignment submission form and fill in the required data.
|
#Locate the assignment submission form and fill in the required data.
|
||||||
wait3 = WebDriverWait(driver, 10)
|
wait3 = WebDriverWait(driver, 10)
|
||||||
assignment_form = wait3.until(EC.presence_of_element_located((By.ID, "sub_form")))
|
assignment_form = wait3.until(EC.presence_of_element_located((By.ID, "submit_lab_report_form")))
|
||||||
title = assignment_form.find_element(By.ID, "title")
|
title = assignment_form.find_element(By.ID, "title")
|
||||||
dateStr = self.utility.getTodayDate()
|
dateStr = self.utility.getTodayDate()
|
||||||
timeStr = self.utility.getTime()
|
timeStr = self.utility.getTime()
|
||||||
title.send_keys("TESTSUBMISSIOM"+dateStr+timeStr)
|
title.send_keys("TESTSUBMISSIOM"+dateStr+timeStr)
|
||||||
attachment = assignment_form.find_element(By.ID, "att_one")
|
attachment = assignment_form.find_element(By.ID, "attachment1")
|
||||||
attachment.send_keys(os.getcwd()+"/DUMMY_SUBMISSION.txt")
|
attachment.send_keys(os.getcwd()+"/DUMMY_SUBMISSION.txt")
|
||||||
submit = driver.find_element(By.ID, "submit_btn")
|
submit = driver.find_element(By.ID, "submit_lab_assignment_btn")
|
||||||
submit.click()
|
submit.click()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class Student(Actor):
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
marked_tab = wait2.until(EC.presence_of_element_located((By.ID, "marked_tab")))
|
marked_tab = wait2.until(EC.presence_of_element_located((By.ID, "marked_tab")))
|
||||||
marked_tab.click()
|
marked_tab.click()
|
||||||
req_remark = driver.find_element(By.ID, "req_remark")
|
req_remark = driver.find_element(By.ID, "request_remarking_btn")
|
||||||
req_remark.click()
|
req_remark.click()
|
||||||
|
|
||||||
#Fill in the remarking form and submit.
|
#Fill in the remarking form and submit.
|
||||||
|
@ -172,7 +172,7 @@ class Student(Actor):
|
||||||
|
|
||||||
#Locate the create course group button and click it.
|
#Locate the create course group button and click it.
|
||||||
wait2 = WebDriverWait(driver, 10)
|
wait2 = WebDriverWait(driver, 10)
|
||||||
create_group = wait2.until(EC.presence_of_element_located((By.ID, "g_create_btn")))
|
create_group = wait2.until(EC.presence_of_element_located((By.ID, "create_group_btn")))
|
||||||
create_group.click()
|
create_group.click()
|
||||||
|
|
||||||
#Fill in the course group form and create.
|
#Fill in the course group form and create.
|
||||||
|
@ -180,9 +180,9 @@ class Student(Actor):
|
||||||
group_form = wait3.until(EC.presence_of_element_located((By.ID, "frm")))
|
group_form = wait3.until(EC.presence_of_element_located((By.ID, "frm")))
|
||||||
timeStr = self.utility.getTime()
|
timeStr = self.utility.getTime()
|
||||||
dateStr = self.utility.getTodayDate()
|
dateStr = self.utility.getTodayDate()
|
||||||
group_name = group_form.find_element(By.ID, "g_name")
|
group_name = group_form.find_element(By.ID, "group_name")
|
||||||
group_name.send_keys("TESTGROUP"+str(dateStr)+str(timeStr))
|
group_name.send_keys("TESTGROUP"+str(dateStr)+str(timeStr))
|
||||||
create = group_form.find_element(By.XPATH, "//div[2]/div/button[1]")
|
create = driver.find_element(By.XPATH, "/html/body/div[7]/div[2]/div/button[1]")
|
||||||
create.click()
|
create.click()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ class MyUtility:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
driver = webdriver.Chrome()
|
driver = webdriver.Chrome()
|
||||||
|
driver.maximize_window()
|
||||||
driver.get(self.getPageURL())
|
driver.get(self.getPageURL())
|
||||||
return driver
|
return driver
|
||||||
except:
|
except:
|
||||||
|
@ -69,11 +70,11 @@ class MyUtility:
|
||||||
try:
|
try:
|
||||||
driver = self.getSession()
|
driver = self.getSession()
|
||||||
WebDriverWait(driver, 10)
|
WebDriverWait(driver, 10)
|
||||||
username = driver.find_element(By.ID, "uname")
|
username = driver.find_element(By.ID, "user_name")
|
||||||
username.send_keys(obj.getStudentID())
|
username.send_keys(obj.getStudentID())
|
||||||
password = driver.find_element(By.ID, "upass")
|
password = driver.find_element(By.ID, "user_password")
|
||||||
password.send_keys(obj.getPassword())
|
password.send_keys(obj.getPassword())
|
||||||
login = driver.find_element(By.ID, "log_btn")
|
login = driver.find_element(By.ID, "login_btn")
|
||||||
login.click()
|
login.click()
|
||||||
return driver
|
return driver
|
||||||
except:
|
except:
|
||||||
|
@ -104,26 +105,35 @@ class MyUtility:
|
||||||
driver = self.getSession()
|
driver = self.getSession()
|
||||||
wait = WebDriverWait(driver, 10, ignored_exceptions='StaleElementReferenceException')
|
wait = WebDriverWait(driver, 10, ignored_exceptions='StaleElementReferenceException')
|
||||||
|
|
||||||
#Locate the signup form and fill in the student ID
|
#Click the sign up button, and fill the sign up form
|
||||||
signup_form = wait.until(EC.presence_of_element_located((By.ID, "signup_frm")))
|
signup_btn = wait.until(EC.presence_of_element_located((By.ID, "signup_link")))
|
||||||
student_id = signup_form.find_element(By.ID, "std_id")
|
signup_btn.click()
|
||||||
|
|
||||||
|
#Find and fill full student name
|
||||||
|
wait2 = WebDriverWait(driver, 10)
|
||||||
|
signup_form = wait2.until(EC.presence_of_element_located((By.ID, "signup_form")))
|
||||||
|
name_field = signup_form.find_element(By.ID, "full_name")
|
||||||
|
name_field.send_keys(name)
|
||||||
|
|
||||||
|
#Find and fill student ID
|
||||||
|
student_id = signup_form.find_element(By.ID, "student_id")
|
||||||
std_id = self.fetch_new_student_id()
|
std_id = self.fetch_new_student_id()
|
||||||
student_id.send_keys(std_id)
|
student_id.send_keys(std_id)
|
||||||
next_btn = signup_form.find_element(By.ID, "next_btn")
|
|
||||||
next_btn.click()
|
|
||||||
|
|
||||||
#Fill in student data and sign up.
|
#Find and fill email
|
||||||
wait2 = WebDriverWait(driver, 10, ignored_exceptions='StaleElementReferenceException')
|
email_field = signup_form.find_element(By.ID, "email")
|
||||||
reg_form = wait2.until(EC.presence_of_element_located((By.ID, "frm")))
|
|
||||||
name_field = reg_form.find_element(By.XPATH, "//form/input[2]")
|
|
||||||
name_field.send_keys(name)
|
|
||||||
email_field = reg_form.find_element(By.XPATH, "//form/input[3]")
|
|
||||||
email_field.send_keys(email)
|
email_field.send_keys(email)
|
||||||
password_field = reg_form.find_element(By.XPATH, "//form/input[4]")
|
|
||||||
|
#Find and fill password
|
||||||
|
password_field = signup_form.find_element(By.ID, "password1")
|
||||||
password_field.send_keys(password)
|
password_field.send_keys(password)
|
||||||
re_password_field = reg_form.find_element(By.XPATH, "//form/input[5]")
|
|
||||||
|
#Find and fill password confirmation
|
||||||
|
re_password_field = signup_form.find_element(By.ID, "password2")
|
||||||
re_password_field.send_keys(password)
|
re_password_field.send_keys(password)
|
||||||
submit = reg_form.find_element(By.XPATH, "//form/input[6]")
|
|
||||||
|
#Sign up new student
|
||||||
|
submit = signup_form.find_element(By.ID, "signup_btn")
|
||||||
submit.click()
|
submit.click()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -165,8 +175,9 @@ class MyUtility:
|
||||||
- date: formatted date string.
|
- date: formatted date string.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
date = datetime.datetime.today().strftime ('%d%m%Y')
|
date = datetime.datetime.today() + datetime.timedelta(days=1)
|
||||||
return date
|
date_str = date.strftime ('%m%d%Y')
|
||||||
|
return date_str
|
||||||
|
|
||||||
def getTomorrowDate(self):
|
def getTomorrowDate(self):
|
||||||
|
|
||||||
|
@ -177,8 +188,8 @@ class MyUtility:
|
||||||
- date: formatted date string.
|
- date: formatted date string.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
date = datetime.datetime.today() + datetime.timedelta(days=1)
|
date = datetime.datetime.today() + datetime.timedelta(days=2)
|
||||||
date_str = date.strftime('%d%m%Y')
|
date_str = date.strftime('%m%d%Y')
|
||||||
return date_str
|
return date_str
|
||||||
|
|
||||||
def getYesterdayDate(self):
|
def getYesterdayDate(self):
|
||||||
|
@ -191,7 +202,7 @@ class MyUtility:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
date = datetime.datetime.today() - datetime.timedelta(days=1)
|
date = datetime.datetime.today() - datetime.timedelta(days=1)
|
||||||
date_str = date.strftime('%d%m%Y')
|
date_str = date.strftime('%m%d%Y')
|
||||||
return date_str
|
return date_str
|
||||||
|
|
||||||
def storeCourseCode(self, course_code):
|
def storeCourseCode(self, course_code):
|
||||||
|
@ -302,3 +313,12 @@ class MyUtility:
|
||||||
ls.append(chr(random.randint(97,122)))
|
ls.append(chr(random.randint(97,122)))
|
||||||
|
|
||||||
return ''.join(ls)
|
return ''.join(ls)
|
||||||
|
|
||||||
|
def clean(self, file):
|
||||||
|
"""This method clean the test scripts directory by resetting some
|
||||||
|
.txt files.
|
||||||
|
"""
|
||||||
|
|
||||||
|
#Clean 'course_code.txt' file
|
||||||
|
f = open(file, "w+")
|
||||||
|
f.close()
|
||||||
|
|
Loading…
Reference in New Issue