Dear Students,
Update Server-Side Logic with Client-Side UI/UX
Using WAMP and LAMP server platforms, this development approach integrates server-side logic with an
intuitive client-side interface. It’s a straightforward, efficient solution that meets company needs while
ensuring strong performance and a seamless user experience
<?php
session_start();
if (!isset($_SESSION['faculty_id'])) {
header("Location: login.php");
exit();
require_once 'db.php';
$faculty_id = $_SESSION['faculty_id'];
$sql = "SELECT name, email, profile_image FROM faculty WHERE id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$faculty_id]);
$faculty = $stmt->fetch();
$attendance_sql = "SELECT student_name, date, status FROM attendance WHERE faculty_id = ?";
$stmt = $pdo->prepare($attendance_sql);
$stmt->execute([$faculty_id]);
$attendance_records = $stmt->fetchAll();
$assignments_sql = "SELECT title, date_uploaded FROM assignments WHERE faculty_id = ?";
$stmt = $pdo->prepare($assignments_sql);
$stmt->execute([$faculty_id]);
$assignments = $stmt->fetchAll();
$leave_sql = "SELECT leave_date, status FROM leaves WHERE faculty_id = ?";
$stmt = $pdo->prepare($leave_sql);
$stmt->execute([$faculty_id]);
$leave_requests = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Faculty Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
.card-header {
font-weight: bold;
.card-body {
font-size: 1.1rem;
.profile-img {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
border: 2px solid #ffffff;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
.profile-container {
position: absolute;
top: 20px;
right: 20px;
z-index: 10;
}
.content-container {
padding-top: 70px;
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<img src="assets/college_logo.png" alt="College Logo" height="50"> <!-- College Logo -->
<span class="navbar-brand ms-3">Faculty Dashboard</span>
<div class="ml-auto">
<span class="text-muted"><?php echo htmlspecialchars($faculty['name']); ?> - Faculty</span>
</div>
</div>
</nav>
<div class="profile-container">
<?php
// Display default image if profile image is not set
$profile_image = $faculty['profile_image'] ? $faculty['profile_image'] : 'default-avatar.png';
?>
<img src="uploads/<?php echo htmlspecialchars($profile_image); ?>" alt="Profile Image"
class="profile-img">
</div>
<div class="container mt-5 content-container">
<div class="row">
<!-- Faculty Info Card -->
<div class="col-md-4">
<div class="card">
<div class="card-header">
Welcome, <?php echo htmlspecialchars($faculty['name']); ?>
</div>
<div class="card-body">
<p>Email: <?php echo htmlspecialchars($faculty['email']); ?></p>
<a href="profile.php" class="btn btn-primary">Edit Profile</a>
</div>
</div>
</div>
<!-- Attendance Management -->
<div class="col-md-8">
<div class="card mb-4">
<div class="card-header">
Student Attendance
</div>
<div class="card-body">
<h5>Mark Attendance</h5>
<form method="POST" action="mark_attendance.php">
<div class="mb-3">
<label for="student_name" class="form-label">Student Name</label>
<input type="text" class="form-control" id="student_name" name="student_name"
required>
</div>
<div class="mb-3">
<label for="attendance_status" class="form-label">Attendance Status</label>
<select class="form-control" id="attendance_status" name="attendance_status"
required>
<option value="Present">Present</option>
<option value="Absent">Absent</option>
<option value="Late">Late</option>
</select>
</div>
<div class="mb-3">
<label for="attendance_date" class="form-label">Date</label>
<input type="date" class="form-control" id="attendance_date"
name="attendance_date" required>
</div>
<button type="submit" class="btn btn-success">Mark Attendance</button>
</form>
<hr>
<h5>Attendance Records</h5>
<table class="table table-bordered">
<thead>
<tr>
<th>Student Name</th>
<th>Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($attendance_records as $record): ?>
<tr>
<td><?php echo htmlspecialchars($record['student_name']); ?></td>
<td><?php echo htmlspecialchars($record['date']); ?></td>
<td><?php echo htmlspecialchars($record['status']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<!-- Assignment Upload -->
<div class="card mb-4">
<div class="card-header">
Tutorial and Assignment Upload
</div>
<div class="card-body">
<form method="POST" action="upload_assignment.php" enctype="multipart/form-data">
<div class="mb-3">
<label for="assignment_title" class="form-label">Assignment Title</label>
<input type="text" class="form-control" id="assignment_title" name="assignment_title"
required>
</div>
<div class="mb-3">
<label for="upload_date" class="form-label">Upload Date</label>
<input type="date" class="form-control" id="upload_date" name="upload_date"
required>
</div>
<div class="mb-3">
<label for="file" class="form-label">Upload File</label>
<input type="file" class="form-control" id="file" name="file" required>
</div>
<button type="submit" class="btn btn-primary">Upload Assignment</button>
</form>
<hr>
<h5>Uploaded Assignments</h5>
<table class="table table-bordered">
<thead>
<tr>
<th>Title</th>
<th>Upload Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($assignments as $assignment): ?>
<tr>
<td><?php echo htmlspecialchars($assignment['title']); ?></td>
<td><?php echo htmlspecialchars($assignment['date_uploaded']); ?></td>
<td><a href="uploads/<?php echo htmlspecialchars($assignment['title']); ?>"
class="btn btn-info btn-sm" target="_blank">View</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<!-- Leave Request Form -->
<div class="card">
<div class="card-header">
Leave Request Form
</div>
<div class="card-body">
<form method="POST" action="request_leave.php">
<div class="mb-3">
<label for="leave_date" class="form-label">Leave Date</label>
<input type="date" class="form-control" id="leave_date" name="leave_date" required>
</div>
<div class="mb-3">
<label for="leave_reason" class="form-label">Reason</label>
<textarea class="form-control" id="leave_reason" name="leave_reason" rows="4"
required></textarea>
</div>
<button type="submit" class="btn btn-danger">Request Leave</button>
</form>
<hr>
<h5>Leave Requests</h5>
<table class="table table-bordered">
<thead>
<tr>
<th>Leave Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($leave_requests as $leave): ?>
<tr>
<td><?php echo htmlspecialchars($leave['leave_date']); ?></td>
<td><?php echo htmlspecialchars($leave['status']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]
alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>