aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php62
1 files changed, 51 insertions, 11 deletions
diff --git a/index.php b/index.php
index 5e79ca7..f63f3af 100644
--- a/index.php
+++ b/index.php
@@ -6,22 +6,62 @@ require_once(LIBRARY_PATH . "/functions.php");
$conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']);
-$query = 'SELECT bugs.id AS id, title, description, users.username AS submitter FROM bugs JOIN users ON bugs.author = users.id';
+?>
+<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]";
- $query = $query . " WHERE title LIKE '%$_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>
-echo "<table style='width:80%'>\n";
-echo "<tr><th>Title</th><th>Description</th><th>Submitter</th></tr>\n";
-foreach ($conn->query($query) as $row) {
- echo "<tr>\n";
- echo "<td><a href=view.php?id=$row[id]>$row[title]</a></td>\n";
- echo "<td>" . truncate($row['description']) . "</td>\n";
- echo "<td>$row[submitter]</td>\n";
- echo "</tr>\n";
+<?php
+} else {
+ echo "<p>No unassigned reports.</p>\n";
}
-echo "</table>\n";
require_once(TEMPLATES_PATH . "/footer.php");
?>