$id_graph)); if ($res) $result = "

".__('Successfully deleted')."

"; else $result = "

".__('Not deleted. Error deleting data')."

"; $res = db_process_sql_delete('tgraph', array('id_graph' => $id_graph)); if ($res) $result = "

".__('Successfully deleted')."

"; else $result = "

".__('Not deleted. Error deleting data')."

"; 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 ('Y-m-j')); $time = (string) get_parameter ('time', date ('h:iA')); $unixdate = strtotime ($date.' '.$time); $period = (int) get_parameter ('period'); if (! $period) $period = $graph["period"]; else $period = 3600 * $period; $events = $graph["events"]; $description = $graph["description"]; $stacked = (int) get_parameter ('stacked', -1); if ($stacked == -1) $stacked = $graph["stacked"]; $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; } $url = "index.php?sec=reporting&sec2=operation/reporting/graph_viewer&id=$id_graph&view_graph=1"; if ($config["pure"] == 0) { $options['screen'] = "" . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) . ""; } else { $options['screen'] = "" . html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . ""; } // Header ui_print_page_header (__('Reporting'). " » ". __('Combined image render'), "images/reporting.png", false, "", false, $options); echo ""; echo "
"; custom_graphs_print ($id_graph, $height, $width, $period, $stacked, false, $unixdate); echo "
"; $period_label = human_time_description_raw ($period); echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo "".__('Date').""." "; echo ""; echo html_print_input_text ('date', $date, '', 12, 10, true). ' '; echo ""; echo html_print_input_text ('time', $time, '', 7, 7, true). ' '; echo ""; echo "".__('Period').""; echo ""; html_print_select (custom_graphs_get_periods (), 'period', intval ($period / 3600), '', '', 0, false, false, false); echo ""; $stackeds = array (); $stackeds[0] = __('Graph defined'); $stackeds[0] = __('Area'); $stackeds[1] = __('Stacked area'); $stackeds[2] = __('Line'); $stackeds[3] = __('Stacked line'); html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false); echo ""; $zooms = array(); $zooms[0] = __('Graph defined'); $zooms[1] = __('Zoom x1'); $zooms[2] = __('Zoom x2'); $zooms[3] = __('Zoom x3'); html_print_select ($zooms, 'zoom', $zoom , '', '', 0); echo ""; echo ""; echo "
"; echo "
"; /* We must add javascript here. Otherwise, the date picker won't work if the date is not correct because php is returning. */ ui_require_css_file ('datepicker'); ui_require_jquery_file ('ui.core'); ui_require_jquery_file ('ui.datepicker'); ui_require_jquery_file ('timeentry'); ?> '.__('Invalid date selected').''; return; } return; } // Header ui_print_page_header (__('Reporting'). " » ".__('Custom graph viewer'), "images/reporting.png", false, "", false, "" ); $graphs = custom_graphs_get_user (); if (! empty ($graphs)) { $table->width = '500px'; $tale->class = 'databox_frame'; $table->align = array (); $table->align[2] = 'center'; $table->head = array (); $table->head[0] = __('Graph name'); $table->head[1] = __('Description'); $table->data = array (); foreach ($graphs as $graph) { $data = array (); $data[0] = ''.$graph['name'].''; $data[1] = $graph["description"]; array_push ($table->data, $data); } html_print_table ($table); } else { echo "
".__('There are no defined reportings')."
"; } ?>