-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathposts.php
More file actions
70 lines (65 loc) · 3.1 KB
/
posts.php
File metadata and controls
70 lines (65 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
include './header.php';
$posts = Post::getPostByAuthorId($connection, $_SESSION['user']->id);
if (isset($_GET['id'])) {
Post::deleteById($connection, $_GET['id']);
redirect('posts');
}
?>
<section class="section">
<div class="section-body">
<div class="row">
<div class="col-12">
<div class="card mb-0">
<div class="card-body d-flex justify-content-between align-items-center">
<h4 class="m-0">Your Posts</h4>
<a href="./create_post.php" class="btn btn-outline-primary">Create Post</a>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped" id="table-1">
<thead>
<tr>
<th>Title</th>
<th>Category</th>
<th>Created At</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($posts as $post) { ?>
<tr>
<td><?php echo $post->title; ?>
<div class="table-links">
<a href="./view_post.php?id=<?php echo $post->id; ?>">View</a>
<div class="bullet"></div>
<a href="./update_post.php?id=<?php echo $post->id; ?>">Edit</a>
<div class="bullet"></div>
<a href="./posts.php?id=<?php echo $post->id; ?>" class="text-danger">Trash</a>
</div>
</td>
<td>
<a href="#"><?php echo $post->category; ?></a>
</td>
<td> <?php echo $post->created_at; ?> </td>
<td>
<div class="badge badge-<?php echo getStatusColor($post->status); ?> "><?php echo $post->status; ?></div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php include './footer.php';