1<?php
2/*
3 * LibreNMS
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation, either version 3 of the License, or (at your
8 * option) any later version.  Please see LICENSE.txt at the top level of
9 * the source code distribution for details.
10 *
11 * @package    LibreNMS
12 * @subpackage webui
13 * @link       https://www.librenms.org
14 * @copyright  2017 LibreNMS
15 * @author     LibreNMS Contributors
16*/
17
18if (! isset($vars['section'])) {
19    $vars['section'] = 'alerts';
20}
21
22echo '<br>';
23echo '<div class="panel panel-default">';
24echo '<div class="panel-heading">';
25echo '<strong>Alerts</strong>  &#187; ';
26
27if ($vars['section'] == 'alerts') {
28    echo '<span class="pagemenu-selected">';
29}
30echo generate_link('Active alerts', $vars, ['section' => 'alerts']);
31if ($vars['section'] == 'alerts') {
32    echo '</span>';
33}
34
35echo ' | ';
36
37if ($vars['section'] == 'alert-log') {
38    echo '<span class="pagemenu-selected">';
39}
40echo generate_link('Alert history', $vars, ['section' => 'alert-log']);
41if ($vars['section'] == 'alert-log') {
42    echo '</span>';
43}
44
45echo '</div><br>';
46echo '<div style="width:99%;margin:0 auto;">';
47
48switch ($vars['section']) {
49    case 'alerts':
50        include 'includes/html/modal/alert_details.php';
51        include 'includes/html/modal/alert_notes.inc.php';
52        include 'includes/html/modal/alert_ack.inc.php';
53        include 'includes/html/common/alerts.inc.php';
54        echo implode('', $common_output);
55        break;
56    case 'alert-log':
57        $vars['fromdevice'] = true;
58        $device_id = (int) $vars['device'];
59        include 'includes/html/modal/alert_details.php';
60        include 'includes/html/common/alert-log.inc.php';
61        echo implode('', $common_output);
62        break;
63
64    default:
65        echo '</div>';
66        echo report_this('Unknown section ' . $vars['section']);
67        break;
68}
69
70echo '</div>';
71