diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index f2093dd1c8..2079c8fbc4 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1822,35 +1822,36 @@ function html_get_predefined_table($model='transparent', $columns=4) * Print a nicely formatted table. Code taken from moodle. * * @param object Object with several properties: - * $table->head - An array of heading names. - * $table->head_colspan - An array of colspans of each head column. - * $table->headstyle - An array of styles of each head column. - * $table->align - An array of column alignments - * $table->valign - An array of column alignments - * $table->size - An array of column sizes - * $table->wrap - An array of "nowrap"s or nothing - * $table->style - An array of personalized style for each column. - * $table->rowid - An array of personalized ids of each row. - * $table->rowstyle - An array of personalized style of each row. - * $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored). - * $table->colspan - An array of colspans of each column. - * $table->rowspan - An array of rowspans of each column. - * $table->data[] - An array of arrays containing the data. - * $table->width - A percentage of the page - * $table->border - Border of the table. - * $table->tablealign - Align the whole table (float left or right) - * $table->cellpadding - Padding on each cell - * $table->cellspacing - Spacing between cells - * $table->cellstyle - Style of a cell - * $table->cellclass - Class of a cell - * $table->class - CSS table class - * $table->id - Table ID (useful in JavaScript) - * $table->headclass[] - An array of classes for each heading - * $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table - * $table->titlestyle - Title style - * $table->titleclass - Title class - * $table->styleTable - Table style - * $table->caption - Table title + * $table->head - An array of heading names. + * $table->head_colspan - An array of colspans of each head column. + * $table->headstyle - An array of styles of each head column. + * $table->align - An array of column alignments + * $table->valign - An array of column alignments + * $table->size - An array of column sizes + * $table->wrap - An array of "nowrap"s or nothing + * $table->style - An array of personalized style for each column. + * $table->rowid - An array of personalized ids of each row. + * $table->rowstyle - An array of personalized style of each row. + * $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored). + * $table->colspan - An array of colspans of each column. + * $table->rowspan - An array of rowspans of each column. + * $table->data[] - An array of arrays containing the data. + * $table->width - A percentage of the page + * $table->border - Border of the table. + * $table->tablealign - Align the whole table (float left or right) + * $table->cellpadding - Padding on each cell + * $table->cellspacing - Spacing between cells + * $table->cellstyle - Style of a cell + * $table->cellclass - Class of a cell + * $table->class - CSS table class + * $table->id - Table ID (useful in JavaScript) + * $table->headclass[] - An array of classes for each heading + * $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table + * $table->titlestyle - Title style + * $table->titleclass - Title class + * $table->styleTable - Table style + * $table->caption - Table title + * $table->pdf_report - Table repeat title conteiner. * @param bool Whether to return an output string or echo now * * @return string HTML code if return parameter is true. @@ -2990,4 +2991,3 @@ function html_print_csrf_error() ); return true; } - diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index ed1ddfc891..c753b1b8a6 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -672,26 +672,27 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) true ); } else { - $return_pdf .= ''; + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true ); - $return_pdf .= ''; - - $return_pdf .= ''; - $return_pdf .= html_print_table( - $table2, - true - ); - $return_pdf .= ''; - - $return_pdf .= ''; - $return_pdf .= html_print_table( - $table3, - true - ); - $return_pdf .= ''; + $table2->title = $item['title']; + $table2->titleclass = 'title_table_pdf'; + $table2->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table2, + true + ); + $table3->title = $item['title']; + $table3->titleclass = 'title_table_pdf'; + $table3->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table3, + true + ); } } else { $table->colspan['error']['cell'] = 3; @@ -699,82 +700,83 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) } if (!empty($item['charts'])) { - /* - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->size = []; - $table1->size[0] = '10%'; + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->size = []; + $table1->size[0] = '10%'; - $table1->data = []; + $table1->data = []; - foreach ($item['charts'] as $chart) { + foreach ($item['charts'] as $chart) { $table1->data[] = [ $chart['agent'].'
'.$chart['module'], $chart['chart'], ]; - } + } - if ($pdf === 0) { + if ($pdf === 0) { $table->colspan['charts']['cell'] = 2; $table->data['charts']['cell'] = html_print_table( $table1, true ); - } else { + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true ); - } + } - // Table_legend_graphs. - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->data = []; - $table1->size = []; - $table1->size[0] = '2%'; - $table1->data[0][0] = ''; - $table1->size[1] = '14%'; - $table1->data[0][1] = ''.__('OK').''; + // Table_legend_graphs. + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->data = []; + $table1->size = []; + $table1->size[0] = '2%'; + $table1->data[0][0] = ''; + $table1->size[1] = '14%'; + $table1->data[0][1] = ''.__('OK').''; - $table1->size[2] = '2%'; - $table1->data[0][2] = ''; - $table1->size[3] = '14%'; - $table1->data[0][3] = ''.__('Critical').''; + $table1->size[2] = '2%'; + $table1->data[0][2] = ''; + $table1->size[3] = '14%'; + $table1->data[0][3] = ''.__('Critical').''; - $table1->size[4] = '2%'; - $table1->data[0][4] = ''; - $table1->size[5] = '14%'; - $table1->data[0][5] = ''.__('Unknow').''; + $table1->size[4] = '2%'; + $table1->data[0][4] = ''; + $table1->size[5] = '14%'; + $table1->data[0][5] = ''.__('Unknow').''; - $table1->size[6] = '2%'; - $table1->data[0][6] = ''; - $table1->size[7] = '14%'; - $table1->data[0][7] = ''.__('Not Init').''; + $table1->size[6] = '2%'; + $table1->data[0][6] = ''; + $table1->size[7] = '14%'; + $table1->data[0][7] = ''.__('Not Init').''; - $table1->size[8] = '2%'; - $table1->data[0][8] = ''; - $table1->size[9] = '14%'; - $table1->data[0][9] = ''.__('Downtimes').''; + $table1->size[8] = '2%'; + $table1->data[0][8] = ''; + $table1->size[9] = '14%'; + $table1->data[0][9] = ''.__('Downtimes').''; - $table1->size[10] = '2%'; - $table1->data[0][10] = ''; - $table1->size[11] = '15%'; - $table1->data[0][11] = ''.__('Ignore time').''; + $table1->size[10] = '2%'; + $table1->data[0][10] = ''; + $table1->size[11] = '15%'; + $table1->data[0][11] = ''.__('Ignore time').''; - if ($pdf === 0) { + if ($pdf === 0) { $table->colspan['legend']['cell'] = 2; $table->data['legend']['cell'] = html_print_table( $table1, true ); - } else { + } else { $return_pdf .= html_print_table( $table1, true ); - } - */ + } } } @@ -2348,13 +2350,28 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e } -function reporting_html_increment(&$table, $item) +/** + * Show a brief analysis in which the variation of the value + * of the indicated module is indicated. + * + * @param string $table + * @param array $item + * @param integer $pdf + * @return html + */ +function reporting_html_increment($table, $item, $pdf=0) { global $config; + $return_pdf = ''; + if (isset($item['data']['error'])) { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = $item['data']['message']; + if ($pdf === 0) { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = $item['data']['message']; + } else { + $return_pdf = $item['data']['message']; + } } else { $table1 = new stdClass(); $table1->width = '99%'; @@ -2403,9 +2420,17 @@ function reporting_html_increment(&$table, $item) $table1->data[] = $table1_row; - $data = []; - $data[0] = html_print_table($table1, true); - array_push($table->data, $data); + if ($pdf === 0) { + $data = []; + $data[0] = html_print_table($table1, true); + array_push($table->data, $data); + } else { + $return_pdf = html_print_table($table1, true); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css index f3dca9373d..85eec2aa9b 100644 --- a/pandora_console/include/styles/pandoraPDF.css +++ b/pandora_console/include/styles/pandoraPDF.css @@ -48,6 +48,12 @@ thead.header_tr tr th.th_first { text-align: left; } +thead.header_tr tr th.th_description { + background-color: #f5f5f5; + color: #1c1c1c; + text-align: justify; +} + table.table_beauty { border-collapse: collapse; width: 100%; @@ -57,3 +63,12 @@ table.table_beauty tbody tr td { padding: 5px; border: 0.1pt solid #acacac; } + +table.databox { + margin-bottom: 20px; +} + +th.title_table_pdf { + background-color: #acacac; + padding: 15px; +}