<?php if(!defined('SANTI_NAME')) die("Доступ запрещен"); ?>
<div class="content_wrapper">
<div class="contents">
<div class="row-fluid">
<div class="span6">
<div class="ico_16_dashboard content_header">
<h3>Главная страница</h3>
<span>Статистика, подозрительные объекты, динамика</span>
</div>
</div>
<?php include('templates/express.tpl.php'); ?>
</div>
<div class="separator">
<span></span>
</div>
<div class="row-fluid">
<div class="span12">
<div class="widget_wrapper">
<div class="widget_header">
<h3 class="icos_fire">Последние уведомления</h3>
</div>
<div class="widget_content no-padding">
<table width="100%" cellspacing="0" cellpadding="0" class="default_table dynamicTable_two">
<thead>
<tr>
<th>№</th>
<th>Критичность</th>
<th>Объект</th>
<th>Тип</th>
<th>Дата</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
<?php
$obj_rows = objects_get();
foreach($obj_rows as $rows)
{
$alert_type = get_alert_type($rows[2]);
$alert_criticality = get_alert_criticality($rows[4]);
$alert_status = get_alert_status($rows[5]);
$actions_block = "";
if($rows[5] == 0)
{
$actions_block = '<a style="cursor: pointer;" onclick="object_healed('.$rows[0].');">вылечен</a><br><a style="cursor: pointer;" onclick="object_ignore('.$rows[0].')">игнорировать</a><br><a href="index.php?page=121&file_id='.$rows[0].'">редактировать</a>';
}
elseif($rows[5] == 1)
{
$actions_block = '<span style="display: inline-block; float: right;">Отредактирован <a style="cursor: pointer;" onclick="object_null('.$rows[0].');" class="tips" title="отменить"><i class="icon-refresh"></i></a></span>';
}
elseif($rows[5] == 2)
{
$actions_block = '<span style="display: inline-block; float: right;">Игнорируется <a style="cursor: pointer;" onclick="object_null('.$rows[0].');" class="tips" title="отменить"><i class="icon-refresh"></i></a></span>';
}
if(($rows[5] != 1) && ($rows[5] != 2))
{
echo '<tr class="gradeX"><td class="center">'.$rows[0].'</td><td class="center">'.$alert_criticality.'</td><td>'.str_replace("\", "/", $rows[1]).'</td><td class="tip-top" title="'.$rows[3].'">'.$alert_type.'</td><td>'.date('d-m-Y H:i:s', $rows[6]).'</td><td class="center" id="action_'.$rows[0].'">'.$actions_block.'</td></tr>';
}
}
?>
</tbody>
<tfoot>
<tr>
<td>№</td>
<td>Критичность</td>
<td>Объект</td>
<td>Тип</td>
<td>Дата</td>
<td>Действия</td>
</tr>
</tfoot>
</table>
</div>
</div><!-- widget_wrapper end -->
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="widget_wrapper">
<div class="widget_header">
<h3 class="icos_stats">Статистика подозрительных объектов</h3>
</div>
<div class="widget_content">
<script>
$(function()
{
var datasets = {
"low": {
label: "Низкая критичность",
data:
[<?php
$low_alerts = get_alert_stat(1);
foreach ($low_alerts as $res)
{
echo "[".(strtotime($res[0])*1000).", ".$res[1]."], ";
}
?>]
},
"normal": {
label: "Средняя критичность",
data: [<?php
$low_alerts = get_alert_stat(2);
foreach ($low_alerts as $res)
{
echo "[".(strtotime($res[0])*1000).", ".$res[1]."], ";
}
?>]
},
"high": {
label: "Высокая критичность",
data: [<?php
$low_alerts = get_alert_stat(3);
foreach ($low_alerts as $res)
{
echo "[".(strtotime($res[0])*1000).", ".$res[1]."], ";
}
?>]
}
};
var i = 0;
$.each(datasets, function(key, val) {
val.color = i;
++i;
});
var choiceContainer = $("#choices");
$.each(datasets, function(key, val) {
choiceContainer.append("<br/><input type='checkbox' name='" + key +
"' checked='checked' id='id" + key + "' style='margin: 7px !important;'></input>" +
"<label for='id" + key + "' style='display: inline !important; font-weight: bold;'>" + val.label + "</label>");
});
choiceContainer.find("input").click(plotAccordingToChoices);
function plotAccordingToChoices() {
var data = [];
choiceContainer.find("input:checked").each(function () {
var key = $(this).attr("name");
if (key && datasets[key]) {
data.push(datasets[key]);
}
});
if (data.length > 0) {
$.plot("#placeholder", data, {
xaxis: {
mode: "time",
timeformat: "%d/%m/%Y"
}
});
}
}
plotAccordingToChoices();
});
</script>
<div class="demo-container">
<div id="placeholder" class="demo-placeholder" style="float:left; width:800px;"></div>
<p id="choices" style="float:right; width:190px;"></p>
</div>
</div>
</div><!-- widget_wrapper end -->
</div>
</div>
</div><!-- content end -->
</div><!-- content_wrapper end -->
</div><!-- wrapper end -->
</div>
</div>
</div>
</div><!-- container_wrapper end -->