PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ] ); } catch (PDOException $e) { die("DB connection failed"); } /* =============================== INPUT ================================ */ $roll_no = $_GET['roll'] ?? null; if (!$roll_no) { die("Student not specified"); } /* =============================== FETCH LEARNING PROFILE ================================ */ $stmt = $pdo->prepare(" SELECT * FROM learning_profiles WHERE roll_no = :roll LIMIT 1 "); $stmt->execute([':roll' => $roll_no]); $profile = $stmt->fetch(); if (!$profile) { die("Learning profile not found"); } $style_scores = json_decode($profile['style_scores'], true) ?? []; $learning_signals = json_decode($profile['learning_signals'], true) ?? []; /* =============================== FETCH MOMENTUM ================================ */ $stmt = $pdo->prepare(" SELECT momentum_score, momentum_state, updated_at FROM learning_momentum WHERE roll_no = :roll LIMIT 1 "); $stmt->execute([':roll' => $roll_no]); $momentum = $stmt->fetch(); $momentum_score = $momentum['momentum_score'] ?? 50; $momentum_state = $momentum['momentum_state'] ?? "Building"; $momentum_updated = $momentum['updated_at'] ?? null; /* =============================== MOMENTUM UI MAPPING ================================ */ $momentum_color = [ "Applying" => "#22c55e", "Stabilizing" => "#38bdf8", "Building" => "#facc15", "Reset" => "#ef4444" ]; $momentum_text = [ "Applying" => "Applying concepts confidently", "Stabilizing" => "Understanding is settling steadily", "Building" => "Learning habit is forming", "Reset" => "Needs calm practice reinforcement" ]; $bar_color = $momentum_color[$momentum_state] ?? "#38bdf8"; ?>
Student Name
Roll No
Class