0) if (!isset($groups[$graph["id_group"]])){ continue; } if ($only_names) { $graphs[$graph['id_graph']] = $graph['name']; } else { $graphs[$graph['id_graph']] = $graph; $graphsCount = db_get_value_sql("SELECT COUNT(id_gs) FROM tgraph_source WHERE id_graph = " . $graph['id_graph']); $graphs[$graph['id_graph']]['graphs_count'] = $graphsCount; } } return $graphs; } /** * Print a custom graph image. * * @param $id_graph Graph id to print. * @param $height Height of the returning image. * @param $width Width of the returning image. * @param $period Period of time to get data in seconds. * @param $stacked Wheter the graph is stacked or not. * @param $return Whether to return an output string or echo now (optional, echo by default). * @param $date Date to start printing the graph */ function custom_graphs_print($id_graph, $height, $width, $period, $stacked = null, $return = false, $date = 0, $only_image = false, $background_color = 'white') { global $config; $graph_conf = db_get_row('tgraph', 'id_graph', $id_graph); if ($stacked === null) { $stacked = $graph_conf['stacked']; } $sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph', $id_graph); $modules = array (); $weights = array (); if ($sources === false) { echo "
" . __('Empty graph') . "
"; return; } foreach ($sources as $source) { array_push ($modules, $source['id_agent_module']); array_push ($weights, $source['weight']); } $output = graphic_combined_module($modules, $weights, $period, $width, $height, '', '', 0, 0, 0, $stacked, $date, $only_image, '', 1, false, false, $background_color); if ($return) return $output; echo $output; } ?>