mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Fixed problems with column 'last contact'. Gitlab: #269
This commit is contained in:
parent
4d6a3ee66c
commit
72d18f61a4
@ -1391,6 +1391,29 @@ function agents_get_interval ($id_agent) {
|
|||||||
return (int) db_get_value ('intervalo', 'tagente', 'id_agente', $id_agent);
|
return (int) db_get_value ('intervalo', 'tagente', 'id_agente', $id_agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all data of agent.
|
||||||
|
*
|
||||||
|
* @param Agent object.
|
||||||
|
*
|
||||||
|
* @return The interval value and status of last contact
|
||||||
|
*/
|
||||||
|
function agents_get_interval_status ($agent) {
|
||||||
|
|
||||||
|
$return = '';
|
||||||
|
$last_time = strtotime ($agent["ultimo_contacto"]);
|
||||||
|
$now = time ();
|
||||||
|
$diferencia = $now - $last_time;
|
||||||
|
$time = ui_print_timestamp ($last_time, true, array('style' => 'font-size:6.5pt'));
|
||||||
|
$min_interval = modules_get_agentmodule_mininterval($agent['id_agente']);
|
||||||
|
|
||||||
|
$return = $time;
|
||||||
|
if ($diferencia > ($min_interval["min_interval"] * 2))
|
||||||
|
$return = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the operating system of an agent.
|
* Get the operating system of an agent.
|
||||||
*
|
*
|
||||||
|
@ -2432,4 +2432,8 @@ function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = fal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modules_get_agentmodule_mininterval($id_agent) {
|
||||||
|
$sql = sprintf('SELECT min(current_interval) min_interval from tagente_estado where id_agente = %d', $id_agent);
|
||||||
|
return db_get_row_sql($sql);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -571,16 +571,7 @@ foreach ($agents as $agent) {
|
|||||||
|
|
||||||
$data[7] = $alert_img;
|
$data[7] = $alert_img;
|
||||||
|
|
||||||
|
$data[8] = agents_get_interval_status ($agent);
|
||||||
$last_time = strtotime ($agent["ultimo_contacto"]);
|
|
||||||
$now = time ();
|
|
||||||
$diferencia = $now - $last_time;
|
|
||||||
$time = ui_print_timestamp ($last_time, true, array('style' => 'font-size:6.5pt'));
|
|
||||||
$style = '';
|
|
||||||
if ($diferencia > ($agent["intervalo"] * 2))
|
|
||||||
$data[8] = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
|
|
||||||
else
|
|
||||||
$data[8] = $time;
|
|
||||||
|
|
||||||
// This old code was returning "never" on agents without modules, BAD !!
|
// This old code was returning "never" on agents without modules, BAD !!
|
||||||
// And does not print outdated agents in red. WRONG !!!!
|
// And does not print outdated agents in red. WRONG !!!!
|
||||||
@ -624,7 +615,6 @@ else {
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
$("[class^='left']").mouseenter (function () {
|
$("[class^='left']").mouseenter (function () {
|
||||||
console.log($(this));
|
|
||||||
$(".agent"+$(this)[0].className).css('visibility', '');
|
$(".agent"+$(this)[0].className).css('visibility', '');
|
||||||
}).mouseleave(function () {
|
}).mouseleave(function () {
|
||||||
$(".agent"+$(this)[0].className).css('visibility', 'hidden');
|
$(".agent"+$(this)[0].className).css('visibility', 'hidden');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user