-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
60 lines (50 loc) · 1.62 KB
/
index.php
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
<?php
include 'functions.php';
// Connect to MySQL using the below function
$pdo = pdo_connect_mysql();
// MySQL query that retrieves all the tickets from the database
$stmt = $pdo->prepare('SELECT * FROM tickets ORDER BY created DESC');
$stmt->execute();
$tickets = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tickets</title>
<!-- Link to your CSS stylesheet -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?=template_header('Tickets')?>
<div class="content home">
<h2>Recent Tickets</h2>
<p>Welcome to your dashboard. You can view the list of tickets below.</p>
<!-- <div class="btns">
<a href="create.php" class="btn">Create Ticket</a>
</div> -->
<div class="tickets-list">
<?php foreach ($tickets as $ticket): ?>
<a href="view.php?id=<?=$ticket['id']?>" class="ticket">
<span class="con">
<?php if ($ticket['status'] == 'open'): ?>
<i class="far fa-clock fa-2x"></i>
<?php elseif ($ticket['status'] == 'resolved'): ?>
<i class="fas fa-check fa-2x"></i>
<?php elseif ($ticket['status'] == 'closed'): ?>
<i class="fas fa-times fa-2x"></i>
<?php endif; ?>
</span>
<span class="con">
<span class="title"><?=htmlspecialchars($ticket['title'], ENT_QUOTES)?></span>
<span class="msg"><?=htmlspecialchars($ticket['msg'], ENT_QUOTES)?></span>
</span>
<span class="con created"><?=date('F dS, G:ia', strtotime($ticket['created']))?></span>
</a>
<?php endforeach; ?>
</div>
</div>
<?=template_footer()?>
</body>
</html>