#11589 fixed generate pdf graph

This commit is contained in:
Daniel Cebrian 2023-06-21 18:15:18 +02:00
parent 6ee3a9134d
commit 43c7dfe383
3 changed files with 36 additions and 29 deletions

View File

@ -142,31 +142,31 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pandora FMS Graph</title>
<link rel="stylesheet" href="styles/pandora.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="styles/pandora_minimal.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui.min.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="styles/js/jquery-ui_custom.css?v=<?php echo $config['current_package']; ?>" type="text/css" />
<script language="javascript" type='text/javascript' src='javascript/pandora_ui.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.current.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery.pandora.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='javascript/jquery-ui.min.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='javascript/pandora.js?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.min.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.time.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.pie.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.crosshair.min.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.stack.min.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.selection.min.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.resize.min.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.threshold.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.threshold.multiple.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.symbol.min.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.exportdata.pandora.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/jquery.flot.axislabels.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/flot/pandora.flot.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/chartjs/chart.js?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="graphs/chartjs/chartjs-plugin-datalabels.min.js?v=<?php echo $config['current_package']; ?>"></script>
<link rel="stylesheet" href="<?php echo ui_get_full_url('/include/styles/pandora.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="<?php echo ui_get_full_url('/include/styles/pandora_minimal.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="<?php echo ui_get_full_url('/include/styles/js/jquery-ui.min.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<link rel="stylesheet" href="<?php echo ui_get_full_url('/include/styles/js/jquery-ui_custom.css'); ?>?v=<?php echo $config['current_package']; ?>" type="text/css" />
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url('/include/javascript/pandora_ui.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url('/include/javascript/jquery.current.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url('/include/javascript/jquery.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url('/include/javascript/jquery-ui.min.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type='text/javascript' src='<?php echo ui_get_full_url('/include/javascript/pandora.js'); ?>?v=<?php echo $config['current_package']; ?>'></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.time.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.pie.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.crosshair.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.stack.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.selection.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.resize.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.threshold.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.threshold.multiple.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.symbol.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.exportdata.pandora.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/jquery.flot.axislabels.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/flot/pandora.flot.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/chartjs/chart.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
<script language="javascript" type="text/javascript" src="<?php echo ui_get_full_url('/include/graphs/chartjs/chartjs-plugin-datalabels.min.js'); ?>?v=<?php echo $config['current_package']; ?>"></script>
</head>
<body style='width:794px; margin: 0px; background-color: <?php echo $params['backgroundColor']; ?>;'>
<?php

View File

@ -4337,10 +4337,17 @@ function generator_chart_to_pdf(
// Creates a new page.
$page = $browser->createPage();
$curl = curl_init();
// Navigate to an URL.
$navigation = $page->navigate($url.'?data='.urlencode(json_encode($data)));
$navigation->waitForNavigation(Page::DOM_CONTENT_LOADED);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, ['data' => json_encode($data)]);
$response = curl_exec($curl);
curl_close($curl);
$page->setHtml($response);
// Dynamic.
$dynamic_height = $page->evaluate('document.getElementById("container-chart-generator-item").clientHeight')->getReturnValue();

View File

@ -755,7 +755,7 @@ function flot_slicesbar_graph(
'date_to' => $date_to,
'server_id' => $server_id,
];
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
update_check_config_token($tokem_config, json_encode($graph_data));
$_SESSION['slicebar'] = $tokem_config;
$_SESSION['slicebar_value'] = json_encode($graph_data);