$id_graph]); if ($res) { $result = ui_print_success_message(__('Successfully deleted'), '', true); } else { $result = ui_print_error_message(__('Not deleted. Error deleting data'), '', true); } $res = db_process_sql_delete('tgraph', ['id_graph' => $id_graph]); if ($res) { $result = ui_print_success_message(__('Successfully deleted'), '', true); } else { $result = ui_print_error_message(__('Not deleted. Error deleting data'), '', true); } echo $result; } else { db_pandora_audit('ACL Violation', 'Trying to delete a graph from access graph builder'); include 'general/noaccess.php'; exit; } } if ($view_graph) { $sql = "SELECT * FROM tgraph_source WHERE id_graph = $id_graph"; $sources = db_get_all_rows_sql($sql); $sql = "SELECT * FROM tgraph WHERE id_graph = $id_graph"; $graph = db_get_row_sql($sql); $id_user = $graph['id_user']; $private = $graph['private']; $width = $graph['width']; $height = ($graph['height'] + count($sources) * 10); $zoom = (int) get_parameter('zoom', 0); // Increase the height to fix the leyend rise if ($zoom > 0) { switch ($zoom) { case 1: $width = 500; $height = (200 + count($sources) * 15); break; case 2: $width = 650; $height = (300 + count($sources) * 10); break; case 3: $width = 770; $height = (400 + count($sources) * 5); break; } } // Get different date to search the report. $date = (string) get_parameter('date', date(DATE_FORMAT)); $time = (string) get_parameter('time', date(TIME_FORMAT)); $unixdate = strtotime($date.' '.$time); $period = (int) get_parameter('period'); if (! $period) { $period = $graph['period']; } else { $period = $period; } $events = $graph['events']; $description = $graph['description']; $stacked = (int) get_parameter('stacked', -1); $percentil = ($graph['percentil']) ? 1 : null; $check = get_parameter('threshold', false); $fullscale = ($graph['fullscale']) ? 1 : null; if ($check == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD) { $check = true; $stacked = CUSTOM_GRAPH_BULLET_CHART_THRESHOLD; } if ($stacked == -1) { $stacked = $graph['stacked']; } if ($stacked == CUSTOM_GRAPH_BULLET_CHART || $stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD) { $height = 50; } if ($stacked == CUSTOM_GRAPH_GAUGE) { // Use the defined graph height, that's why // the user can setup graph height. $height = $graph['height']; } $name = $graph['name']; if (($graph['private'] == 1) && ($graph['id_user'] != $id_user)) { db_pandora_audit( 'ACL Violation', 'Trying to access to a custom graph not allowed' ); include 'general/noaccess.php'; exit; } html_print_input_hidden('line_width_graph', $config['custom_graph_width']); html_print_input_hidden('custom_graph', 1); $url = 'index.php?'.'sec=reporting&'.'sec2=operation/reporting/graph_viewer&'."id=$id_graph&".'view_graph=1'; $options = []; if (check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RW') || check_acl_restricted_all($config['id_user'], $graph['id_group'], 'RM') ) { $options = [ 'graph_list' => [ 'active' => false, 'text' => ''.html_print_image( 'images/list.png', true, [ 'title' => __('Graph list'), 'class' => 'invert_filter', ] ).'', ], 'main' => [ 'active' => false, 'text' => ''.html_print_image( 'images/chart.png', true, [ 'title' => __('Main data'), 'class' => 'invert_filter', ] ).'', ], 'graph_editor' => [ 'active' => false, 'text' => ''.html_print_image( 'images/builder.png', true, [ 'title' => __('Graph editor'), 'class' => 'invert_filter', ] ).'', ], ]; } else { $options = [ 'graph_list' => [ 'active' => false, 'text' => ''.html_print_image('images/list.png', true, ['title' => __('Graph list')]).'', ], ]; } $options['view']['text'] = ''.html_print_image( 'images/eye.png', true, [ 'title' => __('View graph'), 'class' => 'invert_filter', ] ).''; $options['view']['active'] = true; if ($config['pure'] == 0) { $options['screen']['text'] = "".html_print_image( 'images/full_screen.png', true, [ 'title' => __('Full screen mode'), 'class' => 'invert_filter', ] ).''; } else { $options['screen']['text'] = "".html_print_image( 'images/normal_screen.png', true, [ 'title' => __('Back to normal mode'), 'class' => 'invert_filter', ] ).''; // In full screen, the manage options are not available $options = [ 'view' => $options['view'], 'screen' => $options['screen'], ]; } // Header. ui_print_standard_header( $graph['name'], 'images/chart.png', false, '', false, $options, [ [ 'link' => '', 'label' => __('Reporting'), ], [ 'link' => '', 'label' => __('Custom graphs'), ], ] ); $width = null; $height = null; $params = [ 'period' => $period, 'width' => $width, 'height' => $height, 'date' => $unixdate, 'percentil' => $percentil, 'fullscale' => $fullscale, ]; $params_combined = [ 'stacked' => $stacked, 'id_graph' => $id_graph, ]; $graph_return = graphic_combined_module( false, $params, $params_combined ); if ($graph_return) { echo "
';
if ($stacked == CUSTOM_GRAPH_VBARS) {
echo ' ';
}
echo $graph_return;
if ($stacked == CUSTOM_GRAPH_VBARS) {
echo ' ';
}
echo ' |