mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
fixed errors agent access and other fix
This commit is contained in:
parent
5574ddd205
commit
6eba3250da
@ -2970,17 +2970,6 @@ function color_graph_array(){
|
|||||||
'color' => '#0097BC',
|
'color' => '#0097BC',
|
||||||
'alpha' => 10
|
'alpha' => 10
|
||||||
);
|
);
|
||||||
//XXXXXXXX
|
|
||||||
/*
|
|
||||||
if($id_widget_dashboard){
|
|
||||||
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $id_widget_dashboard)));
|
|
||||||
foreach ($module_list as $key => $value) {
|
|
||||||
if(!empty($opcion[$value])){
|
|
||||||
$color[$key]['color'] = $opcion[$value];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $color_series;
|
return $color_series;
|
||||||
}
|
}
|
||||||
@ -3004,6 +2993,18 @@ function series_type_graph_array($data, $show_elements_graph){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$color_series = color_graph_array();
|
$color_series = color_graph_array();
|
||||||
|
|
||||||
|
if($show_elements_graph['id_widget_dashboard']){
|
||||||
|
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $show_elements_graph['id_widget_dashboard'])));
|
||||||
|
foreach ($opcion as $key => $value) {
|
||||||
|
$color_series[0] = array(
|
||||||
|
'border' => '#000000',
|
||||||
|
'color' => $opcion['avg'],
|
||||||
|
'alpha' => CHART_DEFAULT_ALPHA
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if(isset($data) && is_array($data)){
|
if(isset($data) && is_array($data)){
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
|
@ -870,8 +870,13 @@ function grafico_modulo_sparse ($params) {
|
|||||||
$params['graph_combined'] = false;
|
$params['graph_combined'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//XXXX Configurable
|
||||||
|
$params['grid_color'] = '#C1C1C1';
|
||||||
|
$params['legend_color'] = '#636363';
|
||||||
|
|
||||||
$params['font'] = $config['fontpath'];
|
$params['font'] = $config['fontpath'];
|
||||||
$params['font-size'] = $config['font_size'];
|
$params['font-size'] = $config['font_size'];
|
||||||
|
$params['short_data'] = $config['short_module_graph_data'];
|
||||||
|
|
||||||
if($params['only_image']){
|
if($params['only_image']){
|
||||||
return generator_chart_to_pdf('sparse', $params);
|
return generator_chart_to_pdf('sparse', $params);
|
||||||
@ -1228,7 +1233,6 @@ function graphic_combined_module (
|
|||||||
$params_combined['percentil'] = $params['percentil'];
|
$params_combined['percentil'] = $params['percentil'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!isset($params['period'])){
|
if(!isset($params['period'])){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2267,24 +2271,6 @@ function combined_graph_summatory_average ($array_data, $average = false, $summa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a graph with access data of agents
|
* Print a graph with access data of agents
|
||||||
*
|
*
|
||||||
@ -2308,7 +2294,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
|
|||||||
WHERE id_agent = $id_agent
|
WHERE id_agent = $id_agent
|
||||||
AND utimestamp > $datelimit
|
AND utimestamp > $datelimit
|
||||||
AND utimestamp < $date
|
AND utimestamp < $date
|
||||||
GROUP by ROUND(utimestamp / 300)"
|
GROUP by ROUND(utimestamp / 1800)"
|
||||||
);
|
);
|
||||||
|
|
||||||
if(isset($data) && is_array($data)){
|
if(isset($data) && is_array($data)){
|
||||||
@ -2342,14 +2328,16 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
|
|||||||
'only_image' => $only_image,
|
'only_image' => $only_image,
|
||||||
'homeurl' => $homeurl,
|
'homeurl' => $homeurl,
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
'backgroundColor' => 'white',
|
'backgroundColor' => '#f9faf9',
|
||||||
'type_graph' => 'area',
|
'type_graph' => 'area',
|
||||||
'font' => $config['fontpath'],
|
'font' => $config['fontpath'],
|
||||||
'font-size' => $config['font_size'],
|
'font-size' => $config['font_size'],
|
||||||
'array_data_create' => $data_array,
|
'array_data_create' => $data_array,
|
||||||
'show_overview' => false,
|
'show_overview' => false,
|
||||||
'show_export_csv' => false,
|
'show_export_csv' => false,
|
||||||
'vconsole' => $tree
|
'vconsole' => true,
|
||||||
|
'show_legend' => false,
|
||||||
|
'grid_color' => 'grey'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
|
@ -729,7 +729,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||||||
if ($config["agentaccess"]) {
|
if ($config["agentaccess"]) {
|
||||||
$access_graph = '<div>hjhhjhhj</div>';
|
$access_graph = '<div>hjhhjhhj</div>';
|
||||||
$access_graph = '<div style="width:100%; heigth:200px;">';
|
$access_graph = '<div style="width:100%; heigth:200px;">';
|
||||||
$access_graph .= graphic_agentaccess($id_agente, 380, 180, SECONDS_1DAY, true, true);
|
$access_graph .= graphic_agentaccess($id_agente, 380, 90, SECONDS_1DAY, true, true);
|
||||||
$access_graph .= '</div><br><br>';
|
$access_graph .= '</div><br><br>';
|
||||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||||
}
|
}
|
||||||
|
@ -855,29 +855,33 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pandoraFlotArea(
|
function pandoraFlotArea( graph_id, values, legend,
|
||||||
graph_id, values, legend, agent_module_id,
|
|
||||||
series_type, color, water_mark, date_array,
|
series_type, color, water_mark, date_array,
|
||||||
data_module_graph, params,
|
data_module_graph, params, events_array
|
||||||
force_integer, background_color,
|
|
||||||
legend_color, short_data, events_array
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
//diferents vars
|
//diferents vars
|
||||||
var unit = params.unit ? params.unit : '';
|
var unit = params.unit ? params.unit : '';
|
||||||
var homeurl = params.homeurl;
|
var homeurl = params.homeurl;
|
||||||
var font_size = params.font_size;
|
var font_size = params.font_size;
|
||||||
var font = params.font;
|
var font = params.font;
|
||||||
var width = params.width;
|
var width = params.width;
|
||||||
var height = params.height;
|
var height = params.height;
|
||||||
var vconsole = params.vconsole;
|
var vconsole = params.vconsole;
|
||||||
var dashboard = params.dashboard;
|
var dashboard = params.dashboard;
|
||||||
var menu = params.menu;
|
var menu = params.menu;
|
||||||
var min_x = date_array['start_date'] *1000;
|
var min_x = date_array['start_date'] *1000;
|
||||||
var max_x = date_array['final_date'] *1000;
|
var max_x = date_array['final_date'] *1000;
|
||||||
var type = params.stacked;
|
var type = params.stacked;
|
||||||
var show_legend = params.show_legend;
|
var show_legend = params.show_legend;
|
||||||
var image_treshold = params.image_treshold;
|
var image_treshold = params.image_treshold;
|
||||||
|
var short_data = params.short_data;
|
||||||
|
var grid_color = params.grid_color;
|
||||||
|
var background_color = params.backgroundColor;
|
||||||
|
var legend_color = params.legend_color;
|
||||||
|
|
||||||
|
//XXXXXX colocar
|
||||||
|
var force_integer = 0;
|
||||||
|
|
||||||
if(typeof type === 'undefined' || type == ''){
|
if(typeof type === 'undefined' || type == ''){
|
||||||
type = params.type_graph;
|
type = params.type_graph;
|
||||||
@ -1594,7 +1598,7 @@ function pandoraFlotArea(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var maxticks = date_array['period'] / 3600 / number_ticks;
|
var maxticks = date_array['period'] / 3600 / number_ticks;
|
||||||
|
console.log(grid_color);
|
||||||
var options = {
|
var options = {
|
||||||
series: {
|
series: {
|
||||||
stack: stacked,
|
stack: stacked,
|
||||||
@ -1618,8 +1622,8 @@ function pandoraFlotArea(
|
|||||||
clickable: true,
|
clickable: true,
|
||||||
borderWidth:1,
|
borderWidth:1,
|
||||||
borderColor: '#C1C1C1',
|
borderColor: '#C1C1C1',
|
||||||
tickColor: background_color,
|
backgroundColor: background_color,
|
||||||
color: legend_color,
|
color: grid_color,
|
||||||
autoHighlight: true
|
autoHighlight: true
|
||||||
},
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
@ -1677,7 +1681,7 @@ function pandoraFlotArea(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*//XXXXXXX
|
/*//XXXXXXXREvisar esto
|
||||||
if (vconsole) {
|
if (vconsole) {
|
||||||
var myCanvas = plot.getCanvas();
|
var myCanvas = plot.getCanvas();
|
||||||
plot.setupGrid(); // redraw plot to new size
|
plot.setupGrid(); // redraw plot to new size
|
||||||
@ -1696,7 +1700,6 @@ if (vconsole) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Adjust linked graph to the width and position of the main plot
|
// Adjust linked graph to the width and position of the main plot
|
||||||
|
|
||||||
// Miniplot
|
// Miniplot
|
||||||
if (!vconsole) {
|
if (!vconsole) {
|
||||||
var overview = $.plot($('#overview_'+graph_id),datas, {
|
var overview = $.plot($('#overview_'+graph_id),datas, {
|
||||||
@ -1722,7 +1725,7 @@ if (vconsole) {
|
|||||||
borderWidth:1,
|
borderWidth:1,
|
||||||
borderColor: '#C1C1C1',
|
borderColor: '#C1C1C1',
|
||||||
tickColor: background_color,
|
tickColor: background_color,
|
||||||
color: legend_color,
|
color: grid_color,
|
||||||
autoHighlight: true
|
autoHighlight: true
|
||||||
},
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
@ -1757,6 +1760,8 @@ if (vconsole) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').css('color', legend_color);
|
||||||
|
|
||||||
// Adjust overview when main chart is resized
|
// Adjust overview when main chart is resized
|
||||||
$('#overview_'+graph_id).resize(function(){
|
$('#overview_'+graph_id).resize(function(){
|
||||||
update_left_width_canvas(graph_id);
|
update_left_width_canvas(graph_id);
|
||||||
@ -1994,7 +1999,7 @@ if (vconsole) {
|
|||||||
.eq(i).css('font-size',font_size+'pt');
|
.eq(i).css('font-size',font_size+'pt');
|
||||||
|
|
||||||
$('#legend_' + graph_id + ' .legendLabel')
|
$('#legend_' + graph_id + ' .legendLabel')
|
||||||
.eq(i).css('color','');
|
.eq(i).css('color', legend_color);
|
||||||
|
|
||||||
$('#legend_' + graph_id + ' .legendLabel')
|
$('#legend_' + graph_id + ' .legendLabel')
|
||||||
.eq(i).css('font-family',font+'Font');
|
.eq(i).css('font-family',font+'Font');
|
||||||
|
@ -117,15 +117,19 @@ function flot_area_graph (
|
|||||||
switch ($params['backgroundColor']) {
|
switch ($params['backgroundColor']) {
|
||||||
case 'white':
|
case 'white':
|
||||||
$background_style = ' background: #fff; ';
|
$background_style = ' background: #fff; ';
|
||||||
|
$params['grid_color'] = '#C1C1C1';
|
||||||
break;
|
break;
|
||||||
case 'black':
|
case 'black':
|
||||||
$background_style = ' background: #000; ';
|
$background_style = ' background: #000; ';
|
||||||
|
$params['grid_color'] = '#BDBDBD';
|
||||||
break;
|
break;
|
||||||
case 'transparent':
|
case 'transparent':
|
||||||
$background_style = '';
|
$background_style = '';
|
||||||
|
$params['grid_color'] = '#A4A4A4';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$background_style = 'background-color: ' . $params['backgroundColor'];
|
$background_style = 'background-color: ' . $params['backgroundColor'];
|
||||||
|
$params['grid_color'] = '#C1C1C1';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,29 +247,13 @@ function flot_area_graph (
|
|||||||
background:#fff; padding: 2px 2px 2px 2px;
|
background:#fff; padding: 2px 2px 2px 2px;
|
||||||
border: solid #000 1px;'></div>";
|
border: solid #000 1px;'></div>";
|
||||||
|
|
||||||
if(substr($background_style, -6, 4) == '#fff'){
|
|
||||||
$background_color = "#eee";
|
|
||||||
$legend_color = "#151515";
|
|
||||||
}
|
|
||||||
else if(substr($background_style, -6, 4) == '#000'){
|
|
||||||
$background_color = "#151515";
|
|
||||||
$legend_color = "#BDBDBD";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$background_color = "#A4A4A4";
|
|
||||||
$legend_color = "#A4A4A4";
|
|
||||||
}
|
|
||||||
|
|
||||||
$force_integer = 0;
|
|
||||||
|
|
||||||
// Trick to get translated string from javascript
|
// Trick to get translated string from javascript
|
||||||
$return .= html_print_input_hidden('unknown_text', __('Unknown'), true);
|
$return .= html_print_input_hidden('unknown_text', __('Unknown'), true);
|
||||||
|
|
||||||
if (!isset($config["short_module_graph_data"])){
|
//XXXX Meter en params
|
||||||
$config["short_module_graph_data"] = '';
|
/*
|
||||||
}
|
mirar tmb lo de force integer
|
||||||
|
*/
|
||||||
$short_data = $config["short_module_graph_data"];
|
|
||||||
|
|
||||||
$values = json_encode($array_data);
|
$values = json_encode($array_data);
|
||||||
$legend = json_encode($legend);
|
$legend = json_encode($legend);
|
||||||
@ -284,17 +272,12 @@ function flot_area_graph (
|
|||||||
"'$graph_id', \n" .
|
"'$graph_id', \n" .
|
||||||
"JSON.parse('$values'), \n" .
|
"JSON.parse('$values'), \n" .
|
||||||
"JSON.parse('$legend'), \n" .
|
"JSON.parse('$legend'), \n" .
|
||||||
"'$agent_module_id', \n" .
|
|
||||||
"JSON.parse('$series_type'), \n" .
|
"JSON.parse('$series_type'), \n" .
|
||||||
"JSON.parse('$color'), \n" .
|
"JSON.parse('$color'), \n" .
|
||||||
"'$watermark', \n" .
|
"'$watermark', \n" .
|
||||||
"JSON.parse('$date_array'), \n" .
|
"JSON.parse('$date_array'), \n" .
|
||||||
"JSON.parse('$data_module_graph'), \n" .
|
"JSON.parse('$data_module_graph'), \n" .
|
||||||
"JSON.parse('$params'), \n" .
|
"JSON.parse('$params'), \n" .
|
||||||
"$force_integer, \n" .
|
|
||||||
"'$background_color', \n" .
|
|
||||||
"'$legend_color', \n" .
|
|
||||||
"'$short_data', \n" .
|
|
||||||
"JSON.parse('$array_events_alerts')".
|
"JSON.parse('$array_events_alerts')".
|
||||||
");";
|
");";
|
||||||
$return .= "});";
|
$return .= "});";
|
||||||
|
@ -284,7 +284,7 @@ if ($config["agentaccess"] && $access_agent > 0) {
|
|||||||
<legend>' .
|
<legend>' .
|
||||||
__('Agent access rate (24h)') .
|
__('Agent access rate (24h)') .
|
||||||
'</legend>' .
|
'</legend>' .
|
||||||
graphic_agentaccess($id_agente, '90%', 150, SECONDS_1DAY, true) .
|
graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true) .
|
||||||
'</fieldset>';
|
'</fieldset>';
|
||||||
$table_data->style[0] = 'width: 20%;';
|
$table_data->style[0] = 'width: 20%;';
|
||||||
$table_data->style[1] = 'width: 30%;';
|
$table_data->style[1] = 'width: 30%;';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user