33828-dev/instructors.php
Flatlogic Bot 5926dbfc54 main part
2025-09-02 19:37:21 +00:00

70 lines
2.5 KiB
PHP

<?php include 'header.php'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Instructors</h1>
<button class="btn btn-primary" data-toggle="modal" data-target="#addInstructorModal"><i class="fas fa-plus"></i> Add New Instructor</button>
</div>
<?php
$instructors_json = file_get_contents('data/instructors.json');
$instructors = json_decode($instructors_json, true);
?>
<div class="card">
<div class="card-body">
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Instructor Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php if (!empty($instructors)):
foreach ($instructors as $instructor):
?>
<tr>
<td><?= htmlspecialchars($instructor['name']) ?></td>
<td><?= htmlspecialchars($instructor['email']) ?></td>
</tr>
<?php
endforeach;
else:
?>
<tr>
<td colspan="2">No instructors found.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<!-- Add Instructor Modal -->
<div class="modal fade" id="addInstructorModal" tabindex="-1" aria-labelledby="addInstructorModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addInstructorModalLabel">Add a new instructor</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="add_instructor.php" method="post">
<div class="form-group">
<label for="name">Instructor Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<button type="submit" class="btn btn-primary">Add Instructor</button>
</form>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>