0% found this document useful (0 votes)
5 views11 pages

Correct

The document contains code for a Course Coverage Management System, including PHP files for an admin dashboard, logging course coverage, selecting categories, submitting coverage, and database connection. It also includes HTML for headers and footers, along with CSS styles for layout and design. The system allows users to sort and log course coverage details efficiently.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views11 pages

Correct

The document contains code for a Course Coverage Management System, including PHP files for an admin dashboard, logging course coverage, selecting categories, submitting coverage, and database connection. It also includes HTML for headers and footers, along with CSS styles for layout and design. The system allows users to sort and log course coverage details efficiently.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Sure, here are the complete codes for each file without comments or additional text.

### 1. Admin Dashboard (`dashboard.php`)


```php
<?php include '../include/header.php'; ?>
<?php include '../include/footer.php'; ?>
<main>
<h2>Admin Dashboard</h2>

<form method="get" action="dashboard.php">


<label for="sort_year">Sort by Years of Study:</label>
<select name="sort_year" id="sort_year">
<option value="">All Years</option>
<?php
$years = $conn->query("SELECT * FROM years_of_study");
while ($row = $years->fetch_assoc()) {
$selected = isset($_GET['sort_year']) && $_GET['sort_year'] == $row['id'] ? 'selected' : '';
echo "<option value='{$row['id']}' $selected>{$row['year_name']}</option>";
}
?>
</select>

<label for="sort_category">Sort by Course Category:</label>


<select name="sort_category" id="sort_category">
<option value="">All Categories</option>
<?php
$categories = $conn->query("SELECT * FROM course_categories");
while ($row = $categories->fetch_assoc()) {
$selected = isset($_GET['sort_category']) && $_GET['sort_category'] == $row['id'] ? 'selected' :
'';
echo "<option value='{$row['id']}' $selected>{$row['category_name']}</option>";
}
?>
</select>
<button type="submit">Sort Logs</button>
</form>

<section>
<h3>Course Coverage Logs</h3>
<?php
$sort_year = isset($_GET['sort_year']) ? $_GET['sort_year'] : '';
$sort_category = isset($_GET['sort_category']) ? $_GET['sort_category'] : '';

$query = "SELECT cl.*, c.course_name, y.year_name, cc.category_name


FROM coverage_logs cl
JOIN courses c ON cl.course_id = c.id
JOIN years_of_study y ON c.year_id = y.id
JOIN course_categories cc ON c.category_id = cc.id";

$conditions = [];
if (!empty($sort_year)) {
$conditions[] = "y.id = '$sort_year'";
}
if (!empty($sort_category)) {
$conditions[] = "cc.id = '$sort_category'";
}
if (count($conditions) > 0) {
$query .= " WHERE " . implode(' AND ', $conditions);
}

$result = $conn->query($query);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<p><strong>{$row['course_name']} ({$row['year_name']} -
{$row['category_name']})</strong>: {$row['coverage_details']} <em>By {$row['staff_name']} on
{$row['coverage_date']}</em></p>";
}
} else {
echo "<p>No coverage logs found.</p>";
}
?>
</section>
</main>
```

### 2. Log Coverage (`log_coverage.php`)


```php
<?php include '../include/header.php'; ?>

<main>
<h2>Log Course Coverage</h2>
<form action="submit_coverage.php" method="post">
<label for="courseSelect">Select Course:</label>
<select id="courseSelect" name="course_id" required>
<?php
$year_id = $_GET['year_id'] ?? '';
$category_id = $_GET['category_id'] ?? '';
if ($year_id && $category_id) {
$result = $conn->query("SELECT * FROM courses WHERE year_id='$year_id' AND
category_id='$category_id'");
while ($row = $result->fetch_assoc()) {
echo "<option value='{$row['id']}'>{$row['course_name']}</option>";
}
}
?>
</select>
<label for="staffName">Staff Name:</label>
<input type="text" name="staff_name" id="staffName" required>
<label for="coverageDate">Coverage Date:</label>
<input type="date" name="coverage_date" id="coverageDate" required>
<label for="coverageDetails">Coverage Details:</label>
<textarea name="coverage_details" id="coverageDetails" required></textarea>
<label for="confirmation">Confirm Details:</label>
<input type="checkbox" name="confirmed" id="confirmation" required>
<button type="submit">Submit Coverage</button>
</form>
</main>
```

### 3. Select Categories (`select_categories.php`)


```php
<?php include '../include/header.php'; ?>
<main>
<h2>Select Year and Course Category</h2>
<form action="log_coverage.php" method="get">
<label for="yearSelect">Year of Study:</label>
<select id="yearSelect" name="year_id" required>
<?php
$result = $conn->query("SELECT * FROM years_of_study");
while ($row = $result->fetch_assoc()) {
echo "<option value='{$row['id']}'>{$row['year_name']}</option>";
}
?>
</select>
<label for="categorySelect">Course Category:</label>
<select id="categorySelect" name="category_id" required>
<?php
$result = $conn->query("SELECT * FROM course_categories");
while ($row = $result->fetch_assoc()) {
echo "<option value='{$row['id']}'>{$row['category_name']}</option>";
}
?>
</select>
<button type="submit">Proceed to Course Selection</button>
</form>
</main>
```

### 4. Submit Coverage (`submit_coverage.php`)


```php
<?php
include '../include/db_connect.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$course_id = $_POST['course_id'];
$staff_name = htmlspecialchars(trim($_POST['staff_name']));
$coverage_date = $_POST['coverage_date'];
$coverage_details = htmlspecialchars(trim($_POST['coverage_details']));
$confirmed = isset($_POST['confirmed']) ? 1 : 0;

$stmt = $conn->prepare("INSERT INTO coverage_logs (course_id, staff_name, coverage_date,


coverage_details, confirmed) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("isssi", $course_id, $staff_name, $coverage_date, $coverage_details,
$confirmed);
$stmt->execute();
header("Location: ../index.php?msg=Coverage logged successfully");
exit;
}
include '../include/footer.php';
?>
```

