$interval, 'width' => '100%', 'graph_width' => '85%', 'height' => 100, 'date' => time(), 'percentil' => null, 'fullscale' => 1, 'type_graph' => 'line', 'timestamp_top_fixed' => 'timestamp-top-fixed', 'graph_analytics' => true, 'realtime' => true, ]; $params_combined = [ 'stacked' => 2, 'labels' => [], 'modules_series' => $modules, 'id_graph' => null, 'return' => 1, 'graph_analytics' => true, ]; $graph_return = graphic_combined_module( $modules, $params, $params_combined ); $graph_return .= " "; echo $graph_return; return; } // Save filter. if (empty($save_filter) === false) { $graphs = get_parameter('graphs'); $interval = (int) get_parameter('interval'); if (empty($save_filter) === true) { echo __('Empty name'); return; } if (empty($graphs) === true) { echo __('Empty graphs'); return; } $id_filter = db_process_sql_insert( 'tgraph_analytics_filter', [ 'filter_name' => $save_filter, 'user_id' => $config['id_user'], 'graph_modules' => json_encode($graphs), 'interval' => $interval, ] ); if ($id_filter > 0) { echo 'saved'; return; } else { echo __('Empty graphs'); return; } } // Update filter. if (empty($update_filter) === false) { $graphs = get_parameter('graphs'); $interval = (int) get_parameter('interval'); if (empty($graphs) === true) { echo __('Empty graphs'); return; } $update_filter = db_process_sql_update( 'tgraph_analytics_filter', [ 'graph_modules' => json_encode($graphs), 'interval' => $interval, ], ['id' => $update_filter] ); if ($update_filter > 0) { echo 'updated'; return; } else { echo __('No updated'); return; } echo $update_filter; return; } // Load filter. if (empty($load_filter) === false) { $data = []; $data['graphs'] = json_decode(db_get_value('graph_modules', 'tgraph_analytics_filter', 'id', $load_filter)); $data['interval'] = db_get_value('tgraph_analytics_filter.interval', 'tgraph_analytics_filter', 'id', $load_filter); echo json_encode($data); return; } // Get new values. if (empty($get_new_values) === false) { $data = []; $agent_module_id = $get_new_values; $date_array = get_parameter('date_array'); $data_module_graph = get_parameter('data_module_graph'); $params = get_parameter('params'); $suffix = get_parameter('suffix'); // Stract data. $array_data_module = grafico_modulo_sparse_data( $agent_module_id, $date_array, $data_module_graph, $params, $suffix ); echo json_encode($array_data_module); return; } return; } // Save filter modal. echo ''; // Load filter modal. $filters = graph_analytics_filter_select(); echo ''; // Header & Actions. $title_tab = __('Start realtime'); $tab_start_realtime = [ 'text' => ''.html_print_image( 'images/change-active.svg', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; $title_tab = __('Pause realtime'); $tab_pause_realtime = [ 'text' => ''.html_print_image( 'images/change-pause.svg', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; $title_tab = __('New'); $tab_new = [ 'text' => ''.html_print_image( 'images/plus-black.svg', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; $title_tab = __('Save'); $tab_save = [ 'text' => ''.html_print_image( 'images/save_mc.png', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; $title_tab = __('Load'); $tab_load = [ 'text' => ''.html_print_image( 'images/logs@svg.svg', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; $title_tab = __('Share'); $tab_share = [ 'text' => ''.html_print_image( 'images/responses.svg', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; $title_tab = __('Export to custom graph'); $tab_export = [ 'text' => ''.html_print_image( 'images/module-graph.svg', true, [ 'title' => $title_tab, 'class' => 'invert_filter main_menu_icon', ] ).$title_tab.'', ]; ui_print_standard_header( __('Graph analytics'), 'images/menu/reporting.svg', false, '', false, [ $tab_export, $tab_share, $tab_load, $tab_save, $tab_new, $tab_pause_realtime, $tab_start_realtime, ], [ [ 'link' => '', 'label' => __('Reporting'), ], ] ); // Content. $left_content = ''; $right_content = ''; $left_content .= '

'.ui_toggle( '', __('Agents'), 'agents-toggle', 'agents-toggle', true, true, '', 'white-box-content', 'box-flat white_table_graph', 'images/arrow@svg.svg', 'images/arrow@svg.svg', false, false, false, '', '', null, null, false, false, 'static' ).ui_toggle( '', __('Groups'), 'groups-toggle', 'groups-toggle', true, true, '', 'white-box-content', 'box-flat white_table_graph', 'images/arrow@svg.svg', 'images/arrow@svg.svg', false, false, false, '', '', null, null, false, false, 'static' ).ui_toggle( '', __('Modules'), 'modules-toggle', 'modules-toggle', true, true, '', 'white-box-content', 'box-flat white_table_graph', 'images/arrow@svg.svg', 'images/arrow@svg.svg', false, false, false, '', '', null, null, false, false, 'static' ).'
'; $intervals = []; $intervals[SECONDS_1HOUR] = _('Last ').human_time_description_raw(SECONDS_1HOUR, true, 'large'); $intervals[SECONDS_6HOURS] = _('Last ').human_time_description_raw(SECONDS_6HOURS, true, 'large'); $intervals[SECONDS_12HOURS] = _('Last ').human_time_description_raw(SECONDS_12HOURS, true, 'large'); $intervals[SECONDS_1DAY] = _('Last ').human_time_description_raw(SECONDS_1DAY, true, 'large'); $intervals[SECONDS_2DAY] = _('Last ').human_time_description_raw(SECONDS_2DAY, true, 'large'); $intervals[SECONDS_1WEEK] = _('Last ').human_time_description_raw(SECONDS_1WEEK, true, 'large'); $right_content .= '
'.html_print_select( $intervals, 'interval', SECONDS_12HOURS, '', '', 0, true, false, false, '' ).'
'; $right_content .= '
'.__('Drop here').'
'; //
//
//
$filters_div = html_print_div( [ 'class' => 'filters-div-main', 'content' => $left_content, ], true ); $graphs_div = html_print_div( [ 'class' => 'padding-div graphs-div-main', 'content' => $right_content, ], true ); html_print_div( [ 'class' => 'white_box main-div', 'content' => $filters_div.$graphs_div, ] ); ?>