scc24php/admin/page-list.php

82 lines
2.9 KiB
PHP

<?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");
?>
<p style="font-size: 25px; text-align: center; margin-top: 10px;">Page Content List</p>
<div class="table-container">
<table class="responsive-table">
<thead>
<tr>
<th style="border: 2px solid #7a7a7a;">ID</th>
<th style="border: 2px solid #7a7a7a;">Type</th>
<th style="border: 2px solid #7a7a7a;">Title</th>
<th style="border: 2px solid #7a7a7a;">Action</th>
</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){ ?>
<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> &nbsp;
<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>
<?php } ?>
</tbody>
</table>
</div>
<?php
require('../.hta_footer.php');
?>
<style>
.table-container {
margin: 20px auto;
width: 90%;
max-width: 900px;
}
.table-container {
overflow-x: auto;
/* margin-top: 20px; */
}
.responsive-table {
width: 100%;
border-collapse: collapse;
margin: 0 auto;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
.responsive-table th, .responsive-table td {
border: 2px solid #7a7a7a;
padding: 10px;
/* text-align: center; */
}
.responsive-table th {
background-color: #402517;
color: #fff;
}
@media (max-width: 600px) {
.responsive-table {
font-size: 14px;
}
.action-btn {
font-size: 12px;
padding: 6px 8px;
}
}
</style>