2012-03-01 17:41:02 +01:00
|
|
|
<?PHP
|
|
|
|
|
|
|
|
// Copyright (c) 2007-2008 Sancho Lerena, slerena@gmail.com
|
|
|
|
// Copyright (c) 2008 Esteban Sanchez, estebans@artica.es
|
|
|
|
// Copyright (c) 2007-2011 Artica, info@artica.es
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// (LGPL) as published by the Free Software Foundation; version 2
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
|
|
|
|
//JQuery 1.6.1 library addition
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
2012-03-05 20:25:02 +01:00
|
|
|
|
|
|
|
function include_javascript_dependencies_flot_graph($return = false) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
static $is_include_javascript = false;
|
|
|
|
|
|
|
|
if (!$is_include_javascript) {
|
|
|
|
$is_include_javascript = true;
|
|
|
|
|
2012-09-28 16:06:20 +02:00
|
|
|
$metaconsole_hack = '';
|
|
|
|
if (defined('METACONSOLE')) {
|
|
|
|
$metaconsole_hack = '../../';
|
|
|
|
}
|
|
|
|
|
2012-03-05 20:25:02 +01:00
|
|
|
// NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area
|
|
|
|
$output = '
|
2013-04-11 18:35:07 +02:00
|
|
|
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="' . ui_get_full_url($metaconsole_hack . '/include/graphs/flot/excanvas.js') . '"></script><![endif]-->
|
2012-09-28 16:06:20 +02:00
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.min.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.pie.js') .'"></script>
|
2012-09-28 16:06:20 +02:00
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.crosshair.min.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.stack.min.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.selection.min.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.resize.min.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.threshold.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/jquery.flot.symbol.min.js') .'"></script>
|
|
|
|
<script language="javascript" type="text/javascript" src="'.
|
2013-03-15 15:35:52 +01:00
|
|
|
ui_get_full_url($metaconsole_hack . '/include/graphs/flot/pandora.flot.js') .'"></script>';
|
2012-03-05 20:25:02 +01:00
|
|
|
$output .= "
|
2013-03-15 15:35:52 +01:00
|
|
|
<script type='text/javascript'>
|
|
|
|
function pieHover(event, pos, obj)
|
|
|
|
{
|
|
|
|
if (!obj)
|
|
|
|
return;
|
|
|
|
percent = parseFloat(obj.series.percent).toFixed(2);
|
|
|
|
$('#hover').html('<span style=\'font-weight: bold; color: '+obj.series.color+'\'>'+obj.series.label+' ('+percent+'%)</span>');
|
|
|
|
$('.legendLabel').each(function() {
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($(this).html() == obj.series.label) {
|
2013-03-15 15:35:52 +01:00
|
|
|
$(this).css('font-weight','bold');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$(this).css('font-weight','');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function pieClick(event, pos, obj)
|
|
|
|
{
|
|
|
|
if (!obj)
|
|
|
|
return;
|
|
|
|
percent = parseFloat(obj.series.percent).toFixed(2);
|
2013-04-10 09:57:54 +02:00
|
|
|
alert(''+obj.series.label+': '+obj.series.data[0][1]+' ('+percent+'%)');
|
2013-03-15 15:35:52 +01:00
|
|
|
}
|
|
|
|
</script>";
|
2012-03-05 20:25:02 +01:00
|
|
|
|
|
|
|
if (!$return)
|
|
|
|
echo $output;
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
////////// AREA GRAPHS ////////
|
|
|
|
///////////////////////////////
|
2014-09-23 13:02:49 +02:00
|
|
|
function flot_area_stacked_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl = '', $unit = '', $water_mark = '',
|
|
|
|
$serie_types = array(), $chart_extra_data = array(),
|
|
|
|
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
|
|
|
$force_integer = false, $series_suffix_str = '', $menu = true,
|
2016-04-04 10:06:34 +02:00
|
|
|
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_area_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl, $unit, 'area_stacked',
|
|
|
|
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
|
|
|
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
2016-04-04 10:06:34 +02:00
|
|
|
$menu, $background_color, $dashboard, $vconsole, $agent_module_id);
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function flot_area_simple_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl = '', $unit = '', $water_mark = '',
|
|
|
|
$serie_types = array(), $chart_extra_data = array(),
|
|
|
|
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
|
|
|
$force_integer = false, $series_suffix_str = '', $menu = true,
|
2016-04-04 10:06:34 +02:00
|
|
|
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_area_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl, $unit, 'area_simple',
|
|
|
|
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
|
|
|
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
2016-04-04 10:06:34 +02:00
|
|
|
$menu, $background_color, $dashboard, $vconsole, $agent_module_id);
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl = '', $unit = '', $water_mark = '',
|
|
|
|
$serie_types = array(), $chart_extra_data = array(),
|
|
|
|
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
|
|
|
$force_integer = false, $series_suffix_str = '', $menu = true,
|
2016-04-04 10:06:34 +02:00
|
|
|
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_area_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl, $unit, 'line_stacked',
|
|
|
|
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
|
|
|
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
2016-04-04 10:06:34 +02:00
|
|
|
$menu, $background_color, $dashboard, $vconsole, $agent_module_id);
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl = '', $unit = '', $water_mark = '',
|
|
|
|
$serie_types = array(), $chart_extra_data = array(),
|
|
|
|
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
|
|
|
$force_integer = false, $series_suffix_str = '', $menu = true,
|
2016-04-04 10:06:34 +02:00
|
|
|
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
return flot_area_graph($chart_data, $width, $height, $color,
|
|
|
|
$legend, $long_index, $homeurl, $unit, 'line_simple',
|
|
|
|
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
|
|
|
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
2016-03-15 09:25:48 +01:00
|
|
|
$menu, $background_color, $dashboard, $vconsole);
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|
|
|
$long_index, $homeurl, $unit, $type, $water_mark, $serie_types,
|
|
|
|
$chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key,
|
|
|
|
$force_integer, $series_suffix_str = '', $menu = true,
|
2016-04-04 10:06:34 +02:00
|
|
|
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2015-08-20 17:55:10 +02:00
|
|
|
|
2012-03-05 20:25:02 +01:00
|
|
|
include_javascript_dependencies_flot_graph();
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$font_size = '7';
|
|
|
|
|
2013-04-15 13:44:36 +02:00
|
|
|
$menu = (int)$menu;
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Get a unique identifier to graph
|
|
|
|
$graph_id = uniqid('graph_');
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2014-09-23 13:02:49 +02:00
|
|
|
$background_style = '';
|
|
|
|
switch ($background_color) {
|
|
|
|
default:
|
|
|
|
case 'white':
|
|
|
|
$background_style = ' background: #fff; ';
|
|
|
|
break;
|
|
|
|
case 'black':
|
|
|
|
$background_style = ' background: #000; ';
|
|
|
|
break;
|
|
|
|
case 'transparent':
|
|
|
|
$background_style = '';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-07 16:39:50 +01:00
|
|
|
// Parent layer
|
2014-09-23 13:02:49 +02:00
|
|
|
$return = "<div class='parent_graph' style='width: " . $width . "px; " . $background_style . "'>";
|
2012-03-01 17:41:02 +01:00
|
|
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
2013-12-12 15:49:36 +01:00
|
|
|
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:".$font_size."pt'></p>";
|
2016-04-04 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Get other required module datas to draw warning and critical
|
|
|
|
if ($agent_module_id == 0) {
|
|
|
|
$yellow_up = 0;
|
|
|
|
$red_up = 0;
|
|
|
|
$yellow_inverse = false;
|
|
|
|
$red_inverse = false;
|
|
|
|
} else {
|
|
|
|
$module_data = db_get_row_sql ('SELECT * FROM tagente_modulo WHERE id_agente_modulo = ' . $agent_module_id);
|
|
|
|
$yellow_up = $module_data['max_warning'];
|
|
|
|
$red_up = $module_data['max_critical'];
|
|
|
|
$yellow_inverse = !($module_data['warning_inverse'] == 0);
|
|
|
|
$red_inverse = !($module_data['critical_inverse'] == 0);
|
|
|
|
}
|
|
|
|
|
2015-07-02 10:06:26 +02:00
|
|
|
if ($menu) {
|
|
|
|
$threshold = false;
|
2016-04-04 10:06:34 +02:00
|
|
|
if ($yellow_threshold != $yellow_up || $red_threshold != $red_up) {
|
2015-07-02 10:06:26 +02:00
|
|
|
$threshold = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$nbuttons = 3;
|
|
|
|
|
|
|
|
if ($threshold) {
|
|
|
|
$nbuttons++;
|
|
|
|
}
|
|
|
|
$menu_width = 25 * $nbuttons + 15;
|
2016-03-23 15:13:31 +01:00
|
|
|
if ( $dashboard == false AND $vconsole == false) {
|
2015-11-04 17:42:45 +01:00
|
|
|
$return .= "<div id='menu_$graph_id' class='menu_graph' " .
|
|
|
|
"style='display: none; " .
|
|
|
|
"text-align: center; " .
|
|
|
|
"width: " . $menu_width . "px; ".
|
|
|
|
"border: solid 1px #666; ".
|
|
|
|
"border-bottom: 0px; " .
|
|
|
|
"padding: 4px 4px 4px 4px;margin-bottom:5px;'>
|
|
|
|
<a href='javascript:'><img id='menu_cancelzoom_$graph_id' src='".$homeurl."images/zoom_cross_grey.disabled.png' alt='".__('Cancel zoom')."' title='".__('Cancel zoom')."'></a>";
|
|
|
|
if ($threshold) {
|
|
|
|
$return .= " <a href='javascript:'><img id='menu_threshold_$graph_id' src='".$homeurl."images/chart_curve_threshold.png' alt='".__('Warning and Critical thresholds')."' title='".__('Warning and Critical thresholds')."'></a>";
|
|
|
|
}
|
|
|
|
$return .= " <a href='javascript:'>
|
|
|
|
<img id='menu_overview_$graph_id' class='menu_overview' src='" . $homeurl . "images/chart_curve_overview.png' alt='" . __('Overview graph') . "' title='".__('Overview graph')."'></a>";
|
|
|
|
|
|
|
|
// Export buttons
|
|
|
|
$return .= " <a href='javascript:'><img id='menu_export_csv_$graph_id' src='".$homeurl."images/csv_grey.png' alt='".__('Export to CSV')."' title='".__('Export to CSV')."'></a>";
|
|
|
|
// Button disabled. This feature works, but seems that is not useful enough to the final users.
|
|
|
|
//$return .= " <a href='javascript:'><img id='menu_export_json_$graph_id' src='".$homeurl."images/json.png' alt='".__('Export to JSON')."' title='".__('Export to JSON')."'></a>";
|
|
|
|
|
|
|
|
$return .= "</div>";
|
2015-07-02 10:06:26 +02:00
|
|
|
}
|
|
|
|
}
|
2016-05-30 19:31:01 +02:00
|
|
|
$return .= html_print_input_hidden('line_width_graph', $config['custom_graph_width'], true);
|
2013-12-12 15:49:36 +01:00
|
|
|
$return .= "<div id='timestamp_$graph_id' class='timestamp_graph' style='font-size:".$font_size."pt;display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px; z-index:1000;'></div>";
|
2012-03-08 13:32:59 +01:00
|
|
|
$return .= "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
|
2014-03-10 16:59:36 +01:00
|
|
|
if ($menu) {
|
2014-01-13 11:29:12 +01:00
|
|
|
$height = 100;
|
|
|
|
}
|
|
|
|
else {
|
2014-10-13 14:13:31 +02:00
|
|
|
$height = 1;
|
2014-01-13 11:29:12 +01:00
|
|
|
}
|
2016-06-06 17:01:34 +02:00
|
|
|
if (!$dashboard && !$vconsole)
|
|
|
|
$return .= "<div id='overview_$graph_id' class='overview_graph' style='display: none; margin-left:0px; margin-top:20px; width: ".$width."px; height: ".$height ."px;'></div>";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-07 12:03:22 +01:00
|
|
|
if ($water_mark != '') {
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
|
|
|
$watermark = 'true';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$watermark = 'false';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
|
|
|
$separator = ';;::;;';
|
|
|
|
$separator2 = ':,:,,,:,:';
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Transform data from our format to library format
|
2012-03-06 18:23:46 +01:00
|
|
|
$legend2 = array();
|
2012-03-01 17:41:02 +01:00
|
|
|
$labels = array();
|
|
|
|
$a = array();
|
|
|
|
$vars = array();
|
|
|
|
$serie_types2 = array();
|
|
|
|
|
|
|
|
$colors = array();
|
2012-03-07 12:03:22 +01:00
|
|
|
|
2012-03-06 18:23:46 +01:00
|
|
|
$index = array_keys(reset($chart_data));
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
foreach ($index as $serie_key) {
|
|
|
|
if (isset($color[$serie_key])) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$colors[] = $color[$serie_key]['color'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$colors[] = '';
|
|
|
|
}
|
|
|
|
}
|
2013-10-14 13:48:51 +02:00
|
|
|
|
2015-08-25 13:00:46 +02:00
|
|
|
foreach ($chart_data as $label => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$labels[] = io_safe_output($label);
|
2013-10-14 13:48:51 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
foreach($values as $key => $value) {
|
2013-10-14 13:48:51 +02:00
|
|
|
$jsvar = "data_" . $graph_id . "_" . $key;
|
2012-03-01 17:41:02 +01:00
|
|
|
|
2015-08-20 17:55:10 +02:00
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if (!isset($serie_types[$key])) {
|
2015-08-20 17:55:10 +02:00
|
|
|
switch ($type) {
|
|
|
|
case 'line_simple':
|
|
|
|
case 'line_stacked':
|
|
|
|
$serie_types2[$jsvar] = 'line';
|
|
|
|
break;
|
|
|
|
case 'area_simple':
|
|
|
|
case 'area_stacked':
|
|
|
|
default:
|
|
|
|
$serie_types2[$jsvar] = 'area';
|
|
|
|
break;
|
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$serie_types2[$jsvar] = $serie_types[$key];
|
|
|
|
}
|
|
|
|
|
2015-08-20 17:55:10 +02:00
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if ($serie_types2[$jsvar] == 'points' && $value == 0) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$data[$jsvar][] = 'null';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$jsvar][] = $value;
|
2012-03-06 18:23:46 +01:00
|
|
|
}
|
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if (!isset($legend[$key])) {
|
2012-03-06 18:23:46 +01:00
|
|
|
$legend2[$jsvar] = 'null';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$legend2[$jsvar] = $legend[$key];
|
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
}
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Store data series in javascript format
|
|
|
|
$jsvars = '';
|
|
|
|
$jsseries = array();
|
|
|
|
$values2 = array();
|
|
|
|
$i = 0;
|
|
|
|
$max_x = 0;
|
2013-04-04 19:44:07 +02:00
|
|
|
foreach ($data as $jsvar => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$n_values = count($values);
|
2013-04-04 19:44:07 +02:00
|
|
|
if ($n_values > $max_x) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$max_x = $n_values;
|
|
|
|
}
|
|
|
|
|
|
|
|
$values2[] = implode($separator,$values);
|
|
|
|
$i ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
$values = implode($separator2, $values2);
|
|
|
|
|
|
|
|
// Max is "n-1" because start with 0
|
|
|
|
$max_x--;
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$extra_width = (int)($width / 3);
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2015-08-25 13:00:46 +02:00
|
|
|
$return .= "<div id='extra_$graph_id' style='font-size: " . $font_size . "pt; display:none; position:absolute; overflow: auto; max-height: ".($height+50)."px; width: ".$extra_width."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Process extra data
|
|
|
|
$events = array();
|
|
|
|
$event_ids = array();
|
|
|
|
$alerts = array();
|
|
|
|
$alert_ids = array();
|
|
|
|
$legend_events = '';
|
|
|
|
$legend_alerts = '';
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
if (empty($chart_extra_data)) {
|
|
|
|
$chart_extra_data = array();
|
|
|
|
}
|
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
foreach ($chart_extra_data as $i => $data) {
|
|
|
|
switch ($i) {
|
2012-03-01 17:41:02 +01:00
|
|
|
case 'legend_alerts':
|
|
|
|
$legend_alerts = $data;
|
|
|
|
break;
|
|
|
|
case 'legend_events':
|
|
|
|
$legend_events = $data;
|
|
|
|
break;
|
|
|
|
default:
|
2013-03-12 17:20:53 +01:00
|
|
|
if (isset($data['events'])) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$event_ids[] = $i;
|
|
|
|
$events[$i] = $data['events'];
|
|
|
|
}
|
2013-03-12 17:20:53 +01:00
|
|
|
if (isset($data['alerts'])) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$alert_ids[] = $i;
|
|
|
|
$alerts[$i] = $data['alerts'];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store serialized data to use it from javascript
|
|
|
|
$events = implode($separator,$events);
|
|
|
|
$event_ids = implode($separator,$event_ids);
|
|
|
|
$alerts = implode($separator,$alerts);
|
|
|
|
$alert_ids = implode($separator,$alert_ids);
|
|
|
|
$labels = implode($separator,$labels);
|
2012-03-07 12:03:22 +01:00
|
|
|
if (!empty($long_index)) {
|
|
|
|
$labels_long = implode($separator, $long_index);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$labels_long = $labels;
|
|
|
|
}
|
|
|
|
if (!empty($legend)) {
|
2015-06-11 21:24:14 +02:00
|
|
|
$legend = io_safe_output(implode($separator, $legend));
|
2012-03-07 12:03:22 +01:00
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
$serie_types = implode($separator, $serie_types2);
|
|
|
|
$colors = implode($separator, $colors);
|
|
|
|
|
2012-03-08 17:32:11 +01:00
|
|
|
// transform into string to pass to javascript
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if ($force_integer) {
|
2012-03-08 17:32:11 +01:00
|
|
|
$force_integer = 'true';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$force_integer = 'false';
|
|
|
|
}
|
2013-10-14 13:48:51 +02:00
|
|
|
|
2013-02-13 10:41:59 +01:00
|
|
|
// Trick to get translated string from javascript
|
2013-10-14 13:48:51 +02:00
|
|
|
$return .= html_print_input_hidden('unknown_text', __('Unknown'),
|
|
|
|
true);
|
2012-03-08 17:32:11 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Javascript code
|
|
|
|
$return .= "<script type='text/javascript'>";
|
|
|
|
$return .= "//<![CDATA[\n";
|
2013-10-14 13:48:51 +02:00
|
|
|
$return .= "pandoraFlotArea(" .
|
2015-08-20 17:55:10 +02:00
|
|
|
"'$graph_id', \n" .
|
|
|
|
"'$values', \n" .
|
|
|
|
"'$labels', \n" .
|
|
|
|
"'$labels_long', \n" .
|
|
|
|
"'$legend', \n" .
|
|
|
|
"'$colors', \n" .
|
|
|
|
"'$type', \n" .
|
|
|
|
"'$serie_types', \n" .
|
|
|
|
"$watermark, \n" .
|
|
|
|
"$width, \n" .
|
|
|
|
"$max_x, \n" .
|
|
|
|
"'" . $homeurl . "', \n" .
|
|
|
|
"'$unit', \n" .
|
|
|
|
"$font_size, \n" .
|
|
|
|
"$menu, \n" .
|
|
|
|
"'$events', \n" .
|
|
|
|
"'$event_ids', \n" .
|
|
|
|
"'$legend_events', \n" .
|
|
|
|
"'$alerts', \n" .
|
|
|
|
"'$alert_ids', \n" .
|
|
|
|
"'$legend_alerts', \n" .
|
|
|
|
"'$yellow_threshold', \n" .
|
|
|
|
"'$red_threshold', \n" .
|
|
|
|
"$force_integer, \n" .
|
|
|
|
"'$separator', \n" .
|
|
|
|
"'$separator2', \n" .
|
2016-04-04 10:06:34 +02:00
|
|
|
"'$yellow_up', \n" .
|
|
|
|
"'$red_up', \n" .
|
|
|
|
"'$yellow_inverse', \n" .
|
|
|
|
"'$red_inverse', \n" .
|
2016-03-15 09:25:48 +01:00
|
|
|
"'$series_suffix_str',
|
2016-05-30 17:55:07 +02:00
|
|
|
" . json_encode($dashboard) . ",\n
|
|
|
|
" . json_encode($vconsole) . ");";
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "\n//]]>";
|
|
|
|
$return .= "</script>";
|
2012-03-07 16:39:50 +01:00
|
|
|
|
|
|
|
// Parent layer
|
|
|
|
$return .= "</div>";
|
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
return $return;
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////
|
|
|
|
///////////////////////////////
|
|
|
|
///////////////////////////////
|
|
|
|
|
|
|
|
// Prints a FLOT pie chart
|
2013-01-30 17:29:49 +01:00
|
|
|
function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
2016-05-26 13:47:45 +02:00
|
|
|
$font = '', $font_size = 8, $legend_position = '', $colors = '',
|
|
|
|
$hide_labels = false) {
|
2013-01-30 17:29:49 +01:00
|
|
|
|
2012-03-05 20:25:02 +01:00
|
|
|
include_javascript_dependencies_flot_graph();
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$series = sizeof($values);
|
2012-03-05 20:25:02 +01:00
|
|
|
if (($series != sizeof ($labels)) || ($series == 0) ) {
|
2012-03-01 17:41:02 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$graph_id = uniqid('graph_');
|
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
switch ($legend_position) {
|
|
|
|
case 'bottom':
|
|
|
|
$height = $height + (count($values) * 24);
|
|
|
|
break;
|
|
|
|
case 'right':
|
|
|
|
default:
|
|
|
|
//TODO FOR TOP OR LEFT OR RIGHT
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-07 12:03:22 +01:00
|
|
|
$return = "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
2012-03-01 17:41:02 +01:00
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($water_mark != '') {
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
|
|
|
$water_mark = 'true';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$water_mark = 'false';
|
|
|
|
}
|
|
|
|
|
|
|
|
$separator = ';;::;;';
|
|
|
|
|
2013-02-19 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/functions_agents.php,
include/functions_config.php, include/ajax/reporting.ajax.php,
include/functions_snmp_browser.php,
operation/agentes/status_monitor.php: improved code style.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/flot/jquery.flot.pie.js,
include/graphs/flot/jquery.flot.pie.min.js,
include/graphs/flot/pandora.flot.js,
include/graphs/functions_flot.php: fixed the pie graphs, added the
expanded version of flot pie js file with some changes for the
last version of jQuery.
Fixes: #3604555
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7675 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-02-19 11:35:04 +01:00
|
|
|
$labels = implode($separator, $labels);
|
|
|
|
$values = implode($separator, $values);
|
2013-07-17 13:12:37 +02:00
|
|
|
if (!empty($colors)) {
|
2013-02-20 18:15:38 +01:00
|
|
|
$colors = implode($separator, $colors);
|
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
$return .= "<script type='text/javascript'>";
|
2014-06-09 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php, general/login_page.php: improved
the source code style.
* godmode/setup/os.builder.php: fixed the form.
* godmode/update_manager_xxx/*, godmode/menu.php,
include/functions_update_manager.php,
include/ajax/update_manager.ajax.php,
include/graphs/functions_gd.php, include/graphs/functions_flot.php,
include/config_process.php, include/javascript/update_manager.js,
include/javascript/jquery.knob.js,
include/javascript/jquery.iframe-transport.js,
include/javascript/jquery.fileupload.js, images/check-cross.png:
first version of new update manager.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10144 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-06-09 15:33:55 +02:00
|
|
|
|
2013-01-30 17:29:49 +01:00
|
|
|
$return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
|
2016-05-26 13:47:45 +02:00
|
|
|
'$series', '$width', $font_size, $water_mark, '$separator',
|
|
|
|
'$legend_position', '$height', '$colors', " . json_encode($hide_labels) . ")";
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
$return .= "</script>";
|
2012-03-07 12:03:22 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2015-11-04 17:42:45 +01:00
|
|
|
// Prints a FLOT pie chart
|
|
|
|
function flot_custom_pie_chart ($flash_charts, $graph_values,
|
|
|
|
$width, $height, $colors, $module_name_list, $long_index,
|
|
|
|
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
|
|
|
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
|
|
|
|
|
|
|
|
|
|
|
///TODO
|
|
|
|
include_javascript_dependencies_flot_graph();
|
|
|
|
|
|
|
|
$total_modules = $graph_values['total_modules'];
|
|
|
|
unset($graph_values['total_modules']);
|
|
|
|
|
|
|
|
foreach ($graph_values as $label => $value) {
|
2015-11-27 11:50:53 +01:00
|
|
|
if ($value['value']) {
|
|
|
|
if ($value['value'] > 1000000)
|
|
|
|
$legendvalue = sprintf("%sM", number_format($value['value'] / 1000000, 2));
|
|
|
|
else if ($value['value'] > 1000)
|
|
|
|
$legendvalue = sprintf("%sK", number_format($value['value'] / 1000, 2));
|
|
|
|
else
|
|
|
|
$legendvalue = $value['value'];
|
|
|
|
}
|
2015-11-25 14:25:19 +01:00
|
|
|
else
|
2015-11-27 11:50:53 +01:00
|
|
|
$legendvalue = __('No data');
|
2015-11-04 17:42:45 +01:00
|
|
|
$values[] = $value['value'];
|
|
|
|
$legend[] = $label .": " . $legendvalue . " " .$value['unit'];
|
|
|
|
$labels[] = $label;
|
|
|
|
}
|
|
|
|
|
|
|
|
$graph_id = uniqid('graph_');
|
|
|
|
|
|
|
|
$return = "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
|
|
|
|
|
|
|
|
if ($water_mark != '') {
|
|
|
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='".$water_mark["url"]."'></div>";
|
|
|
|
$water_mark = 'true';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$water_mark = 'false';
|
|
|
|
}
|
|
|
|
|
|
|
|
$separator = ';;::;;';
|
|
|
|
|
|
|
|
$labels = implode($separator, $labels);
|
|
|
|
$legend = implode($separator, $legend);
|
|
|
|
$values = implode($separator, $values);
|
|
|
|
if (!empty($colors)) {
|
|
|
|
foreach ($colors as $color) {
|
|
|
|
$temp_colors[] = $color['color'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$colors = implode($separator, $temp_colors);
|
|
|
|
|
|
|
|
$return .= "<script type='text/javascript'>";
|
|
|
|
|
|
|
|
$return .= "pandoraFlotPieCustom('$graph_id', '$values', '$labels',
|
|
|
|
'$width', $font_size, $water_mark,
|
|
|
|
'$separator', '$legend_position', '$height', '$colors','$legend')";
|
|
|
|
|
|
|
|
$return .= "</script>";
|
|
|
|
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Returns a 3D column chart
|
|
|
|
function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
|
|
|
|
global $config;
|
|
|
|
|
2012-03-05 20:25:02 +01:00
|
|
|
include_javascript_dependencies_flot_graph();
|
|
|
|
|
|
|
|
$return = '';
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$stacked_str = '';
|
|
|
|
$multicolor = true;
|
|
|
|
|
|
|
|
// Get a unique identifier to graph
|
|
|
|
$graph_id = uniqid('graph_');
|
|
|
|
$graph_id2 = uniqid('graph_');
|
|
|
|
|
|
|
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
2015-11-04 17:42:45 +01:00
|
|
|
$return .= "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px; padding-left: 20px;'></div>";
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if ($water_mark != '') {
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
|
|
|
$watermark = 'true';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$watermark = 'false';
|
|
|
|
}
|
|
|
|
|
2014-12-11 13:48:25 +01:00
|
|
|
// Set a weird separator to serialize and unserialize passing data
|
|
|
|
// from php to javascript
|
2012-03-01 17:41:02 +01:00
|
|
|
$separator = ';;::;;';
|
|
|
|
$separator2 = ':,:,,,:,:';
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Transform data from our format to library format
|
|
|
|
$labels = array();
|
|
|
|
$a = array();
|
|
|
|
$vars = array();
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$max = 0;
|
|
|
|
$i = count($graph_data);
|
2014-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/snmpconsole/snmp_view.php,
operation/events/events_list.php, operation/incidents/incident.php,
extensions/files_repo.php,
extensions/files_repo/sql/files_repo.postgreSQL.sql,
extensions/files_repo/functions_files_repo.php,
extensions/files_repo/files_repo_list.php,
godmode/agentes/modificar_agente.php,
godmode/snmpconsole/snmp_alert.php, godmode/db/db_info.php,
include/functions_graph.php, include/functions_db.php,
include/db/postgresql.php, include/db/oracle.php,
include/db/mysql.php, include/functions_update_manager.php,
include/functions_events.php, include/graphs/functions_flot.php,
include/graphs/fgraph.php: tiny fixes for the improve the support of
postgreSQL databases.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10354 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2014-07-24 18:02:06 +02:00
|
|
|
$data = array();
|
2015-10-08 16:26:27 +02:00
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
foreach ($graph_data as $label => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$labels[] = io_safe_output($label);
|
|
|
|
$i--;
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
|
|
|
foreach ($values as $key => $value) {
|
2014-12-11 13:48:25 +01:00
|
|
|
$jsvar = "data_" . $graph_id . "_" . $key;
|
2012-03-01 17:41:02 +01:00
|
|
|
|
2015-10-08 16:26:27 +02:00
|
|
|
$data[$jsvar][] = $value;
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($value > $max) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$max = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-10-08 16:26:27 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
// Store serialized data to use it from javascript
|
|
|
|
$labels = implode($separator,$labels);
|
|
|
|
|
|
|
|
// Store data series in javascript format
|
|
|
|
$jsvars = '';
|
|
|
|
$jsseries = array();
|
|
|
|
|
|
|
|
$i = 0;
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$values2 = array();
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
|
|
|
foreach ($data as $jsvar => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$values2[] = implode($separator,$values);
|
|
|
|
}
|
|
|
|
|
|
|
|
$values = implode($separator2, $values2);
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$jsseries = implode(',', $jsseries);
|
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Javascript code
|
|
|
|
$return .= "<script type='text/javascript'>";
|
|
|
|
|
2014-12-11 13:48:25 +01:00
|
|
|
$return .= "pandoraFlotHBars('$graph_id', '$values', '$labels',
|
|
|
|
false, $max, '$water_mark', '$separator', '$separator2')";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "</script>";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
return $return;
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns a 3D column chart
|
2015-11-25 14:25:19 +01:00
|
|
|
function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir) {
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2012-03-05 20:25:02 +01:00
|
|
|
|
|
|
|
include_javascript_dependencies_flot_graph();
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$stacked_str = '';
|
|
|
|
$multicolor = false;
|
|
|
|
|
|
|
|
// Get a unique identifier to graph
|
|
|
|
$graph_id = uniqid('graph_');
|
|
|
|
$graph_id2 = uniqid('graph_');
|
2014-06-11 13:34:27 +02:00
|
|
|
|
|
|
|
if ($width != 'auto') {
|
|
|
|
$width = $width . "px";
|
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
2015-11-04 17:42:45 +01:00
|
|
|
$return .= "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."; height: ".$height."px; padding-left: 20px;'></div>";
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if ($water_mark != '') {
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
|
|
|
$watermark = 'true';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$watermark = 'false';
|
|
|
|
}
|
|
|
|
|
2016-06-08 15:48:47 +02:00
|
|
|
$colors = array_map(function ($elem) {
|
|
|
|
return $elem['color'] ? $elem['color'] : null;
|
|
|
|
}, $color);
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
|
|
|
$separator = ';;::;;';
|
|
|
|
$separator2 = ':,:,,,:,:';
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Transform data from our format to library format
|
|
|
|
$labels = array();
|
|
|
|
$a = array();
|
|
|
|
$vars = array();
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$max = 0;
|
|
|
|
$i = count($graph_data);
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
foreach ($graph_data as $label => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$labels[] = io_safe_output($label);
|
|
|
|
$i--;
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
|
|
|
foreach ($values as $key => $value) {
|
2015-11-04 17:42:45 +01:00
|
|
|
$jsvar = "data_" . $graph_id . "_" . $key;
|
|
|
|
|
|
|
|
$data[$jsvar][] = $value;
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
if ($value > $max) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$max = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store serialized data to use it from javascript
|
|
|
|
$labels = implode($separator,$labels);
|
2012-03-06 18:23:46 +01:00
|
|
|
$colors = implode($separator, $colors);
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Store data series in javascript format
|
|
|
|
$jsvars = '';
|
|
|
|
$jsseries = array();
|
|
|
|
|
|
|
|
$i = 0;
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$values2 = array();
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
foreach ($data as $jsvar => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$values2[] = implode($separator,$values);
|
|
|
|
}
|
|
|
|
|
|
|
|
$values = implode($separator2, $values2);
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$jsseries = implode(',', $jsseries);
|
2012-03-07 12:03:22 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Javascript code
|
|
|
|
$return .= "<script type='text/javascript'>";
|
|
|
|
|
2012-03-06 18:23:46 +01:00
|
|
|
$return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2')";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "</script>";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
return $return;
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
|
|
|
|
2015-12-31 12:04:23 +01:00
|
|
|
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false) {
|
2012-03-01 17:41:02 +01:00
|
|
|
global $config;
|
2014-09-23 13:02:49 +02:00
|
|
|
|
2012-03-05 20:25:02 +01:00
|
|
|
include_javascript_dependencies_flot_graph();
|
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$height+= 20;
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$stacked_str = 'stack: stack,';
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Get a unique identifier to graph
|
|
|
|
$graph_id = uniqid('graph_');
|
|
|
|
|
|
|
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
2015-12-31 12:04:23 +01:00
|
|
|
if ($stat_win) {
|
|
|
|
$return = "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px; display: inline-block;'></div>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$return = "<div id='$graph_id' class='graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
|
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
|
|
|
|
|
|
|
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
|
|
|
$separator = ';;::;;';
|
|
|
|
$separator2 = ':,:,,,:,:';
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Transform data from our format to library format
|
|
|
|
$labels = array();
|
|
|
|
$a = array();
|
|
|
|
$vars = array();
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$datacolor = array();
|
|
|
|
|
|
|
|
$max = 0;
|
|
|
|
|
|
|
|
$i = count($graph_data);
|
|
|
|
|
|
|
|
$intervaltick = $period / $i;
|
|
|
|
|
|
|
|
$leg_max_length = 0;
|
2013-03-12 17:20:53 +01:00
|
|
|
foreach ($legend as $l) {
|
|
|
|
if (strlen($l) > $leg_max_length) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$leg_max_length = strlen($l);
|
|
|
|
}
|
|
|
|
}
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$fontsize = 7;
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2012-03-08 13:32:59 +01:00
|
|
|
$extra_height = 15;
|
2015-03-30 10:17:35 +02:00
|
|
|
if (defined("METACONSOLE"))
|
|
|
|
$extra_height = 20;
|
2012-09-28 16:06:20 +02:00
|
|
|
|
2012-03-08 13:32:59 +01:00
|
|
|
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
$maxticks = (int) ($width / ($fontsize * $leg_max_length));
|
|
|
|
|
|
|
|
$i_aux = $i;
|
|
|
|
while(1) {
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($i_aux <= $maxticks ) {
|
2012-03-01 17:41:02 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$intervaltick*= 2;
|
|
|
|
|
|
|
|
$i_aux /= 2;
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
}
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
$intervaltick = (int) $intervaltick;
|
|
|
|
$acumulate = 0;
|
|
|
|
$c = 0;
|
|
|
|
$acumulate_data = array();
|
2013-07-17 13:12:37 +02:00
|
|
|
foreach ($graph_data as $label => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$labels[] = io_safe_output($label);
|
|
|
|
$i--;
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2013-07-17 13:12:37 +02:00
|
|
|
foreach ($values as $key => $value) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$jsvar = "d_".$graph_id."_".$i;
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($key == 'data') {
|
2012-03-01 17:41:02 +01:00
|
|
|
$datacolor[$jsvar] = $colors[$value];
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$data[$jsvar][] = $value;
|
|
|
|
|
|
|
|
$acumulate_data[$c] = $acumulate;
|
|
|
|
$acumulate += $value;
|
|
|
|
$c++;
|
|
|
|
|
|
|
|
//$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>";
|
2013-07-17 13:12:37 +02:00
|
|
|
if ($value > $max) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$max = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store serialized data to use it from javascript
|
|
|
|
$labels = implode($separator,$labels);
|
|
|
|
$datacolor = implode($separator,$datacolor);
|
|
|
|
$legend = io_safe_output(implode($separator,$legend));
|
|
|
|
$acumulate_data = io_safe_output(implode($separator,$acumulate_data));
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
// Store data series in javascript format
|
|
|
|
$jsvars = '';
|
|
|
|
$jsseries = array();
|
|
|
|
|
|
|
|
$date = get_system_time ();
|
|
|
|
$datelimit = ($date - $period) * 1000;
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2012-03-01 17:41:02 +01:00
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
$values2 = array();
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
foreach ($data as $jsvar => $values) {
|
2012-03-01 17:41:02 +01:00
|
|
|
$values2[] = implode($separator,$values);
|
|
|
|
$i ++;
|
|
|
|
}
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
$values = implode($separator2, $values2);
|
2012-03-01 17:41:02 +01:00
|
|
|
|
|
|
|
// Javascript code
|
|
|
|
$return .= "<script type='text/javascript'>";
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
$return .= "//<![CDATA[\n";
|
|
|
|
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2')";
|
2012-03-01 17:41:02 +01:00
|
|
|
$return .= "\n//]]>";
|
|
|
|
$return .= "</script>";
|
2012-03-05 20:25:02 +01:00
|
|
|
|
2013-03-12 17:20:53 +01:00
|
|
|
return $return;
|
2012-03-01 17:41:02 +01:00
|
|
|
}
|
2013-12-12 15:49:36 +01:00
|
|
|
?>
|