diff options
author | Simon Rettberg | 2014-10-09 16:01:11 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-10-09 16:01:11 +0200 |
commit | e1dc0d3c99217504de2ac8467156274786efc0bd (patch) | |
tree | 130d7fed1fff8aaaffe5942cf2a3d6bb1dad03c8 /modules/eventlog.inc.php | |
parent | Minor fixes and improvements (diff) | |
download | slx-admin-e1dc0d3c99217504de2ac8467156274786efc0bd.tar.gz slx-admin-e1dc0d3c99217504de2ac8467156274786efc0bd.tar.xz slx-admin-e1dc0d3c99217504de2ac8467156274786efc0bd.zip |
Big load of changes
- Added callback functionality for taskmanager tasks. You can launch
a task and define a callback function to be run when the task finished.
This requires activating the cronjob
- Added cron functionality: Add cronjob that calls the cron api every 5
minutes to use it. (See cron.inc.php)
- Added eventlog
- Added missing translations
- Merged main-menu-login and main-menu-logout
Diffstat (limited to 'modules/eventlog.inc.php')
-rw-r--r-- | modules/eventlog.inc.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/eventlog.inc.php b/modules/eventlog.inc.php new file mode 100644 index 00000000..1a63a0a6 --- /dev/null +++ b/modules/eventlog.inc.php @@ -0,0 +1,55 @@ +<?php + +class Page_EventLog extends Page +{ + + protected function doPreprocess() + { + User::load(); + if (!User::hasPermission('superadmin')) { + Message::addError('no-permission'); + Util::redirect('?do=Main'); + } + User::setLastSeenEvent(Property::getLastWarningId()); + } + + protected function doRender() + { + Render::setTitle(Dictionary::translate('lang_titleEventLog')); + $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('today'); + } elseif ($day === $yesterday) { + $day = Dictionary::translate('yesterday'); + } + $row['date'] = $day . date(' H:i', $row['dateline']); + $row['icon'] = $this->typeToIcon($row['logtypeid']); + $lines[] = $row; + } + + $paginate->render('eventlog/_page', array( + 'list' => $lines + )); + } + + private function typeToIcon($type) + { + switch ($type) { + case 'info': + return 'ok'; + case 'warning': + return 'exclamation-sign'; + case 'error': + return 'remove'; + default: + return 'question-sign'; + } + } + +} |