36459-vm/student/lei_dashboard.php
2026-05-27 14:29:58 +05:30

136 lines
2.8 KiB
PHP

<?php
session_start();
if (!isset($_SESSION['student_id'])) {
header("Location: /rs_lab/student/login.php");
exit;
}
include("../config.php");
$student_id = 1; // demo, later session-la varum
$sql = "SELECT * FROM learning_effort_index WHERE student_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $student_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows == 0) {
die("LEI not calculated yet");
}
$data = $result->fetch_assoc();
$total_lei = $data['total_lei'];
$level = $data['lei_level'];
$consistency = $data['consistency_score'];
$attempts = $data['attempt_score'];
$improvement = $data['improvement_score'];
$style = $data['style_match_score'];
?>
<!DOCTYPE html>
<html>
<head>
<title>My Learning Effort Index</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f8fafc;
padding: 20px;
}
.card {
max-width: 700px;
margin: auto;
background: #fff;
border-radius: 12px;
padding: 25px;
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.lei-score {
text-align: center;
font-size: 52px;
font-weight: bold;
color: #0b8c9f;
}
.level {
text-align: center;
font-size: 18px;
margin-bottom: 20px;
}
.bar {
margin: 12px 0;
}
.label {
font-size: 14px;
margin-bottom: 4px;
}
.progress {
background: #e5e7eb;
border-radius: 8px;
overflow: hidden;
}
.progress div {
height: 14px;
background: #0b8c9f;
}
.tip {
background: #ecfeff;
padding: 15px;
border-radius: 8px;
margin-top: 20px;
font-size: 14px;
}
</style>
</head>
<body>
<div class="card">
<div class="lei-score"><?= $total_lei ?>/100</div>
<div class="level">Learning Effort Level: <b><?= $level ?></b></div>
<div class="bar">
<div class="label">Consistency</div>
<div class="progress"><div style="width: <?= $consistency * 4 ?>%"></div></div>
</div>
<div class="bar">
<div class="label">Attempts</div>
<div class="progress"><div style="width: <?= $attempts * 4 ?>%"></div></div>
</div>
<div class="bar">
<div class="label">Improvement</div>
<div class="progress"><div style="width: <?= $improvement * 3.3 ?>%"></div></div>
</div>
<div class="bar">
<div class="label">Learning Style Match</div>
<div class="progress"><div style="width: <?= $style * 5 ?>%"></div></div>
</div>
<div class="tip">
<?php
if ($total_lei >= 80) {
echo "Excellent consistency! Keep going 🚀";
} elseif ($total_lei >= 60) {
echo "Good effort. Try learning more regularly to improve 👍";
} else {
echo "Start small. Regular practice will boost your LEI 💡";
}
?>
</div>
</div>
</body>
</html>