Courses.php: indent code.

Bug203-Hui
Lan Hui 2021-10-20 23:21:07 +08:00
parent d2443230c9
commit 2d57786dc6
1 changed files with 474 additions and 645 deletions

View File

@ -2,42 +2,30 @@
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\
@ -64,23 +52,23 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
} }
}); });
}catch(e){ alert(e); } } catch (e) {
alert(e);
}
} }
</script> </script>
<?php <?php
if(!empty($_GET["course"])) if (!empty($_GET["course"])) {
{
$course_url = $_GET["course"]; $course_url = $_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 { while($row = mysqli_fetch_assoc($result)) { } else {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name']; $name = $row['Course_Name'];
$code = $row['Course_Code']; $code = $row['Course_Code'];
$faculty = $row['Faculty']; $faculty = $row['Faculty'];
@ -103,7 +91,6 @@ 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 = $_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'");
@ -131,7 +118,6 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$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.";
@ -174,7 +160,6 @@ 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>
@ -187,12 +172,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------------------------------------
@ -234,7 +219,6 @@ 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>
@ -247,7 +231,6 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<?php <?php
} }
} }
} }
echo "</div>"; echo "</div>";
@ -267,22 +250,16 @@ 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 {
} else { while($row = mysqli_fetch_assoc($result)) { while ($row = mysqli_fetch_assoc($result)) {
$marks = $row['Marks']; $marks = $row['Marks'];
$title = $row['Title']; $title = $row['Title'];
$ins = $row['Instructions']; $ins = $row['Instructions'];
@ -308,15 +285,19 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
$full_link = $full_link . " &nbsp; | &nbsp <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>"; $full_link = $full_link . " &nbsp; | &nbsp <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)) {$count_subs=$row['cnt'];} while ($row = mysqli_fetch_assoc($resultx1)) {
$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){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}} if (mysqli_num_rows($resultx2) == 0) {
$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;
@ -329,25 +310,17 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
. "<span class='btn-default'> &nbsp;&nbsp; $count_subs Submissions ( $count_marked Marked ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='Courses.php?course=" . $url . "&act=edit&cid=" . $id . "'>Edit</a>&nbsp;&nbsp; |&nbsp;&nbsp;<a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a> &nbsp;&nbsp; |&nbsp;&nbsp; <a href='#' onclick='extend_deadline($id)'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>" . "<span class='btn-default'> &nbsp;&nbsp; $count_subs Submissions ( $count_marked Marked ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='Courses.php?course=" . $url . "&act=edit&cid=" . $id . "'>Edit</a>&nbsp;&nbsp; |&nbsp;&nbsp;<a href='~\..\Submissions.php?id=$id&header=$header&total=$marks' onclick=''> View </a> &nbsp;&nbsp; |&nbsp;&nbsp; <a href='#' onclick='extend_deadline($id)'> Extend Deadline </a> </span> <hr> Attachments : $full_link </span>"
. "&nbsp;&nbsp;</div> . "&nbsp;&nbsp;</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'];
@ -357,17 +330,11 @@ 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
@ -379,23 +346,20 @@ 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) {
if(mysqli_num_rows($result)==0) } else {
{} else { while($row = mysqli_fetch_assoc($result)) { 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'];
@ -413,8 +377,6 @@ 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'>
@ -422,15 +384,13 @@ where course_ta.Course_ID=$id");
<br> <span style='font-size:8pt'>Faculty : $faculty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Year : $academic &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lecturer :$lecturer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TA:$ta </span> <br> <span style='font-size:8pt'>Faculty : $faculty &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Year : $academic &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lecturer :$lecturer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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`
@ -438,11 +398,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 { while($row = mysqli_fetch_assoc($result)) { } else {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['ID']; $id = $row['ID'];
$name = $row['Course_Name']; $name = $row['Course_Name'];
@ -455,21 +415,12 @@ WHERE Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'"
$std_name is Requesting to join <br> [($code) - $name ] &nbsp;&nbsp;&nbsp;&nbsp; <br><a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=yes' class='btn-sm btn-success' onclick=return confirm(\"are you sure to join this course?\")' > Accept </a> $std_name is Requesting to join <br> [($code) - $name ] &nbsp;&nbsp;&nbsp;&nbsp; <br><a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=yes' class='btn-sm btn-success' onclick=return confirm(\"are you sure to join this course?\")' > Accept </a>
&nbsp;&nbsp;<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=no' class='btn-sm btn-danger' onclick=return confirm(\"are you sure to join this course?\")' > Decline </a> &nbsp;&nbsp;<a href='~\..\Script.php?AcceptStudent=y&id=$id&rs=no' class='btn-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") { ?>
@ -494,10 +445,8 @@ 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
@ -511,16 +460,12 @@ 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-->
@ -540,34 +485,23 @@ 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"])) if (!empty($_GET["search"]) || !empty($_GET["faculty"])) {
{
$search = trim($_GET["search"]); $search = trim($_GET["search"]);
$faculty = $_GET["faculty"]; $faculty = $_GET["faculty"];
if ($faculty == "") {
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 Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id)");
} } else {
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`
@ -575,11 +509,8 @@ if( $_SESSION['user_type']=="Student")
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 Faculty='$faculty' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id)");
} }
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)) {
@ -592,8 +523,7 @@ 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";
} }
@ -615,8 +545,7 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
where course_students_table.Student_ID=$student_id"); where course_students_table.Student_ID=$student_id");
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)) {
@ -629,15 +558,12 @@ 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) &nbsp;&nbsp;&nbsp; <i class='fa fa-check-circle'></i> $Status &nbsp;&nbsp;&nbsp;&nbsp; <a href='~\..\Course.php?url=$url' class='btn-sm btn-primary'> Open</a> ($code) - $name <br>($url) &nbsp;&nbsp;&nbsp; <i class='fa fa-check-circle'></i> $Status &nbsp;&nbsp;&nbsp;&nbsp; <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>
@ -646,32 +572,6 @@ 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'>
@ -684,12 +584,14 @@ 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 { while($row = mysqli_fetch_assoc($result)) { } else {
while ($row = mysqli_fetch_assoc($result)) {
$fname = $row['Faculty']; $fname = $row['Faculty'];
echo "<option value=''> Search by faculty </option> <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>
@ -701,87 +603,14 @@ 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>