Added graph to content in mail

This commit is contained in:
Arturo Gonzalez 2017-05-10 12:34:54 +02:00
parent 1d6101e715
commit 212698cb11
2 changed files with 11 additions and 7 deletions

View File

@ -8904,6 +8904,9 @@ function api_set_delete_special_day($id_special_day, $thrash2, $thrash3, $thrash
*
*/
function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
@ -8921,9 +8924,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
}
$graph_seconds =
(!empty($other) && isset($other['data']))
(!empty($other) && isset($other['data'][0]))
?
$other['data']
$other['data'][0]
:
SECONDS_1HOUR; // 1 hour by default
@ -8936,8 +8939,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
$graph_html = grafico_modulo_sparse(
$id_module, $graph_seconds, false, 600, 300, '',
'', false, false, true, time(), '', 0, 0, true, true,
ui_get_full_url(false) . '/', 1, false, '', false, true);
ui_get_full_url(false) . '/', 1, false, '', false, true,
true, 'white', null, false, false, $config['type_module_charts']);
$graph_image_file_encoded = false;
if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) {
$file_url = $matches[1];
@ -8982,7 +8986,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
// returnError('error_module_graph', __(''));
}
else {
if($other['data'] < 40000){
if($other['data'][1]){
header('Content-type: text/html');
returnData('string', array('type' => 'string', 'data' => '<img src="data:image/jpeg;base64,' . $graph_image_file_encoded . '">'));
} else {

View File

@ -1042,8 +1042,8 @@ sub pandora_execute_action ($$$$$$$$$;$) {
my $subst_func = sub {
my $hours = shift;
my $period = $hours * 3600; # Hours to seconds
$params->{"other"} = $period;
$params->{"other"} = $period . '%7C0';
$params->{"other_mode"} = 'url_encode_separator_%7C';
my $cid = 'module_graph_' . $hours . 'h';
if (! exists($module_graph_list->{$cid}) && defined $url) {