mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
#8458 Fixed errors
This commit is contained in:
parent
270bb433da
commit
cab85cbfbd
@ -38,7 +38,7 @@ if (is_ajax() === true) {
|
|||||||
$type = get_parameter('type', 0);
|
$type = get_parameter('type', 0);
|
||||||
|
|
||||||
if ($getFilters === true) {
|
if ($getFilters === true) {
|
||||||
$refresh = get_parameter('refresh', 30);
|
$refresh = get_parameter('refresh', 180);
|
||||||
$search = get_parameter('search', '');
|
$search = get_parameter('search', '');
|
||||||
$group = get_parameter('group', true);
|
$group = get_parameter('group', true);
|
||||||
|
|
||||||
@ -117,6 +117,7 @@ if (is_ajax() === true) {
|
|||||||
'return' => true,
|
'return' => true,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'privilege' => 'AR',
|
'privilege' => 'AR',
|
||||||
|
'multiple' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -186,28 +187,20 @@ if (is_ajax() === true) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
$module_groups = modules_get_modulegroups();
|
|
||||||
// $module_groups[0] = _('Not assigned');
|
|
||||||
// hd(current($filter));
|
|
||||||
echo '<p class="label-dialog">'.__('Module group').'</p>';
|
echo '<p class="label-dialog">'.__('Module group').'</p>';
|
||||||
echo html_print_select(
|
echo html_print_select_from_sql(
|
||||||
$module_groups,
|
'SELECT id_mg, name FROM tmodule_group ORDER BY name',
|
||||||
'filter[]',
|
'filter[]',
|
||||||
$filter,
|
$filter,
|
||||||
'',
|
'',
|
||||||
_('Not assigned'),
|
__('Not assigned'),
|
||||||
0,
|
'0',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
'width: 200px',
|
||||||
'',
|
'5'
|
||||||
false,
|
|
||||||
'width: 70%',
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -216,20 +209,28 @@ if (is_ajax() === true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($getInfo === true) {
|
if ($getInfo === true) {
|
||||||
|
enterprise_include_once('include/functions_agents.php');
|
||||||
$id = get_parameter('id', 0);
|
$id = get_parameter('id', 0);
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 2:
|
case 2:
|
||||||
$data = db_get_row('tagente_modulo', 'id_agente_modulo', $id);
|
$data = db_get_row('tagente_modulo', 'id_agente_modulo', $id);
|
||||||
|
|
||||||
// Nombre.
|
// Nombre.
|
||||||
|
$link = sprintf(
|
||||||
|
'index.php?sec=view&sec2=operation/agentes/status_monitor%s&ag_modulename=%s',
|
||||||
|
'&refr=0&ag_group=0&module_option=1&status=-1',
|
||||||
|
$data['nombre']
|
||||||
|
);
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p class="title-dialog">'.__('Module name').'</p>';
|
echo '<p class="title-dialog">'.__('Module name').'</p>';
|
||||||
echo '<a class="info-dialog">'.$data['nombre'].'</a>';
|
echo '<a href="'.$link.'" class="info-dialog">'.$data['nombre'].'</a>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Descripcion.
|
// Descripcion.
|
||||||
|
$description = (empty($data['descripcion']) === true) ? '-' : $data['descripcion'];
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p class="title-dialog">'.__('Description').'</p>';
|
echo '<p class="title-dialog">'.__('Description').'</p>';
|
||||||
echo '<p class="info-dialog">'.$data['descripcion'].'</p>';
|
echo '<p class="info-dialog">'.$description.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Agent.
|
// Agent.
|
||||||
@ -240,24 +241,35 @@ if (is_ajax() === true) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Group.
|
// Group.
|
||||||
|
$group = (empty($data['id_module_group']) === true)
|
||||||
|
? '-'
|
||||||
|
: modules_get_modulegroup_name($data['id_module_group']);
|
||||||
|
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p class="title-dialog">'.__('Group').'</p>';
|
echo '<p class="title-dialog">'.__('Module group').'</p>';
|
||||||
echo '<p class="info-dialog">'.modules_get_modulegroup_name($data['id_module_group']).'</p>';
|
echo '<p class="info-dialog">'.$group.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
$data = db_get_row('tagente_modulo', 'id_agente_modulo', $id);
|
$data = db_get_row('tagente_modulo', 'id_agente_modulo', $id);
|
||||||
|
|
||||||
// Nombre.
|
// Nombre.
|
||||||
|
$link = sprintf(
|
||||||
|
'index.php?sec=view&sec2=operation/agentes/status_monitor%s&ag_modulename=%s',
|
||||||
|
'&refr=0&ag_group=0&module_option=1&status=-1',
|
||||||
|
$data['nombre']
|
||||||
|
);
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p class="title-dialog">'.__('Module name').'</p>';
|
echo '<p class="title-dialog">'.__('Module name').'</p>';
|
||||||
echo '<a class="info-dialog">'.$data['nombre'].'</a>';
|
echo '<a href="'.$link.'" class="info-dialog" target="_blank">'.$data['nombre'].'</a>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Descripcion.
|
// Descripcion.
|
||||||
|
$description = (empty($data['descripcion']) === true) ? '-' : $data['descripcion'];
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p sclass="title-dialog">'.__('Description').'</p>';
|
echo '<p class="title-dialog">'.__('Description').'</p>';
|
||||||
echo '<p class="info-dialog">'.$data['descripcion'].'</p>';
|
echo '<p class="info-dialog">'.$description.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Agent.
|
// Agent.
|
||||||
@ -268,9 +280,13 @@ if (is_ajax() === true) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Group.
|
// Group.
|
||||||
|
$group = (empty($data['id_module_group']) === true)
|
||||||
|
? '-'
|
||||||
|
: modules_get_modulegroup_name($data['id_module_group']);
|
||||||
|
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p class="title-dialog">'.__('Group').'</p>';
|
echo '<p class="title-dialog">'.__('Module group').'</p>';
|
||||||
echo '<p class="info-dialog">'.modules_get_modulegroup_name($data['id_module_group']).'</p>';
|
echo '<p class="info-dialog">'.$group.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Tag.
|
// Tag.
|
||||||
@ -317,17 +333,25 @@ if (is_ajax() === true) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Group.
|
// Group.
|
||||||
|
$secondary_groups = '';
|
||||||
|
$secondary = agents_get_secondary_groups($data['id_agente']);
|
||||||
|
if (isset($secondary['for_select']) === true && empty($secondary['for_select']) === false) {
|
||||||
|
$secondary_groups = implode(', ', $secondary['for_select']);
|
||||||
|
$secondary_groups = ', '.$secondary_groups;
|
||||||
|
}
|
||||||
|
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo '<p class="title-dialog">'.__('Group').'</p>';
|
echo '<p class="title-dialog">'.__('Group').'</p>';
|
||||||
echo '<p class="info-dialog">'.groups_get_name($data['id_grupo']).'</p>';
|
echo '<p class="info-dialog">'.groups_get_name($data['id_grupo']).$secondary_groups.'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
|
||||||
// Events.
|
// Events.
|
||||||
echo '<div class="div-dialog">';
|
echo '<div class="div-dialog">';
|
||||||
echo graph_graphic_agentevents(
|
echo graph_graphic_agentevents(
|
||||||
$id,
|
$id,
|
||||||
100,
|
100,
|
||||||
80,
|
40,
|
||||||
SECONDS_1DAY,
|
SECONDS_1DAY,
|
||||||
'',
|
'',
|
||||||
true,
|
true,
|
||||||
|
@ -112,7 +112,7 @@ class Heatmap
|
|||||||
int $type=0,
|
int $type=0,
|
||||||
array $filter=[],
|
array $filter=[],
|
||||||
string $randomId=null,
|
string $randomId=null,
|
||||||
int $refresh=300,
|
int $refresh=180,
|
||||||
int $width=0,
|
int $width=0,
|
||||||
int $height=0,
|
int $height=0,
|
||||||
string $search=null,
|
string $search=null,
|
||||||
@ -230,6 +230,8 @@ class Heatmap
|
|||||||
},
|
},
|
||||||
(refresh * 1000)
|
(refresh * 1000)
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -307,8 +309,7 @@ class Heatmap
|
|||||||
|
|
||||||
$id_grupo = '';
|
$id_grupo = '';
|
||||||
if (empty($this->filter) === false && current($this->filter) != 0) {
|
if (empty($this->filter) === false && current($this->filter) != 0) {
|
||||||
$filter['id_grupo'] = current($this->filter);
|
$id_grupo = ' AND id_grupo IN ('.implode(',', $this->filter).')';
|
||||||
$id_grupo = ' AND id_grupo = '.current($this->filter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// All agents.
|
// All agents.
|
||||||
@ -380,7 +381,7 @@ class Heatmap
|
|||||||
{
|
{
|
||||||
$filter_group = '';
|
$filter_group = '';
|
||||||
if (empty($this->filter) === false && current($this->filter) != -1) {
|
if (empty($this->filter) === false && current($this->filter) != -1) {
|
||||||
$filter_group = 'AND am.id_module_group ='.current($this->filter);
|
$filter_group = 'AND am.id_module_group IN ('.implode(',', $this->filter).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_name = '';
|
$filter_name = '';
|
||||||
@ -477,9 +478,8 @@ class Heatmap
|
|||||||
{
|
{
|
||||||
$filter_tag = '';
|
$filter_tag = '';
|
||||||
if (empty($this->filter) === false && $this->filter[0] !== '0') {
|
if (empty($this->filter) === false && $this->filter[0] !== '0') {
|
||||||
foreach ($this->filter as $key => $value) {
|
$tags = implode(',', $this->filter);
|
||||||
$filter_tag .= ' AND tm.id_tag ='.$value;
|
$filter_tag .= ' AND tm.id_tag IN ('.$tags.')';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_name = '';
|
$filter_name = '';
|
||||||
@ -680,11 +680,22 @@ class Heatmap
|
|||||||
{
|
{
|
||||||
$result = $this->getData();
|
$result = $this->getData();
|
||||||
|
|
||||||
$scale = ($this->width / $this->height);
|
if (empty($result) === true) {
|
||||||
|
echo '<div style="position: absolute; top:70px; left:20px">'.__('No data found').'</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$Yaxis = $this->getYAxis(count($result), $scale);
|
$count_result = count($result);
|
||||||
$Xaxis = (int) ceil($Yaxis * $scale);
|
|
||||||
$Yaxis = ceil($Yaxis);
|
$scale = ($this->width / $this->height);
|
||||||
|
$Yaxis = $this->getYAxis($count_result, $scale);
|
||||||
|
if ($count_result <= 3) {
|
||||||
|
$Xaxis = $count_result;
|
||||||
|
$Yaxis = 1;
|
||||||
|
} else {
|
||||||
|
$Xaxis = (int) ceil($Yaxis * $scale);
|
||||||
|
$Yaxis = ceil($Yaxis);
|
||||||
|
}
|
||||||
|
|
||||||
$viewBox = sprintf(
|
$viewBox = sprintf(
|
||||||
'0 0 %d %d',
|
'0 0 %d %d',
|
||||||
@ -728,7 +739,7 @@ class Heatmap
|
|||||||
modal: true,
|
modal: true,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
height: 400,
|
height: 400,
|
||||||
width: 430,
|
width: 530,
|
||||||
title: '<?php echo __('Info'); ?>',
|
title: '<?php echo __('Info'); ?>',
|
||||||
open: function() {
|
open: function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -755,7 +766,15 @@ class Heatmap
|
|||||||
$x_back = 0;
|
$x_back = 0;
|
||||||
$y_back = 0;
|
$y_back = 0;
|
||||||
|
|
||||||
echo '<polyline points="0,0 '.$Xaxis.',0" class="polyline" />';
|
if ($count_result <= 100) {
|
||||||
|
$fontSize = 'small-size';
|
||||||
|
$stroke = 'small-stroke';
|
||||||
|
} else {
|
||||||
|
$fontSize = 'big-size';
|
||||||
|
$stroke = 'big-stroke';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<polyline points="0,0 '.$Xaxis.',0" class="polyline '.$stroke.'" />';
|
||||||
foreach ($groups as $key => $group) {
|
foreach ($groups as $key => $group) {
|
||||||
$name = '';
|
$name = '';
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
@ -786,7 +805,7 @@ class Heatmap
|
|||||||
($y_back + 1)
|
($y_back + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
$points = sprintf(
|
$points = sprintf(
|
||||||
@ -799,11 +818,11 @@ class Heatmap
|
|||||||
$y_back
|
$y_back
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
|
|
||||||
// Name.
|
// Name.
|
||||||
echo '<text x="'.((($x_position - $x_back) / 2) + $x_back).'" y="'.($y_position + 1).'"
|
echo '<text x="'.((($x_position - $x_back) / 2) + $x_back).'" y="'.($y_position + 1).'"
|
||||||
dominant-baseline="middle" style="font-size:0.4">'.$name.'</text>';
|
class="'.$fontSize.'">'.$name.'</text>';
|
||||||
|
|
||||||
$x_back = $x_position;
|
$x_back = $x_position;
|
||||||
if ($x_position === $Xaxis) {
|
if ($x_position === $Xaxis) {
|
||||||
@ -815,7 +834,7 @@ class Heatmap
|
|||||||
($y_back + 1)
|
($y_back + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
|
|
||||||
$y_back++;
|
$y_back++;
|
||||||
$x_back = 0;
|
$x_back = 0;
|
||||||
@ -838,7 +857,7 @@ class Heatmap
|
|||||||
($y_position)
|
($y_position)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bottom of last line.
|
// Bottom of last line.
|
||||||
@ -850,11 +869,11 @@ class Heatmap
|
|||||||
($y_position + 1)
|
($y_position + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
|
|
||||||
// Name.
|
// Name.
|
||||||
echo '<text x="'.(($x_position) / 2).'" y="'.($y_position + 1).'"
|
echo '<text x="'.(($x_position) / 2).'" y="'.($y_position + 1).'"
|
||||||
dominant-baseline="middle" style="font-size:0.4">'.$name.'</text>';
|
class="'.$fontSize.'">'.$name.'</text>';
|
||||||
|
|
||||||
// Bottom-right of last line.
|
// Bottom-right of last line.
|
||||||
$points = sprintf(
|
$points = sprintf(
|
||||||
@ -865,7 +884,7 @@ class Heatmap
|
|||||||
($y_position + 1)
|
($y_position + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
|
|
||||||
if ($x_position > $x_back) {
|
if ($x_position > $x_back) {
|
||||||
// Bottom-top of last line.
|
// Bottom-top of last line.
|
||||||
@ -877,7 +896,7 @@ class Heatmap
|
|||||||
($y_position)
|
($y_position)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Two or more lines.
|
// Two or more lines.
|
||||||
@ -896,7 +915,7 @@ class Heatmap
|
|||||||
($y_position + 1)
|
($y_position + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
|
|
||||||
// Bottom-right of last line.
|
// Bottom-right of last line.
|
||||||
$points = sprintf(
|
$points = sprintf(
|
||||||
@ -907,11 +926,11 @@ class Heatmap
|
|||||||
($y_position + 1)
|
($y_position + 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
|
|
||||||
// Name.
|
// Name.
|
||||||
echo '<text x="'.(($x_position) / 2).'" y="'.($y_position + 1).'"
|
echo '<text x="'.(($x_position) / 2).'" y="'.($y_position + 1).'"
|
||||||
dominant-baseline="middle" style="font-size:0.4">'.$name.'</text>';
|
class="'.$fontSize.'">'.$name.'</text>';
|
||||||
|
|
||||||
// Bottom-top of last line.
|
// Bottom-top of last line.
|
||||||
$points = sprintf(
|
$points = sprintf(
|
||||||
@ -922,7 +941,7 @@ class Heatmap
|
|||||||
($y_position)
|
($y_position)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<polyline points="'.$points.'" class="polyline" />';
|
echo '<polyline points="'.$points.'" class="polyline '.$stroke.'" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($x_position === $Xaxis) {
|
if ($x_position === $Xaxis) {
|
||||||
|
@ -253,3 +253,19 @@ div#heatmap-controls div.heatmap-refr > div {
|
|||||||
stroke: black;
|
stroke: black;
|
||||||
stroke-width: 0.05;
|
stroke-width: 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.small-stroke {
|
||||||
|
stroke-width: 0.03;
|
||||||
|
}
|
||||||
|
|
||||||
|
.big-stroke {
|
||||||
|
stroke-width: 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-size {
|
||||||
|
font-size: 0.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.big-size {
|
||||||
|
font-size: 0.4px;
|
||||||
|
}
|
||||||
|
@ -45,7 +45,7 @@ require_once $config['homedir'].'/include/class/Heatmap.class.php';
|
|||||||
$pure = (bool) get_parameter('pure', false);
|
$pure = (bool) get_parameter('pure', false);
|
||||||
$type = get_parameter('type', 0);
|
$type = get_parameter('type', 0);
|
||||||
$randomId = get_parameter('randomId', null);
|
$randomId = get_parameter('randomId', null);
|
||||||
$refresh = get_parameter('refresh', 30);
|
$refresh = get_parameter('refresh', 180);
|
||||||
$height = get_parameter('height', 0);
|
$height = get_parameter('height', 0);
|
||||||
$width = get_parameter('width', 0);
|
$width = get_parameter('width', 0);
|
||||||
$search = get_parameter('search', '');
|
$search = get_parameter('search', '');
|
||||||
@ -274,7 +274,7 @@ if ($is_ajax === true) {
|
|||||||
draggable: false,
|
draggable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
height: 370,
|
height: 410,
|
||||||
width: 330,
|
width: 330,
|
||||||
title: '<?php echo __('Config'); ?>',
|
title: '<?php echo __('Config'); ?>',
|
||||||
position: {
|
position: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user