Logic Machine Forum
How to export / print alerts - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: How to export / print alerts (/showthread.php?tid=2344)



How to export / print alerts - gjniewenhuijse - 13.11.2019

How to export or print all alerts given in the alerts tab?


RE: How to export / print alerts - admin - 14.11.2019

Via .lp file:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Alerts</title>
  <link rel="stylesheet" href="/apps/css/bootstrap.css">
</head>
<body>
<table class="table">
  <tr>
    <th>Date/time</th>
    <th>Script name</th>
    <th>Message</th>
  </tr>
<?
require('apps')
items = db:getall('SELECT * FROM alerts ORDER BY id DESC')
for _, item in ipairs(items) do
  datetime = os.date('%c', item.alerttime)
?>
  <tr>
    <td><?=escape(datetime)?></td>
    <td><?=escape(item.scriptname)?></td>
    <td><?=escape(item.alert)?></td>
    <td></td>
  </tr>
<? end ?>
</table>
</body>
</html>