s3
This commit is contained in:
@@ -1,9 +1,32 @@
|
||||
<?php
|
||||
require('../.hta_config/env.php');
|
||||
require('../.hta_header.php');
|
||||
require('../.hta_admin_header.php');
|
||||
$current_date_time = date("Y-m-d H:i:s");
|
||||
require('../.hta_config/env.php');
|
||||
require('../.hta_header.php');
|
||||
require('../.hta_admin_header.php');
|
||||
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Define the number of results per page
|
||||
$results_per_page = 30;
|
||||
|
||||
// Get the current page number from the URL (default to page 1)
|
||||
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int) $_GET['page'] : 1;
|
||||
$offset = ($page - 1) * $results_per_page;
|
||||
|
||||
// Get total number of records
|
||||
$total_stmt = $conn->prepare("SELECT COUNT(*) AS total FROM `scc24`");
|
||||
$total_stmt->execute();
|
||||
$total_rows = $total_stmt->fetch(PDO::FETCH_ASSOC)['total'];
|
||||
$total_pages = ceil($total_rows / $results_per_page);
|
||||
|
||||
// Fetch paginated records
|
||||
$stmt = $conn->prepare("SELECT * FROM `scc24` ORDER BY id DESC LIMIT :limit OFFSET :offset");
|
||||
$stmt->bindValue(':limit', $results_per_page, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
|
||||
<p style="font-size: 25px; text-align: center; margin-top: 10px;">Page Content List</p>
|
||||
<div class="table-container">
|
||||
<table class="responsive-table">
|
||||
@@ -16,31 +39,46 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE type != 'faculty' ORDER BY id DESC ");
|
||||
$stmt->execute();
|
||||
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
foreach($content as $pageData){ ?>
|
||||
<?php foreach ($content as $pageData) { ?>
|
||||
<tr>
|
||||
<td style="border: 2px solid #7a7a7a;"><?php echo $pageData['id']; ?></td>
|
||||
<td style="border: 2px solid #7a7a7a;"><?php echo $pageData['type']; ?></td>
|
||||
<td style="border: 2px solid #7a7a7a;"><?php echo $pageData['title']; ?></td>
|
||||
<td style="border: 2px solid #7a7a7a;">
|
||||
<div style="display: flex; flex-direction: row; justify-content: center; color: blue;">
|
||||
<a href="edit-content.php?id=<?php echo $pageData['id'] . '&slug=' . $pageData['slug'] . '&type=' . $pageData['type']; ?>">Edit</a>
|
||||
<a target="_blank" href="<?php if($pageData['type'] === 'notice'){echo '/notice/'.$pageData['slug'].'.html';} elseif($pageData['type'] === 'page'){echo '/'.$pageData['slug'].'.html';}?>">View</a>
|
||||
<a href="edit-content.php?id=<?php echo $pageData['id'] . '&slug=' . $pageData['slug'] . '&type=' . $pageData['type']; ?>">Edit</a>
|
||||
<a target="_blank" href="<?php
|
||||
if ($pageData['type'] === 'notice') {
|
||||
echo '/notice/' . $pageData['slug'] . '.html';
|
||||
} elseif ($pageData['type'] === 'page') {
|
||||
echo '/' . $pageData['slug'] . '.html';
|
||||
}
|
||||
?>">View</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
require('../.hta_footer.php');
|
||||
?>
|
||||
|
||||
<!-- Pagination Links -->
|
||||
<div style="text-align: center; margin-top: 20px; display: flex; flex-direction: row; gap: 20px; justify-content: center;">
|
||||
<?php if ($page > 1): ?>
|
||||
<a href="?page=1">First</a>
|
||||
<a href="?page=<?php echo $page - 1; ?>">Prev</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<span>Page <?php echo $page; ?> of <?php echo $total_pages; ?></span>
|
||||
|
||||
<?php if ($page < $total_pages): ?>
|
||||
<a href="?page=<?php echo $page + 1; ?>">Next</a>
|
||||
<a href="?page=<?php echo $total_pages; ?>">Last</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php require('../.hta_footer.php'); ?>
|
||||
|
||||
<style>
|
||||
.table-container {
|
||||
margin: 20px auto;
|
||||
|
||||
Reference in New Issue
Block a user