174 lines
7.9 KiB
PHP
174 lines
7.9 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
// If the user is not logged in, redirect to the login page.
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
require_once 'includes/analysis_helpers.php';
|
|
require_once 'includes/report_helpers.php';
|
|
|
|
$userName = $_SESSION['user_name'] ?? 'User';
|
|
$credibilityScore = null;
|
|
$strengths = [];
|
|
$weaknesses = [];
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if (isset($_POST['save_report'])) {
|
|
save_report($_SESSION['user_id'], $_POST['report_type'], $_POST['report_data']);
|
|
} else {
|
|
$resumeText = $_POST['resume_text'] ?? '';
|
|
|
|
$achievementsScore = calculate_achievements_score($resumeText);
|
|
$durationScore = calculate_duration_score($resumeText);
|
|
$skillsScore = calculate_skills_score($resumeText);
|
|
$coursesScore = calculate_courses_score($resumeText);
|
|
$projectQualityScore = calculate_project_quality_score($resumeText);
|
|
|
|
$credibilityScore = $achievementsScore + $durationScore + $skillsScore + $coursesScore + $projectQualityScore;
|
|
|
|
if ($achievementsScore > 15) {
|
|
$strengths[] = 'Solid list of achievements.';
|
|
} else {
|
|
$weaknesses[] = 'Missing real-world metrics and quantifiable achievements.';
|
|
}
|
|
|
|
if ($durationScore > 10) {
|
|
$strengths[] = 'Good duration of experience.';
|
|
} else {
|
|
$weaknesses[] = 'Short duration of experience.';
|
|
}
|
|
|
|
if ($skillsScore > 10) {
|
|
$strengths[] = 'Good list of skills.';
|
|
} else {
|
|
$weaknesses[] = 'Missing relevant skills.';
|
|
}
|
|
|
|
if ($coursesScore > 7) {
|
|
$strengths[] = 'Good list of courses and certifications.';
|
|
} else {
|
|
$weaknesses[] = 'Missing courses and certifications.';
|
|
}
|
|
|
|
if ($projectQualityScore > 7) {
|
|
$strengths[] = 'Solid project list.';
|
|
} else {
|
|
$weaknesses[] = 'Missing project details and links.';
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Resume Credibility Score - <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Deris AI'); ?></title>
|
|
|
|
<!-- Google Fonts -->
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
|
|
<!-- Bootstrap CSS -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
|
|
<!-- Bootstrap Icons -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
|
|
<!-- Custom CSS -->
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<header class="navbar navbar-expand-lg navbar-light bg-light">
|
|
<div class="container">
|
|
<a class="navbar-brand fw-bold" href="dashboard.php"><img src="assets/pasted-20251128-163837-87f97f7a.png" alt="Deris AI Logo" style="height: 30px; margin-right: 10px;"></a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item"><span class="navbar-text me-3">Welcome, <?php echo htmlspecialchars($userName); ?>!</span></li>
|
|
<li class="nav-item"><a class="btn btn-outline-primary" href="logout.php">Logout</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container mt-5">
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-10">
|
|
<h1 class="display-5 fw-bold mb-4">Resume Credibility Score</h1>
|
|
<p class="lead mb-5">Paste your resume text below to calculate its credibility score.</p>
|
|
|
|
<div id="credibility-widget" class="card shadow-lg">
|
|
<div class="card-body p-4 p-lg-5">
|
|
<form id="credibility-form" method="post">
|
|
<div class="mb-3">
|
|
<label for="resume-text" class="form-label visually-hidden">Paste your resume text here</label>
|
|
<textarea class="form-control form-control-lg" id="resume-text" name="resume_text" rows="12" placeholder="Paste your resume text here..."></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary btn-lg w-100">
|
|
<span class="button-text">Calculate Credibility Score</span>
|
|
<span class="spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ($credibilityScore !== null): ?>
|
|
<div id="results-widget" class="card shadow-lg mt-5">
|
|
<div class="card-body p-4 p-lg-5">
|
|
<h2 class="card-title mb-4">Your Resume Credibility Score</h2>
|
|
<div class="score-circle mx-auto mb-4">
|
|
<span id="score-value"><?php echo $credibilityScore; ?></span>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h3 class="h4">Strengths:</h3>
|
|
<ul class="list-group list-group-flush text-start">
|
|
<?php foreach ($strengths as $strength): ?>
|
|
<li class="list-group-item"><i class="bi bi-check-circle-fill text-success me-2"></i><?php echo $strength; ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h3 class="h4">Weaknesses:</h3>
|
|
<ul class="list-group list-group-flush text-start">
|
|
<?php foreach ($weaknesses as $weakness): ?>
|
|
<li class="list-group-item"><i class="bi bi-exclamation-triangle-fill text-danger me-2"></i><?php echo $weakness; ?></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<form method="post" class="mt-4">
|
|
<input type="hidden" name="save_report" value="true">
|
|
<input type="hidden" name="report_type" value="credibility_score">
|
|
<input type="hidden" name="report_data" value='<?php echo json_encode(["score" => $credibilityScore, "strengths" => $strengths, "weaknesses" => $weaknesses]); ?>'>
|
|
<button type="submit" class="btn btn-secondary btn-lg">Save Report</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="bg-light text-center py-4 mt-5">
|
|
<div class="container">
|
|
<p class="mb-0">© <?php echo date("Y"); ?> <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Deris AI'); ?>. All Rights Reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Bootstrap JS Bundle -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
|
|
<!-- Custom JS -->
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|