File: /home/bibuzptr/elearning.bibu-edu.us/lecturers/student-progress.php
<?php
ob_start();
session_start();
include_once('../includes/db_connect.php');
$today = date('Y-m-d');
$now = date('Y-m-d H:i:s');
$year = date("Y");
if(isset($_SESSION["OpenUniL^###DHSG"])){
$email = $_SESSION["OpenUniL^###DHSG"];
$chkuser = mysqli_query($con,"SELECT * FROM lecturers WHERE email='$email'");
while($row = mysqli_fetch_assoc($chkuser)){
$lecturerid = $row["id"];
$name = $row["fullname"];
$icon = $row["profilepic"];
}
$studentid=$_GET["student"];
$courseurl=$_GET["course"];
$studentdetails=mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM students WHERE id='$studentid'"));
$coursedetails=mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM courses WHERE url='$courseurl'"));
$courseid=$coursedetails["id"];
}
else{
header("Location:../staff-login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<title>Lecturer Dashboard | Breakthrough Open University</title>
<link rel="shortcut icon" type="image/x-icon" href="../assets/img/logo.png">
<!--<link rel="stylesheet" href="../assets/css/bootstrap.min.css">-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/css/bp.min.css">
<link rel="stylesheet" href="../assets/plugins/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="../assets/plugins/fontawesome/css/all.min.css">
<link rel="stylesheet" href="../assets/css/feather.css">
<link rel="stylesheet" href="../assets/css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
<script>
$('#myTab a').click(function (e) {
e.preventDefault()
$(this).tab('show')
})
</script>
<style>
#dash{
background: #102044;
border-left: 6px solid #06bf1c;
color: #fff;
}
.nav-link{
color:#fff;
}
@media (max-width: 392.98px) {
#pgc{
margin-top:50%;
background: #fafafa;
}
}
@media (max-width: 767.98px) {
#pgc{
margin-top:42%;
background: #fafafa;
}
}
@media (max-width: 992.98px) {
#pgc{
margin-top:20%;
background: #fafafa;
}
}
@media (min-width: 992.98px) {
#pgc{
margin-top:11%;
background: #fafafa;
}
}
</style>
</head>
<body>
<div class="main-wrapper">
<?php //include_once("../includes/header-course.php") ?>
<div style="margin-top:0%;" class="course-student-header header-fixed">
<div class="container">
<div class="student-group">
<div class="course-group ">
<div class="course-group-img d-flex">
<a href="#"><img src="../lecturer-images/<?php echo $icon ?>" alt class="img-fluid"></a>
<div class="d-flex align-items-center">
<div class="course-name">
<h4><a href="lecturer-profile.php"><?php echo $name ?></a></h4>
</div>
</div>
</div>
<!--<div class="course-share ">-->
<!--<a href="javascript:void(0);" class="btn btn-primary">Account Settings</a>-->
<!--</div>-->
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark1">
<div class="container-fluid">
<a class="navbar-brand" href="#"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link" href="../">Home</a>
<a class="nav-link" href="../courses">All Courses</a>
<a class="nav-link active" href="index.php">Dashboard</a>
<a class="nav-link" href="my-students.php">My Students</a>
<a class="nav-link" href="logout.php">Logout</a>
</div>
</div>
</div>
</nav>
</div>
</div>
<div id="pgc" class="page-content1">
<div class="container1" style="margin-top:2%;margin-left:2%; margin-right:2%">
<div class="row">
<div class="col-xl-12 col-md-12">
<div class="settings-widget">
<div class="settings-inner-blk p-0">
<div class="comman-space pb-0">
<div class="filter-grp ticket-grp d-flex align-items-center justify-content-between">
</div>
<div class="settings-tickets-blk table-responsive">
<div class="filter-grp ticket-grp d-flex align-items-center justify-content-between">
<h3><?php echo $studentdetails["name"] ?></h3>
<h3><?php echo $coursedetails["title"] ?></h3>
</div>
<div class="panel with-nav-tabs panel-default">
<div class="panel-heading">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#DailyIncome" role="tab" data-toggle="tab">Learning Progress</a></li>
<li><a href="#YearlyIncome" role="tab" data-toggle="tab">Assignments Uploaded</a></li>
<li><a href="#Clients" role="tab" data-toggle="tab">Grades</a></li>
</ul>
<!--<ul class="nav nav-tabs">-->
<!-- <li class="active"><a href="#tab1" data-toggle="tab"><i class="fa fa-spinner"></i> Learning Progress</a></li>-->
<!-- <li><a href="#tab2" data-toggle="tab"><i class="fa fa-books"></i> Assignments Uploaded</a></li>-->
<!-- <li><a href="#tab3" data-toggle="tab"><i class="fa fa-star"></i> Grades</a></li>-->
<!--</ul>-->
</div>
<div class="panel-body">
<!-- Content -->
<div class="tab-content">
<div class="tab-pane fade in active" id="DailyIncome">
<div id="DailyIncomeChart" class="DailyIncomePanel">
<div class="table-responsive row">
<table id="dataTable" class="table table-nowrap mb-0 table-striped">
<thead>
<tr>
<th>Unit Title</th>
<th>Lessons</th>
<th>Period</th>
<th>Progress</th>
</tr>
</thead>
<tbody>
<?php
$listcat=mysqli_query($con,"SELECT * FROM units WHERE courseid='$courseid' ORDER BY id ASC");
while($lc=mysqli_fetch_assoc($listcat)){
$unitid=$lc["id"];
?>
<td>
<a style="display:none" target="_blank" href="../course-details/<?php echo $coursedet["url"];?>"><?php echo $lc['unittitle'] ?></a>
<h6 class="cou-title">
<a class="collapsed" data-bs-toggle="collapse" href="#collapse<?php echo $unitid ?>" aria-expanded="false"><?php echo $lc['unittitle'] ?></a>
</h6>
<div id="collapse<?php echo $unitid ?>" class="card-collapse collapse" style>
<ul>
<?php
$lesson=mysqli_query($con,"SELECT * FROM lessons WHERE unitid='$unitid'");
while($lsn=mysqli_fetch_assoc($lesson)){
$lessonid=$lsn["id"];
$existing=mysqli_num_rows(mysqli_query($con,"SELECT * FROM learningprogress WHERE lessonid='$lessonid' AND studentid='$studentid'"));
?>
<li>
<p>
<?php echo $lsn["lessontitle"] ?>
<?php if($existing>0){ ?>
<i style="color:green" class="fa fa-check"></i>
<?php }else{ ?>
<i style="color:orange" class="fa fa-spinner"></i>
<?php } ?>
</p>
</li>
<?php } ?>
</ul>
</div>
</td>
<td><?php echo mysqli_num_rows(mysqli_query($con,"SELECT * FROM lessons WHERE unitid='$unitid'")) ?> Lessons</td>
<td><?php echo $lc['hours'] ?></td>
<td>
<?php
$lessonsdone=mysqli_fetch_assoc(mysqli_query($con,"SELECT COUNT(*) as theprogress FROM learningprogress WHERE studentid='$studentid' AND unitid='$unitid'"))["theprogress"];
$listlessons=mysqli_query($con,"SELECT * FROM lessons WHERE unitid='$unitid'");
$nooflessons=mysqli_num_rows($listlessons);
$percentdone=number_format($lessonsdone/$nooflessons*100,2);
?>
<div class="progress-stip">
<div class="progress-bar bg-success progress-bar-striped active-stip1" role="progressbar" aria-valuenow="<?php echo $percentdone ?>"
aria-valuemin="0" aria-valuemax="100" style="width:<?php echo $percentdone ?>%"></div><?php echo $percentdone ?>%
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="YearlyIncome">
<div id="YearlyIncomeChart" class="YearlyIncomePanel">
<div class="table-responsive row">
<table id="dataTable11" class="table table-striped table-nowrap mb-2">
<thead>
<th>Question</th>
<th>Answer Submitted</th>
<th>Max Score</th>
<th>Student Score & Grading Date</th>
</thead>
<tbody>
<?php
$assq=mysqli_query($con,"SELECT quizanswer.*,docquizs.docessay,docquizs.docmarks FROM quizanswer,docquizs WHERE quizanswer.quizid=docquizs.id AND studentid='$studentid' AND lessonid IN (SELECT lessons.id FROM lessons, units WHERE lessons.unitid=units.id AND units.courseid='$courseid')");
while($aq=mysqli_fetch_assoc($assq)){
?>
<tr>
<td><?php echo $aq["docessay"] ?></td>
<td><a target="_blank" href="../docanswers/<?php echo $aq["doc"];?>"><i class="fa fa-file fa-2x"></i></a></td>
<td><?php echo $aq["docmarks"] ?></td>
<td>
<form method="post">
<input type="number" value="<?php echo $aq["marks"] ?>" maxvalue="<?php echo $aq["docmarks"] ?>" class="form-control studentscore" id="<?php echo $aq['id'] ?>" data-maxscore="<?php echo $aq["docmarks"] ?>" required>
<input type="date" value="<?php echo $aq["gradedon"] ?>" class="form-control gradedate" id="<?php echo $aq['id'] ?>" required>
<p id="status11"></p>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="Clients">
<div class="table-responsive row">
<table id="dataTable12" class="table table-striped table-nowrap mb-2">
<thead>
<th>Unit</th>
<th>Lesson</th>
<th>Question</th>
<th>Student Score / Max Score</th>
<th>Date Graded</th>
<th>Action</th>
</thead>
<tbody>
<?php
$assq=mysqli_query($con,"SELECT quizanswer.*,lessons.lessontitle,units.unittitle,docquizs.docmarks,docquizs.docessay FROM quizanswer,lessons,units,docquizs WHERE quizanswer.quizid=docquizs.id AND quizanswer.lessonid=lessons.id AND lessons.unitid=units.id AND quizanswer.marks!='' AND studentid='$studentid' AND lessonid IN (SELECT lessons.id FROM lessons, units WHERE lessons.unitid=units.id AND units.courseid='$courseid') ORDER BY quizanswer.id DESC");
while($aq=mysqli_fetch_assoc($assq)){
?>
<tr>
<td><?php echo $aq["unittitle"] ?></td>
<td><?php echo $aq["lessontitle"] ?></td>
<td><?php echo $aq["docessay"] ?></td>
<td><?php echo $aq["marks"]."/".$aq["docmarks"] ?></td>
<td><?php echo date("d/m/Y",strtotime($aq["gradedon"])) ?></td>
<td><a style="display:none" class="btn btn-primary btn-md" href="../student-progress?course=<?php echo $url ?>&&student=<?php echo $studentid ?>">Update Date</a></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--<script src="https://olickhom.co.ke/inventory/assets/bootstrap/bootstrap.min.js"></script>-->
<script>
// $(function() {
$('.studentscore').change(function(){
var quizid =$(this).attr("id");
var maxscore =$(this).attr("data-maxscore");
var score =$(this).val();
if(parseInt(score)>parseInt(maxscore)){
$("#status11").html("<p class=' bg-danger'><i class='fa fa-exclamation-circle'></i> Student score cannot be greater than max score.</p>");
}else{
$("#status11").html("<p class=' bg-success'><i class='fa fa-spinner fa-pulse'></i> updating score...</p>");
$.ajax({
method: "POST",
url: "app/quizscore",
data: {quizid:quizid,score:score},
cache:false
}).done(function(data){
if(data.status == "200"){
$("#status11").html("<p class=' bg-success'><i class='fa fa-check'></i> score updated successfully.</p>");
//window.location.replace("../course-students/<?php echo $url ?>");
location.reload()
}
if(data.message == "ERROR"){
$("#status11").html("<p class=' bg-danger'><i class='fa fa-exclamation-circle'></i> An error occured, please try again later.</p>");
}
});
}
});
$('.gradedate').change(function(){
var quizid1 =$(this).attr("id");
var gdate =$(this).val();
$("#status11").html("<p class=' bg-success'><i class='fa fa-spinner fa-pulse'></i> updating date...</p>");
$.ajax({
method: "POST",
url: "app/quizscore",
data: {quizid1:quizid1,gdate:gdate},
cache:false
}).done(function(data){
if(data.status == "200"){
$("#status11").html("<p class=' bg-success'><i class='fa fa-check'></i> date updated successfully.</p>");
//window.location.replace("../course-students/<?php echo $url ?>");
location.reload()
}
if(data.message == "ERROR"){
$("#status11").html("<p class=' bg-danger'><i class='fa fa-exclamation-circle'></i> An error occured, please try again later.</p>");
}
});
});
// });
</script>
<?php include_once("../includes/footer-course.php") ?>
<script>
$('#dataTable').DataTable({"aaSorting" : []});
$('#dataTable11').DataTable({"aaSorting" : []});
$('#dataTable12').DataTable({"aaSorting" : []});
</script>
</div>
</body>
</html>