fixed sql graph pie

This commit is contained in:
Daniel Barbero Martin 2020-10-13 09:32:28 +02:00
parent 2b06c5babc
commit 8c6c4d99a0
1 changed files with 53 additions and 45 deletions

View File

@ -3737,14 +3737,18 @@ function graph_custom_sql_graph(
global $config;
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
if (is_metaconsole() && $content['server_name'] !== '0') {
$server = metaconsole_get_connection_names();
$connection = metaconsole_get_connection($server);
if (is_metaconsole() === true
&& empty($content['server_name']) === false
) {
$connection = metaconsole_get_connection($content['server_name']);
metaconsole_connect($connection);
}
$report_content = db_get_row('treport_content', 'id_rc', $content['id_rc']);
$report_content = db_get_row(
'treport_content',
'id_rc',
$content['id_rc']
);
if ($report_content == false || $report_content == '') {
$report_content = db_get_row(
@ -3755,7 +3759,9 @@ function graph_custom_sql_graph(
}
if ($report_content == false || $report_content == '') {
if (is_metaconsole() && $content['server_name'] !== '0') {
if (is_metaconsole() === true
&& empty($content['server_name']) === false
) {
enterprise_hook('metaconsole_restore_db');
}
@ -3772,9 +3778,10 @@ function graph_custom_sql_graph(
);
}
if ((is_metaconsole() & $content['server_name']) !== '0') {
$server = metaconsole_get_connection_names();
$connection = metaconsole_get_connection($server);
if (is_metaconsole() === true
&& empty($content['server_name']) === false
) {
$connection = metaconsole_get_connection($content['server_name']);
metaconsole_connect($connection);
}
}
@ -3800,7 +3807,7 @@ function graph_custom_sql_graph(
$data_result = db_get_all_rows_sql($sql, $historical_db);
if ((is_metaconsole() & $content['server_name']) !== '0') {
if (is_metaconsole() === true && empty($content['server_name']) === false) {
enterprise_hook('metaconsole_restore_db');
}
@ -3908,6 +3915,7 @@ function graph_custom_sql_graph(
];
}
$output = '';
switch ($type) {
case 'sql_graph_vbar':
default:
@ -3936,48 +3944,48 @@ function graph_custom_sql_graph(
$output .= vbar_graph($data, $options, $ttl);
$output .= '</div>';
}
return $output;
break;
break;
case 'sql_graph_hbar':
// Horizontal bar.
return hbar_graph(
$data,
$width,
$height,
[],
[],
'',
'',
'',
'',
$water_mark,
$config['fontpath'],
$config['font_size'],
false,
$ttl,
$homeurl,
'white',
'#c1c1c1'
);
$output .= hbar_graph(
$data,
$width,
$height,
[],
[],
'',
'',
'',
'',
$water_mark,
$config['fontpath'],
$config['font_size'],
false,
$ttl,
$homeurl,
'white',
'#c1c1c1'
);
break;
break;
case 'sql_graph_pie':
// Pie.
return pie_graph(
$data,
$width,
$height,
__('other'),
$homeurl,
$water_mark,
$config['fontpath'],
$config['font_size'],
$ttl
);
break;
$output .= pie_graph(
$data,
$width,
$height,
__('other'),
$homeurl,
$water_mark,
$config['fontpath'],
$config['font_size'],
$ttl
);
break;
}
return $output;
}