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

137 lines
2.5 KiB
PHP

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$type = $_GET['type'] ?? '';
$name = $_GET['name'] ?? '';
$roll = $_GET['roll'] ?? '';
$class = $_GET['class'] ?? '';
if ($type === '' || $name === '') {
die("Invalid request");
}
if ($type === 'reinforcement') {
$title = "Reinforcement Track Completed";
} else {
$title = "Achievement Badge";
}
header("Content-Type: text/html; charset=UTF-8");
?>
<!DOCTYPE html>
<html>
<head>
<title>Learning Badge | RS Learning Lab</title>
<style>
body{
margin:0;
font-family: "Segoe UI", Arial, sans-serif;
background: radial-gradient(circle at top, #020617, #0f172a);
display:flex;
align-items:center;
justify-content:center;
height:100vh;
}
.badge{
background:#ffffff;
width:760px;
padding:60px 50px;
border-radius:18px;
text-align:center;
box-shadow:0 25px 60px rgba(0,0,0,.45);
}
.badge h1{
margin:0;
color:#020617;
font-size:32px;
letter-spacing:.5px;
}
.badge h2{
margin:18px 0 30px;
color:#0b8c9f;
font-weight:600;
}
.details{
font-size:18px;
color:#334155;
margin-bottom:40px;
}
.details p{
margin:6px 0;
}
.actions{
display:flex;
justify-content:center;
gap:20px;
}
.btn{
padding:14px 28px;
border-radius:999px;
font-weight:600;
border:none;
cursor:pointer;
font-size:15px;
}
.print{
background:#0b8c9f;
color:#ffffff;
}
.next{
background:#020617;
color:#22c55e;
}
.footer{
margin-top:35px;
font-size:13px;
color:#64748b;
}
/* PRINT MODE FIX */
@media print {
.actions {
display: none !important;
}
body {
background: #ffffff !important;
}
}
</style>
</head>
<body>
<div class="badge">
<h1>RS Learning Lab</h1>
<h2><?= htmlspecialchars($title) ?></h2>
<div class="details">
<p><strong><?= htmlspecialchars($name) ?></strong></p>
<p>Roll No: <?= htmlspecialchars($roll) ?></p>
<p>Class: <?= htmlspecialchars($class) ?></p>
</div>
<div class="actions">
<button class="btn print" onclick="window.print()">⬇ Download / Print Badge</button>
<button class="btn next" onclick="location.href='/rs_lab/final_track.php?name=<?=urlencode($name)?>&roll=<?=urlencode($roll)?>&class=<?=urlencode($class)?>'">
▶ Proceed to Final Track
</button>
</div>
<div class="footer">
© RS Learning Lab — Learning Behaviour Platform
</div>
</div>
</body>
</html>