import
[web.mtrack] / web / reports.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3 include '../inc/common.php';
4
5 mtrack_head("Reports");
6 ?>
7 <h1>Available Reports</h1>
8
9 <p>
10   The reports below are constructed using SQL.  You may also
11   use the <a href="<?php echo $ABSWEB ?>query.php">Custom Query</a>
12   page to create a report on the fly.
13 </p>
14
15 <table>
16 <tr>
17   <th>Report</th>
18   <th>Title</th>
19 </tr>
20 <?php
21 foreach (MTrackDB::q("select rid, summary from reports order by rid"
22     )->fetchAll(PDO::FETCH_ASSOC) as $row)
23 {
24   $url = "${ABSWEB}report.php/$row[rid]";
25   $t = "<a href='$url'>{" . $row['rid'] . "}</a>";
26   $s = htmlentities($row['summary'], ENT_COMPAT, 'utf-8');
27   $s = "<a href='$url'>$s</a>";
28
29   echo <<<HTML
30 <tr><td>$t</td><td>$s</td></tr>
31 HTML;
32 }
33 ?>
34 </table>
35 <?php
36 if (MTrackACL::hasAllRights('Reports', 'create')) {
37 ?>
38 <form action="report.php" method="get">
39 <button type="submit" name="edit">Create Report</button>
40 </form>
41 <?php
42 }
43
44 mtrack_foot();
45