2011-04-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php: added the parameter $homeurl in some functions and in others rename from $homedir. * include/graphs/functions_pchart.php: setted the default values in some vars. And replaced the calls to new engine graph. * include/graphs/fgraph.php: added the parameter $homeurl. * include/functions_reporting.php: fixed in 'simple_graph' the $content['id_agent_module']. * include/functions_custom_graphs.php, operation/reporting/reporting_xml.php, godmode/admin_access_logs.php: cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4230 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f2c5c741c6
commit
a5da2b0d7d
|
@ -17,10 +17,6 @@
|
|||
|
||||
global $config;
|
||||
|
||||
if ($config['flash_charts']) {
|
||||
require_once ("include/fgraph.php");
|
||||
}
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
check_login ();
|
||||
|
@ -79,13 +75,7 @@ echo '</div>';
|
|||
echo '<div style="float: right; width: 250px;">';
|
||||
|
||||
echo graphic_user_activity2(300, 140);
|
||||
/*
|
||||
if ($config['flash_charts']) {
|
||||
echo graphic_user_activity (300, 140);
|
||||
}
|
||||
else {
|
||||
echo '<img src="include/fgraph.php?tipo=user_activity&width=300&height=140" />';
|
||||
}*/
|
||||
|
||||
echo '</div>';
|
||||
echo '<div style="clear:both;"> </div>';
|
||||
echo '</td></tr></table>';
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
* @global array Contents all var configs for the local instalation.
|
||||
*/
|
||||
global $config;
|
||||
if ($config['flash_charts']) {
|
||||
require_once ('include/fgraph.php');
|
||||
}
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
|
@ -111,17 +108,6 @@ function custom_graphs_print ($id_graph, $height, $width, $period, $stacked, $re
|
|||
|
||||
$output = graphic_combined_module2($modules, $weights, $period, $width, $height,
|
||||
'', '', 0, 0, 0, $stacked, $date);
|
||||
|
||||
/*
|
||||
if ($config['flash_charts']) {
|
||||
$output = graphic_combined_module ($modules, $weights, $period, $width, $height,
|
||||
'', '', 0, 0, 0, $stacked, $date);
|
||||
} else {
|
||||
$modules = implode (',', $modules);
|
||||
$weights = implode (',', $weights);
|
||||
$output = '<img src="include/fgraph.php?tipo=combined&height='.$height.'&width='.$width.'&id='.$modules.'&period='.$period.'&weight_l='.$weights.'&stacked='.$stacked.'&date='.$date.'">';
|
||||
}
|
||||
*/
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
|
@ -25,7 +25,8 @@ define("GRAPH_STACKED_LINE", 3);
|
|||
function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
|
||||
$width, $height , $title = '', $unit_name = null,
|
||||
$show_alerts = false, $avg_only = 0, $pure = false,
|
||||
$date = 0, $baseline = 0, $return_data = 0, $show_title = true, $only_image = false) {
|
||||
$date = 0, $baseline = 0, $return_data = 0, $show_title = true,
|
||||
$only_image = false, $homeurl = '') {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -295,7 +296,8 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
|
|||
$flash_chart = false;
|
||||
}
|
||||
|
||||
return area_graph($flash_chart, $chart, $width, $height, $color,$legend, $long_index, "images/image_problem.opaque.png");
|
||||
return area_graph($flash_chart, $chart, $width, $height, $color,$legend,
|
||||
$long_index, "images/image_problem.opaque.png", "", "", $homeurl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,7 +318,8 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
|
|||
* @return Mixed
|
||||
*/
|
||||
function graphic_combined_module2 ($module_list, $weight_list, $period, $width, $height,
|
||||
$title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, $only_image = false) {
|
||||
$title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0,
|
||||
$stacked = 0, $date = 0, $only_image = false, $homeurl = '') {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -621,7 +624,8 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
|||
case GRAPH_AREA:
|
||||
$color = null;
|
||||
return area_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
|
||||
$color, $module_name_list, $long_index, "images/image_problem.opaque.png",
|
||||
"", "", $homeurl);
|
||||
break;
|
||||
default:
|
||||
case GRAPH_STACKED_AREA:
|
||||
|
@ -1232,7 +1236,7 @@ function grafico_eventos_usuario2 ($width, $height) {
|
|||
* @param integer width graph width
|
||||
* @param integer Graph type 1 vbar, 2 hbar, 3 pie
|
||||
*/
|
||||
function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar', $only_image = false, $homedir) {
|
||||
function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar', $only_image = false, $homeurl = '') {
|
||||
global $config;
|
||||
|
||||
$report_content = get_db_row ('treport_content', 'id_rc', $id);
|
||||
|
@ -1275,13 +1279,13 @@ function graph_custom_sql_graph2 ($id, $width, $height, $type = 'sql_graph_vbar'
|
|||
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", false, $homedir);
|
||||
return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", false, $homeurl);
|
||||
break;
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homedir);
|
||||
return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl);
|
||||
break;
|
||||
case 'sql_graph_pie': // Pie
|
||||
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homedir);
|
||||
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1883,7 +1883,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
else {
|
||||
$agent_name = get_agent_name($content['id_agent']);
|
||||
}
|
||||
|
||||
|
||||
switch ($content["type"]) {
|
||||
case 1:
|
||||
case 'simple_graph':
|
||||
|
@ -1905,7 +1905,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
|
||||
$data = array ();
|
||||
|
||||
$data[0] = grafico_modulo_sparse2($layout_data['id_agente_modulo'], $content['period'],
|
||||
$data[0] = grafico_modulo_sparse2($content['id_agent_module'], $content['period'],
|
||||
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
|
||||
$report["datetime"], 0, 0, true, true);
|
||||
|
||||
|
@ -1973,7 +1973,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
|
||||
$table->colspan[1][0] = 3;
|
||||
$data = array ();
|
||||
//$data[0] = '<img src="include/fgraph.php?tipo=combined&id='.implode (',', $modules).'&weight_l='.implode (',', $weights).'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&stacked='.$graph["stacked"].'&pure=1" border="1" alt="">';
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
$data[0] = graphic_combined_module2(
|
||||
$modules,
|
||||
|
@ -2106,14 +2106,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$data = array();
|
||||
$data_pie_graph = json_encode ($data_graph);
|
||||
if (($show_graph == 1 || $show_graph == 2) && !empty($slas)) {
|
||||
if($config['flash_charts']) {
|
||||
$data[0] = fs_3d_pie_chart ($data_graph, 370, 180);
|
||||
}
|
||||
else {
|
||||
//Display pie graph
|
||||
$data[0] = "<img src='include/fgraph.php?tipo=generic_pie_graph&array=".$data_pie_graph.
|
||||
"&height=150&width=500'>";
|
||||
}
|
||||
$data[0] = pie3d_graph($config['flash_charts'], $data_graph,
|
||||
500, 150, __("other"));
|
||||
array_push ($table->data, $data);
|
||||
|
||||
//Display horizontal bar graphs
|
||||
|
@ -2130,10 +2124,12 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$data[0] = printSmallFont(get_agentmodule_agent_name ($sla['id_agent_module']));
|
||||
$data[0] .= "<br>";
|
||||
$data[0] .= printSmallFont(get_agentmodule_name ($sla['id_agent_module']));
|
||||
|
||||
$data[1] = "<img src='include/fgraph.php?tipo=sla_horizontal_graph&id=".$sla['id_agent_module'].
|
||||
"&period=".$content['period']."&value1=".$sla['sla_min']."&value2=".$sla['sla_max'].
|
||||
"&value3=".$content['time_from']."&value4=".$content['time_to']."&percent=".$sla['sla_limit'].
|
||||
"&daysWeek=".$daysWeek."&height=25&width=550'>";
|
||||
|
||||
array_push ($table2->data, $data);
|
||||
}
|
||||
$table->colspan[4][0] = 3;
|
||||
|
@ -3064,21 +3060,15 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$table->colspan[3][0] = 3;
|
||||
$data = array();
|
||||
if ($show_graph == 1 || $show_graph == 2) {
|
||||
if($config['flash_charts']) {
|
||||
$data[0] = fs_3d_pie_chart ($data_pie_graph, 370, 180);
|
||||
}
|
||||
else {
|
||||
$data_graph = json_encode ($data_pie_graph);
|
||||
//Display pie graph
|
||||
$data[0] = "<img src='include/fgraph.php?tipo=generic_pie_graph&array=".$data_graph.
|
||||
"&height=150&width=600'>";
|
||||
}
|
||||
$data[0] = pie3d_graph($config['flash_charts'], $data_pie_graph,
|
||||
600, 150, __("other"));
|
||||
|
||||
array_push ($table->data, $data);
|
||||
//Display bars graph
|
||||
$table->colspan[4][0] = 3;
|
||||
$height = count($data_pie_graph)*20+35;
|
||||
$data = array();
|
||||
$data[0] = "<img src='include/fgraph.php?tipo=generic_horizontal_bar_graph&array=".$data_graph.
|
||||
$data[0] = "<img src='include/fgraph.php?tipo=generic_horizontal_bar_graph&array=".$data_pie_graph.
|
||||
"&height=".$height."&width=600'>";
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
@ -3318,15 +3308,8 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$table->colspan[3][0] = 3;
|
||||
$data = array();
|
||||
if ($show_graph == 1 || $show_graph == 2) {
|
||||
if($config['flash_charts']) {
|
||||
$data[0] = fs_3d_pie_chart ($data_pie_graph, 370, 180);
|
||||
}
|
||||
else {
|
||||
$data_graph = json_encode ($data_pie_graph);
|
||||
//Display pie graph
|
||||
$data[0] = "<img src='include/fgraph.php?tipo=generic_pie_graph&array=".$data_graph.
|
||||
"&height=150&width=600'>";
|
||||
}
|
||||
$data[0] = pie3d_graph($config['flash_charts'], $data_graph,
|
||||
600, 150, __("other"));
|
||||
array_push ($table->data, $data);
|
||||
//Display bars graph
|
||||
$table->colspan[4][0] = 3;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// If is called from index
|
||||
if(file_exists('include/functions.php')) {
|
||||
include_once('include/functions.php');
|
||||
|
@ -135,7 +136,8 @@ function threshold_graph($flash_chart, $chart_data, $width, $height) {
|
|||
}
|
||||
}
|
||||
|
||||
function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "") {
|
||||
function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
||||
$long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $homedir="") {
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
|
|||
|
||||
$id_graph = serialize_in_temp($graph);
|
||||
|
||||
return "<img src='include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "'>";
|
||||
return "<img src='".$homedir."include/graphs/functions_pchart.php?graph_type=area&id_graph=" . $id_graph . "'>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,15 +60,17 @@ if (!isset($graph)) {
|
|||
$data = $graph['data'];
|
||||
$width = $graph['width'];
|
||||
$height = $graph['height'];
|
||||
if (isset($graph['color'])) {
|
||||
$colors = null;
|
||||
if (isset($graph['color']))
|
||||
$colors = $graph['color'];
|
||||
}
|
||||
if (isset($graph['legend'])) {
|
||||
$legend = null;
|
||||
if (isset($graph['legend']))
|
||||
$legend = $graph['legend'];
|
||||
}
|
||||
$xaxisname = '';
|
||||
if(isset($graph['xaxisname'])) {
|
||||
$xaxisname = $graph['xaxisname'];
|
||||
}
|
||||
$yaxisname = '';
|
||||
if(isset($graph['yaxisname'])) {
|
||||
$yaxisname = $graph['yaxisname'];
|
||||
}
|
||||
|
@ -745,4 +747,4 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
|
|||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
?>
|
||||
?>
|
|
@ -334,27 +334,6 @@ foreach ($contents as $content) {
|
|||
$data["objdata"] = format_numeric ($data["objdata"]);
|
||||
}
|
||||
break;
|
||||
// case 11:
|
||||
// case 'general_group_report':
|
||||
// $data["title"] = __('Group');
|
||||
// $data["objdata"] = "<![CDATA[";
|
||||
// $data["objdata"] .= print_group_reporting ($report['id_group'], true);
|
||||
// $data["objdata"] .= "]]>";
|
||||
// break;
|
||||
// case 12:
|
||||
// case 'monitor_health':
|
||||
// $data["title"] = __('Monitor health');
|
||||
// $data["objdata"] = "<![CDATA[";
|
||||
// $data["objdata"] .= monitor_health_reporting ($report['id_group'], $content['period'], $datetime, true);
|
||||
// $data["objdata"] .= "]]>";
|
||||
// break;
|
||||
// case 13:
|
||||
// case 'agents_detailed':
|
||||
// $data["title"] = __('Agents detailed view');
|
||||
// $data["objdata"] = "<![CDATA[";
|
||||
// $data["objdata"] .= get_group_agents_detailed_reporting ($report['id_group'], $content['period'], $datetime, true);
|
||||
// $data["objdata"] .= "]]>";
|
||||
// break;
|
||||
case 'agent_detailed_event':
|
||||
case 'event_report_agent':
|
||||
$data["title"] = __('Agent detailed event');
|
||||
|
|
Loading…
Reference in New Issue