### 5. Database Connection (`db_connect.php`)


```php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "course_management";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
```

### 6. Footer (`footer.php`)


```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../assets/css/style.css">
<title>Footer</title>
</head>
<body>
<footer class="mainfooter">
<section class="secfooter">
<div class="loga">
<div class="logo">
<span class="s">S</span>c<span class="h">h</span>o<span class="o">o</span>l
</div>
<div class="about">
<p>This is all you need to know about Us.</p>
</div>
</div>
<div class="useful-links">
<ul>
<li><a href="https://www.swisslinkedu.com">Swisslink</a></li>
<li><a href="https://www.turacos.ch">Turacos</a></li>
<li><a href="https://www.hndregistration.com">HND</a></li>
</ul>
</div>
<div class="socials">
<ul>
<li><a
href="https://www.facebook.com/profile.php?id=61561853724649&mibextid=ZbWKwL">Facebook<
/a></li>
<li><a
href="https://www.instagram.com/haensellomessi?igsh=MXB0aGI3ejViMWpzMg==">Instagram</a>
</li>
<li><a href="https://www.tiktok.com/@sakwehansel?_t=8rl8BBbylfb&_r=1">Tik
Tok</a></li>
</ul>
</div>
<div class="site-map">
<ul>
<li><a href="../admin/dashboard.php">Dashboard</a></li>
<li><a href="../admin/log_coverage.php">Log Coverage</a></li>
<li><a href="../admin/select_categories.php">Select Categories</a></li>
<li><a href="../admin/submit_coverage.php">Submit Coverage</a></li>
<li><a href="../include/db_connect.php">Database Connect</a></li>
</ul>
</div>
</section>
<section class="copyright">
<div class="copie">
<p>&copy; 2024 Course Coverage Management System</p>
</div>
</section>
</footer>
</body>
</html>
```

### 7. Header (`header.php`)


```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../assets/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.7.1/css/all.min.css" integrity="sha512-
5Hs3dF2AEPkpNAR7UiOHba+lRSJNeM2ECkwxUIxC1Q/FLycGTbNapWXB4tP889k5T5Ju8fs4b1P5z/
iB4nMfSQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<title>Header</title>
</head>
<body>
<section class="stylo">
<div class="logo"><span class="s">S</span>c<span class="h">h</span>o<span
class="o">o</span>l</div>
<div class="heading">
<ul>
<li><a href="../index.php">Home</a></li>
<li><a href="../admin/log_coverage.php">Log Coverage</a></li>
<li><a href="../admin/submit_coverage.php">Submit Coverage</a></li>
<li><a href="../admin/select_categories.php">Select Categories</a></li>
<li><a href="../admin/dashboard.php">Admin Dashboard</a></li>
</ul>
</div>
<div class="navclass">
<a
href="https://www.facebook.com/profile.php?id=61561853724649&mibextid=ZbWKwL"><i
class="fa-brands fa-facebook"></i></a>
<a href="https://wa.me/237651835615"><i class="fa-brands fa-whatsapp"></i></a>
<a href="https://www.instagram.com/haensellomessi?igsh=MXB0aGI3ejViMWpzMg=="><i
class="fa-brands fa-instagram"></i></a>
</div>
</section>
</body>
</html>
```

### 8. CSS Styles (`style.css`)


```css
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
overflow-x: hidden;
background-image: url('../../include/pic.jpg');
background-repeat: no-repeat;
background-size: cover;
background-position: center;
height: 100vh;
}

main {
padding: 20px;
}

h2, h3 {
color: darkslateblue;
}

form {
background-color: rgba(255, 255, 255, 0.8);
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
margin-bottom: 30px;
}

label {
font-weight: bold;
margin-top: 10px;
}

input[type="text"],
input[type="date"],
select,
textarea {
width: calc(100% - 22px);
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
}

button {
padding: 10px 15px;
background-color: darkslateblue;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
}

button:hover {
background-color: slateblue;
}

@media (max-width: 768px) {


main {
padding: 10px;
}

form {
padding: 15px;
}

label, input, select, textarea {


display: block;
width: 100%;
margin-bottom: 10px;
}
}
.stylo {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
background-color: aqua;
}

.logo {
font-size: 24px;
color: black;
}

.heading ul {
list-style: none;
display: flex;
justify-content: space-between;
}

.heading ul li {
margin: 0 10px;
}

.heading ul li a {
text-decoration: none;
color: orangered;
font-weight: bold;
}

.navclass {
display: flex;
gap: 15px;
}

.navclass a {
color: orangered;
}

.navclass a:hover {
color: darkslateblue;
}

.secfooter {
justify-content: center;
align-items: center;
padding: 10px;
background-color: aqua;
}

.useful-links ul, .socials ul, .site-map ul {


list-style-type: none;
display: flex;
justify-content: space-evenly;
padding: 10px 0;
}

.useful-links ul li, .socials ul li, .site-map ul li {


margin: 0 10px;
}

.copie {
display: flex;
justify-content: center;
align-items: center;
background-color: aqua;
padding: 10px;
color: orangered;
border-top: 6px solid aqua;
}

.site-map a {
text-decoration: none;
color: blue;
}

.site-map a:hover {
text-decoration: underline;
}

.alert {
padding: 10px;
background: rgba(255, 0, 0, 0.1);
border: 1px solid red;
color: red;
margin: 10px 0;
}

.success {
padding: 10px;
background: rgba(0, 255, 0, 0.1);
border: 1px solid green;
color: green;
margin: 10px 0;
}
```

You might also like