diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 94acbc4ba2..c062793b9d 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -68,6 +68,10 @@ class Diagnostics extends Wizard // Check access. check_login(); + $this->url = ui_get_full_url( + 'index.php?sec=gextensions&sec2=tools/diagnostics' + ); + $this->ajaxController = $page; $this->pdf = $pdf; $this->product_name = io_safe_output(get_product_name()); @@ -123,15 +127,34 @@ class Diagnostics extends Wizard { global $config; + if ($this->pdf === true) { + $this->exportPDF(); + exit; + } + ui_require_css_file('diagnostics'); + $pdf_url = $this->url.'&pdf=true'; + $pdf_img = html_print_image( + 'images/pdf.png', + true, + ['title' => __('Export to PDF')] + ); + $header_buttons = [ + 'csv' => [ + 'active' => false, + 'text' => ''.$pdf_img.'', + ], + ]; + // Header. ui_print_page_header( __('%s Diagnostic tool', $this->product_name), 'images/gm_massive_operations.png', false, 'diagnostic_tool_tab', - true + true, + $header_buttons ); // Print all Methods Diagnostic Info. @@ -2080,6 +2103,10 @@ class Diagnostics extends Wizard enterprise_include_once('/include/class/Pdf.class.php'); $mpdf = new Pdf([]); + // Ignore pending HTML outputs. + while (@ob_end_clean()) { + } + // ADD style. $mpdf->addStyle($config['homedir'].'/include/styles/diagnostics.css'); @@ -2112,6 +2139,8 @@ class Diagnostics extends Wizard // Write html filename. $mpdf->writePDFfile($filename); + + exit; } diff --git a/pandora_console/tools/diagnostics.php b/pandora_console/tools/diagnostics.php index 30be89efc4..fc2b2fecd2 100644 --- a/pandora_console/tools/diagnostics.php +++ b/pandora_console/tools/diagnostics.php @@ -32,7 +32,7 @@ global $config; require_once $config['homedir'].'/include/class/Diagnostics.class.php'; $ajaxPage = 'tools/diagnostics'; -$pdf = false; +$pdf = get_parameter('pdf', false); // Control call flow.