Change Default Page View

- Add print-alerts code
 - Change the view of the lower part of the front page from 12 columns
to 2 x 6 columns
 - Add alertlog entries to the new column
This commit is contained in:
Rosiak
2015-02-20 00:33:49 +01:00
parent 9c6c61bef8
commit 8c2f629e14
2 changed files with 42 additions and 4 deletions

View File

@@ -0,0 +1,22 @@
<?php
$hostname = gethostbyid($alert_entry['device_id']);
echo('<tr>
<td>
' . $alert_entry['time_logged'] . '
</td>');
if (!isset($alert_entry['device'])) {
$dev = device_by_id_cache($alert_entry['device_id']);
echo("<td>
" . generate_device_link($dev, shorthost($dev['hostname'])) . "
</td>");
}
echo("<td>".$alert_entry['link']."</td>");
echo("<td>".htmlspecialchars($alert_entry['name']) . "</td>
</tr>");
?>

View File

@@ -199,21 +199,37 @@ if ($config['enable_syslog'])
if ($_SESSION['userlevel'] >= '10')
{
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
$alertquery = "SELECT devices.device_id,name,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15";
} else {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
$alertquery = "SELECT devices.device_id,name,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id RIGHT JOIN devices_perms ON alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " ORDER BY `time_logged` DESC LIMIT 0,15";
}
$data = mysql_query($query);
$alertdata = mysql_query($alertquery);
echo('<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
&nbsp;
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-6 column">
<div class="panel panel-default panel-condensed">
<div class="panel-heading">
<strong>Alertlog entries</strong>
</div>
<table class="table table-hover table-condensed table-striped">');
foreach (dbFetchRows($alertquery) as $alert_entry)
{
include("includes/print-alerts.inc.php");
}
echo('</table>
</div>
</div>
<div class="col-md-6 column">
<div class="panel panel-default panel-condensed">
<div class="panel-heading">
<strong>Eventlog entries</strong>