This commit is contained in:
Flatlogic Bot 2025-10-27 10:19:31 +00:00
parent ae55cc8a86
commit 57b68bc2a2
3 changed files with 244 additions and 0 deletions

155
analysis.php Normal file
View File

@ -0,0 +1,155 @@
<?php
include 'header.php';
// Protected page
if (!isset($_SESSION['user_email'])) {
header('Location: login.php');
exit;
}
?>
<div class="container-fluid mt-5">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h2><i class="bi bi-bar-chart-line-fill me-2"></i>Data Analysis Mockup</h2>
</div>
<div class="card-body">
<p>This is a static mockup to illustrate the data analysis interface. The data below is for demonstration purposes only.</p>
<!-- Filters -->
<div class="card mb-4">
<div class="card-body bg-light">
<h5 class="card-title">Filters</h5>
<form class="row g-3 align-items-end">
<div class="col-md-3">
<label for="filterYear" class="form-label">Year</label>
<select id="filterYear" class="form-select">
<option selected>2024</option>
<option>2023</option>
<option>2022</option>
</select>
</div>
<div class="col-md-3">
<label for="filterPollutant" class="form-label">Pollutant</label>
<select id="filterPollutant" class="form-select">
<option selected>Carbon Dioxide (CO2)</option>
<option>Methane (CH4)</option>
<option>Nitrogen Oxides (NOx)</option>
</select>
</div>
<div class="col-md-4">
<label for="filterRegion" class="form-label">Region / NUTS Code</label>
<input type="text" class="form-control" id="filterRegion" placeholder="e.g., UKN0">
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary w-100">Apply</button>
</div>
</form>
</div>
</div>
<!-- Chart Placeholder -->
<div class="row text-center">
<div class="col-lg-8 mb-4">
<div class="card h-100">
<div class="card-header">Emissions Trend (Chart Placeholder)</div>
<div class="card-body d-flex align-items-center justify-content-center bg-light">
<div class="text-muted">
<i class="bi bi-graph-up" style="font-size: 3rem;"></i>
<p>Chart would be rendered here.</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100">
<div class="card-header">Key Metrics</div>
<div class="card-body">
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-2">
<span>Total Facilities Reporting:</span>
<span class="badge bg-primary rounded-pill fs-6">1,204</span>
</div>
<div class="d-flex justify-content-between align-items-center border-bottom pb-2 mb-2">
<span>Total Emissions (Tons):</span>
<span class="badge bg-success rounded-pill fs-6">4.5M</span>
</div>
<div class="d-flex justify-content-between align-items-center">
<span>Compliance Rate:</span>
<span class="badge bg-warning rounded-pill fs-6">98.2%</span>
</div>
</div>
</div>
</div>
</div>
<!-- Data Table -->
<h5>Aggregated Emissions Data</h5>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>Facility Name</th>
<th>Region</th>
<th>Pollutant</th>
<th>Total Emissions</th>
<th>Unit</th>
<th>Year</th>
</tr>
</thead>
<tbody>
<tr>
<td>West Burton Power Station</td>
<td>UKD1</td>
<td>Carbon Dioxide (CO2)</td>
<td>1,500,000</td>
<td>Tonnes</td>
<td>2024</td>
</tr>
<tr>
<td>Drax Power Station</td>
<td>UKE2</td>
<td>Carbon Dioxide (CO2)</td>
<td>1,250,000</td>
<td>Tonnes</td>
<td>2024</td>
</tr>
<tr>
<td>Rugeley Power Station</td>
<td>UKG2</td>
<td>Nitrogen Oxides (NOx)</td>
<td>80,000</td>
<td>Kilograms</td>
<td>2024</td>
</tr>
<tr>
<td>Fiddlers Ferry Power Station</td>
<td>UKD2</td>
<td>Methane (CH4)</td>
<td>5,500</td>
<td>Kilograms</td>
<td>2024</td>
</tr>
<tr>
<td>Cottam Development Centre</td>
<td>UKF1</td>
<td>Carbon Dioxide (CO2)</td>
<td>950,000</td>
<td>Tonnes</td>
<td>2024</td>
</tr>
</tbody>
</table>
</div>
<div class="d-flex justify-content-end">
<button class="btn btn-secondary"><i class="bi bi-download me-2"></i>Export as CSV</button>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>

View File

@ -20,6 +20,20 @@ if (!isset($_SESSION['user_email'])) {
</div>
<div class="card-body">
<p>This is a placeholder for your dashboard content. From here, you will be able to manage your reporting tasks based on your role.</p>
<hr>
<h4>Actions</h4>
<div class="list-group">
<a href="upload.php" class="list-group-item list-group-item-action">
<i class="bi bi-file-earmark-arrow-up-fill me-2"></i>
<strong>Submit a new Report</strong>
<p class="mb-1 text-muted">Upload your XML report file for validation and processing.</p>
</a>
<a href="analysis.php" class="list-group-item list-group-item-action">
<i class="bi bi-bar-chart-line-fill me-2"></i>
<strong>Analyze Data</strong>
<p class="mb-1 text-muted">View aggregated data, trends, and generate analytical reports.</p>
</a>
</div>
</div>
</div>
</div>

75
upload.php Normal file
View File

@ -0,0 +1,75 @@
<?php
include 'header.php';
// Protected page
if (!isset($_SESSION['user_email'])) {
header('Location: login.php');
exit;
}
$message = '';
$message_type = ''; // 'success' or 'danger'
// Handle file upload
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['xmlfile'])) {
$file = $_FILES['xmlfile'];
// Check for upload errors
if ($file['error'] !== UPLOAD_ERR_OK) {
$message = 'An error occurred during file upload. Please try again.';
$message_type = 'danger';
} else {
// Check file extension
$file_extension = pathinfo($file['name'], PATHINFO_EXTENSION);
if (strtolower($file_extension) !== 'xml') {
$message = 'Invalid file type. Only .xml files are allowed.';
$message_type = 'danger';
} else {
// In a real application, you would move the file to a permanent location
// and process it. For now, we just show a success message.
// move_uploaded_file($file['tmp_name'], 'uploads/' . basename($file['name']));
$message = '<strong>Success!</strong> Your file "' . htmlspecialchars(basename($file['name'])) . '" has been uploaded and is pending validation.';
$message_type = 'success';
}
}
}
?>
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h2>Submit a new Report</h2>
</div>
<div class="card-body">
<p class="card-text">Please select the E-PRTR XML report file you wish to submit. The file will be validated against the required schema before being processed.</p>
<?php if ($message): ?>
<div class="alert alert-<?php echo $message_type; ?>">
<?php echo $message; ?>
</div>
<?php endif; ?>
<form action="upload.php" method="post" enctype="multipart/form-data">
<div class="mb-3">
<label for="xmlfile" class="form-label">XML Report File</label>
<input class="form-control" type="file" id="xmlfile" name="xmlfile" accept=".xml" required>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary btn-lg">
<i class="bi bi-upload me-2"></i>Upload and Validate
</button>
</div>
</form>
</div>
</div>
<div class="text-center mt-3">
<a href="dashboard.php"><i class="bi bi-arrow-left-circle"></i> Back to Dashboard</a>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>