aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: 43eb00dff8c876738aa2f54a3b4fcbecc9bcbbe1 (plain)
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
<?php
require 'config.php';
require_once(TEMPLATES_PATH . "/header.php");
require_once(TEMPLATES_PATH . "/panel.php");
require_once(LIBRARY_PATH . "/functions.php");

$conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']);

?>
<h2>Bugs</h2>

<?php
if(session_set()) {
    echo "<p><a href='{$config['urls']['base']}/bug/edit.php'>Create</a></p>\n";
}
# bugs query
$bugs = $conn->prepare("SELECT bugs.id AS id, title, description, users.username AS submitter 
    FROM bugs JOIN users ON bugs.author = users.id
    WHERE title LIKE :term");
$bugs->bindValue(':term', isset($_GET['term']) ? '%' . $_GET['term'] : "%");
$bugs->execute();

if($bugs->rowCount() > 0) {
?>
<table style='width:80%'>
<tr><th>Title</th><th>Description</th><th>Owner</th></tr>
<?php
foreach ($bugs as $row) {
    echo "<tr><td><a href=bug/view.php?id=$row[id]>$row[title]</a></td> <td>" . truncate($row['description']) . "</td> <td>$row[submitter]</td></tr>\n";
}
?>
</table>

<?php
} else {
    echo "<p>No bugs found.</p>\n";
}
?>

<h2>Reports</h2>
<?php

if(session_set()) {
    echo "<p><a href='{$config['urls']['base']}/report/edit.php'>Create</a></p>\n";
}

# reports query
$reports = $conn->query("SELECT reports.id AS id, title, description, users.username AS user 
    FROM reports JOIN users ON reports.author=users.id WHERE bug IS NULL ORDER BY id");

if($reports->rowCount() > 0) {
?>

<table style='width:80%'>
<tr><th>Title</th><th>Description</th><th>Submitted by</th></tr>
<?php
foreach ($reports as $row) {
    echo "<tr><td><a href=report/view.php?id=$row[id]>$row[title]</a></td> <td>" . truncate($row['description']) . "</td> <td>$row[user]</td></tr>\n";
}
?>
</table>

<?php
} else {
    echo "<p>No unassigned reports.</p>\n";
}

require_once(TEMPLATES_PATH . "/footer.php");
?>