aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-04-29 18:04:56 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2021-04-29 18:04:56 +0300
commit4cee97e695c889445c3146bc8169a89b132855ea (patch)
tree693489f2f89f86e277255dfe0f9d5482ecad0359 /index.php
parentAdd nginx and php-fpm config files (diff)
downloadbugtracker-4cee97e695c889445c3146bc8169a89b132855ea.tar.xz
Finish user management
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");
?>