summaryrefslogtreecommitdiffstats
path: root/modules-available/eventlog/page.inc.php
diff options
context:
space:
mode:
authorroot2019-02-19 18:53:50 +0100
committerroot2019-02-19 18:53:50 +0100
commit0ad4c0f8196b61699754762aacbaab0223478ab9 (patch)
treede434c4aea8d07ecd01cd3badd48d057d62c2d1b /modules-available/eventlog/page.inc.php
parent[usb-lock-off] Edit rule cleanup and fix of the dropdown boxes. (diff)
parent[statistics] Fix RAM change warning to handle increase too (diff)
downloadslx-admin-0ad4c0f8196b61699754762aacbaab0223478ab9.tar.gz
slx-admin-0ad4c0f8196b61699754762aacbaab0223478ab9.tar.xz
slx-admin-0ad4c0f8196b61699754762aacbaab0223478ab9.zip
Merge branch 'master' into usb-lock-offusb-lock-off
Diffstat (limited to 'modules-available/eventlog/page.inc.php')
-rw-r--r--modules-available/eventlog/page.inc.php45
1 files changed, 14 insertions, 31 deletions
diff --git a/modules-available/eventlog/page.inc.php b/modules-available/eventlog/page.inc.php
index 320c3b07..1c81983c 100644
--- a/modules-available/eventlog/page.inc.php
+++ b/modules-available/eventlog/page.inc.php
@@ -6,43 +6,26 @@ class Page_EventLog extends Page
protected function doPreprocess()
{
User::load();
- if (!User::isLoggedIn()) {
- Message::addError('main.no-permission');
- Util::redirect('?do=Main');
- }
- if (User::hasPermission("view")) {
- User::setLastSeenEvent(Property::getLastWarningId());
- }
+ User::assertPermission('view');
+ User::setLastSeenEvent(Property::getLastWarningId());
}
protected function doRender()
{
Render::addTemplate("heading");
- if (User::hasPermission("view")) {
- $today = date('d.m.Y');
- $yesterday = date('d.m.Y', time() - 86400);
- $lines = array();
- $paginate = new Paginate("SELECT logid, dateline, logtypeid, description, extra FROM eventlog ORDER BY logid DESC", 50);
- $res = $paginate->exec();
- while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
- $day = date('d.m.Y', $row['dateline']);
- if ($day === $today) {
- $day = Dictionary::translate('lang_today');
- } elseif ($day === $yesterday) {
- $day = Dictionary::translate('lang_yesterday');
- }
- $row['date'] = $day . date(' H:i', $row['dateline']);
- $row['icon'] = $this->typeToIcon($row['logtypeid']);
- $row['color'] = $this->typeToColor($row['logtypeid']);
- $lines[] = $row;
- }
-
- $paginate->render('_page', array(
- 'list' => $lines
- ));
- } else {
- Message::addError('main.no-permission');
+ $lines = array();
+ $paginate = new Paginate("SELECT logid, dateline, logtypeid, description, extra FROM eventlog ORDER BY logid DESC", 50);
+ $res = $paginate->exec();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $row['date'] = Util::prettyTime($row['dateline']);
+ $row['icon'] = $this->typeToIcon($row['logtypeid']);
+ $row['color'] = $this->typeToColor($row['logtypeid']);
+ $lines[] = $row;
}
+
+ $paginate->render('_page', array(
+ 'list' => $lines
+ ));
}
private function typeToIcon($type)