aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: f63f3af0fe39d5f1228a15bc2f0e4a90631e75ed (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
<?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
# bugs query
$bugs_q= 'SELECT bugs.id AS id, title, description, users.username AS submitter FROM bugs JOIN users ON bugs.author = users.id';
if(isset($_GET['term']) && $_GET['term'] != "") {
    echo "where the title contains: $_GET[term]";
    $bugs_q = $bugs_q . " WHERE title LIKE '%$_GET[term]%'";
}

$bugs_r = $conn->query($bugs_q);
if($bugs_r->rowCount() > 0) {
?>
<table style='width:80%'>
<tr><th>Title</th><th>Description</th><th>Owner</th></tr>
<?php
foreach ($bugs_r as $row) {
    echo "<tr><td><a href=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>Zero boogs found.</p>\n";
}
?>

<h2>Reports</h2>
<?php

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

# reports query
$reports_q = 'SELECT title, description, author FROM reports WHERE bug IS NULL';

$reports_r = $conn->query($reports_q);
if($reports_r->rowCount() > 0) {
?>

<table style='width:80%'>
<tr><th>Title</th><th>Description</th><th>Submitted by</th></tr>
<?php
foreach ($reports_r as $row) {
    echo "<tr><td><a href=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 unassigned reports.</p>\n";
}

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